@sylang/web-editor
v0.1.1
Published
Self-contained Sylang TipTap editor — built as a static iframe-loadable bundle (main.html + chunks). Hosts (web apps, VSCode webviews) load this in an iframe and communicate with it via postMessage.
Readme
@sylang/web-editor
Self-contained Sylang TipTap editor. Built as a static iframe-loadable bundle.
What it is
A full TipTap-based editor for Sylang DSL files (.req, .fun, .blk, .fml, etc.). Renders header/definition/comment/use blocks with proper React NodeViews, property tables, relation cells, slash menus, cell pickers, and inline rich-text descriptions (Mermaid, charts, math, code, callouts, images).
How to use
- Build the bundle:
pnpm --filter @sylang/web-editor build→ emitsdist-web/main.html+ chunks. - Copy or symlink
dist-web/into your app's public assets folder (e.g.public/sylang-editor/). - Load it in an
<iframe>and use@sylang/react's<SylangEditor />to wire uppostMessage-based communication.
Architecture
The editor was originally designed for VSCode webviews; this package generalises it to any host that can mount an iframe and send/receive messages via window.postMessage. The host is responsible for:
- File IO (read DSL text, persist on save)
- Calling
parseDSLToTiptapfrom@sylang/tiptapto produce the TipTap doc - Posting
{ type: 'init', document, fileExtension, ... }to the iframe - Receiving
{ type: 'contentChange', document }from the iframe and serialising viaserializeToDSL
License
Apache-2.0
