question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Void nodes not being deleted using removeNodeByKey

See original GitHub issue

Hey again! I ran into this issue where I am unable to delete a void block using removeNodeByKey - the same method works for inline nodes. For void block nodes, it doesn’t seem to remove it from the DOM even though it is removed from Slate state.

I am able to remove it by the default backspace behavior though.

Here is a fiddle illustrating that - https://jsfiddle.net/rzwn92np/2/

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bunterWolfcommented, Mar 11, 2017

removeNodeByKey works well 😉 The problem is that the click on the button leads to onChange by the editor it self. Wich comes after your clickFunction. It gets overwritte. I stopped the click event and everything works well:

https://jsfiddle.net/bunterWolf/pqb5cehn/

0reactions
bengotowcommented, Jan 6, 2018

Hey folks! I just ran into this as well trying to create my first removable void node —I wonder if the docs should mention calling preventDefault from your custom onClick handler? I ran into the problem following this example, which makes a removable img: https://docs.slatejs.org/guides/changes#2.-from-custom-node-components

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why my node isn't getting deleted on using free() or delete
Your code is too complicated. There are multiple problems: addNode() allocates a new node but does not use it when recursing.
Read more >
Commands - Slate
Insert a new inline at a range , splitting the text to make room if it is non-empty. If the selection is expanded,...
Read more >
Deleting a Node from the List
In this case, the first Node of the linked list is deleted. The first Node is called head. To delete a Node at...
Read more >
Delete Node in a BST - LeetCode
So we find the node with value 3 and delete it. One valid answer is [5,4,6,2,null,null,7], shown in the above BST. Please notice...
Read more >
Given a binary tree, how do you remove all the half nodes?
if current nodes is a half node with left. child NULL left, then it's right child is. returned and replaces it in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found