Skip to content

fix(prompts): use multiline textarea for prompt variable input - #804

Merged
urzeye merged 2 commits into
mainfrom
fix/prompt-variable-multiline-format
Jul 27, 2026
Merged

fix(prompts): use multiline textarea for prompt variable input#804
urzeye merged 2 commits into
mainfrom
fix/prompt-variable-multiline-format

Conversation

@urzeye

@urzeye urzeye commented Jul 27, 2026

Copy link
Copy Markdown
Owner

概述

修复 #801:提示词变量粘贴多行 Markdown 内容时,换行被压成一行的问题。

问题根因

变量输入弹窗 VariableInputDialog.tsx 的普通文本变量使用单行 <input type="text">,HTML 单行输入框会剥离粘贴内容中的所有换行符,导致多行 Markdown 被压成一行。replaceVariables() 只做字符串替换,不影响换行,问题纯粹出在输入控件类型。

改动内容

  • 将普通文本变量的 <input type="text"> 替换为多行 <textarea>,保留换行与格式
  • firstInputRef 类型由 HTMLInputElement 改为 HTMLTextAreaElement
  • 弹窗宽度从 400px 放宽,便于编辑长文本
  • 保留原有键盘逻辑:Enter 提交、Shift+Enter 换行
  • 下拉选择(options)与默认值语法不受影响
  • 更新中英文 CHANGELOG

测试

  • pnpm typecheck 通过
  • pre-commit prettier 通过

关联 Issue

Closes #801

Single-line input stripped line breaks when pasting multi-line Markdown
into a prompt variable, collapsing the content onto one line. Switch the
variable text field to a multiline textarea so line breaks and formatting
are preserved.

Closes #801
@urzeye urzeye self-assigned this Jul 27, 2026
@urzeye urzeye added the bug Something isn't working label Jul 27, 2026
@urzeye urzeye added this to the v1.1.8 milestone Jul 27, 2026
…llbar

Make the variable textarea start at single-line height and grow to fit
content up to a max height, so short variables keep a compact look while
multi-line Markdown still preserves line breaks. Remove the resize handle
and apply a thin custom scrollbar.
@urzeye
urzeye merged commit 7ee8689 into main Jul 27, 2026
1 check passed
@urzeye
urzeye deleted the fix/prompt-variable-multiline-format branch July 27, 2026 09:51
@github-project-automation github-project-automation Bot moved this from Todo to Done in Ophel Development Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: 核心功能-提示词的变量“格式丢失问题”

1 participant