-
Notifications
You must be signed in to change notification settings - Fork 0
Contenteditable Web Contract
This repo follows the naming and package shape used by
json-document/packages/contenteditable-web.
packages/contenteditable-web is the thin browser bridge between
@interactive-os/json-document and a browser contenteditable text surface.
It is not a product editor, document schema, toolbar system, markdown layer, or
React rendering framework.
The /codex route is only a smoke demo for the package contract.
- Map DOM Selection to
json-documentSelectionSnap. - Keep native text input and IME composition inside a leased text surface.
- Flush browser-owned text back to
json-documentthrough JSON Patch commits. - Preserve
selectionAfterfor undo/redo and toolbar commands. - Copy, cut, and paste plain text plus structured JSON fragments.
- Treat atoms as one model character using
\uFFFC. - Rebase range metadata for marks and other inline annotations.
- Route undo/redo through
json-documenthistory.
- No legacy
src/editorproduct surface. - No block editor command suite.
- No overlay/caret geometry engine.
- No markdown import/export policy.
- No app-owned toolbar or design system.
- No long audit/history documents in this repo.
The browser is allowed to own only the active text surface during native input
or IME composition. The canonical document remains json-document.
Normal flow:
json-document transaction
-> host render
-> DOM selection restore
Native input flow:
contenteditable mutation
-> read leased text surface
-> json-document patch commit
-> host render
IME flow:
compositionstart
-> lease active text surface
-> let browser own composition DOM
compositionend/input
-> flush leased text
-> release lease
Use contenteditable-web for the package because contenteditable is the
standard browser concept and web names the DOM adapter layer.
Avoid tool-specific names such as codex/core for source modules or public
contracts. The word codex may remain only as the demo route path when that URL
is intentionally preserved.
-
pnpm run test:corechecks jsdom package contracts. -
pnpm run verify:browserchecks the/codexbrowser smoke route. -
pnpm run verify:internalchecks TypeScript, Vitest, Biome, and production build.