@richhtmleditor/workflows 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +144 -144
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,144 +1,144 @@
1
- # @richhtmleditor/workflows
2
-
3
- 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`](https://www.npmjs.com/package/@richhtmleditor/enterprise), built on [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core).
4
-
5
- **Current release: 1.0.0** — Depends on `@richhtmleditor/core` **^1.0.0**.
6
-
7
- **Repository:** [github.com/rajkishorsahu89/richhtmleditor](https://github.com/rajkishorsahu89/richhtmleditor)
8
-
9
- **Demo:** [richhtmleditor.vercel.app](https://richhtmleditor.vercel.app/) — [demo](https://richhtmleditor.vercel.app/demo) · [guide](https://richhtmleditor.vercel.app/guide) · [API](https://richhtmleditor.vercel.app/api). Doc Preview joint demo: [doc-preview-app.vercel.app/demo/enterprise](https://doc-preview-app.vercel.app/demo/enterprise)
10
-
11
- ### What's in 1.0.0
12
-
13
- - **`createWorkflowsPlugin`** — workflow toolbar row and status bar
14
- - **Document states** — `draft` → `in_review` → `approved` → `published` (with `changes_requested`)
15
- - **Role-based permissions** — viewer, commenter, editor, approver, publisher
16
- - **Track changes** — mark deletion, accept/reject selection, accept/reject all
17
- - **Audit trail** — transitions recorded in document metadata and workflow bar
18
- - **`getWorkflowsHandle`** — programmatic access to role and snapshot
19
- - **`exportImmutableAudit`** — export tamper-evident audit log
20
-
21
- > Requires `features.workflows: true`. Demo key: `RHE-ENT-DEMO-2026-FULL`. Pairs with `editor.exportForPreview()` for workflow watermarks.
22
-
23
- **Keywords:** `richhtmleditor` `enterprise` `workflow` `approval` `track-changes` `permissions`
24
-
25
- ## Install
26
-
27
- ```bash
28
- npm install @richhtmleditor/workflows @richhtmleditor/enterprise
29
- # Requires @richhtmleditor/core (via framework wrapper or direct install).
30
- ```
31
-
32
- ## Usage
33
-
34
- ```ts
35
- import { createEditor } from "@richhtmleditor/core";
36
- import { createWorkflowsPlugin, getWorkflowsHandle } from "@richhtmleditor/workflows";
37
- import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise/browser";
38
-
39
- const gate = resolveEnterpriseFeatures({ token: "RHE-ENT-DEMO-2026-FULL" });
40
-
41
- const editor = createEditor({
42
- element: host,
43
- toolbar: { preset: "full" },
44
- features: gate.features,
45
- plugins: [
46
- createWorkflowsPlugin({
47
- actor: "Legal Team",
48
- role: "editor",
49
- initialState: "draft",
50
- onChange: (snapshot) => console.log(snapshot.state, snapshot.audit)
51
- })
52
- ]
53
- });
54
-
55
- editor.on("workflow:change", (snapshot) => {
56
- // React to state transitions
57
- });
58
-
59
- const handle = getWorkflowsHandle(editor);
60
- handle?.setRole("approver");
61
- ```
62
-
63
- Use toolbar workflow buttons (**Submit for review**, **Approve**, **Publish**, etc.) to transition states. Editing is automatically disabled for viewers, commenters, and published documents.
64
-
65
- ## Usage — export with workflow watermark
66
-
67
- ```ts
68
- const snapshot = getWorkflowsHandle(editor)?.getSnapshot();
69
-
70
- const preview = editor.exportForPreview({
71
- workflowState: snapshot?.state ?? "draft",
72
- includePrintCss: true
73
- });
74
- // preview.watermarkText — e.g. "IN REVIEW", "APPROVED · PUBLISHED"
75
- ```
76
-
77
- ## API
78
-
79
- ### `createWorkflowsPlugin(options?)`
80
-
81
- | Option | Type | Description |
82
- | --- | --- | --- |
83
- | `actor` | `string` | Display name for audit entries (default `"Reviewer"`). |
84
- | `role` | `EditorRole` | Initial role (default `"editor"`). |
85
- | `initialState` | `DocumentWorkflowState` | Starting state (default `"draft"`). |
86
- | `initialAudit` | `WorkflowAuditEntry[]` | Pre-load audit log. |
87
- | `onChange` | `(snapshot: WorkflowSnapshot) => void` | Fired on state or role changes. |
88
-
89
- ### Document states
90
-
91
- | State | Label | Editing |
92
- | --- | --- | --- |
93
- | `draft` | Draft | Editors+ can edit |
94
- | `in_review` | In review | Editors+ can edit; track changes active |
95
- | `changes_requested` | Changes requested | Editors+ can edit |
96
- | `approved` | Approved | Read-only |
97
- | `published` | Published | Read-only |
98
-
99
- ### Roles
100
-
101
- | Role | Can edit | Can approve | Can publish |
102
- | --- | --- | --- | --- |
103
- | `viewer` | No | No | No |
104
- | `commenter` | No | No | No |
105
- | `editor` | Yes (draft/review) | No | No |
106
- | `approver` | Yes (draft/review) | Yes | No |
107
- | `publisher` | Yes (draft/review) | Yes | Yes |
108
-
109
- ### Toolbar transitions
110
-
111
- | Tool ID | Action |
112
- | --- | --- |
113
- | `workflowSubmit` | Submit for review (`draft` → `in_review`) |
114
- | `workflowRequestChanges` | Request changes (`in_review` → `changes_requested`) |
115
- | `workflowApprove` | Approve (`in_review` / `changes_requested` → `approved`) |
116
- | `workflowPublish` | Publish (`approved` → `published`) |
117
- | `workflowReopen` | Reopen draft |
118
-
119
- ### `getWorkflowsHandle(editor)`
120
-
121
- | Method | Description |
122
- | --- | --- |
123
- | `setRole(role)` | Change the active editor role. |
124
- | `getSnapshot()` | `{ state, role, audit }` current workflow snapshot. |
125
-
126
- ### Events
127
-
128
- | Event | Payload | Description |
129
- | --- | --- | --- |
130
- | `workflow:change` | `WorkflowSnapshot` | State or role changed. |
131
- | `workflow:status` | `WorkflowSnapshot` | Emitted from Workflow status button. |
132
-
133
- ## Related packages
134
-
135
- - [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) — editor engine, track changes commands, `exportForPreview`.
136
- - [`@richhtmleditor/enterprise`](https://www.npmjs.com/package/@richhtmleditor/enterprise) — licence gating for `features.workflows`.
137
- - [`@richhtmleditor/comments`](https://www.npmjs.com/package/@richhtmleditor/comments) — review comments plugin.
138
- - [`@richhtmleditor/ai`](https://www.npmjs.com/package/@richhtmleditor/ai) — AI authoring plugin.
139
- - [`@richhtmleditor/angular`](https://www.npmjs.com/package/@richhtmleditor/angular) — Angular wrapper.
140
- - [`@richhtmleditor/react`](https://www.npmjs.com/package/@richhtmleditor/react) — React wrapper.
141
-
142
- ## License
143
-
144
- [MIT](./LICENSE)
1
+ # @richhtmleditor/workflows
2
+
3
+ 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`](https://www.npmjs.com/package/@richhtmleditor/enterprise), built on [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core).
4
+
5
+ **Current release: 1.1.1** — Depends on `@richhtmleditor/core` **^1.1.1**.
6
+
7
+ **Repository:** [github.com/rajkishorsahu89/richhtmleditor](https://github.com/rajkishorsahu89/richhtmleditor)
8
+
9
+ **Demo:** [richhtmleditor.vercel.app](https://richhtmleditor.vercel.app/) — [demo](https://richhtmleditor.vercel.app/demo) · [guide](https://richhtmleditor.vercel.app/guide) · [API](https://richhtmleditor.vercel.app/api). Doc Preview joint demo: [doc-preview-app.vercel.app/demo/enterprise](https://doc-preview-app.vercel.app/demo/enterprise)
10
+
11
+ ### What's in 1.1.1
12
+
13
+ - **`createWorkflowsPlugin`** — workflow toolbar row and status bar
14
+ - **Document states** — `draft` → `in_review` → `approved` → `published` (with `changes_requested`)
15
+ - **Role-based permissions** — viewer, commenter, editor, approver, publisher
16
+ - **Track changes** — mark deletion, accept/reject selection, accept/reject all
17
+ - **Audit trail** — transitions recorded in document metadata and workflow bar
18
+ - **`getWorkflowsHandle`** — programmatic access to role and snapshot
19
+ - **`exportImmutableAudit`** — export tamper-evident audit log
20
+
21
+ > Requires `features.workflows: true`. Demo key: `RHE-ENT-DEMO-2026-FULL`. Pairs with `editor.exportForPreview()` for workflow watermarks.
22
+
23
+ **Keywords:** `richhtmleditor` `enterprise` `workflow` `approval` `track-changes` `permissions`
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ npm install @richhtmleditor/workflows @richhtmleditor/enterprise
29
+ # Requires @richhtmleditor/core (via framework wrapper or direct install).
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```ts
35
+ import { createEditor } from "@richhtmleditor/core";
36
+ import { createWorkflowsPlugin, getWorkflowsHandle } from "@richhtmleditor/workflows";
37
+ import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise/browser";
38
+
39
+ const gate = resolveEnterpriseFeatures({ token: "RHE-ENT-DEMO-2026-FULL" });
40
+
41
+ const editor = createEditor({
42
+ element: host,
43
+ toolbar: { preset: "full" },
44
+ features: gate.features,
45
+ plugins: [
46
+ createWorkflowsPlugin({
47
+ actor: "Legal Team",
48
+ role: "editor",
49
+ initialState: "draft",
50
+ onChange: (snapshot) => console.log(snapshot.state, snapshot.audit)
51
+ })
52
+ ]
53
+ });
54
+
55
+ editor.on("workflow:change", (snapshot) => {
56
+ // React to state transitions
57
+ });
58
+
59
+ const handle = getWorkflowsHandle(editor);
60
+ handle?.setRole("approver");
61
+ ```
62
+
63
+ Use toolbar workflow buttons (**Submit for review**, **Approve**, **Publish**, etc.) to transition states. Editing is automatically disabled for viewers, commenters, and published documents.
64
+
65
+ ## Usage — export with workflow watermark
66
+
67
+ ```ts
68
+ const snapshot = getWorkflowsHandle(editor)?.getSnapshot();
69
+
70
+ const preview = editor.exportForPreview({
71
+ workflowState: snapshot?.state ?? "draft",
72
+ includePrintCss: true
73
+ });
74
+ // preview.watermarkText — e.g. "IN REVIEW", "APPROVED · PUBLISHED"
75
+ ```
76
+
77
+ ## API
78
+
79
+ ### `createWorkflowsPlugin(options?)`
80
+
81
+ | Option | Type | Description |
82
+ | --- | --- | --- |
83
+ | `actor` | `string` | Display name for audit entries (default `"Reviewer"`). |
84
+ | `role` | `EditorRole` | Initial role (default `"editor"`). |
85
+ | `initialState` | `DocumentWorkflowState` | Starting state (default `"draft"`). |
86
+ | `initialAudit` | `WorkflowAuditEntry[]` | Pre-load audit log. |
87
+ | `onChange` | `(snapshot: WorkflowSnapshot) => void` | Fired on state or role changes. |
88
+
89
+ ### Document states
90
+
91
+ | State | Label | Editing |
92
+ | --- | --- | --- |
93
+ | `draft` | Draft | Editors+ can edit |
94
+ | `in_review` | In review | Editors+ can edit; track changes active |
95
+ | `changes_requested` | Changes requested | Editors+ can edit |
96
+ | `approved` | Approved | Read-only |
97
+ | `published` | Published | Read-only |
98
+
99
+ ### Roles
100
+
101
+ | Role | Can edit | Can approve | Can publish |
102
+ | --- | --- | --- | --- |
103
+ | `viewer` | No | No | No |
104
+ | `commenter` | No | No | No |
105
+ | `editor` | Yes (draft/review) | No | No |
106
+ | `approver` | Yes (draft/review) | Yes | No |
107
+ | `publisher` | Yes (draft/review) | Yes | Yes |
108
+
109
+ ### Toolbar transitions
110
+
111
+ | Tool ID | Action |
112
+ | --- | --- |
113
+ | `workflowSubmit` | Submit for review (`draft` → `in_review`) |
114
+ | `workflowRequestChanges` | Request changes (`in_review` → `changes_requested`) |
115
+ | `workflowApprove` | Approve (`in_review` / `changes_requested` → `approved`) |
116
+ | `workflowPublish` | Publish (`approved` → `published`) |
117
+ | `workflowReopen` | Reopen draft |
118
+
119
+ ### `getWorkflowsHandle(editor)`
120
+
121
+ | Method | Description |
122
+ | --- | --- |
123
+ | `setRole(role)` | Change the active editor role. |
124
+ | `getSnapshot()` | `{ state, role, audit }` current workflow snapshot. |
125
+
126
+ ### Events
127
+
128
+ | Event | Payload | Description |
129
+ | --- | --- | --- |
130
+ | `workflow:change` | `WorkflowSnapshot` | State or role changed. |
131
+ | `workflow:status` | `WorkflowSnapshot` | Emitted from Workflow status button. |
132
+
133
+ ## Related packages
134
+
135
+ - [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) — editor engine, track changes commands, `exportForPreview`.
136
+ - [`@richhtmleditor/enterprise`](https://www.npmjs.com/package/@richhtmleditor/enterprise) — licence gating for `features.workflows`.
137
+ - [`@richhtmleditor/comments`](https://www.npmjs.com/package/@richhtmleditor/comments) — review comments plugin.
138
+ - [`@richhtmleditor/ai`](https://www.npmjs.com/package/@richhtmleditor/ai) — AI authoring plugin.
139
+ - [`@richhtmleditor/angular`](https://www.npmjs.com/package/@richhtmleditor/angular) — Angular wrapper.
140
+ - [`@richhtmleditor/react`](https://www.npmjs.com/package/@richhtmleditor/react) — React wrapper.
141
+
142
+ ## License
143
+
144
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@richhtmleditor/workflows",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Enterprise approval workflows plugin for Rich HTML Editor.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "prepack": "node ../../scripts/assert-pack-ready.mjs"
22
22
  },
23
23
  "dependencies": {
24
- "@richhtmleditor/core": "^1.0.0"
24
+ "@richhtmleditor/core": "^1.1.1"
25
25
  },
26
26
  "keywords": [
27
27
  "richhtmleditor",