Slate: Can't delete blocks at first line

Created on 25 Aug 2017  路  3Comments  路  Source: ianstormtaylor/slate

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

Bug

What's the current behavior?

Can't delete block nodes in first line.

  1. Go to http://slatejs.org/#/rich-text
  2. Add a list or a blockquote
  3. Remove the previous content so the block is in the first line
  4. Press backspace like crazy

slatelist

slatequote

What's the expected behavior?

It should remove the block (probably defaulting to paragraph?)

question

Most helpful comment

@ezakto in other cases it's not forced to come up with the node type you want to insert by itself because it's actually just collapsing the content into the previous node, whatever its type may be. In the case of deleting at the start of a single quote block, it would actually need to create a new node (or change the node's type), and that is a schema-specific decision.

Basically anything where the decision is schema-specific, Slate's core won't handle it. In general this sacrifices a bit smartness in certain cases, like this one, but reduces complexity a lot overall. But I do feel for you that this specific case is an unfortunate casualty of that design decision.

All 3 comments

Hey @ezakto thanks for this. The rich-text example is just an example of what's possible, in your editor you can choose how you want to handle backspacing at the beginning of a document like this, but it's not something core will handle for it, since it doesn't make assumptions about your schema.

@ianstormtaylor that seems odd as it assumes you want to delete block nodes in other lines?

@ezakto in other cases it's not forced to come up with the node type you want to insert by itself because it's actually just collapsing the content into the previous node, whatever its type may be. In the case of deleting at the start of a single quote block, it would actually need to create a new node (or change the node's type), and that is a schema-specific decision.

Basically anything where the decision is schema-specific, Slate's core won't handle it. In general this sacrifices a bit smartness in certain cases, like this one, but reduces complexity a lot overall. But I do feel for you that this specific case is an unfortunate casualty of that design decision.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexeiAndreev picture AlexeiAndreev  路  3Comments

ianstormtaylor picture ianstormtaylor  路  3Comments

ianstormtaylor picture ianstormtaylor  路  3Comments

bunterWolf picture bunterWolf  路  3Comments

ShardulNalegave picture ShardulNalegave  路  3Comments