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

Pasting any string containing " and no spaces throws an error #817

Closed
darkkeh opened this issue May 16, 2017 · 5 comments
Closed

Pasting any string containing " and no spaces throws an error #817

darkkeh opened this issue May 16, 2017 · 5 comments

Comments

@darkkeh
Copy link

darkkeh commented May 16, 2017

Do you want to request a feature or report a bug?

Bug

What's the current behavior?

Pasting " anywhere in slate throws the following error.
pasteerror
Here is a very basic jsfiddle where the error can be reproduced: https://jsfiddle.net/4wzp6hxa/3/

Tested on Windows in Firefox with the latest version of Slate

What's the expected behavior?

" should be pasted into the editor.

@darkkeh
Copy link
Author

darkkeh commented May 16, 2017

Just noticed that if the string contains at least one space the error is not thrown. Ex. 'asd asd"'

@darkkeh darkkeh changed the title Pasting any string containing " throws an error Pasting any string containing " and no spaces throws an error May 16, 2017
@malloryerik
Copy link

Couldn't reproduce the bug on Mac in Chrome, Safari, or Firefox.
" pasted as expected.

@darkkeh
Copy link
Author

darkkeh commented May 17, 2017

Looked at it some more today and can only reproduce in Firefox think the error I had in Chrome was entirely different (Sorry yesterday was a looong day). Updated the original comment with a new error stack

@danburzo
Copy link
Contributor

Clarification: this seems to be the case in Firefox when copying a " character from within Slate, and then trying to paste it. Clipboard reveals:

<span data-slate-fragment="JTdCJTIyZGF0YSUyMiUzQSU3QiU3RCUyQyUyMmtpbmQlMjIlM0ElMjJkb2N1bWVudCUyMiUyQyUyMm5vZGVzJTIyJTNBJTVCJTdCJTIyZGF0YSUyMiUzQSU3QiU3RCUyQyUyMmtpbmQlMjIlM0ElMjJibG9jayUyMiUyQyUyMmlzVm9pZCUyMiUzQWZhbHNlJTJDJTIydHlwZSUyMiUzQSUyMnBhcmFncmFwaCUyMiUyQyUyMm5vZGVzJTIyJTNBJTVCJTdCJTIya2luZCUyMiUzQSUyMnRleHQlMjIlMkMlMjJyYW5nZXMlMjIlM0ElNUIlN0IlMjJraW5kJTIyJTNBJTIycmFuZ2UlMjIlMkMlMjJ0ZXh0JTIyJTNBJTIyJTVDJTIyJTIyJTJDJTIybWFya3MlMjIlM0ElNUIlNUQlN0QlNUQlN0QlNUQlN0QlNUQlN0Q=">"</span>

for mime text/html.

@danburzo
Copy link
Contributor

The problem was with the FRAGMENT_MATCHER regex matching the data-slate-fragment too greedily. Fixed in PR above.

oyeanuj added a commit to oyeanuj/slate that referenced this issue Aug 25, 2017
* ianstormtaylor/master: (21 commits)
  0.21.3
  Add .babelrc into .npmignore (ianstormtaylor#1020)
  Add a missing dependency which was causing errors (ianstormtaylor#1017)
  Fixes ianstormtaylor#1010 — adds debuginfo to Contributing.md (ianstormtaylor#1011)
  Add State.characters to docs (ianstormtaylor#1006)
  Use parent node to find text node parent (ianstormtaylor#1004)
  IE11 compat (ianstormtaylor#996)
  Add .editorconfig and .gitattributes (ianstormtaylor#997)
  Improve documentation (ianstormtaylor#1000)
  Consistently use toLowerCase in tag name comparisons. (ianstormtaylor#1001)
  Custom wrapper component (ianstormtaylor#978)
  Add link to IME reference page in Contributing.md (ianstormtaylor#995)
  Don't break macOS emoji insert nor composition when fixing ianstormtaylor#938 (ianstormtaylor#994)
  When the `isInEditor` parameter is a text node use its parent only if the parent exists (ianstormtaylor#974)
  Document Raw serializer options (ianstormtaylor#993)
  tagName returns capitalized name now (ianstormtaylor#985)
  Fixes ianstormtaylor#938 chrome eating first line of text on space at beginning of line (ianstormtaylor#991)
  Fixes ianstormtaylor#817; fragment matcher regex (ianstormtaylor#992)
  Update ISSUE_TEMPLATE.md
  Update Contributing.md
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants