「记一条」面板里正文是个 textarea,排版、表格、贴图都没有——创建时反而比 详情页更寒酸。现在新建面板直接用详情同款 Vditor 编辑器,创建与修改一个模样。 - `RichTextEditor` 的 `itemId` 改为可选:新建时还没有条目 id,正文照写, 只是上传按钮不摆出来;真去贴图会提示「先保存这条内容,再回来贴图」。 - `KnowledgeComposer` 的正文换用 `RichTextEditor`(minHeight 320),页脚提示 按有没有条目 id 给不同文案。 - 安卓:新建对话框不再放纯文本正文框,保存后直接进 `RichTextEditorScreen` 写正文(排版、表格、贴图都在那儿),写完回到列表并展开详情。 - e2e 增加一条断言:新建面板里的正文就是富文本编辑器(aria-label=正文 的 contenteditable),正文按真实键盘输入后 Markdown 正常落库。 验证:`tsc --noEmit` 通过、`vite build` 通过、`knowledge-notebook.mjs` 11 项 全绿(新增「新建面板的正文是富文本编辑器」)。安卓端本机仍是 JDK 25 + Gradle 8.7/AGP 8.7.3 不兼容,本次未编译验证。
This commit is contained in:
+14
-10
@@ -707,17 +707,21 @@ function KnowledgeComposer({
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="block">
|
||||
<div>
|
||||
<span className="label">正文</span>
|
||||
<textarea
|
||||
className="input min-h-64 resize-y font-mono text-sm leading-relaxed"
|
||||
rows={14}
|
||||
placeholder={"可以直接写 Markdown:\n\n## 步骤\n1. 停灰度\n2. 回滚镜像\n3. 验证关键接口"}
|
||||
value={body}
|
||||
onChange={(e) => setBody(e.target.value)}
|
||||
aria-label="正文"
|
||||
/>
|
||||
</label>
|
||||
{/* 和详情抽屉同一个富文本编辑器:新建时就该能排版、写表格,而不是先存一个纯文本框 */}
|
||||
<div className="rounded-xl border border-line-200 bg-paper-50 px-3 py-2">
|
||||
<RichTextEditor
|
||||
ariaLabel="正文"
|
||||
wsId={wsId}
|
||||
value={body}
|
||||
onChange={setBody}
|
||||
minHeight={320}
|
||||
onError={setError}
|
||||
placeholder={"写下要点、步骤、结论…\n\n标题、类型、分类、标签都在上面,正文就是这张备忘的主体。"}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{error && <InlineAlert>{error}</InlineAlert>}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user