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
Is there a way to export more than just HTML from the DecoratorNode? Let's say I want to export both the HTML and also some data that is required to hydrate the html when rendered outside the lexical editor.
I thought of adding the extra JSON info into the data attribute of the exporting element but then it will be hard for me to update that data in the DB.
Also the data could get large and having it as a data attribute would be absurd right?
Let's say I want one attribute per DecoratorNode to be exported in this manner. How can I import/export this ancillary data without using any hacky methods.
This provides us with the HTML (Which is just the static husk/template later to be hydrate using the ancillary data)
Now I want something like the below method for creating interactive messages generated by this editor
const ancillaryData = $exportAncillaryData()
This method will call all the Nodes "exportExtraData() {}" method and combine them together as a single object which can then be saved in the DB and updated separately when other users interact with it the associated HTML element.
So essentially what I need is something like the exportDOM method which gets called for every node but for just exporting custom data from each node.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is there a way to export more than just HTML from the DecoratorNode? Let's say I want to export both the HTML and also some data that is required to hydrate the html when rendered outside the lexical editor.
I thought of adding the extra JSON info into the data attribute of the exporting element but then it will be hard for me to update that data in the DB.
Also the data could get large and having it as a data attribute would be absurd right?
Let's say I want one attribute per DecoratorNode to be exported in this manner. How can I import/export this ancillary data without using any hacky methods.
Example:
const exportedHTML = newEditor.getEditorState().read(() => {
const htmlString = $generateHtmlFromNodes(newEditor, null)
return htmlString
})
This provides us with the HTML (Which is just the static husk/template later to be hydrate using the ancillary data)
Now I want something like the below method for creating interactive messages generated by this editor
const ancillaryData = $exportAncillaryData()
This method will call all the Nodes "exportExtraData() {}" method and combine them together as a single object which can then be saved in the DB and updated separately when other users interact with it the associated HTML element.
So essentially what I need is something like the exportDOM method which gets called for every node but for just exporting custom data from each node.
Am I over engineering this? Please advice.
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions