feat(html)!: address an edit by element id, not by document path - #872
Merged
Conversation
An operation names its element by the id the render writes into the page, `data-odr-id`, and the envelope moves to version 2. A path is positional, so it names a different element the moment an operation inserts one - which the structural edits this prepares for do. An id does not move. An editable render addresses its paragraphs as well as its runs, because a paragraph is what a split or an insert anchors on. `Element::identifier()` and `Document::element_by_id()` are the two ends of the address, in C++ and in the python, jni and apple bindings. `docs/design/document-editing.md` records the decisions this work rests on. It sits beside `spreadsheet-editing.md`: one document per editor, named after the view it edits. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW
andiwand
force-pushed
the
feat/text-edit-by-id
branch
from
September 10, 2026 12:56
b7195cf to
12310b4
Compare
andiwand
added a commit
that referenced
this pull request
Sep 10, 2026
`odr.editing.getOperations()` and `odr.generateDiff()` stated `"version": 1` while `Document::edit` has taken 2 since #872, so every save the browser produced was refused with "unsupported edit version". Nothing caught it: the check pages read the operations and never the version, and the wasm and gtest suites write their own envelope by hand. So a check on each page that produces one now asserts it. Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW Co-authored-by: Claude Opus 5 (1M context) <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.
🤖 Generated with Claude Code
First of a five-PR stack that brings text documents and presentations up to
what spreadsheets already do: editing across runs, new paragraphs, and a
delete or replace that reaches across both.
docs/design/document-editing.md,added here, records the decisions the whole stack rests on.
What this one does
An edit operation names its element by the id the render writes into the page,
data-odr-id, rather than by aDocumentPath. The envelope moves to{"version": 2, …}and version 1 is refused rather than read.Why: a path is positional. The moment an operation inserts a paragraph,
every path recorded after it in the same log names a different element, so a
log of more than one structural operation cannot be replayed. An id does not
move. This is decision 4 of
docs/design/editing.md, now that there issomething that needs it.
An editable render addresses its paragraphs as well as its runs, because a
paragraph is what a split or an insert anchors on.
Element::identifier()andDocument::element_by_id()are the two ends of theaddress, in C++ and in the python, jni and apple bindings.
Breaking
Wire only, and only for our own editor's envelope. Nothing outside the tests
read
data-odr-path.Reference output
The markup change moves 275 reference files across the stack (attributes only —
the visible text of every one is byte-identical, checked). The pin advance
comes after the stack lands, so
compare-htmlstays red on these five PRsuntil then.