Virtual whiteboard for sketching hand-drawn like diagrams
fix: keep input focus during generation (#10679)
David Luzar3c8e893cab21
diff --git a/packages/excalidraw/components/TTDDialog/Chat/ChatInterface.tsx b/packages/excalidraw/components/TTDDialog/Chat/ChatInterface.tsxindex b26aa9bc70..312c49ac9c 100644--- a/packages/excalidraw/components/TTDDialog/Chat/ChatInterface.tsx+++ b/packages/excalidraw/components/TTDDialog/Chat/ChatInterface.tsx@@ -90,7 +90,9 @@ export const ChatInterface = ({const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {if (event.key === KEYS.ENTER && !event.shiftKey) {event.preventDefault();- handleSubmit();+ if (!isGenerating) {+ handleSubmit();+ }}};@@ -143,7 +145,14 @@ export const ChatInterface = ({<div className="chat-interface__input-container"><div className="chat-interface__input-outer">- <div className="chat-interface__input-wrapper">+ <div+ className="chat-interface__input-wrapper"+ style={{+ borderColor: isGenerating+ ? "var(--dialog-border-color)"+ : undefined,+ }}+ ><textarearef={textareaRef}autoFocus@@ -152,13 +161,15 @@ export const ChatInterface = ({onChange={handleInputChange}onKeyDown={handleKeyDown}placeholder={- rateLimits?.rateLimitRemaining === 0+ isGenerating+ ? t("chat.generating")+ : rateLimits?.rateLimitRemaining === 0? t("chat.rateLimit.messageLimitInputPlaceholder"): messages.length > 0? t("chat.inputPlaceholderWithMessages"): t("chat.inputPlaceholder", { shortcut: "Shift + Enter" })}- disabled={isGenerating || rateLimits?.rateLimitRemaining === 0}+ disabled={rateLimits?.rateLimitRemaining === 0}rows={1}cols={30}onInput={onInput}diff --git a/packages/excalidraw/locales/en.json b/packages/excalidraw/locales/en.jsonindex 48cbc8b2d6..dd69162c3f 100644--- a/packages/excalidraw/locales/en.json+++ b/packages/excalidraw/locales/en.json@@ -623,6 +623,7 @@"chat": {"inputPlaceholder": "Start typing your diagram idea here... ({{shortcut}} for new line)","inputPlaceholderWithMessages": "Continue refining your diagram...",+ "generating": "Generating...","rateLimitRemaining": "{{count}} requests left today","role": {"user": "You",