🩹 don't submit empty msg

This commit is contained in:
Nate Sesti 2024-02-26 23:40:18 -05:00
parent f88bec3df5
commit bfbc3b8a7f

View file

@ -346,7 +346,14 @@ function TipTapEditor(props: TipTapEditorProps) {
});
const onEnterRef = useUpdatingRef(() => {
props.onEnter(editor.getJSON());
const json = editor.getJSON()
// Don't do anything if input box is empty
if (!json.content?.some(c => c.content)) {
return
}
props.onEnter(json);
editor.commands.clearContent(true);
}, [props.onEnter, editor]);