Skip to content

Commit

Permalink
Merge pull request #3569 from bettyblocks/fix/rich-text-value-not-ser…
Browse files Browse the repository at this point in the history
…ializing-correctly-PAGE-4765

Fix/rich text value not serializing correctly page 4765
  • Loading branch information
jrquak authored Jan 21, 2025
2 parents fa2d269 + 5340dfc commit 73b2da5
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/components/richTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,7 @@
};

const renderLeaf = useCallback((props) => <Leaf {...props} />, []);
const editor = React.useMemo(
() => withHistory(withReact(createEditor())),
[],
);
const [editor] = useState(() => withReact(withHistory(createEditor())));
const parsed = new DOMParser().parseFromString(
useText(valueProp),
'text/html',
Expand All @@ -438,21 +435,6 @@
];
});

if (isDev) {
useEffect(() => {
Transforms.delete(editor, {
at: {
anchor: Editor.start(editor, []),
focus: Editor.end(editor, []),
},
});
Transforms.insertNodes(editor, deserialize(parsed.body));
Transforms.delete(editor, {
at: Editor.start(editor, [0]),
});
}, [valueProp]);
}

const handleListdepth = (listKind, key, event) => {
const isList = isBlockActive(editor, listKind, 'type');
if (isList) {
Expand Down

0 comments on commit 73b2da5

Please sign in to comment.