feat(html): type into a sheet cell through an overlay - #863
Conversation
8b2dfb8 to
4603784
Compare
|
Reviewed the branch and force-pushed the fixes; the checks are Placement was wrong under a body zoom. The same bug in the reflow, where it matters more: the spill was measured with rects and written into a The reflow was also quadratic, with a Smaller things:
Comments cut throughout — the msvc rationale on the split literal (it sits on |
Double-clicking a cell, or a key on the pinned one, opens an `<input>` over it: Enter and Tab commit and move the pin, Escape cancels, blur commits, and the arrows walk the pin through `odr.sheet.pin` rather than a pin of the editor's own. The sheet's dom is untouched until the commit patches the cell, so nothing is `contenteditable` and a cell holding shapes or several runs never opens one - a locked cell refuses on the click, ahead of the double click. The type follows what was typed (decision 4): a strict grammar makes a number, a leading `'` forces a string, and `=` is refused as `formulaInput`, since overwriting an input leaves every formula computed from it stale until step 4. The commit records the op beside the value it replaced, patches the cell through its own run so a styled one keeps its style, and hands the log out coalesced per position as `odr.editing.getOperations()` - the envelope `Document::edit` takes. `odr.sheet` gained the half of this the sheet script owns: `valueAt` and `showValue` for what the page shows at a position, `reflow` for the spill `translate_sheet` measured, which goes stale the moment a blank cell fills or a full one empties, and `lower` for the raise the overlay stands in for. The spill is measured again by the same rule, off the geometry the browser has. `spreadsheet_js` outgrew msvc's 16380-byte literal and is written as two, as `pdf_annotation_js` is; `serve` joins them back. Steps 1.2 and 1.3 of `docs/design/spreadsheet-editing.md`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012eNBvra2NSxLjUvVKzuXSY
4603784 to
b6e6328
Compare
🤖 Generated with Claude Code
Steps 1.2 and 1.3 of
docs/design/spreadsheet-editing.md, which land together: an editor that throws away what is typed is not one.The overlay
Double-clicking a cell, or a key on the pinned one (
Enter,F2, a printable character), opens an<input>placed over it.EnterandTabcommit and move the pin — down and right, up and left with shift —Escapecancels, blur commits, and the arrows walk the pin throughodr.sheet.pinrather than through a pin of the editor's own. The sheet's dom is untouched until the commit patches the cell, so nothing iscontenteditable, and the pin is put back down while the overlay is open, since the overlay shows what a raise would.A cell holding a formula, shapes or several runs never opens one: it refuses on the click, ahead of the double click, and is outlined for the tap it answers.
odr.editing.editAt(column, row)is the same thing for a host.The commit
The type follows what was typed (decision 4): a strict grammar makes a number, a leading
'forces a string, and=is refused asformulaInput(code 6), since overwriting an input leaves every formula computed from it stale until step 4 — the refusal leaves the editor open.The commit records the op beside the value it replaced, patches the cell through its own run so a styled one keeps its style, toggles
odr-value-type-floatfor the alignment, and hands the log out coalesced per position asodr.editing.getOperations()— the envelopeDocument::edittakes.getOperationscame forward from step 1.4: ops nothing hands out are ops nothing can check.What the sheet script gained
odr.sheetowns the position map, so the value and geometry half sits beside it rather than being reached around (decision 8):valueAt/showValuefor what the page shows at a position,reflowfor the spilltranslate_sheetmeasured — which goes stale the moment a blank cell fills or a full one empties — andlowerfor the raise. The spill is measured again by the same rule the renderer used, off the geometry the browser has: a string runs over the blank cells beside it up to the next one showing something, and is cut at its own edge where a column states no width to run over.spreadsheet_jsoutgrew msvc's 16380-byte literal and is written as two, the waypdf_annotation_jsis;servejoins them back.Checks
test/browser/sheet/editing.htmldrives all of it through the public surface — 34 checks, green in Chrome, beside the 14 + 20 + 8 of the pages already there. It also verifies on a real render:translateonods/overflow.ods, then typing into C2 throughodr.editing, cuts the two strings spilling into it exactly as a fresh translate would.No markup changed, so the reference-output pins stay where they are.