Status drafts

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-03-27 22:52:57 +01:00
parent 5b5eb52793
commit 9df5aaa572
25 changed files with 481 additions and 47 deletions

View File

@ -15,9 +15,10 @@ const StatePlugin: React.FC<IStatePlugin> = ({ composeId }) => {
useEffect(() => {
editor.registerUpdateListener(({ editorState }) => {
const isEmpty = editorState.read(() => $getRoot().getTextContent()) === '';
const text = editorState.read(() => $getRoot().getTextContent());
const isEmpty = text === '';
const data = isEmpty ? null : JSON.stringify(editorState.toJSON());
dispatch(setEditorState(composeId, data));
dispatch(setEditorState(composeId, data, text));
});
}, [editor]);