Skip to content

Customize merge model when paste#1993

Merged
juliaroldi merged 6 commits intomasterfrom
u/juliaroldi/customized-merge
Jul 31, 2023
Merged

Customize merge model when paste#1993
juliaroldi merged 6 commits intomasterfrom
u/juliaroldi/customized-merge

Conversation

@juliaroldi
Copy link
Contributor

Add customizedMerge to the ContentModelBeforePasteEventData 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.

}

function createFragmentFromClipboardData(
function createBeforePasteEventAndFragment(
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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;
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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

@juliaroldi juliaroldi merged commit 79c9c0e into master Jul 31, 2023
@JiuqingSong JiuqingSong deleted the u/juliaroldi/customized-merge branch September 8, 2023 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants