Skip to content

Update presentation when typing inside table in sdt#2729

Open
VladaHarbour wants to merge 3 commits intomainfrom
sd-2453_typing-table-sdt
Open

Update presentation when typing inside table in sdt#2729
VladaHarbour wants to merge 3 commits intomainfrom
sd-2453_typing-table-sdt

Conversation

@VladaHarbour
Copy link
Copy Markdown
Contributor

No description provided.

@VladaHarbour VladaHarbour self-assigned this Apr 7, 2026
@linear
Copy link
Copy Markdown

linear bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VladaHarbour good fix — the three changes work well together: cache updates so edits show up, version tracking so the page re-renders, and click handling so the cursor lands inside the inner table instead of selecting the whole field.

no correctness issues found.

one thing we noticed while testing: opening a Word file that already has this structure (table inside an SDT inside a table cell) doesn't produce the right nodes on import — the inner tables get dropped. that's not something this PR broke, it was already like that, but it means these code paths only get triggered through the template builder (where users build the structure interactively). could be worth a follow-up ticket for import support.

left two inline comments — both about test coverage, not the logic itself.

// Nested tables inside table cells must contribute to the parent
// table cache key, otherwise edits can be missed until a later
// broader invalidation.
cellHashes.push(`nt:${hashRuns(cellBlock as FlowBlock)}`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works but there's no test for it. cache.test.ts already has lots of table tests — adding one for a table-inside-a-table (~30 lines, same pattern) would make sure this path doesn't break silently. worth adding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added test

hash = hashString(hash, getRunStringProp(run, 'vertAlign'));
hash = hashNumber(hash, getRunNumberProp(run, 'baselineShift'));
}
} else if (cellBlock?.kind) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this catches all non-paragraph blocks in cells, while cache.ts only catches tables specifically. both approaches work, just different — worth a comment pointing to each other so whoever changes one remembers the other exists.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment added

@VladaHarbour VladaHarbour force-pushed the sd-2453_typing-table-sdt branch from 006066c to 82075ec Compare April 14, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants