Slate: Pasting any string containing " and no spaces throws an error

Created on 16 May 2017  Â·  5Comments  Â·  Source: ianstormtaylor/slate

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.

bug ♥ help ⚑ cross platform

All 5 comments

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

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

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

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YurkaninRyan picture YurkaninRyan  Â·  3Comments

ezakto picture ezakto  Â·  3Comments

JSH3R0 picture JSH3R0  Â·  3Comments

chrpeter picture chrpeter  Â·  3Comments

chriserickson picture chriserickson  Â·  3Comments