@richhtmleditor/workflows
v1.1.2
Published
Enterprise approval workflows plugin for Rich HTML Editor.
Maintainers
Readme
@richhtmleditor/workflows
Enterprise approval workflows plugin for Rich HTML Editor. Draft, in-review, changes-requested, approved, and published states with role-based editing permissions, track-changes tools, audit trail, and workflow bar — requires features.workflows from @richhtmleditor/enterprise, built on @richhtmleditor/core.
Current release: 1.1.2 — Depends on @richhtmleditor/core ^1.1.2.
Repository: github.com/rajkishorsahu89/richhtmleditor
Demo: richhtmleditor.vercel.app — demo · guide · API. Doc Preview joint demo: doc-preview-app.vercel.app/demo/enterprise
What's in 1.1.2
createWorkflowsPlugin— workflow toolbar row and status bar- Document states —
draft→in_review→approved→published(withchanges_requested) - Role-based permissions — viewer, commenter, editor, approver, publisher
- Track changes — mark deletion, accept/reject selection, accept/reject all
- Audit trail — transitions recorded in document metadata and workflow bar
getWorkflowsHandle— programmatic access to role and snapshotexportImmutableAudit— export tamper-evident audit log
Requires
features.workflows: true. Demo key:RHE-ENT-DEMO-2026-FULL. Pairs witheditor.exportForPreview()for workflow watermarks.
Keywords: richhtmleditor enterprise workflow approval track-changes permissions
Install
npm install @richhtmleditor/workflows @richhtmleditor/enterprise
# Requires @richhtmleditor/core (via framework wrapper or direct install).Usage
import { createEditor } from "@richhtmleditor/core";
import { createWorkflowsPlugin, getWorkflowsHandle } from "@richhtmleditor/workflows";
import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise/browser";
const gate = resolveEnterpriseFeatures({ token: "RHE-ENT-DEMO-2026-FULL" });
const editor = createEditor({
element: host,
toolbar: { preset: "full" },
features: gate.features,
plugins: [
createWorkflowsPlugin({
actor: "Legal Team",
role: "editor",
initialState: "draft",
onChange: (snapshot) => console.log(snapshot.state, snapshot.audit)
})
]
});
editor.on("workflow:change", (snapshot) => {
// React to state transitions
});
const handle = getWorkflowsHandle(editor);
handle?.setRole("approver");Use toolbar workflow buttons (Submit for review, Approve, Publish, etc.) to transition states. Editing is automatically disabled for viewers, commenters, and published documents.
Usage — export with workflow watermark
const snapshot = getWorkflowsHandle(editor)?.getSnapshot();
const preview = editor.exportForPreview({
workflowState: snapshot?.state ?? "draft",
includePrintCss: true
});
// preview.watermarkText — e.g. "IN REVIEW", "APPROVED · PUBLISHED"API
createWorkflowsPlugin(options?)
| Option | Type | Description |
| --- | --- | --- |
| actor | string | Display name for audit entries (default "Reviewer"). |
| role | EditorRole | Initial role (default "editor"). |
| initialState | DocumentWorkflowState | Starting state (default "draft"). |
| initialAudit | WorkflowAuditEntry[] | Pre-load audit log. |
| onChange | (snapshot: WorkflowSnapshot) => void | Fired on state or role changes. |
Document states
| State | Label | Editing |
| --- | --- | --- |
| draft | Draft | Editors+ can edit |
| in_review | In review | Editors+ can edit; track changes active |
| changes_requested | Changes requested | Editors+ can edit |
| approved | Approved | Read-only |
| published | Published | Read-only |
Roles
| Role | Can edit | Can approve | Can publish |
| --- | --- | --- | --- |
| viewer | No | No | No |
| commenter | No | No | No |
| editor | Yes (draft/review) | No | No |
| approver | Yes (draft/review) | Yes | No |
| publisher | Yes (draft/review) | Yes | Yes |
Toolbar transitions
| Tool ID | Action |
| --- | --- |
| workflowSubmit | Submit for review (draft → in_review) |
| workflowRequestChanges | Request changes (in_review → changes_requested) |
| workflowApprove | Approve (in_review / changes_requested → approved) |
| workflowPublish | Publish (approved → published) |
| workflowReopen | Reopen draft |
getWorkflowsHandle(editor)
| Method | Description |
| --- | --- |
| setRole(role) | Change the active editor role. |
| getSnapshot() | { state, role, audit } current workflow snapshot. |
Events
| Event | Payload | Description |
| --- | --- | --- |
| workflow:change | WorkflowSnapshot | State or role changed. |
| workflow:status | WorkflowSnapshot | Emitted from Workflow status button. |
Related packages
@richhtmleditor/core— editor engine, track changes commands,exportForPreview.@richhtmleditor/enterprise— licence gating forfeatures.workflows.@richhtmleditor/comments— review comments plugin.@richhtmleditor/ai— AI authoring plugin.@richhtmleditor/angular— Angular wrapper.@richhtmleditor/react— React wrapper.
