diff --git a/package-lock.json b/package-lock.json index cc6789620f5..044dc5249f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16423,7 +16423,6 @@ "resolved": "https://registry.npmjs.org/npm-run-all2/-/npm-run-all2-8.0.1.tgz", "integrity": "sha512-jkhE0AsELQeCtScrcJ/7mSIdk+ZsnWjvKk3KwE96HZ6+OFVB74XhxQtHT1W6kdUfn92fRnBb29Mz82j9bV2XEQ==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^6.2.1", "cross-spawn": "^7.0.6", diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 43722a5d6d4..eb5a54193dc 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -497,6 +497,7 @@ const ChatTextArea = forwardRef( // Only hide the context menu if the user didn't click on it. if (!isMouseDownOnMenu) { setShowContextMenu(false) + } setIsFocused(false) diff --git a/webview-ui/src/components/prompts/PromptsView.tsx b/webview-ui/src/components/prompts/PromptsView.tsx index c4943870428..6df01368819 100644 --- a/webview-ui/src/components/prompts/PromptsView.tsx +++ b/webview-ui/src/components/prompts/PromptsView.tsx @@ -663,13 +663,13 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { // For custom modes, update the JSON file updateCustomMode(visualMode, { ...customMode, - roleDefinition: value.trim() || "", + roleDefinition: value || "", source: customMode.source || "global", }) } else { // For built-in modes, update the prompts updateAgentPrompt(visualMode, { - roleDefinition: value.trim() || undefined, + roleDefinition: value || undefined, }) } }} @@ -845,7 +845,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { // For custom modes, update the JSON file updateCustomMode(visualMode, { ...customMode, - customInstructions: value.trim() || undefined, + customInstructions: value || undefined, source: customMode.source || "global", }) } else { @@ -853,7 +853,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { const existingPrompt = customModePrompts?.[visualMode] as PromptComponent updateAgentPrompt(visualMode, { ...existingPrompt, - customInstructions: value.trim(), + customInstructions: value, }) } }} @@ -989,7 +989,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { setCustomInstructions(value || undefined) vscode.postMessage({ type: "customInstructions", - text: value.trim() || undefined, + text: value || undefined, }) }} rows={4} @@ -1064,8 +1064,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { const value = (e as unknown as CustomEvent)?.detail?.target?.value || ((e as any).target as HTMLTextAreaElement).value - const trimmedValue = value.trim() - updateSupportPrompt(activeSupportOption, trimmedValue || undefined) + updateSupportPrompt(activeSupportOption, value || undefined) }} rows={6} className="resize-y w-full" diff --git a/webview-ui/src/components/ui/autosize-textarea.tsx b/webview-ui/src/components/ui/autosize-textarea.tsx index d23f7a43600..b74c63b3ad6 100644 --- a/webview-ui/src/components/ui/autosize-textarea.tsx +++ b/webview-ui/src/components/ui/autosize-textarea.tsx @@ -82,7 +82,10 @@ export const AutosizeTextarea = React.forwardRef { - setTriggerAutoSize(value as string) + // Don't trim the value when setting the trigger + if (typeof value === "string") { + setTriggerAutoSize(value) + } }, [props?.defaultValue, value]) return ( @@ -98,6 +101,7 @@ export const AutosizeTextarea = React.forwardRef { + // Ensure we're not trimming the value setTriggerAutoSize(e.target.value) onChange?.(e) }}