🩹 don't submit empty msg
This commit is contained in:
parent
f88bec3df5
commit
bfbc3b8a7f
1 changed files with 8 additions and 1 deletions
|
|
@ -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]);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue