Closed oyeanuj closed 7 years ago
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:
@bunterWolf ah, i see! thank you. I guess it still leaves me with one question - why would the same work for non-void nodes? The click again should be overwritten, right?
yeah strange... :) I thought about contenteditable="false" and therefore editor > blur > onChange. But the editor blures even on non void nodes...
@ianstormtaylor do you have thoughts on why this might be happening for void nodes but not for non-void nodes?
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
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/