-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize merge model when paste #1993
Conversation
@@ -120,14 +125,19 @@ function createBeforePasteEvent( | |||
}; | |||
} | |||
|
|||
function createFragmentFromClipboardData( | |||
function createBeforePasteEventAndFragment( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this fucntion does not only create event and fragment, but also trigger the event and let plugins handle it (same for the origianl code). So I think we need a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it to triggerPluginEventAndCreatePasteFragment and added a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
PluginEventType.BeforePaste, | ||
eventData, | ||
true /* broadcast */ | ||
) as ContentModelBeforePasteEvent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this type case required? Try remove it and see if it can pass the build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build fails due a domToModelOption does not exist in BeforePasteEvent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, that is a real problem
Add
customizedMerge
to theContentModelBeforePasteEventData
interface so can we use it as callback to change the way the copied fragment is merged to content model.Also, split the
getSelectedSegments
functions from the other collect selections functions, so it can be exported.