Skip to content

Commit

Permalink
Merge pull request #34 from qvantor/fix/prosemirror
Browse files Browse the repository at this point in the history
tiptap update and ProseMirror fix
  • Loading branch information
qvantor authored Nov 18, 2023
2 parents 0121ba3 + 3d94dcd commit e20a990
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 148 deletions.
7 changes: 5 additions & 2 deletions libs/text-editor/src/components/base-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ export function BaseEditor({
},
// sync outside content value with editor value, when not editable
onBlur: ({ editor }) => {
if (deepEqual(content, editor.getJSON())) return;
onChange(editor.getJSON());
// editor.getJSON return some object without prototype (from ProseMirror model)
// https://github.com/ProseMirror/prosemirror/issues/761#issuecomment-362794646
const editorJson = window.structuredClone(editor.getJSON());
if (deepEqual(content, editorJson)) return;
onChange(editorJson);
},
});

Expand Down
Loading

0 comments on commit e20a990

Please sign in to comment.