Replies: 1 comment 6 replies
-
your sandbox is not found
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Source code
https://codesandbox.io/p/sandbox/lexical-plain-text-example-forked-7j24ys?file=%2Fsrc%2FEditor.js
I have a
MyLexicalPlugin
where I load a html into the editorState. And I'm expected to get back the Menu in the editor State.For some reason the only thing I get back is an empty children.
Could you help me get this working and give me a Menu paragraph as the root's children.
A bit of summary what I want to achieve:
I'm building an inline website editor. So you can inline edit the text. I parse the editor state to HTML send it to ChatGPT for translation, get back the translated text in the right HTML structure. Parse it on the fly (and this is the important bit, without creating another LexicalComposer instance) to JSON and append the JSON to my website structure.
I read the initial hungarien text under
and I want to append to:
And then later on the user able to toggle the language states from the header.
Initially I've got to a point where I got the
const nodes = $generateNodesFromDOM(editor, dom);
and I recursively walked the children. And manually constructed a root and appended the nodes. Unfortunately this structure sometimes crashed the app so I wanted to programatically get the whole JSON information from the editorState. So as you can see I played around with many ways in CodeSandbox. But nothing really worked. I get back empty children state from the parsed html.
Although when I get the
toJSON
from the rendered editor with the hungarien text it works as expected.Beta Was this translation helpful? Give feedback.
All reactions