Bug: Pasting text from the clipboard into a CustomElementNode does not work properly #6477
Description
If you define a CustomElementNode class with isInline(): true and/or canBeEmpty(): true, then no text can be inserted from the clipboard. In this case, the text is inserted after the CustomElementNode. The same applies to adding DecoratorNodes. I assume that no nodes of any kind can be added to the CustomElementNode as a child.
But if isInline():false and canBeEmpty():false, then it works as expected.
Lexical version: 0.16.1
Link to code example:
https://stackblitz.com/edit/vitejs-vite-qmtgsj
The current behavior
After inserting text from the clipboard (or adding a new node, such as a DecoratorNode) into the CustomElementNode, the text appears after the CustomElementNode
The expected behavior
Text from clipboard (or new DecoratorNode) should added at current cursor position
Impact of fix
HIGH
It affects all classes that extend from ElementNode and that may not be empty or are inline elements.