Repository navigation
Description
A list toggled on a paragraph inside a table that was inserted or restructured in this session is written to the file but never shown in the editor, and it cannot be removed from the toolbar.
Reproduction:
- Open a document for editing and insert a table.
- Type in a cell and click "Bulleted list".
- The button stays unpressed (
aria-pressed="false") and no marker is shown. The saved / reopened file has the bullet. - Click "Bulleted list" again. The command sets
list: 'bullet'once more, so the list stays.
Reproduced in Chromium with a real worker while reviewing #22.
Cause, on main at 43b28d6:
- Paragraphs in a table that has a
tidare committed throughcommitTable/docx.table, which returns no conversion.lstand the marker are never set, and nothing is republished, so the fix for DOCX: async list conversion leaves formatting state stale after list removal #19 does not reach this path:
office-engine/src/react/docx/DocxEditor.ts
Lines 467 to 472 in 43b28d6
private commit(pa: string, before: Paragraph[], next: Paragraph[], want?: boolean) { const c = this.container(pa)! if (c.cell && (this.st.blocks[c.cell[0]] as Table).tid !== undefined) { this.commitTable(c.cell[0]) return } toggleListdecides the direction fromp.lst, which is still unset, so the second click applies the list again:
office-engine/src/react/docx/DocxEditor.ts
Lines 891 to 898 in 43b28d6
toggleList(kind: 'bullet' | 'number') { const sel = this.input.sel() if (!sel) return const r = this.selectedParas(sel) if (!r) return const all = r.pas.every((pa) => this.para(pa)?.lst === kind) this.setPara({ list: all ? 'none' : kind, ilvl: all ? undefined : 0 }, {}, sel) }
Expected: the marker shows, the published state reports the list, and a second click removes it, the same as for a paragraph outside a table.
Possible direction: have docx.table return the converted paragraphs and markers for the table it rewrote and apply them like a docx.edit result, or set the list state optimistically in toggleList so the direction no longer depends on a round trip.
Activity