Skip to content

DOCX: a list toggled in a table inserted this session is not shown and cannot be removed #27

Open

Description

@pierreneter

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:

  1. Open a document for editing and insert a table.
  2. Type in a cell and click "Bulleted list".
  3. The button stays unpressed (aria-pressed="false") and no marker is shown. The saved / reopened file has the bullet.
  4. 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 tid are committed through commitTable / docx.table, which returns no conversion. lst and 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:
    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
    }
  • toggleList decides the direction from p.lst, which is still unset, so the second click applies the list again:
    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions