Deleting selection across nested blocks results in an error (`Node.assertNode` could not find node with path or key)
See original GitHub issueDo you want to request a feature or report a bug?
Bug. 🐛
What’s the current behavior?
When you select a list branch with more then three levels of nesting and try to delete it, it will result in an error. For example:
Node.assertNode
could not find node with path or key:List [ 0, 1, 0, 0, 0, 0 ]
This behavior, however, won’t happen when you select multiple branches (see the recording).
CodeSandbox reproduction
https://codesandbox.io/s/6ykzw473wz
GIF
Environment
- macOS High Sierra
- Chrome 70
slate@0.42.6
slate-react@0.19.8
What’s the expected behavior?
Expected behavior is to delete the selected content.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
jasonphillips-slate - UNPKG
'text') {\n logger.warn(\n 'The range focus was set to a Node that is not a Text ... throw new Error(`Could not find a...
Read more >third_party/blink/renderer/core/inspector ... - Google Git
Response InspectorDOMAgent::AssertNode(int node_id, Node*& node) {. node = NodeForId(node_id);. if (!node). return Response::ServerError("Could not find ...
Read more >https://opensource.apple.com/source/WebCore/WebCor...
pushNodePathToFrontend (node); if (!nodeId) return; m_domAgent. ... if (!parentNode) { errorString = "Cannot remove detached node"_s; return; } ...
Read more >Changelog - Slate
This is a list of changes to Slate with each new release. Until 1.0 is released, breaking changes will be added as minor...
Read more >https://www.postgresql.org/message-id/attachment/1...
The planner can include this node type in the plan to have the executor ... is no good way to know if a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m pretty sure it’s happening here packages/slate/src/utils/path-utils.js#L323
The operation:
The result is
List [ 0, 1, 0, 0, 0, 0 ]
pIndex
is 3The correct result should be
List [ 0, 1, 0, 0]
Commenting out the
else if
makes my test pass (but of course breaks others tests), so it seems like there is missing an additional conditional there, but I have no idea what. Tried various.@ianstormtaylor any ideas?
The replicated test document:
Fixed by https://github.com/ianstormtaylor/slate/pull/3093.