Skip to content

allow to copy with ctrl-c#85

Merged
nightwing merged 1 commit intomasterfrom
copy-with-ctrl-c
Feb 28, 2023
Merged

allow to copy with ctrl-c#85
nightwing merged 1 commit intomasterfrom
copy-with-ctrl-c

Conversation

@nightwing
Copy link
Collaborator

Copy link
Contributor

@sergeichestakov sergeichestakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, thanks! 📝

copy: function(e: ClipboardEvent, view: EditorView) {
if (!this.waitForCopy) return;
this.waitForCopy = false;
Promise.resolve().then(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this wrapped in a Promise.resolve()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codemirror doesn't have a way to handle copy event after the default handler, so we need some short timeout to clear selection after codemirror handler finishes updating clipboardData.

@nightwing nightwing merged commit 2e443bb into master Feb 28, 2023
@nightwing nightwing deleted the copy-with-ctrl-c branch February 28, 2023 20:00
nightwing added a commit that referenced this pull request Feb 18, 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.

Copying With Ctrl+c Does Not Work

2 participants