Slate: Spellcheck removes entire line when used with bold

Created on 3 Jul 2017  Â·  5Comments  Â·  Source: ianstormtaylor/slate

Go here http://slatejs.org/#/rich-text
Type a line in the editor, intentionally misspelling something "Paraggraphs are cool"
Make that line bold
Right click the misspelled word, correct it, and the entire line is removed except that one word.

It shouldn't be removing the entire line..

bug ♥ help

Most helpful comment

@ianstormtaylor I've experience this too, so have created a gif of the issue @Soletiq describes:

error

While trying to reproduce the error I also experienced an issue whereby the cursor was writing to two places in the document after a spell check:

error2

All 5 comments

Hey @Soletiq can you add a video showing the issue? Thanks!

@ianstormtaylor I've experience this too, so have created a gif of the issue @Soletiq describes:

error

While trying to reproduce the error I also experienced an issue whereby the cursor was writing to two places in the document after a spell check:

error2

More generally, in Chrome/macOS, correcting the spelling of a marked word:

  1. Makes the corrected word lose its marks
  2. Introduces a state inconsistency that breaks in all sorts of ways.

Some steps to repro:

  1. Open the editor http://slatejs.org/#/rich-text
  2. Misspell a word, then __bold it__
  3. Right-click on the word and correct it — notice how it's introduced as plain text
  4. Press Cmd + Z to undo

When correcting the first word in the paragraph:

screen shot 2017-08-17 at 16 31 35

When correcting a word in the middle of the paragraph:

screen shot 2017-08-17 at 16 32 50

Hmm I'm seeing this too... In Chrome, the browser inserts the correction by running document.execCommand('insertText', false, correction) so we might be able to identify / test the issue using the behavior of insertText.

I'm fixing this in Mailspring (an Electron app) by implementing my own contextmenu event handler on the Editor component and then displaying a custom menu that performs Slate changes rather than native DOM changes, but I'm not sure if there's a general purpose fix.

I think this is fixed in the latest versions of Slate.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markolofsen picture markolofsen  Â·  3Comments

ianstormtaylor picture ianstormtaylor  Â·  3Comments

Slapbox picture Slapbox  Â·  3Comments

varoot picture varoot  Â·  3Comments

chriserickson picture chriserickson  Â·  3Comments