Replies: 2 comments
-
Interesting ideas - looks like we have another issue around this too: #3200 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ah, yes, I actually ended up with the same hacky workaround. But I figured it was a bug since it seemed logical to me that tranforms would also be called on setEditorState. Otherwise nodes just 'magically'/suddenly transform when they're marked as dirty later on. On the other hand, a primitive to force node transforms to run may be more flexible. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a node type that generates additional helper nodes as part of a node transform.
However, in some circumstances I am updating the lexical state using
parseEditorState
to create a newEditorState
and then setting it usingsetEditorState
.When I perform these steps, the node transforms are not run and hence the helper nodes are not generated.
I can't force these helper nodes to be generated in
importJSON
since it relies on the node's children being present andimportJSON
never sees the children for the node (unlikeimportDOM
which can provide anafter
callback for each conversion).I can force the node transforms to be run by borrowing the relevant bit of code from
markAllNodesAsDirty
:However, it seems fragile to be reaching into
_nodeMap
like this.How should this work?
setEditorState
do it automatically?importDOM
to update the node after its children have been attached?Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions