@agilehub/agile-editor 1.8.5 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agile-editor.css +1 -1
- package/dist/agile-editor.js +31160 -14002
- package/dist/{i18n-DZxiNlPY.js → i18n-CChALhQN.js} +36 -2
- package/dist/types/components/editor/table-background-control.vue.d.ts +1 -1
- package/dist/types/components/index.vue.d.ts +55 -4
- package/dist/types/components/menus/bubble/menus.vue.d.ts +2 -2
- package/dist/types/components/menus/toolbar/insert/emoji.vue.d.ts +3 -0
- package/dist/types/components/picker/color-panel.vue.d.ts +37 -0
- package/dist/types/components/picker/color.vue.d.ts +9 -0
- package/dist/types/components/preview-toolbar/drawing-layer.vue.d.ts +1 -1
- package/dist/types/components/statusbar/countdown.vue.d.ts +2 -2
- package/dist/types/composables/i18n.d.ts +51 -0
- package/dist/types/extensions/bubble-note-extensions.d.ts +1 -1
- package/dist/types/i18n.d.ts +51 -0
- package/dist/types/options/config/dicts.d.ts +8 -1
- package/dist/types/options/config/emojis.d.ts +15 -0
- package/dist/types/options/config/index.d.ts +8 -1
- package/dist/types/utils/emoji-search.d.ts +21 -0
- package/dist/types/utils/player.d.ts +12 -4
- package/dist/types/utils/video-frame.d.ts +1 -0
- package/dist/types/utils/video-skin.d.ts +1 -0
- package/dist/{viewer-DWO1FZ3A.js → viewer-Cv5V0Gjs.js} +2 -2
- package/docs/FORMATTING_TEMPLATES.md +253 -253
- package/docs/FORMATTING_TEMPLATE_BUSINESS_GUIDE.md +536 -536
- package/docs/SECONDARY_DEVELOPMENT.md +799 -799
- package/docs/features.md +1 -1
- package/docs/superpowers/plans/2026-11-27-table-reset-controls.md +185 -185
- package/docs/superpowers/plans/2026-11-28-bubble-note-rich-content.md +101 -101
- package/docs/superpowers/plans/2026-11-28-image-replace.md +190 -190
- package/docs/superpowers/plans/2026-11-28-table-image-resize-preview.md +121 -121
- package/docs/superpowers/plans/2026-11-28-table-property-category-actions.md +192 -192
- package/docs/superpowers/specs/2026-11-27-table-reset-controls-design.md +66 -66
- package/docs/superpowers/specs/2026-11-28-bubble-note-rich-content-design.md +64 -64
- package/docs/superpowers/specs/2026-11-28-image-replace-design.md +40 -40
- package/docs/superpowers/specs/2026-11-28-table-image-resize-preview-design.md +30 -30
- package/docs/superpowers/specs/2026-11-28-table-property-category-actions-design.md +63 -63
- package/package.json +165 -165
package/docs/features.md
CHANGED
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
# Table Reset Controls Implementation Plan
|
|
2
|
-
|
|
3
|
-
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
-
|
|
5
|
-
**Goal:** Add table, row, and cell reset controls that clear only their own level of formatting through centralized Tiptap commands.
|
|
6
|
-
|
|
7
|
-
**Architecture:** Pure update builders in `src/utils/table-reset.ts` define the exact default attributes and nodes affected. `src/extensions/table.ts` exposes three commands that apply those updates in one transaction. The existing table quick toolbar and cell properties panel only call commands and render localized buttons.
|
|
8
|
-
|
|
9
|
-
**Tech Stack:** Vue 3, TypeScript, Tiptap 3, ProseMirror transactions, Node test runner, TDesign Vue Next.
|
|
10
|
-
|
|
11
|
-
**Spec:** `docs/superpowers/specs/2026-11-27-table-reset-controls-design.md`
|
|
12
|
-
|
|
13
|
-
## Global Constraints
|
|
14
|
-
|
|
15
|
-
- Table reset must not touch row or cell formatting.
|
|
16
|
-
- Row reset must not touch other rows or cell content.
|
|
17
|
-
- Cell reset must not delete content or reset text marks such as color, font, and size.
|
|
18
|
-
- Every reset must be one undoable transaction.
|
|
19
|
-
- Do not add a confirmation dialog.
|
|
20
|
-
- All visible copy must have `zh-CN` and `en-US` translations.
|
|
21
|
-
|
|
22
|
-
## Review Focus
|
|
23
|
-
|
|
24
|
-
- Reset commands must remove `sourceAttributes` styles that could replay old formatting after reset.
|
|
25
|
-
- Row reset must clear shared borders without removing cell width or text alignment.
|
|
26
|
-
- Cell reset must remove imported inline text alignment while preserving other paragraph styles.
|
|
27
|
-
- Empty or invalid selections must return `false` without dispatching a transaction.
|
|
28
|
-
- All reset buttons must remain enabled in their own settings panel but fail safely outside a table.
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
### Task 1: Pure Reset Update Builders
|
|
33
|
-
|
|
34
|
-
**Files:**
|
|
35
|
-
- Create: `src/utils/table-reset.ts`
|
|
36
|
-
- Create: `tests/table-reset.test.mjs`
|
|
37
|
-
- Modify: `package.json:test:style-target`
|
|
38
|
-
|
|
39
|
-
**Interfaces:**
|
|
40
|
-
- Consumes: ProseMirror `Node`, `TableMap`, and existing `removeInlineStyleProperties`.
|
|
41
|
-
- Produces:
|
|
42
|
-
- `getTableResetAttributes(attrs: Record<string, unknown>): Record<string, unknown>`
|
|
43
|
-
- `getTableRowResetUpdates(doc: ProseMirrorNode, tableStart: number, row: number, map: TableMap): TableResetUpdate[]`
|
|
44
|
-
- `getTableCellResetUpdates(doc: ProseMirrorNode, cellPosition: number): TableResetUpdate[] | null`
|
|
45
|
-
- `type TableResetUpdate = { position: number; attrs: Record<string, unknown> }`
|
|
46
|
-
|
|
47
|
-
- [ ] **Step 1: Write failing tests for all three scopes**
|
|
48
|
-
|
|
49
|
-
Test names and assertions:
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
test('table reset clears table styling without touching rows or cells', () => {
|
|
53
|
-
// Table attrs gain defaults and lose sourceAttributes/preset/background styles.
|
|
54
|
-
// Row and cell attrs remain byte-for-byte equal to the fixture.
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
test('row reset clears row styling while preserving cell width and content', () => {
|
|
58
|
-
// Selected row loses rowHeight/borders/background/header role.
|
|
59
|
-
// A different row and each cell's colwidth/textAlign remain unchanged.
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('cell reset clears cell styling and generated text alignment', () => {
|
|
63
|
-
// Selected cell loses all appearance attrs, colwidth and sourceAttributes.
|
|
64
|
-
// Paragraph text remains, while textAlign and inline text-align are cleared.
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
- [ ] **Step 2: Run the new test file to verify RED**
|
|
69
|
-
|
|
70
|
-
Run: `node --test tests/table-reset.test.mjs`
|
|
71
|
-
|
|
72
|
-
Expected: FAIL because `src/utils/table-reset.ts` does not exist.
|
|
73
|
-
|
|
74
|
-
- [ ] **Step 3: Implement the pure update builders**
|
|
75
|
-
|
|
76
|
-
Table defaults are `sourceAttributes: null`, `inlineStyle: null`, `presetStyle: null`, `presetColor: null`, `presetShading: ''`, `indentNormalized: false`, `borderType: 'all'`, `borderColor: null`, `borderStyle: '1px solid'`, `dateTableType: 'table'`. Preserve `id` and track-change metadata.
|
|
77
|
-
|
|
78
|
-
Row updates use `TableMap` to find every mapped cell for the selected row. Clear row `rowHeight` and `inlineStyle`; remove background properties from row cell inline styles; clear all cell border attrs; convert each row cell to `tableCell`.
|
|
79
|
-
|
|
80
|
-
Cell reset clears all appearance, alignment, width, border, and source attrs. For each internal text block, set `textAlign: 'left'` and remove `text-align`/`text-align-last` from `inlineStyle`.
|
|
81
|
-
|
|
82
|
-
- [ ] **Step 4: Run the new tests to verify GREEN**
|
|
83
|
-
|
|
84
|
-
Run: `node --test tests/table-reset.test.mjs`
|
|
85
|
-
|
|
86
|
-
Expected: PASS, 3 tests.
|
|
87
|
-
|
|
88
|
-
- [ ] **Step 5: Run the full suite**
|
|
89
|
-
|
|
90
|
-
Run: `npm run test:style-target`
|
|
91
|
-
|
|
92
|
-
Expected: PASS, all tests.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
### Task 2: Tiptap Reset Commands
|
|
97
|
-
|
|
98
|
-
**Files:**
|
|
99
|
-
- Modify: `src/extensions/table.ts`
|
|
100
|
-
- Test: `tests/table-reset.test.mjs`
|
|
101
|
-
|
|
102
|
-
**Interfaces:**
|
|
103
|
-
- Consumes: Task 1 update builders.
|
|
104
|
-
- Produces commands:
|
|
105
|
-
- `clearTableSettings(): ReturnType`
|
|
106
|
-
- `clearTableRowSettings(): ReturnType`
|
|
107
|
-
- `clearTableCellSettings(): ReturnType`
|
|
108
|
-
|
|
109
|
-
- [ ] **Step 1: Add a characterization assertion for command-level target resolution**
|
|
110
|
-
|
|
111
|
-
Add a test that verifies the selected table row is derived from the current cell rectangle and that invalid table positions yield no updates.
|
|
112
|
-
|
|
113
|
-
- [ ] **Step 2: Run the characterization test to verify RED**
|
|
114
|
-
|
|
115
|
-
Run: `node --test tests/table-reset.test.mjs`
|
|
116
|
-
|
|
117
|
-
Expected: FAIL because the target-resolution helper is missing.
|
|
118
|
-
|
|
119
|
-
- [ ] **Step 3: Implement the three commands**
|
|
120
|
-
|
|
121
|
-
`clearTableSettings` finds the current `tableFigure`, updates its `table` child attrs with `getTableResetAttributes`, and sets the figure's `tableCaption.hidden` to `true`.
|
|
122
|
-
|
|
123
|
-
`clearTableRowSettings` uses `selectionCell`, `selectedRect`, `TableMap`, and the existing row range to apply Task 1 row updates to all selected rows in one transaction.
|
|
124
|
-
|
|
125
|
-
`clearTableCellSettings` applies Task 1 cell updates to every selected cell.
|
|
126
|
-
|
|
127
|
-
All commands return `false` when no table, row, or cell can be resolved and dispatch no transaction.
|
|
128
|
-
|
|
129
|
-
- [ ] **Step 4: Run the focused tests to verify GREEN**
|
|
130
|
-
|
|
131
|
-
Run: `node --test tests/table-reset.test.mjs`
|
|
132
|
-
|
|
133
|
-
Expected: PASS.
|
|
134
|
-
|
|
135
|
-
- [ ] **Step 5: Run typecheck**
|
|
136
|
-
|
|
137
|
-
Run: `npm run typecheck`
|
|
138
|
-
|
|
139
|
-
Expected: exit 0.
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
### Task 3: Reset Buttons and Localization
|
|
144
|
-
|
|
145
|
-
**Files:**
|
|
146
|
-
- Modify: `src/components/editor/table-quick-toolbar.vue`
|
|
147
|
-
- Modify: `src/components/editor/table-cell-properties.vue`
|
|
148
|
-
- Modify: `src/locales/zh-CN.json`
|
|
149
|
-
- Modify: `src/locales/en-US.json`
|
|
150
|
-
|
|
151
|
-
**Interfaces:**
|
|
152
|
-
- Consumes: Task 2 commands.
|
|
153
|
-
- Produces: table/row/cell reset buttons with the exact translation keys `table.quickTools.clearTable`, `clearRow`, and `clearCell`.
|
|
154
|
-
|
|
155
|
-
- [ ] **Step 1: Add the three localized labels**
|
|
156
|
-
|
|
157
|
-
Use Chinese labels `清除表格设置`, `清除表行设置`, `清除单元格属性设置`; use English equivalents `Clear table settings`, `Clear row settings`, `Clear cell properties`.
|
|
158
|
-
|
|
159
|
-
- [ ] **Step 2: Add reset buttons left of each apply button**
|
|
160
|
-
|
|
161
|
-
Use the existing text-button treatment already used by “清除背景”. Keep the reset and apply buttons in one right-aligned action row.
|
|
162
|
-
|
|
163
|
-
- [ ] **Step 3: Wire the buttons**
|
|
164
|
-
|
|
165
|
-
Call `editor.chain().focus().clearTableSettings().run()`, `clearTableRowSettings()`, and `clearTableCellSettings()` respectively. Keep the active panel open so the form can resync to cleared values.
|
|
166
|
-
|
|
167
|
-
- [ ] **Step 4: Run typecheck and focused tests**
|
|
168
|
-
|
|
169
|
-
Run: `npm run typecheck && node --test tests/table-reset.test.mjs`
|
|
170
|
-
|
|
171
|
-
Expected: both exit 0.
|
|
172
|
-
|
|
173
|
-
- [ ] **Step 5: Verify in the browser**
|
|
174
|
-
|
|
175
|
-
Create a table with width, alignment, background, preset style, row height/background/border, and cell width/alignment/background/border. Verify each clear button changes only its own scope, preserves content, and can be undone with one undo.
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## Final Verification
|
|
180
|
-
|
|
181
|
-
- [ ] Run `npm run test:style-target`
|
|
182
|
-
- [ ] Run `npm run typecheck`
|
|
183
|
-
- [ ] Run `npm run build`
|
|
184
|
-
- [ ] Run lint on all modified files
|
|
185
|
-
- [ ] Review `git diff --check`
|
|
1
|
+
# Table Reset Controls Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Add table, row, and cell reset controls that clear only their own level of formatting through centralized Tiptap commands.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Pure update builders in `src/utils/table-reset.ts` define the exact default attributes and nodes affected. `src/extensions/table.ts` exposes three commands that apply those updates in one transaction. The existing table quick toolbar and cell properties panel only call commands and render localized buttons.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Vue 3, TypeScript, Tiptap 3, ProseMirror transactions, Node test runner, TDesign Vue Next.
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-11-27-table-reset-controls-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Table reset must not touch row or cell formatting.
|
|
16
|
+
- Row reset must not touch other rows or cell content.
|
|
17
|
+
- Cell reset must not delete content or reset text marks such as color, font, and size.
|
|
18
|
+
- Every reset must be one undoable transaction.
|
|
19
|
+
- Do not add a confirmation dialog.
|
|
20
|
+
- All visible copy must have `zh-CN` and `en-US` translations.
|
|
21
|
+
|
|
22
|
+
## Review Focus
|
|
23
|
+
|
|
24
|
+
- Reset commands must remove `sourceAttributes` styles that could replay old formatting after reset.
|
|
25
|
+
- Row reset must clear shared borders without removing cell width or text alignment.
|
|
26
|
+
- Cell reset must remove imported inline text alignment while preserving other paragraph styles.
|
|
27
|
+
- Empty or invalid selections must return `false` without dispatching a transaction.
|
|
28
|
+
- All reset buttons must remain enabled in their own settings panel but fail safely outside a table.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
### Task 1: Pure Reset Update Builders
|
|
33
|
+
|
|
34
|
+
**Files:**
|
|
35
|
+
- Create: `src/utils/table-reset.ts`
|
|
36
|
+
- Create: `tests/table-reset.test.mjs`
|
|
37
|
+
- Modify: `package.json:test:style-target`
|
|
38
|
+
|
|
39
|
+
**Interfaces:**
|
|
40
|
+
- Consumes: ProseMirror `Node`, `TableMap`, and existing `removeInlineStyleProperties`.
|
|
41
|
+
- Produces:
|
|
42
|
+
- `getTableResetAttributes(attrs: Record<string, unknown>): Record<string, unknown>`
|
|
43
|
+
- `getTableRowResetUpdates(doc: ProseMirrorNode, tableStart: number, row: number, map: TableMap): TableResetUpdate[]`
|
|
44
|
+
- `getTableCellResetUpdates(doc: ProseMirrorNode, cellPosition: number): TableResetUpdate[] | null`
|
|
45
|
+
- `type TableResetUpdate = { position: number; attrs: Record<string, unknown> }`
|
|
46
|
+
|
|
47
|
+
- [ ] **Step 1: Write failing tests for all three scopes**
|
|
48
|
+
|
|
49
|
+
Test names and assertions:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
test('table reset clears table styling without touching rows or cells', () => {
|
|
53
|
+
// Table attrs gain defaults and lose sourceAttributes/preset/background styles.
|
|
54
|
+
// Row and cell attrs remain byte-for-byte equal to the fixture.
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
test('row reset clears row styling while preserving cell width and content', () => {
|
|
58
|
+
// Selected row loses rowHeight/borders/background/header role.
|
|
59
|
+
// A different row and each cell's colwidth/textAlign remain unchanged.
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('cell reset clears cell styling and generated text alignment', () => {
|
|
63
|
+
// Selected cell loses all appearance attrs, colwidth and sourceAttributes.
|
|
64
|
+
// Paragraph text remains, while textAlign and inline text-align are cleared.
|
|
65
|
+
})
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- [ ] **Step 2: Run the new test file to verify RED**
|
|
69
|
+
|
|
70
|
+
Run: `node --test tests/table-reset.test.mjs`
|
|
71
|
+
|
|
72
|
+
Expected: FAIL because `src/utils/table-reset.ts` does not exist.
|
|
73
|
+
|
|
74
|
+
- [ ] **Step 3: Implement the pure update builders**
|
|
75
|
+
|
|
76
|
+
Table defaults are `sourceAttributes: null`, `inlineStyle: null`, `presetStyle: null`, `presetColor: null`, `presetShading: ''`, `indentNormalized: false`, `borderType: 'all'`, `borderColor: null`, `borderStyle: '1px solid'`, `dateTableType: 'table'`. Preserve `id` and track-change metadata.
|
|
77
|
+
|
|
78
|
+
Row updates use `TableMap` to find every mapped cell for the selected row. Clear row `rowHeight` and `inlineStyle`; remove background properties from row cell inline styles; clear all cell border attrs; convert each row cell to `tableCell`.
|
|
79
|
+
|
|
80
|
+
Cell reset clears all appearance, alignment, width, border, and source attrs. For each internal text block, set `textAlign: 'left'` and remove `text-align`/`text-align-last` from `inlineStyle`.
|
|
81
|
+
|
|
82
|
+
- [ ] **Step 4: Run the new tests to verify GREEN**
|
|
83
|
+
|
|
84
|
+
Run: `node --test tests/table-reset.test.mjs`
|
|
85
|
+
|
|
86
|
+
Expected: PASS, 3 tests.
|
|
87
|
+
|
|
88
|
+
- [ ] **Step 5: Run the full suite**
|
|
89
|
+
|
|
90
|
+
Run: `npm run test:style-target`
|
|
91
|
+
|
|
92
|
+
Expected: PASS, all tests.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Task 2: Tiptap Reset Commands
|
|
97
|
+
|
|
98
|
+
**Files:**
|
|
99
|
+
- Modify: `src/extensions/table.ts`
|
|
100
|
+
- Test: `tests/table-reset.test.mjs`
|
|
101
|
+
|
|
102
|
+
**Interfaces:**
|
|
103
|
+
- Consumes: Task 1 update builders.
|
|
104
|
+
- Produces commands:
|
|
105
|
+
- `clearTableSettings(): ReturnType`
|
|
106
|
+
- `clearTableRowSettings(): ReturnType`
|
|
107
|
+
- `clearTableCellSettings(): ReturnType`
|
|
108
|
+
|
|
109
|
+
- [ ] **Step 1: Add a characterization assertion for command-level target resolution**
|
|
110
|
+
|
|
111
|
+
Add a test that verifies the selected table row is derived from the current cell rectangle and that invalid table positions yield no updates.
|
|
112
|
+
|
|
113
|
+
- [ ] **Step 2: Run the characterization test to verify RED**
|
|
114
|
+
|
|
115
|
+
Run: `node --test tests/table-reset.test.mjs`
|
|
116
|
+
|
|
117
|
+
Expected: FAIL because the target-resolution helper is missing.
|
|
118
|
+
|
|
119
|
+
- [ ] **Step 3: Implement the three commands**
|
|
120
|
+
|
|
121
|
+
`clearTableSettings` finds the current `tableFigure`, updates its `table` child attrs with `getTableResetAttributes`, and sets the figure's `tableCaption.hidden` to `true`.
|
|
122
|
+
|
|
123
|
+
`clearTableRowSettings` uses `selectionCell`, `selectedRect`, `TableMap`, and the existing row range to apply Task 1 row updates to all selected rows in one transaction.
|
|
124
|
+
|
|
125
|
+
`clearTableCellSettings` applies Task 1 cell updates to every selected cell.
|
|
126
|
+
|
|
127
|
+
All commands return `false` when no table, row, or cell can be resolved and dispatch no transaction.
|
|
128
|
+
|
|
129
|
+
- [ ] **Step 4: Run the focused tests to verify GREEN**
|
|
130
|
+
|
|
131
|
+
Run: `node --test tests/table-reset.test.mjs`
|
|
132
|
+
|
|
133
|
+
Expected: PASS.
|
|
134
|
+
|
|
135
|
+
- [ ] **Step 5: Run typecheck**
|
|
136
|
+
|
|
137
|
+
Run: `npm run typecheck`
|
|
138
|
+
|
|
139
|
+
Expected: exit 0.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### Task 3: Reset Buttons and Localization
|
|
144
|
+
|
|
145
|
+
**Files:**
|
|
146
|
+
- Modify: `src/components/editor/table-quick-toolbar.vue`
|
|
147
|
+
- Modify: `src/components/editor/table-cell-properties.vue`
|
|
148
|
+
- Modify: `src/locales/zh-CN.json`
|
|
149
|
+
- Modify: `src/locales/en-US.json`
|
|
150
|
+
|
|
151
|
+
**Interfaces:**
|
|
152
|
+
- Consumes: Task 2 commands.
|
|
153
|
+
- Produces: table/row/cell reset buttons with the exact translation keys `table.quickTools.clearTable`, `clearRow`, and `clearCell`.
|
|
154
|
+
|
|
155
|
+
- [ ] **Step 1: Add the three localized labels**
|
|
156
|
+
|
|
157
|
+
Use Chinese labels `清除表格设置`, `清除表行设置`, `清除单元格属性设置`; use English equivalents `Clear table settings`, `Clear row settings`, `Clear cell properties`.
|
|
158
|
+
|
|
159
|
+
- [ ] **Step 2: Add reset buttons left of each apply button**
|
|
160
|
+
|
|
161
|
+
Use the existing text-button treatment already used by “清除背景”. Keep the reset and apply buttons in one right-aligned action row.
|
|
162
|
+
|
|
163
|
+
- [ ] **Step 3: Wire the buttons**
|
|
164
|
+
|
|
165
|
+
Call `editor.chain().focus().clearTableSettings().run()`, `clearTableRowSettings()`, and `clearTableCellSettings()` respectively. Keep the active panel open so the form can resync to cleared values.
|
|
166
|
+
|
|
167
|
+
- [ ] **Step 4: Run typecheck and focused tests**
|
|
168
|
+
|
|
169
|
+
Run: `npm run typecheck && node --test tests/table-reset.test.mjs`
|
|
170
|
+
|
|
171
|
+
Expected: both exit 0.
|
|
172
|
+
|
|
173
|
+
- [ ] **Step 5: Verify in the browser**
|
|
174
|
+
|
|
175
|
+
Create a table with width, alignment, background, preset style, row height/background/border, and cell width/alignment/background/border. Verify each clear button changes only its own scope, preserves content, and can be undone with one undo.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Final Verification
|
|
180
|
+
|
|
181
|
+
- [ ] Run `npm run test:style-target`
|
|
182
|
+
- [ ] Run `npm run typecheck`
|
|
183
|
+
- [ ] Run `npm run build`
|
|
184
|
+
- [ ] Run lint on all modified files
|
|
185
|
+
- [ ] Review `git diff --check`
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
# Bubble Note Rich Content Implementation Plan
|
|
2
|
-
|
|
3
|
-
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
-
|
|
5
|
-
**Goal:** Add safe rich text, images, and formulas to bubble-note bodies without breaking legacy plain-text notes.
|
|
6
|
-
|
|
7
|
-
**Architecture:** Persist a constrained Tiptap document in the existing `bubbleNote` mark, keep a plain-text mirror, edit it in a dedicated nested editor, and render it read-only through the same sanitized schema.
|
|
8
|
-
|
|
9
|
-
**Tech Stack:** Vue 3, Tiptap 3, TDesign Vue Next, `@agilehub/latex-formula`, Node `node:test`.
|
|
10
|
-
|
|
11
|
-
**Spec:** `docs/superpowers/specs/2026-11-28-bubble-note-rich-content-design.md`
|
|
12
|
-
|
|
13
|
-
## Global Constraints
|
|
14
|
-
|
|
15
|
-
- Preserve the 20-character anchor limit.
|
|
16
|
-
- Use `agile-` CSS prefixes and existing TDesign/theme variables.
|
|
17
|
-
- Keep old `data-annotation` documents readable.
|
|
18
|
-
- Do not introduce unsupported arbitrary HTML rendering.
|
|
19
|
-
- Keep image and formula creation inside the bubble-note scope.
|
|
20
|
-
|
|
21
|
-
## Review Focus
|
|
22
|
-
|
|
23
|
-
- Legacy plain annotations must open as valid rich content.
|
|
24
|
-
- Malformed rich JSON must fall back without losing text.
|
|
25
|
-
- Unsupported pasted nodes and unsafe links must not enter stored content.
|
|
26
|
-
- Image upload failure must leave the editor usable.
|
|
27
|
-
- Read-only and keyboard interaction must remain available outside edit mode.
|
|
28
|
-
|
|
29
|
-
### Task 1: Rich Content Codec And Sanitizer
|
|
30
|
-
|
|
31
|
-
**Files:**
|
|
32
|
-
- Create: `src/extensions/bubble-note-content.ts`
|
|
33
|
-
- Test: `tests/bubble-note-rich-content.test.mjs`
|
|
34
|
-
|
|
35
|
-
**Interfaces:**
|
|
36
|
-
- Produces: `createBubbleNoteContent(text)`, `normalizeBubbleNoteContent(value, fallbackText)`, `encodeBubbleNoteContent(value)`, `decodeBubbleNoteContent(value)`, `getBubbleNoteText(value)`, `validateBubbleNoteContent(value, limits)`.
|
|
37
|
-
|
|
38
|
-
- [x] Write failing tests for legacy conversion, round-trip encoding, malformed input, allowed marks, and limits.
|
|
39
|
-
- [x] Run `node --test tests/bubble-note-rich-content.test.mjs` and confirm the missing module failure.
|
|
40
|
-
- [x] Implement the codec and sanitizer.
|
|
41
|
-
- [x] Re-run the focused test until it passes.
|
|
42
|
-
|
|
43
|
-
### Task 2: Bubble Note Mark Persistence
|
|
44
|
-
|
|
45
|
-
**Files:**
|
|
46
|
-
- Modify: `src/extensions/bubble-note.ts`
|
|
47
|
-
- Modify: `tests/style-schema.test.mjs`
|
|
48
|
-
|
|
49
|
-
**Interfaces:**
|
|
50
|
-
- Consumes: Task 1 codec functions.
|
|
51
|
-
- Produces: `annotationContent` and `annotationVersion` mark attributes with HTML parse/render.
|
|
52
|
-
|
|
53
|
-
- [x] Extend the schema test to require rich-content attributes and HTML round-trip.
|
|
54
|
-
- [x] Run the focused schema test and confirm it fails.
|
|
55
|
-
- [x] Add mark attrs, Base64URL HTML persistence, and legacy fallback parsing.
|
|
56
|
-
- [x] Re-run the focused test until it passes.
|
|
57
|
-
|
|
58
|
-
### Task 3: Constrained Note Editor
|
|
59
|
-
|
|
60
|
-
**Files:**
|
|
61
|
-
- Create: `src/components/menus/toolbar/tools/bubble-note-editor.vue`
|
|
62
|
-
- Create: `src/components/menus/toolbar/tools/bubble-note-image.ts`
|
|
63
|
-
- Modify: `src/components/editor/formula-dialog.vue`
|
|
64
|
-
|
|
65
|
-
**Interfaces:**
|
|
66
|
-
- Consumes: Task 1 content model, existing `Math`, `CustomInlineMath`, and `CustomBlockMath`.
|
|
67
|
-
- Produces: a nested editor with toolbar, image insertion, formula insertion, character count, and `getContent()` snapshot.
|
|
68
|
-
|
|
69
|
-
- [x] Add focused tests for note image HTML rendering and content limits.
|
|
70
|
-
- [x] Run the focused tests and confirm they fail.
|
|
71
|
-
- [x] Implement the image node and nested editor.
|
|
72
|
-
- [x] Re-run focused tests and typecheck.
|
|
73
|
-
|
|
74
|
-
### Task 4: Dialog And Popup Integration
|
|
75
|
-
|
|
76
|
-
**Files:**
|
|
77
|
-
- Modify: `src/components/menus/toolbar/tools/bubble-note.vue`
|
|
78
|
-
- Modify: `src/extensions/bubble-note.ts`
|
|
79
|
-
- Modify: `src/assets/styles/editor.less`
|
|
80
|
-
- Modify: `src/locales/zh-CN.json`
|
|
81
|
-
- Modify: `src/locales/en-US.json`
|
|
82
|
-
|
|
83
|
-
**Interfaces:**
|
|
84
|
-
- Consumes: Task 2 persistence and Task 3 editor.
|
|
85
|
-
- Produces: rich edit dialog, static rich popup, keyboard anchor activation, mobile sheet layout.
|
|
86
|
-
|
|
87
|
-
- [x] Add failing assertions for rich popup parsing and keyboard-open metadata.
|
|
88
|
-
- [x] Run the focused test and confirm it fails.
|
|
89
|
-
- [x] Replace the textarea with the note editor and render the saved rich body.
|
|
90
|
-
- [x] Add responsive and dark-theme styles.
|
|
91
|
-
- [x] Run focused tests and typecheck.
|
|
92
|
-
|
|
93
|
-
### Task 5: Verification
|
|
94
|
-
|
|
95
|
-
**Files:**
|
|
96
|
-
- Modify only files required by failures found here.
|
|
97
|
-
|
|
98
|
-
- [x] Run `node --test tests/bubble-note-rich-content.test.mjs tests/style-schema.test.mjs`.
|
|
99
|
-
- [x] Run `npm run typecheck`.
|
|
100
|
-
- [x] Run `npm run build`.
|
|
101
|
-
- [x] Run the project test suite when practical and report unrelated failures separately.
|
|
1
|
+
# Bubble Note Rich Content Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
4
|
+
|
|
5
|
+
**Goal:** Add safe rich text, images, and formulas to bubble-note bodies without breaking legacy plain-text notes.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Persist a constrained Tiptap document in the existing `bubbleNote` mark, keep a plain-text mirror, edit it in a dedicated nested editor, and render it read-only through the same sanitized schema.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Vue 3, Tiptap 3, TDesign Vue Next, `@agilehub/latex-formula`, Node `node:test`.
|
|
10
|
+
|
|
11
|
+
**Spec:** `docs/superpowers/specs/2026-11-28-bubble-note-rich-content-design.md`
|
|
12
|
+
|
|
13
|
+
## Global Constraints
|
|
14
|
+
|
|
15
|
+
- Preserve the 20-character anchor limit.
|
|
16
|
+
- Use `agile-` CSS prefixes and existing TDesign/theme variables.
|
|
17
|
+
- Keep old `data-annotation` documents readable.
|
|
18
|
+
- Do not introduce unsupported arbitrary HTML rendering.
|
|
19
|
+
- Keep image and formula creation inside the bubble-note scope.
|
|
20
|
+
|
|
21
|
+
## Review Focus
|
|
22
|
+
|
|
23
|
+
- Legacy plain annotations must open as valid rich content.
|
|
24
|
+
- Malformed rich JSON must fall back without losing text.
|
|
25
|
+
- Unsupported pasted nodes and unsafe links must not enter stored content.
|
|
26
|
+
- Image upload failure must leave the editor usable.
|
|
27
|
+
- Read-only and keyboard interaction must remain available outside edit mode.
|
|
28
|
+
|
|
29
|
+
### Task 1: Rich Content Codec And Sanitizer
|
|
30
|
+
|
|
31
|
+
**Files:**
|
|
32
|
+
- Create: `src/extensions/bubble-note-content.ts`
|
|
33
|
+
- Test: `tests/bubble-note-rich-content.test.mjs`
|
|
34
|
+
|
|
35
|
+
**Interfaces:**
|
|
36
|
+
- Produces: `createBubbleNoteContent(text)`, `normalizeBubbleNoteContent(value, fallbackText)`, `encodeBubbleNoteContent(value)`, `decodeBubbleNoteContent(value)`, `getBubbleNoteText(value)`, `validateBubbleNoteContent(value, limits)`.
|
|
37
|
+
|
|
38
|
+
- [x] Write failing tests for legacy conversion, round-trip encoding, malformed input, allowed marks, and limits.
|
|
39
|
+
- [x] Run `node --test tests/bubble-note-rich-content.test.mjs` and confirm the missing module failure.
|
|
40
|
+
- [x] Implement the codec and sanitizer.
|
|
41
|
+
- [x] Re-run the focused test until it passes.
|
|
42
|
+
|
|
43
|
+
### Task 2: Bubble Note Mark Persistence
|
|
44
|
+
|
|
45
|
+
**Files:**
|
|
46
|
+
- Modify: `src/extensions/bubble-note.ts`
|
|
47
|
+
- Modify: `tests/style-schema.test.mjs`
|
|
48
|
+
|
|
49
|
+
**Interfaces:**
|
|
50
|
+
- Consumes: Task 1 codec functions.
|
|
51
|
+
- Produces: `annotationContent` and `annotationVersion` mark attributes with HTML parse/render.
|
|
52
|
+
|
|
53
|
+
- [x] Extend the schema test to require rich-content attributes and HTML round-trip.
|
|
54
|
+
- [x] Run the focused schema test and confirm it fails.
|
|
55
|
+
- [x] Add mark attrs, Base64URL HTML persistence, and legacy fallback parsing.
|
|
56
|
+
- [x] Re-run the focused test until it passes.
|
|
57
|
+
|
|
58
|
+
### Task 3: Constrained Note Editor
|
|
59
|
+
|
|
60
|
+
**Files:**
|
|
61
|
+
- Create: `src/components/menus/toolbar/tools/bubble-note-editor.vue`
|
|
62
|
+
- Create: `src/components/menus/toolbar/tools/bubble-note-image.ts`
|
|
63
|
+
- Modify: `src/components/editor/formula-dialog.vue`
|
|
64
|
+
|
|
65
|
+
**Interfaces:**
|
|
66
|
+
- Consumes: Task 1 content model, existing `Math`, `CustomInlineMath`, and `CustomBlockMath`.
|
|
67
|
+
- Produces: a nested editor with toolbar, image insertion, formula insertion, character count, and `getContent()` snapshot.
|
|
68
|
+
|
|
69
|
+
- [x] Add focused tests for note image HTML rendering and content limits.
|
|
70
|
+
- [x] Run the focused tests and confirm they fail.
|
|
71
|
+
- [x] Implement the image node and nested editor.
|
|
72
|
+
- [x] Re-run focused tests and typecheck.
|
|
73
|
+
|
|
74
|
+
### Task 4: Dialog And Popup Integration
|
|
75
|
+
|
|
76
|
+
**Files:**
|
|
77
|
+
- Modify: `src/components/menus/toolbar/tools/bubble-note.vue`
|
|
78
|
+
- Modify: `src/extensions/bubble-note.ts`
|
|
79
|
+
- Modify: `src/assets/styles/editor.less`
|
|
80
|
+
- Modify: `src/locales/zh-CN.json`
|
|
81
|
+
- Modify: `src/locales/en-US.json`
|
|
82
|
+
|
|
83
|
+
**Interfaces:**
|
|
84
|
+
- Consumes: Task 2 persistence and Task 3 editor.
|
|
85
|
+
- Produces: rich edit dialog, static rich popup, keyboard anchor activation, mobile sheet layout.
|
|
86
|
+
|
|
87
|
+
- [x] Add failing assertions for rich popup parsing and keyboard-open metadata.
|
|
88
|
+
- [x] Run the focused test and confirm it fails.
|
|
89
|
+
- [x] Replace the textarea with the note editor and render the saved rich body.
|
|
90
|
+
- [x] Add responsive and dark-theme styles.
|
|
91
|
+
- [x] Run focused tests and typecheck.
|
|
92
|
+
|
|
93
|
+
### Task 5: Verification
|
|
94
|
+
|
|
95
|
+
**Files:**
|
|
96
|
+
- Modify only files required by failures found here.
|
|
97
|
+
|
|
98
|
+
- [x] Run `node --test tests/bubble-note-rich-content.test.mjs tests/style-schema.test.mjs`.
|
|
99
|
+
- [x] Run `npm run typecheck`.
|
|
100
|
+
- [x] Run `npm run build`.
|
|
101
|
+
- [x] Run the project test suite when practical and report unrelated failures separately.
|