diff --git a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx index 59c2ff75d..dee4219bd 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-chat/components/layouts/ChatInput.tsx @@ -78,7 +78,7 @@ export const ChatInput = memo(({ onSend, variant, ref: forwardedRef }: ChatInput setCurrentEditor(editor) editorState.read(() => { - setIsEmpty($getRoot().isEmpty()) + setIsEmpty($getRoot().getTextContent().trim() === "") }) }, []) diff --git a/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx b/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx index 2fc557dd4..3569a63e0 100644 --- a/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx +++ b/packages/internal/components/src/ui/lexical-rich-editor/LexicalRichEditor.tsx @@ -71,6 +71,7 @@ export const LexicalRichEditor = function LexicalRichEditor({ enabledPlugins = defaultEnabledPlugins, initalEditorState, plugins, + accessories, onKeyDown, onChange, @@ -103,12 +104,14 @@ export const LexicalRichEditor = function LexicalRichEditor({ root.clear() }) }, - isEmpty: () => editorRef?.getEditorState().read(() => $getRoot().isEmpty()) || false, + isEmpty: () => + editorRef?.getEditorState().read(() => $getRoot().getTextContent().trim() === "") || false, })) return (
+ {accessories} void onChange?: (editorState: EditorState, editor: LexicalEditor) => void onKeyDown?: (event: KeyboardEvent) => boolean