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 DraftJS error when pasting over non-collapsed selection #22

Merged
merged 1 commit into from
May 24, 2017

Conversation

Rosey
Copy link
Contributor

@Rosey Rosey commented May 23, 2017

addText uses insertText, so the handlePastedText method was failing if a user
was highlighting text and then pasting to replace the highlighted text.

(error was: Target range must be collapsed for insertText)

A similar method, replaceText, has been aded, and the handlePastedText method
has been updated to use replaceText instead.

@Rosey Rosey force-pushed the fix_pasting_selected_text branch from 547f53a to 328381d Compare May 23, 2017 23:08
@Rosey
Copy link
Contributor Author

Rosey commented May 23, 2017

darn sorry, I had the tests passing locally but I rebased onto latest master and I think some new tests that I didn't have locally originally need fixing. 1 sec and I'll force push a fix.

addText uses insertText, so the handlePastedText method was failing if a user
was highlighting text and then pasting to replace the highlighted text.

(error was: Target range must be collapsed for `insertText`)

A similar method, replaceText, has been aded, and the handlePastedText method
has been updated to use replaceText instead.
@Rosey Rosey force-pushed the fix_pasting_selected_text branch from 328381d to 32f18f8 Compare May 23, 2017 23:19
@Rosey
Copy link
Contributor Author

Rosey commented May 23, 2017

k should be better now 🙏

@ngs
Copy link
Owner

ngs commented May 24, 2017

Seems great, thank you!

Will publish as new patch version.

@ngs ngs merged commit 142e66d into ngs:master May 24, 2017
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.

None yet

2 participants