Skip to content
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

Merged
merged 6 commits into from
Jul 31, 2023
Merged

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.

@@ -120,14 +125,19 @@ function createBeforePasteEvent(
};
}

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
7 checks passed
@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