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

Web: provide a "Paste" editor action #104646

Merged
merged 5 commits into from
Aug 26, 2020
Merged

Web: provide a "Paste" editor action #104646

merged 5 commits into from
Aug 26, 2020

Conversation

bpasero
Copy link
Member

@bpasero bpasero commented Aug 14, 2020

This PR fixes #82604

@alexdima would be happy for some initial feedback if this is the right direction. I have to admit that I do not fully understand the concept of "implementations" for actions, this was probably added for custom editors / notebooks later.

Things to do:

  • support multi-cursor paste (I am not sure how that works in the core editor when pasting)
  • clean-up

Unfortunately given the async nature of the clipboard service, we need to await the contents of the clipboard and this would trigger a permission dialog in browsers that the user can decline.

@bpasero bpasero added this to the On Deck milestone Aug 14, 2020
@bpasero bpasero requested a review from alexdima August 14, 2020 11:25
@bpasero bpasero self-assigned this Aug 14, 2020
@bpasero bpasero marked this pull request as draft August 14, 2020 11:25
@bpasero bpasero changed the title Web: provide a "Paste" editor action that works Web: provide a "Paste" editor action Aug 14, 2020
@bpasero bpasero added the web Issues related to running VSCode in the web label Aug 14, 2020
@alexdima alexdima marked this pull request as ready for review August 26, 2020 14:54
@bpasero
Copy link
Member Author

bpasero commented Aug 26, 2020

@alexdima thanks for jumping in, let me know I should review now and then we merge this?

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

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

👍 I've pushed some more changes on top:

  • now going through the same code path as a native paste
  • added support for "in-tab" smart paste (i.e. multicursor, language mode, paste on new line)
  • added better handling for Firefox, where the clipboard service does not work because Firefox does not support navigator.clipboard.readText()

@alexdima alexdima modified the milestones: On Deck, August 2020 Aug 26, 2020
@alexdima alexdima merged commit d52f31e into master Aug 26, 2020
@alexdima alexdima deleted the ben/web-paste branch August 26, 2020 16:22
@bpasero
Copy link
Member Author

bpasero commented Aug 27, 2020

@alexdima thanks a lot!

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
web Issues related to running VSCode in the web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web: editor does not provide a "Paste" action
3 participants