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

allow to copy with ctrl-c #85

Merged
merged 1 commit into from
Feb 28, 2023
Merged

allow to copy with ctrl-c #85

merged 1 commit into from
Feb 28, 2023

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
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