
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@dotit/editor
Advanced tools
Embeddable WYSIWYG visual editor for IntentText (.it) documents — Word-like pages, ribbon, trust banner, and WYSIWYG PDF/HTML export. Drop it into any React app (ERPs, portals, back offices).
Embeddable WYSIWYG visual editor for IntentText (.it) documents — Word-like pages, a formatting ribbon, trust banner, and WYSIWYG PDF/HTML export. Built for embedding in React apps: ERPs, portals, back offices.
The editor is a controlled component over plain .it source text: you pass the source in, you get the edited source back. Everything the user styles maps to core .it properties, so a document printed through @dotit/core (or this package's export functions) always matches what the user saw on screen.
npm install @dotit/editor @dotit/core react react-dom
Peer dependencies: react >= 18, react-dom >= 18.
import { useState } from "react";
import { IntentTextEditor, exportDocumentPDF } from "@dotit/editor";
import "@dotit/editor/style.css";
export function InvoiceEditor() {
const [source, setSource] = useState("title: Invoice INV-001\n\nHello");
return (
<div style={{ height: "100vh" }}>
<IntentTextEditor value={source} onChange={setSource} theme="corporate" />
<button onClick={() => exportDocumentPDF(source, "corporate")}>PDF</button>
</div>
);
}
The editor fills its parent — give the wrapper an explicit height.
<IntentTextEditor /> props| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — (required) | Current .it source text (controlled). |
onChange | (source: string) => void | — (required) | Called with the updated .it source on every edit. |
theme | string | "corporate" | Document theme id (see builtinThemes()). Controlled when provided — pair with onThemeChange. |
onThemeChange | (theme: string) => void | — | Called when the user picks a theme in the ribbon. |
readOnly | boolean | false | Force read-only. Sealed documents (freeze: block) are read-only automatically. |
showRibbon | boolean | true | Show the formatting ribbon. |
showTrustBanner | boolean | true | Show the trust status banner + document properties strip. The banner is multi-sign aware — it shows per-signer status (Signed · N/M), flags an older-ruleset seal (Sealed · older ruleset), and shows SEAL BROKEN when a sealed body is tampered. |
onTrustAction | (a: "seal"|"sign"|"verify") => void | — | Handle the ribbon's Trust group. The editor only reports intent — wire it to your own dialogs (e.g. core's sealDocument / verifyDocument). The group is hidden when omitted. |
| Export | Description |
|---|---|
IntentTextEditor | The embeddable editor component. |
exportDocumentPDF(source, theme, printMode?) | Opens the browser print dialog (→ Save as PDF). WYSIWYG when the editor is mounted; falls back to core's renderPrint. printMode: "normal" | "minimal-ink". |
exportDocumentHTML(source, theme, printMode?) | Downloads the print-ready HTML document. |
builtinThemes() | Built-in theme ids for a theme picker. |
printHtmlViaIframe(html) | Low-level: print any HTML document via a hidden iframe. |
sourceToDoc(source) / docToSource(json) | The lossless .it ↔ editor-document bridge (TipTap JSON). |
extractTemplateVariables(source) / buildSampleSkeleton(vars) | Template helpers for {{variable}} authoring. |
extractTrustState(parsedDoc) | Trust lifecycle snapshot (TrustState): tracked / approved / signed / sealed + amendments. |
getPageGeometry(source) / resolvePageTokens(text, page, pages) | Page geometry from the document's own page:/header:/footer: blocks. |
Types: IntentTextEditorProps, TrustAction, PrintMode, TrustState, PageGeometry.
.it in/out. Store the source string wherever you store documents (a DB column is fine — it's plain text). Load it into value, persist what onChange gives you. No editor-specific format ever touches your data.@dotit/core's reconcileEdit.{{variables}} in the editor (they render as chips); merge real data server-side with @dotit/core's parseAndMerge and print with renderPrint — or @dotit/pdf for real PDF bytes.exportDocumentPDF(source, theme) from your own button — it uses the user's browser print dialog and matches the on-screen pages exactly.onTrustAction to your approval/signature flows; the editor renders sign:/seal:/approve: blocks as proper signature lines and chips. The trust banner is multi-sign aware (per-signer Signed · N/M; a signer of an earlier version is shown as such, not a blanket "broken"). On the page (and in print/PDF) the editor draws @dotit/core's unified certification band (renderTrustBand + TRUST_BAND_CSS), so it looks identical on screen and on paper; the band has an integrity gate — it verifies before drawing, so a tampered seal never prints as sealed.window.dispatchEvent(new CustomEvent("it-insert-text", { detail: "{{customer.name}}" })) to insert text at the cursor (e.g. from your own variable picker)..docs-container/.docs-page and ship in one stylesheet (@dotit/editor/style.css); the editor does not depend on host-page CSS resets. One editor instance per page is the supported setup (theme CSS is injected document-wide).The editor is browser-only (it measures the DOM to paginate). With Next.js or any SSR framework, load it dynamically with SSR disabled:
"use client";
import dynamic from "next/dynamic";
import "@dotit/editor/style.css";
const IntentTextEditor = dynamic(
() => import("@dotit/editor").then((m) => m.IntentTextEditor),
{ ssr: false },
);
exportDocumentPDF / exportDocumentHTML must also only be called in the browser. For server-side PDF generation use @dotit/pdf.
MIT
FAQs
Embeddable WYSIWYG visual editor for IntentText (.it) documents — Word-like pages, ribbon, trust banner, and WYSIWYG PDF/HTML export. Drop it into any React app (ERPs, portals, back offices).
The npm package @dotit/editor receives a total of 20 weekly downloads. As such, @dotit/editor popularity was classified as not popular.
We found that @dotit/editor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.