Contributing
Thanks for helping with zeditor. This page covers setting up the project, the checks a change has to pass, and how changes reach a release.
Setup#
You need Node 18 or newer (CI uses 24) and pnpm 10 (corepack enable installs the right version).
pnpm install
pnpm build
pnpm --filter @buffmomo/zeditor exec playwright install chromium firefox webkit # once, for browser tests
pnpm playground # http://127.0.0.1:4173/| Folder | Contents |
|---|---|
packages/zeditor/src/core |
headless engine: model, schema, steps, commands, serializers |
packages/zeditor/src/view |
DOM rendering, input and selection |
packages/zeditor/src/ui |
default toolbar, menus and panels |
packages/zeditor/src/features |
optional features (review, sync, …) |
packages/zeditor/test |
Vitest unit tests (unit/) and Playwright browser tests (browser/) |
docs/ |
guides and the generated API reference; also the website's pages |
website/ |
the documentation website's CSS and JS; scripts/build-site.mjs builds it |
examples/, playground/ |
runnable examples, also published on the website |
Architecture explains how the pieces fit together.
Making a change#
Create a branch from
main.Make the change, with tests. Unit tests go in
packages/zeditor/test/unit. Anything that depends on real browser input, selection or layout goes inpackages/zeditor/test/browser.If you changed anything public (exports, commands, events, options, toolbar items), run
pnpm docs:apiand document it indocs/commands.mdor the matching guide.Add a line to
CHANGELOG.mdunder## [Unreleased](see RELEASING.md).Run the checks:
shpnpm check # build, typecheck, docs check, unit tests, browser tests, packed tarballFor quicker loops, use
pnpm test, orpnpm --filter @buffmomo/zeditor exec playwright test some.spec.ts --project=chromium. Browser tests loadpackages/zeditor/dist, so rebuild first (SKIP_TYPES=1 node build.mjsinsidepackages/zeditoris the fast way).For visual changes, attach before and after screenshots to the pull request.
node scripts/shots.mjs <dir>andnode scripts/shots-db.mjs <dir>take them.Open a pull request. CI runs the same checks on Linux, Windows and macOS.
Guidelines#
- Base bundle has zero runtime dependencies. Optional integrations (React, Vue, Yjs) are optional peer dependencies behind their own entry points.
- Everything is an extension. New built-in features should use the same extension API that users have. See Writing extensions.
- Stored JSON is a contract. Never break loading of existing documents. Changes to the format need a schema migration and a note in docs/migration.md.
- Accessible by default. Every control is reachable by keyboard and has a label. Menus follow
the ARIA patterns already used in
src/ui. - Performance. Do not read layout inside a transaction.
pnpm benchupdatesdocs/benchmarks.md.
Reporting bugs and requesting features#
Use GitHub issues. For bugs, include the
browser and OS, the editor options, and the smallest document JSON (editor.getJSON()) that
reproduces the problem.
License#
By contributing you agree that your contributions are licensed under the MIT License.