Repository navigation
Remove unstable JSON serialization functions + unify copy+paste to be HTML - #2241
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
zurfyx
left a comment
There was a problem hiding this comment.
So ultimately we're saying that both HTML and JSON have the same fidelity. The only difference with JSON is that is can handle versions in a more structured manner..
| export function parseEditorState( | ||
| parsedEditorState: ParsedEditorState, | ||
| editor: LexicalEditor, | ||
| ): EditorState { |
There was a problem hiding this comment.
Yea I imagine this change will break all of the previously stored states.
I’m not sure that it’s true that HTML has the same fidelity as JSON. Have we found a way to represent nested editors in HTML? The problem with less than perfect fidelity is that copying and pasting within the same editor (like moving sections of a document around) can result in data loss. I think the tolerance for this is higher between editors, but I would generally expect copying within the same editor to reproduce the pasted content almost perfectly. |
This isn't true right now, there's no reliable way to represent decorator nodes as HTML until we add support for a I'm hesitant to accept this PR because without |
I added logic to copy some of the decorators to this PR already. Check out |
Decorator Nodes that have semantic HTML equivalents ( |
I did ExcalidrawNode and EquationNode. Need to do the others, but I used an attribute as signal. |
Ahh, I see that now. I guess I was imagining something added to the core serialization logic to support Decorator Nodes by default so people don't have to add identifying data-attributes and serialized node properties themselves, but this is probably fine for now. |
982ca61 to
b3ab786
Compare
e2884cc to
45a5625
Compare
This PR does the following:
unstable_prefixed JSON import/export serialization functions, instead makes their functionality use the originaltoJSONandparseEditorStatemethods. The new editor state does NOT include selection.x-lexical-editor-statefrom clipboard, instead we only put on HTML and parse HTML accordingly.namespacefrom config, as no longer needed.This PR should remove quite a lot of logic around parsing logic from the core.