Skip to content

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.

@conlanpatrek conlanpatrek changed the title Decide whether or not Quill will handle the copy event THEN preventDefault. Bugfix: Decide whether or not Quill will handle the copy event THEN preventDefault. Jan 19, 2025
@conlanpatrek conlanpatrek changed the title Bugfix: Decide whether or not Quill will handle the copy event THEN preventDefault. Bugfix: Don't cancel copy events when the clipboard module can't handle them. Jan 19, 2025
work-2025 pushed a commit to work-2025/quill that referenced this pull request Apr 3, 2025
work-2025 pushed a commit to work-2025/quill that referenced this pull request Apr 3, 2025
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