File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
packages/web/components/common/Textarea/PromptEditor Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -524,9 +524,21 @@ export const editorStateToText = (editor: LexicalEditor) => {
524524 return node . children . map ( extractText ) . join ( '' ) ;
525525 }
526526
527- // Unknown node type
527+ // Unknown node type - return the raw text content if available
528528 console . warn ( 'Unknown node type in extractText:' , ( node as any ) . type , node ) ;
529- return '' ;
529+
530+ // Try to extract text content from unknown node types
531+ if ( 'text' in node && typeof ( node as any ) . text === 'string' ) {
532+ return ( node as any ) . text ;
533+ }
534+
535+ // Try to recursively extract from children if present
536+ if ( 'children' in node && Array . isArray ( ( node as any ) . children ) ) {
537+ return ( node as any ) . children . map ( extractText ) . join ( '' ) ;
538+ }
539+
540+ // Fallback to stringifying the node content
541+ return JSON . stringify ( node ) ;
530542 } ;
531543
532544 paragraphs . forEach ( ( paragraph ) => {
You can’t perform that action at this time.
0 commit comments