Skip to content

feat(html): a host states how far an edit may reach - #890

Merged
andiwand merged 3 commits into
mainfrom
feat/html-editing-scope
Sep 13, 2026
Merged

andiwand merged 3 commits into
mainfrom
feat/html-editing-scope

Conversation

@andiwand

@andiwand andiwand commented Sep 13, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Why

The next core release makes is_editable true for .ods, .xlsx and .pptx, and puts the full text editor into the page. The apps offer the pencil on that answer, so the next bump un-gates every new feature in the free editions by itself. The gate has to exist in the release the apps bump to.

The core has no edition. Document::is_editable stays an engine fact, because the capability table asserts it and because wasm, python and the CLI must not be gated. The core gives the host one seam and one signal back.

What

  • HtmlConfig::editing_scope, an enum with paragraph and document. The default, document, keeps every existing consumer unchanged.
  • The body states it as data-odr-editing-scope, only when the render is editable.
  • ErrorCode::edit_out_of_scope = 1010, named outOfScope, reported through odr.onEditRefused.
  • In scope paragraph, document.js refuses Enter, Backspace at a paragraph start, a paste that holds a line break, and a selection over two paragraphs. A paragraph is a unit the reader sees; a run is not.
  • odr.editing.scope() reads the attribute per edit, so a host can widen the scope without a second render.
  • The file-type axis needs no core change: a host renders a sheet, a .pptx or a .txt with editable = false. Document::edit stays unchanged, so the gate refuses the edit and never the save.
  • Bound in jni, apple, wasm and python. Decision 14 in docs/design/editing.md, and a changelog entry.

Checks

  • odr_test: ErrorCode.* and the html editing tests pass.
  • test/browser/text/tests.html has a scope-paragraph group; it and the sheet and plaintext pages pass headless.
  • jni JUnit, python pytest, wasm node suite and the apple XCTest suite pass locally.

andiwand and others added 3 commits September 13, 2026 09:04
`HtmlConfig::editing_scope` narrows the document view's editor to one run
of text (`run`) or keeps the whole editor (`document`, the default). The
body states it as `data-odr-editing-scope`, and the editor refuses an edit
past it with the new `ErrorCode::edit_out_of_scope` (1010, `outOfScope`).

The core has no edition, so `Document::is_editable` stays an engine fact
and the scope is the one seam a host states its policy in. `Document::edit`
is unchanged, so the gate refuses the edit and never the save.

Bound in jni, apple, wasm and python. Decision 14 in `editing.md`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNQ2GtyAXXWGvnKBtwTEhQ
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNQ2GtyAXXWGvnKBtwTEhQ
A run is a split the reader cannot see: Word splits runs by revision
session, so a wall at a run stands in the middle of uniform text. A
paragraph is a unit the reader sees, so a refusal there has a visible
reason. Scope `paragraph` takes any edit inside one paragraph and refuses
Enter, a merge, a multi-line paste and a selection over two paragraphs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QNQ2GtyAXXWGvnKBtwTEhQ
@andiwand
andiwand merged commit 03bc57e into main Sep 13, 2026
34 of 35 checks passed
@andiwand
andiwand deleted the feat/html-editing-scope branch September 13, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant