Skip to content

Can I register custom nodes from within plugins? #2053

Answered by zurfyx
diegohaz asked this question in Q&A
Discussion options

You must be logged in to vote

All nodes have to registered on composer creation as conditionals nodes can cause the editor to crash or misbehave when trying to restore content on it. In fact, this used to be the previous API for node registration (editor.registerNode).

For example, you copy-paste NodeA created by plugin A. Plugin A is unmounted, NodeA is unregistered and you paste your clipboard contents, editor will crash because NodeA no longer exists.

Side note: the above is not possible between two Lexical editors living on different surfaces because of the namespace, a unique identifier that tells Lexical to fall back to HTML or plain text.

For this reason, you want to register all nodes at once even if you're no…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@diegohaz
Comment options

Answer selected by diegohaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants