feat(magic-notes): add rich table editing
Add native Quill table insertion and contextual row, column, and table actions. Preserve table-only drafts through composer validation, IPC, and storage, and document the saved behavior.\n\nRelease note: 魔法笔记支持插入和编辑表格,空单元格表格也可保存并在重新打开后恢复。
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
# Magic Notes Progress
|
||||
|
||||
## 2026-10-08: Rich Text Table Editor Fix
|
||||
|
||||
Replaced the Electron-incompatible native prompt flow for table insertion with the shared form
|
||||
Modal. The dialog validates 1-20 rows and 1-12 columns, supports cancellation and Escape, restores
|
||||
focus to the toolbar trigger, and preserves the editor selection while it is open. Table row,
|
||||
column, and delete controls now use compact localized icon buttons, remain disabled outside a table
|
||||
cell, guard against nested insertion, preserve the active cell, and create separate Quill undo
|
||||
steps. Non-empty table Delta content remains readable in the read-only record renderer.
|
||||
|
||||
Focused validation: `npx vitest run src/renderer/src/MagicNoteEditor.test.tsx
|
||||
src/renderer/src/MagicNoteContent.test.tsx` passed 18 tests. `npm run typecheck` and affected-file
|
||||
ESLint passed. Full suite and runtime Electron validation were not run.
|
||||
|
||||
The table content check now also applies to save validation. An empty-cell table remains an active
|
||||
draft after focus leaves the composer, saves through the renderer, IPC and storage layers, and is
|
||||
restored after reopening. A rich Delta containing only a terminal newline remains rejected, and a
|
||||
failed save leaves the draft available for retry. Focused renderer and storage regression tests
|
||||
cover these cases.
|
||||
|
||||
## 2026-10-03: Compact Notes List And Narrow Drawer
|
||||
|
||||
The notes list now defaults to 200px with a 160px minimum. At workspace widths
|
||||
|
||||
@@ -71,6 +71,16 @@ save remounts at the returned revision and establishes a new baseline; an unchan
|
||||
background revision retains the existing editor and baseline. Aborted canvas
|
||||
initialization and file reads for an unmounted text editor cannot write back.
|
||||
|
||||
Rich text tables remain native Quill table Delta operations. Insertion stores the active editor
|
||||
range while the shared table-size dialog is open, rejects invalid dimensions before changing the
|
||||
Delta, and refuses insertion when that range is already a table cell. Row, column, and whole-table
|
||||
commands require a cell selection, preserve the selected range, and cut Quill history around each
|
||||
command so each toolbar action is independently undoable. The read-only rich renderer loads the
|
||||
same Delta with Quill's `readOnly` mode, so table content follows the same persisted schema without
|
||||
an editable toolbar. A table row operation is content even when its cell text is empty: the
|
||||
workspace keeps the composer open after focus leaves it and submits the Delta through the normal
|
||||
IPC and storage path. A genuinely empty rich Delta is still rejected before IPC.
|
||||
|
||||
The real saved formatted-text probe reproduced identical values with different
|
||||
Delta key order: storage returned `{insert, attributes}` and Quill emitted
|
||||
`{attributes, insert}`. The old `JSON.stringify` comparison therefore reported
|
||||
|
||||
@@ -49,4 +49,12 @@
|
||||
|
||||
Tab 使用工作栏现有的共享页签、焦点和关闭模式。搜索有持久标签,列表用可键盘访问的按钮;打开采集后聚焦预览,取消返回触发按钮,触发按钮已不可见时尝试返回会话标题菜单按钮。新建标题出现后聚焦输入框。面板中的 Escape 取消当前草稿,或从详情返回列表;需要放弃输入时先显示草稿确认。确认框初始聚焦“继续编辑”,限制 Tab 焦点范围,Escape 保留草稿并关闭确认。
|
||||
|
||||
## 富文本表格
|
||||
|
||||
富文本编辑器使用共享表单 Modal 插入表格,行数限制为 1-20,列数限制为
|
||||
1-12。取消、关闭、Escape 和遮罩点击不会修改内容,关闭后焦点返回“插入表格”
|
||||
按钮。表格操作使用紧凑图标按钮,保留本地化的可访问名称和提示;未选中表格单元格
|
||||
时,插入行、插入列和删除操作保持禁用,避免误操作或嵌套表格。每个表格操作形成
|
||||
独立的撤销步骤。已保存表格在只读记录视图中继续由 Quill 以不可编辑单元格显示。
|
||||
|
||||
面板服从工作栏现有宽度和停靠规则,以单列切换列表、详情和采集编辑。按钮组可换行,文字摘要保留换行并折行长文本;Markdown 和代码以原始文字显示。头部与快速追加区固定,中间内容独立滚动;完整预览输入区可纵向调整大小。配色、按钮、焦点环、通知和确认使用共享组件与令牌。真实 Electron 已在实测 214px 面板验证无横向溢出,以及原生键盘返回列表、打开笔记和追加保存。
|
||||
|
||||
Reference in New Issue
Block a user