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

Fix Paste without Formatting / Paste and Match Style producing uneditable text nodes. #3415

Merged
merged 2 commits into from Feb 22, 2020
Merged

Fix Paste without Formatting / Paste and Match Style producing uneditable text nodes. #3415

merged 2 commits into from Feb 22, 2020

Conversation

Killavus
Copy link
Contributor

@Killavus Killavus commented Jan 9, 2020

Is this adding or improving a feature or fixing a bug?

Fixing a bug.

What's the new behavior?

This fixes #3414. Basically right now Paste and Match Style type of pasting from Chrome is working properly - as well as mod+shift+v shortcut from other browsers.

How does this change work?

Since these types of pastes are not emitting beforeinput events, I handle them in paste event handler. After that it's just a matter of simply passing them to insertData of ReactEditor. I want to minimize the surface area of change, so this behavior is triggered only for pastes having exclusively text/plain ClipboardData in them.

Have you checked that...?

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)

Does this fix any issues or need any specific reviewers?

Fixes: #3414
Reviewers: @

@cameracker
Copy link
Collaborator

@cameracker cameracker commented Feb 22, 2020

Thanks so much for fixing this bug @Killavus !

@cameracker cameracker merged commit 83b1319 into ianstormtaylor:master Feb 22, 2020
2 checks passed
pzhine pushed a commit to databyss-org/slate that referenced this issue May 17, 2020
…able text nodes. (ianstormtaylor#3415)

* handle plaintext-only pastes using onPaste handler, regardless of browser

* remove extra console.log; merge code paths in onPaste - they contain the same code
lukesmurray pushed a commit to lukesmurray/slate that referenced this issue Feb 5, 2021
…able text nodes. (ianstormtaylor#3415)

* handle plaintext-only pastes using onPaste handler, regardless of browser

* remove extra console.log; merge code paths in onPaste - they contain the same code
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.

2 participants