Slate: Deleting only child void node throws an exception

Created on 31 Aug 2018  路  5Comments  路  Source: ianstormtaylor/slate

Do you want to request a _feature_ or report a _bug_?

Bug

What's the current behavior?

Trying to delete an inline void node that is the only leaf throws an exception Uncaught TypeError: Cannot read property 'text' of null

This JSFiddle sets things up.

  1. Select the void node, or select after it.
  2. Hit backspace.

Browser: Chrome: Latest

kapture 2018-08-30 at 17 01 28

What's the expected behavior?

Should be able to backspace to delete, or select and delete the void node.

question

All 5 comments

My current hypothesis is that the code is failing at this point: https://github.com/ianstormtaylor/slate/blob/master/packages/slate/src/changes/at-range.js#L379-L388

In the case that the current text is preceeded by a void node, the void node is just supposed to be deleted. However, the void node is not being correctly detected, and prevVoid is undefined.

Ok it looks like the problem above is that the "voidness" needs to be specified in the schema, rather than the data itself. I wonder if there should be a warning or error if someone tries to set isVoid. Here is a modified fiddle that works: https://jsfiddle.net/fj9dvhom/1843/

I still haven't solved this problem. Your code hasn't solved my problem. When I deleted the only image content of the Editor, I was prompted that I Cannot read property 'text' of null 锛宲lease ,help me !

I have same error. Full stack is here:
slate_error.zip

I use slate version 0.47.8

Same issue here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bunterWolf picture bunterWolf  路  3Comments

ianstormtaylor picture ianstormtaylor  路  3Comments

JSH3R0 picture JSH3R0  路  3Comments

YurkaninRyan picture YurkaninRyan  路  3Comments

bengotow picture bengotow  路  3Comments