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

Decide whether or not Quill will handle the copy event THEN preventDefault. #4573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

conlanpatrek
Copy link

Resolves #4572

The issue was an order of operations. Whenever the clipboard module captures a copy event it calls preventDefault() on it before it actually decides to do anything with the event.

This PR just moves the call to preventDefault() after the clipboard module decides to handle it.

In the case where the user selects the contents before, including, and after the quill root, the onCopyCapture handler doesn't get called, because some parent node handles the copy event.

In the case where the user selects only text within the quill root, this.quill.selection.getRange() is able to return a valid range.

However in cases where selection goes off the end of the quill root this.quill.selection.getRange() returns null, resulting in a copy handler that prevents default AND doesn't handle the copy.

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.

BUG: Copy command failing when selecting more than just the quill editor contents
1 participant