A stand-in for the Let's Encode campaign console that frames a web editor and speaks the console's
side of the editor host protocol (lets-encode-meta/lets-encode/editor-host.spec.md, protocol 1).
It tests editors and the protocol without touching the console. Verovio Officina is the first editor
to be integrated; ReTab and the simple editor are to follow.
Needs Node 23.6 or later (it imports TypeScript directly) and a checkout of lets-encode beside this
repository, or at LETS_ENCODE_DIR. Nothing to install.
npm startThen open http://127.0.0.1:8401/. The host runs on 127.0.0.1 and the dummy editor on
localhost:8402. These are different sites, so the browser treats the framed editor as it would
treat an editor on its own domain inside the console: storage partitioned, cross-origin messaging.
HOST_PORT and EDITOR_PORT change the ports.
On first start the server downloads the MEI 5.1 CMN schema from music-encoding.org, checks the
console's pinned digest and caches it in work/cache/.
- Campaign stand-in.
work/(not committed) holds the campaign's files, one branch file per claimed task (encode-<task>) and a commit log, seeded fromfixtures/. Reset campaign restores them. - Tasks.
fixtures/tasks.json: page tasks (locatorsurface-N) and a whole-file task (empty locator), as the console plans them. - Registry.
registry.jsonlists the editors with their URL, origin, protocol versions and the task kinds they accept. The host page'sframe-srcis generated from it, as the console's CSP would be. - Protocol.
host/protocol.js: the frame with?hosted=1, source and origin checks on every message,hello/init/readywith the spec's timeouts,get-text/text/saved,dirty,save,exitandhaptic. - Save.
get-text, then the server refuses a branch that moved, splices the page into the campaign's file and checks the result against the MEI schema with the console's own code (mei-page-splice.ts,mei-schema.ts, imported from the lets-encode checkout), then commits the editor's text to the branch and answerssaved. Saves never overlap. - Autosave once the editor has been unsaved for the configured time; drafts of the editor's text in IndexedDB every few seconds while unsaved, offered for restoring on reopening the task.
- Done saves once more and then splices the page into the campaign's file; Give up deletes
the branch; an editor's
exitmarks the task failed or refused. - Message log of everything sent, received and ignored, with long texts abbreviated.
Settings (seconds): autosave, draft interval, the hello, ready and text timeouts, and a commit
latency that delays every commit as GitHub would, which opens the window for edits made between
text and saved. In the Settings menu or in the URL, for example ?autosave=5&draft=2&latency=3.
editors/dummy/ is a textarea speaking the editor's side of protocol 1. Its toolbar provokes the
awkward cases: a delay before answering get-text, the spec's literal reading of saved ("naive
saved"), exit either way, haptic, and a message with the wrong protocol version. Its status line
shows whether it can use localStorage inside the frame. The switches also come from its URL
(?naive=1, ?delay=<ms>), which is how the registry entry "Dummy editor, naive saved" works.
GNU Affero General Public License 3.0, as Let's Encode itself (LICENSE).