You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to extend a TableNode by creating a CustomTable following the Lexical way of doing that:
exportclassCustomTableNodeextendsTableNode{staticgetType(){return'custom-table-node';}// ... other methods}initialConfig.nodes=[// ... other nodesCustomTableNode,{replace: TableNode,with: ()=>newCustomTableNode(),withKlass: CustomTableNode,},];
After investigating I found that it doesn't work because the src/components/LexicalTablePlugin.vue uses $nodesOfType(TableNode) to get all TableNodes, but $nodesOfType doesn't work properly for replaced nodes because it uses klass.getType() on the comparison, which doens't work for replaced nodes.
Is there another function we could use to get the nodes from the exact class being provided or a replaced class properly? If yes, can we switch to them?`
Thanks!
Edit (thread from Lexical's discord)
Q: is there another function that could return all nodes of a given type considering the replacements?
A: registerMutationListener with the {skipInitialization: false} option (that should be the default by now, but hasn't changed yet)
The text was updated successfully, but these errors were encountered:
Hi!
I'm trying to extend a
TableNode
by creating aCustomTable
following the Lexical way of doing that:After investigating I found that it doesn't work because the
src/components/LexicalTablePlugin.vue
uses$nodesOfType(TableNode)
to get allTableNodes
, but$nodesOfType
doesn't work properly for replaced nodes because it usesklass.getType()
on the comparison, which doens't work for replaced nodes.Is there another function we could use to get the nodes from the exact class being provided or a replaced class properly? If yes, can we switch to them?`
Thanks!
Edit (thread from Lexical's discord)
The text was updated successfully, but these errors were encountered: