Creating a new line after adding custom DecoratorBlockNode #5773
-
I have created a new plugin/node that subclasses DecoratorBlockNode, and noticed that after I add my new node, a new paragraph element after it is not created, when it is for a bunch of other similar nodes in the Playground (Figma, YouTube, etc). The node simply gets created and it's impossible to add any more content afterwards because there is no way to make a new paragraph. My node doesn't seem that different in structure from the above nodes, so I assume I'm missing something. Is there some specific configuration or structure I'm missing? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
I think you a probably missing a property like 'isInline': false or one of those that triggers the behaviour |
Beta Was this translation helpful? Give feedback.
-
That was my guess too, but it looks like lexical/packages/lexical-react/src/LexicalDecoratorBlockNode.ts Lines 55 to 57 in 111117d |
Beta Was this translation helpful? Give feedback.
-
Reread the question and realized, I misunderstood it originally. To add a paragraph on creation, you have to do this manually in the insert command for your node. You can create the node there and append a paragraph after it in there. |
Beta Was this translation helpful? Give feedback.
-
That's what I had assumed, I just couldn't figure out how the Playground nodes were doing it, turns out the functionality is indeed in the commands rather than the node/component. Specifically, the use of Thanks for the pointers! |
Beta Was this translation helpful? Give feedback.
That's what I had assumed, I just couldn't figure out how the Playground nodes were doing it, turns out the functionality is indeed in the commands rather than the node/component. Specifically, the use of
$insertNodeToNearestRoot
, which will do this for you.Thanks for the pointers!