https://jsfiddle.net/2zokvrvt/7/
I would expect that when I press enter to split the list items here, that the text would be split along with it and they would drop down to the next line?
Trying to get the slate-edit-list plugin caught up and this is causing some difficulty, am I missing something or is this actually a bug?
@YurkaninRyan I think the JSFiddle didn't save/update. (I do this every time too 馃槃 )
Ah @YurkaninRyan check out splitNodeByKey vs. splitDescendantsByKey (and the message in the changelog). Basically...
splitNodeByKey is low-level now, and takes a "position" which is either an "offset" in the case of text nodes, or an "index" in the case of block/inline nodes.splitDescendantsByKey is higher-level, but requires both the target node, and the leaf text node to split down to. This avoids the issue with calculating offsets from non-text nodes.So I think in that fiddle you'll want something like:
change.splitDescendantsByKey(listItem.key, startKey, startOffset)
Most helpful comment
Ah @YurkaninRyan check out
splitNodeByKeyvs.splitDescendantsByKey(and the message in the changelog). Basically...splitNodeByKeyis low-level now, and takes a "position" which is either an "offset" in the case of text nodes, or an "index" in the case of block/inline nodes.splitDescendantsByKeyis higher-level, but requires both the target node, and the leaf text node to split down to. This avoids the issue with calculating offsets from non-text nodes.So I think in that fiddle you'll want something like: