File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
gui/src/components/mainInput/TipTapEditor/utils Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -56,11 +56,22 @@ export function hasValidEditorContent(json: JSONContent): boolean {
5656 ( c ) => c . type === PromptBlock . name || c . type === CodeBlock . name ,
5757 ) ;
5858
59- // Check for text content
60- const hasTextContent = json . content ?. some ( ( c ) => c . content ) ;
59+ // Check for non-whitespace text content
60+ const hasNonWhitespaceText = json . content ?. some ( ( c ) =>
61+ c . content ?. some ( ( child ) => {
62+ if ( child . type === "text" && child . text ) {
63+ return child . text . trim ( ) . length > 0 ;
64+ }
65+ // Mentions and other non-text nodes are valid content
66+ if ( child . type === "mention" ) {
67+ return true ;
68+ }
69+ return false ;
70+ } ) ,
71+ ) ;
6172
62- // Content is valid if it has either text or special blocks
63- return hasTextContent || hasPromptOrCodeBlock || false ;
73+ // Content is valid if it has either non-whitespace text or special blocks
74+ return hasNonWhitespaceText || hasPromptOrCodeBlock || false ;
6475}
6576
6677/**
You can’t perform that action at this time.
0 commit comments