fix: let double-click open a table cell again - #355
Merged
Conversation
Two separate faults meant double-clicking a table cell never left a caret in it, on any document type. `onDoubleClick` set `editingCell` and then called `selectTable`. That routes through `setSelection`, which clears `editingCell` by design, so the second line threw away what the first had just set — on every double-click, including when the table was already selected. Selecting first fixes it; the clearing behaviour is correct and stays. On the unified canvas the handler was unreachable regardless: only whiteboard TOOLS delegate surface events there, so the select tool never reached the whiteboard layer at all. The cell lookup is now a small exported function that DiagramCanvas calls directly for that case, after its own block-shape check and only when a table is actually under the cursor — so double-clicking empty unified canvas still does nothing rather than gaining the whiteboard's double-click-makes-a-text-box. Closes #353 Closes #354 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Double-clicking a whiteboard table cell selected the table but never left a caret in it. Two separate faults were in the way — one on every document type, one specific to the unified canvas.
Closes #353
Closes #354
#353 — the editor was thrown away immediately after being opened
onDoubleClickdid this:selectTableroutes throughsetSelection, which clearseditingCellby design — any selection change should close an open cell editor. So the second line discarded what the first had just set, on every double-click, including when the table was already selected.Fixed by selecting first, then opening the cell. The clearing behaviour in
setSelectionis correct and is unchanged.WhiteboardTable.vue's own header comment claimed double-click was the way in, so this read as intended behaviour that had silently stopped working.#354 — on the unified canvas the handler was unreachable anyway
delegatesSurface()only delegates to the whiteboard layer for unambiguous whiteboard tools;selectfalls through to shared block handling. That is deliberate for pointer events, but it also gatedonDoubleClick, so on a unified document the whiteboard's double-click never ran at all.The cell lookup is now a small exported
editTableCellAt(store, point), whichDiagramCanvascalls directly for the unified case — after its own block-shape check, and only when a table is actually under the cursor.That last part is deliberate: force-delegating the whole handler would also have brought the whiteboard's "double-click empty canvas creates a text box", which the unified canvas does not do today. There is a test pinning that.
Testing
842 vitest and 8 E2E (3 new), run against a real browser.
The new unit test goes through the real
useWhiteboardUisingleton rather than the fakeuithe neighbouring tests use, because the bug lived in the interaction between the two. I verified it fails against the old ordering:E2E covers double-click opening a cell on both a legacy whiteboard and a unified document, typing into it and asserting the persisted document, plus the guard that double-clicking empty unified canvas still creates nothing.
🤖 Generated with Claude Code