refactor(document)!: one way to edit a document - #839
Merged
Conversation
andiwand
force-pushed
the
feat/decode-options
branch
from
September 6, 2026 14:04
037532d to
d4e5968
Compare
html::edit takes a Document and touches no html; the only thing tying it to that namespace was that our browser-side JavaScript writes its input. It moves to Document::edit, where jni had already put it - jni_document.cpp carried the comment "odr::html::edit, but it belongs to Document" - and objc's HtmlTranslator.edit follows it onto ODRDocument. Text::set_content stays. The plan had it going as the second road into editing, which was wrong: editing a named element in process and replaying a log a browser produced are different operations, and it is mirrored in three bindings and exercised by the swift suite. The plan is amended with why. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016hxDa2rev11eLUEJZJ5nmz
andiwand
force-pushed
the
refactor/one-way-to-edit
branch
from
September 6, 2026 14:12
0b80ffd to
6a8c287
Compare
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
PR 9 of the v7 API plan.
Stacked on #838.
What moves
html::edit(document, diff)→Document::edit(operations).It takes a
Document, walks the element tree, and produces no html. The onlything tying it to
namespace htmlis that our browser-side JavaScript writesits input. JNI had already worked this out —
jni_document.cppcarried thecomment:
Named
editrather than the plan'sapply, to sit besideis_editableand tomatch where JNI put it. ObjC's
HtmlTranslator.edit(document:diff:)moves ontoODRDocument.edit(operations:)the same way, and java'sHtml.editstatic —which was a one-line forward to
document.edit(diff)— goes.What does not move, and why
Text::set_contentstays. The plan had it removed as "the second road intoediting". Working through it, that was wrong, and I have amended the plan doc
in this PR rather than quietly dropping the item:
set_contentedits a named elementin process;
editreplays a log a browser produced. Different callers.Text.setContent,set_content,setContent:) and exercised by the Swift suite. Removing ittakes capability away.
The
odr::open/DecodedFileduplication this series is about was oneimplementation under two names. This is not that. What was actually wrong was
the filing, and that is what this PR fixes.
So the three "can I edit this?" answers also stay —
FileTypeCapabilities::edit(format-level),
Document::is_editable(),Element::is_editable()answerdifferent questions at different altitudes.
Bindings
Html.edit(document, diff)document.edit(diff)pyodr.html.edit(document, diff)document.edit(diff)HtmlTranslator.edit(document:diff:)Document.edit(operations:)DocumentVerified
Full build; 57
Document*/*edit*gtests, 72 python tests, JNI junit all pass.Apple (11 TUs) and wasm (6 TUs) syntax-checked with
-Wall -Wextra -Werror.Migration
html::edit(document, diff) → document.edit(diff)