prevent focusing void inline nodes
See original GitHub issueis it possible to prevent focusing void inline nodes and make them act like characters? i.e. only allow the cursor the be on either side of the node, not “on” it.
I tried to create a rule for this, but couldn’t quite figure out how to check if a node has focus:
{
match: node => node.kind === 'inline' && node.isVoid,
validate: node => // how to check if the node has focus here?,
normalize: (transform, node) => // move cursor to either side
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Normalizing - Slate
All Element nodes must contain at least one Text descendant — even Void Elements. ... Block nodes can only contain other blocks, or...
Read more >focus-within - CSS: Cascading Style Sheets - MDN Web Docs
The :focus-within CSS pseudo-class matches an element if the element or any of its descendants are focused. In other words, it represents an ......
Read more >How do you clear the focus in javascript? - Stack Overflow
It just satisfies the type checker. Wrap it in if(document.activeElement instanceof HTMLElement) to avoid crashing on non-HTML DOM nodes. – Raine Revere.
Read more >How to use the slate.Inline.create function in slate - Snyk
insertInline (inline) // Normalize the keys in the block nodes to match what is sent to gradient const inlinePath = editor.value.selection.focus.path const ...
Read more >Schema – Tiptap Editor
Since paragraph is in the group of block nodes ( group: 'block' ) our document can only contain paragraphs. Our paragraphs allow zero...
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
for anyone interested, managed to solve this eventually with a plugin like this:
for those looking at this today, the bad news is that
onBeforeChange
,Transform
andState
have gone. the good news seems to be that the same trick works if you do it inonChange
withChange
, with something like this: