@editora/core 1.0.8 → 1.0.10
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.
- package/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", te = "__editoraCommandEditorRoot", oe = "rte-approval-workflow-styles", d = "rte-approval-panel", h = "approval", k = "approvalWorkflow", v = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', fe = {
|
|
2
2
|
panelTitle: "Approval Workflow",
|
|
3
3
|
panelAriaLabel: "Approval workflow panel",
|
|
4
4
|
statusLabel: "Status",
|
|
@@ -22,84 +22,84 @@ const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-edi
|
|
|
22
22
|
lockedSuffix: "Locked",
|
|
23
23
|
shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",
|
|
24
24
|
approveCommentRequiredText: "Approval comment is required."
|
|
25
|
-
},
|
|
25
|
+
}, me = {
|
|
26
26
|
draft: "statusDraftText",
|
|
27
27
|
review: "statusReviewText",
|
|
28
28
|
approved: "statusApprovedText"
|
|
29
|
-
}, p = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(),
|
|
30
|
-
let _ = 0,
|
|
29
|
+
}, p = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new Set();
|
|
30
|
+
let _ = 0, be = 0, re = 0, ae = 0, R = null, g = null, T = null, L = null, S = null;
|
|
31
31
|
function c(e) {
|
|
32
32
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ve(e) {
|
|
35
35
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function le(e) {
|
|
38
38
|
return e === "review" || e === "approved" ? e : "draft";
|
|
39
39
|
}
|
|
40
40
|
function z(e = {}) {
|
|
41
41
|
var t;
|
|
42
42
|
return {
|
|
43
|
-
defaultStatus:
|
|
43
|
+
defaultStatus: le(e.defaultStatus),
|
|
44
44
|
lockOnApproval: e.lockOnApproval !== !1,
|
|
45
45
|
maxHistoryEntries: Math.max(10, Math.min(500, Number((t = e.maxHistoryEntries) != null ? t : 120))),
|
|
46
46
|
requireCommentOnApprove: !!e.requireCommentOnApprove,
|
|
47
47
|
defaultActor: (e.defaultActor || "system").trim() || "system",
|
|
48
48
|
labels: {
|
|
49
|
-
...
|
|
49
|
+
...fe,
|
|
50
50
|
...e.labels || {}
|
|
51
51
|
},
|
|
52
|
-
normalizeText: e.normalizeText ||
|
|
52
|
+
normalizeText: e.normalizeText || ve
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Y(e) {
|
|
56
56
|
return e.closest(F) || e;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function K(e) {
|
|
59
59
|
if (!e) return null;
|
|
60
60
|
if (e.matches(w)) return e;
|
|
61
61
|
const t = e.querySelector(w);
|
|
62
62
|
return t instanceof HTMLElement ? t : null;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function ge() {
|
|
65
65
|
if (typeof window == "undefined") return null;
|
|
66
|
-
const e = window[
|
|
66
|
+
const e = window[te];
|
|
67
67
|
if (!(e instanceof HTMLElement)) return null;
|
|
68
|
-
window[
|
|
69
|
-
const t =
|
|
68
|
+
window[te] = null;
|
|
69
|
+
const t = K(e);
|
|
70
70
|
if (t) return t;
|
|
71
71
|
const o = e.closest(F);
|
|
72
72
|
if (o) {
|
|
73
|
-
const a =
|
|
73
|
+
const a = K(o);
|
|
74
74
|
if (a) return a;
|
|
75
75
|
}
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function he(e) {
|
|
79
79
|
const t = e.closest("[data-editora-editor]");
|
|
80
|
-
if (t &&
|
|
80
|
+
if (t && K(t) === e)
|
|
81
81
|
return t;
|
|
82
82
|
let o = e;
|
|
83
83
|
for (; o; ) {
|
|
84
|
-
if (o.matches(F) && (o === e ||
|
|
84
|
+
if (o.matches(F) && (o === e || K(o) === e))
|
|
85
85
|
return o;
|
|
86
86
|
o = o.parentElement;
|
|
87
87
|
}
|
|
88
|
-
return
|
|
88
|
+
return Y(e);
|
|
89
89
|
}
|
|
90
90
|
function W(e) {
|
|
91
91
|
return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
const t =
|
|
93
|
+
function xe(e) {
|
|
94
|
+
const t = Y(e);
|
|
95
95
|
if (W(t)) return !0;
|
|
96
96
|
const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
97
97
|
return W(o) ? !0 : W(document.documentElement) || W(document.body);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
e.classList.remove("rte-approval-theme-dark"),
|
|
99
|
+
function B(e, t) {
|
|
100
|
+
e.classList.remove("rte-approval-theme-dark"), xe(t) && e.classList.add("rte-approval-theme-dark");
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ie(e) {
|
|
103
103
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
104
104
|
}
|
|
105
105
|
function x(e, t = !0) {
|
|
@@ -110,11 +110,11 @@ function x(e, t = !0) {
|
|
|
110
110
|
const l = n.querySelector(w);
|
|
111
111
|
if (l instanceof HTMLElement) return l;
|
|
112
112
|
}
|
|
113
|
-
const o =
|
|
113
|
+
const o = ge();
|
|
114
114
|
if (o) return o;
|
|
115
115
|
const a = window.getSelection();
|
|
116
116
|
if (a && a.rangeCount > 0) {
|
|
117
|
-
const n =
|
|
117
|
+
const n = ie(a.getRangeAt(0).startContainer), l = n == null ? void 0 : n.closest(w);
|
|
118
118
|
if (l) return l;
|
|
119
119
|
}
|
|
120
120
|
const r = document.activeElement;
|
|
@@ -128,20 +128,20 @@ function x(e, t = !0) {
|
|
|
128
128
|
function D() {
|
|
129
129
|
Array.from(H).forEach((t) => {
|
|
130
130
|
var o;
|
|
131
|
-
t.isConnected || ((o =
|
|
131
|
+
t.isConnected || ((o = y.get(t)) == null || o.remove(), y.delete(t), O.delete(t), p.delete(t), I.delete(t), H.delete(t), g === t && (g = null));
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function we(e) {
|
|
135
135
|
return e ? !!(e.closest(`.${d}`) || e.closest(w) || e.closest(F)) : !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function ye() {
|
|
138
138
|
const e = window.getSelection();
|
|
139
139
|
if (!e || e.rangeCount === 0) return !1;
|
|
140
|
-
const t = e.getRangeAt(0).startContainer, o =
|
|
140
|
+
const t = e.getRangeAt(0).startContainer, o = ie(t);
|
|
141
141
|
return !!(o != null && o.closest(w));
|
|
142
142
|
}
|
|
143
143
|
function C(e, t, o) {
|
|
144
|
-
const a =
|
|
144
|
+
const a = he(e);
|
|
145
145
|
Array.from(
|
|
146
146
|
a.querySelectorAll(
|
|
147
147
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -150,13 +150,13 @@ function C(e, t, o) {
|
|
|
150
150
|
n.classList.toggle("active", o), n.setAttribute("aria-pressed", o ? "true" : "false"), n.setAttribute("data-active", o ? "true" : "false");
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function se(e, t, o) {
|
|
154
154
|
t !== null ? e.setAttribute("contenteditable", t) : e.setAttribute("contenteditable", "true"), o !== null ? e.setAttribute("data-readonly", o) : e.removeAttribute("data-readonly");
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function X(e) {
|
|
157
157
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function J(e, t) {
|
|
160
160
|
if (t === e.innerHTML) return;
|
|
161
161
|
const o = window.execEditorCommand || window.executeEditorCommand;
|
|
162
162
|
if (typeof o == "function")
|
|
@@ -165,13 +165,13 @@ function X(e, t) {
|
|
|
165
165
|
} catch (a) {
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
168
|
+
function Q() {
|
|
169
|
+
return re += 1, `approval-comment-${Date.now().toString(36)}-${re.toString(36)}`;
|
|
170
170
|
}
|
|
171
171
|
function ke() {
|
|
172
|
-
return
|
|
172
|
+
return ae += 1, `approval-signoff-${Date.now().toString(36)}-${ae.toString(36)}`;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function pe(e) {
|
|
175
175
|
return {
|
|
176
176
|
status: e.status,
|
|
177
177
|
locked: e.locked,
|
|
@@ -180,17 +180,17 @@ function se(e) {
|
|
|
180
180
|
updatedAt: e.updatedAt
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const o =
|
|
183
|
+
function Ae(e, t) {
|
|
184
|
+
const o = me[e];
|
|
185
185
|
return t.labels[o] || e;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function ce(e, t, o) {
|
|
188
188
|
var a, r;
|
|
189
|
-
if (e.setAttribute("data-approval-status", t.status), e.setAttribute("data-approval-locked", t.locked ? "true" : "false"), e.classList.toggle("rte-approval-locked-editor", t.locked), C(e, "toggleApprovalWorkflowPanel",
|
|
189
|
+
if (e.setAttribute("data-approval-status", t.status), e.setAttribute("data-approval-locked", t.locked ? "true" : "false"), e.classList.toggle("rte-approval-locked-editor", t.locked), C(e, "toggleApprovalWorkflowPanel", ee(e)), C(e, "requestApprovalReview", t.status === "review"), C(e, "approveDocument", t.status === "approved"), C(e, "reopenDraft", t.status === "draft"), t.status === "approved" && o.lockOnApproval) {
|
|
190
190
|
t.locked || (t.preApprovalContentEditable = e.getAttribute("contenteditable"), t.preApprovalReadonly = e.getAttribute("data-readonly")), e.setAttribute("contenteditable", "false"), e.setAttribute("data-readonly", "true"), t.locked = !0;
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
-
t.locked = !1,
|
|
193
|
+
t.locked = !1, se(
|
|
194
194
|
e,
|
|
195
195
|
(a = t.preApprovalContentEditable) != null ? a : t.originalContentEditable,
|
|
196
196
|
(r = t.preApprovalReadonly) != null ? r : t.originalReadonly
|
|
@@ -208,7 +208,7 @@ function f(e, t) {
|
|
|
208
208
|
originalReadonly: e.getAttribute("data-readonly"),
|
|
209
209
|
preApprovalContentEditable: null,
|
|
210
210
|
preApprovalReadonly: null
|
|
211
|
-
}, I.set(e, o), H.add(e),
|
|
211
|
+
}, I.set(e, o), H.add(e), ce(e, o, t), o);
|
|
212
212
|
}
|
|
213
213
|
function j(e, t) {
|
|
214
214
|
return e.length <= t ? e : e.slice(e.length - t);
|
|
@@ -217,8 +217,8 @@ function M(e, t) {
|
|
|
217
217
|
const o = e.querySelector(".rte-approval-live");
|
|
218
218
|
o && (o.textContent = t);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
const o =
|
|
220
|
+
function Se(e, t) {
|
|
221
|
+
const o = pe(t);
|
|
222
222
|
e.__approvalWorkflowState = o, e.dispatchEvent(
|
|
223
223
|
new CustomEvent("editora:approval-state-changed", {
|
|
224
224
|
bubbles: !0,
|
|
@@ -229,13 +229,13 @@ function Ae(e, t) {
|
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
function q(e) {
|
|
232
|
-
const t =
|
|
232
|
+
const t = y.get(e);
|
|
233
233
|
if (!t) return;
|
|
234
234
|
const o = p.get(e) || R;
|
|
235
235
|
if (!o) return;
|
|
236
236
|
const a = f(e, o), r = t.querySelector(".rte-approval-summary"), n = t.querySelector('[data-action="request-review"]'), l = t.querySelector('[data-action="approve"]'), s = t.querySelector('[data-action="reopen-draft"]'), u = t.querySelector(".rte-approval-comments-list"), m = t.querySelector(".rte-approval-signoffs-list");
|
|
237
237
|
if (r) {
|
|
238
|
-
const i =
|
|
238
|
+
const i = Ae(a.status, o);
|
|
239
239
|
r.textContent = `${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked ? ` | ${o.labels.lockedSuffix}` : ""}`;
|
|
240
240
|
}
|
|
241
241
|
n && (n.disabled = a.status !== "draft"), l && (l.disabled = a.status === "approved"), s && (s.disabled = a.status === "draft"), u && (a.comments.length === 0 ? u.innerHTML = `<li class="rte-approval-empty">${c(o.labels.noCommentsText)}</li>` : u.innerHTML = a.comments.slice().reverse().map(
|
|
@@ -265,36 +265,36 @@ function q(e) {
|
|
|
265
265
|
).join(""));
|
|
266
266
|
}
|
|
267
267
|
function G(e, t, o) {
|
|
268
|
-
t.updatedAt = (/* @__PURE__ */ new Date()).toISOString(),
|
|
268
|
+
t.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), ce(e, t, o), q(e), Se(e, t);
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function ne(e, t, o, a) {
|
|
271
271
|
e.comments.push({
|
|
272
|
-
id:
|
|
272
|
+
id: Q(),
|
|
273
273
|
author: o || t.defaultActor,
|
|
274
274
|
message: a,
|
|
275
275
|
kind: "system",
|
|
276
276
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
277
277
|
}), e.comments = j(e.comments, t.maxHistoryEntries);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function $(e, t, o, a) {
|
|
280
280
|
const r = f(e, o);
|
|
281
281
|
if (r.status === t) return !1;
|
|
282
282
|
const n = e.innerHTML;
|
|
283
|
-
return r.status = t, t === "review" ?
|
|
283
|
+
return r.status = t, t === "review" ? ne(r, o, a, "Review requested.") : t === "draft" && ne(r, o, a, "Returned to draft."), G(e, r, o), X(e), J(e, n), !0;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function de(e, t, o, a) {
|
|
286
286
|
const r = a.normalizeText(t);
|
|
287
287
|
if (!r) return !1;
|
|
288
288
|
const n = a.normalizeText(o) || a.defaultActor, l = f(e, a), s = e.innerHTML;
|
|
289
289
|
return l.comments.push({
|
|
290
|
-
id:
|
|
290
|
+
id: Q(),
|
|
291
291
|
author: n,
|
|
292
292
|
message: r,
|
|
293
293
|
kind: "comment",
|
|
294
294
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
295
|
-
}), l.comments = j(l.comments, a.maxHistoryEntries), G(e, l, a),
|
|
295
|
+
}), l.comments = j(l.comments, a.maxHistoryEntries), G(e, l, a), X(e), J(e, s), !0;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function Z(e, t, o, a) {
|
|
298
298
|
const r = t.normalizeText(o) || t.defaultActor, n = t.normalizeText(a);
|
|
299
299
|
if (t.requireCommentOnApprove && !n) return !1;
|
|
300
300
|
const l = f(e, t), s = e.innerHTML;
|
|
@@ -304,30 +304,30 @@ function Q(e, t, o, a) {
|
|
|
304
304
|
comment: n || void 0,
|
|
305
305
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
306
306
|
}), l.signoffs = j(l.signoffs, t.maxHistoryEntries), n && (l.comments.push({
|
|
307
|
-
id:
|
|
307
|
+
id: Q(),
|
|
308
308
|
author: r,
|
|
309
309
|
message: n,
|
|
310
310
|
kind: "system",
|
|
311
311
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
312
|
-
}), l.comments = j(l.comments, t.maxHistoryEntries)), G(e, l, t),
|
|
312
|
+
}), l.comments = j(l.comments, t.maxHistoryEntries)), G(e, l, t), X(e), J(e, s), !0;
|
|
313
313
|
}
|
|
314
314
|
function N(e, t) {
|
|
315
315
|
return e.querySelector(`[data-field="${t}"]`);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Ee(e) {
|
|
318
318
|
var a, r;
|
|
319
319
|
const t = ((a = N(e, "actor")) == null ? void 0 : a.value) || "", o = ((r = N(e, "comment")) == null ? void 0 : r.value) || "";
|
|
320
320
|
return { actor: t, comment: o };
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function U(e, t) {
|
|
323
323
|
if (!t.classList.contains("show")) return;
|
|
324
|
-
const a =
|
|
324
|
+
const a = Y(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 420), n = Math.max(10, window.innerWidth - r - 10), l = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10 - 280, a.top + 12));
|
|
325
325
|
t.style.width = `${r}px`, t.style.left = `${l}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(280, window.innerHeight - 24)}px`;
|
|
326
326
|
}
|
|
327
327
|
function $e(e) {
|
|
328
|
-
const t =
|
|
328
|
+
const t = y.get(e);
|
|
329
329
|
if (t) return t;
|
|
330
|
-
const o = p.get(e) || R || z(), a = `rte-approval-panel-${
|
|
330
|
+
const o = p.get(e) || R || z(), a = `rte-approval-panel-${be++}`, r = document.createElement("section");
|
|
331
331
|
return r.className = d, r.id = a, r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "false"), r.setAttribute("aria-label", o.labels.panelAriaLabel), r.setAttribute("tabindex", "-1"), r.innerHTML = `
|
|
332
332
|
<header class="rte-approval-header">
|
|
333
333
|
<h2 class="rte-approval-title">${c(o.labels.panelTitle)}</h2>
|
|
@@ -391,72 +391,75 @@ function $e(e) {
|
|
|
391
391
|
P(e, !0);
|
|
392
392
|
return;
|
|
393
393
|
}
|
|
394
|
-
const i =
|
|
394
|
+
const i = Ee(r);
|
|
395
395
|
if (u === "request-review") {
|
|
396
|
-
|
|
396
|
+
$(e, "review", m, i.actor || m.defaultActor) && M(r, "Status changed to review.");
|
|
397
397
|
return;
|
|
398
398
|
}
|
|
399
399
|
if (u === "reopen-draft") {
|
|
400
|
-
|
|
400
|
+
$(e, "draft", m, i.actor || m.defaultActor) && M(r, "Status changed to draft.");
|
|
401
401
|
return;
|
|
402
402
|
}
|
|
403
403
|
if (u === "approve") {
|
|
404
|
-
const b =
|
|
404
|
+
const b = Z(e, m, i.actor, i.comment);
|
|
405
405
|
if (!b && m.requireCommentOnApprove) {
|
|
406
406
|
M(r, m.labels.approveCommentRequiredText);
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
409
|
if (b) {
|
|
410
|
-
const
|
|
411
|
-
|
|
410
|
+
const E = N(r, "comment");
|
|
411
|
+
E && (E.value = ""), M(r, "Document approved and signed off.");
|
|
412
412
|
}
|
|
413
413
|
return;
|
|
414
414
|
}
|
|
415
415
|
if (u === "add-comment") {
|
|
416
|
-
if (!
|
|
417
|
-
const
|
|
418
|
-
|
|
416
|
+
if (!de(e, i.comment, i.actor, m)) return;
|
|
417
|
+
const E = N(r, "comment");
|
|
418
|
+
E && (E.value = ""), M(r, "Comment added.");
|
|
419
419
|
return;
|
|
420
420
|
}
|
|
421
421
|
}), r.addEventListener("keydown", (n) => {
|
|
422
422
|
n.key === "Escape" && (n.preventDefault(), P(e, !0));
|
|
423
|
-
}),
|
|
423
|
+
}), B(r, e), document.body.appendChild(r), y.set(e, r), O.set(e, !1), q(e), r;
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function ee(e) {
|
|
426
426
|
return O.get(e) === !0;
|
|
427
427
|
}
|
|
428
428
|
function A(e) {
|
|
429
429
|
D();
|
|
430
430
|
const t = $e(e);
|
|
431
|
-
|
|
431
|
+
y.forEach((o, a) => {
|
|
432
432
|
a !== e && P(a, !1);
|
|
433
|
-
}), t.classList.add("show"), O.set(e, !0), C(e, "toggleApprovalWorkflowPanel", !0),
|
|
433
|
+
}), t.classList.add("show"), O.set(e, !0), C(e, "toggleApprovalWorkflowPanel", !0), B(t, e), U(e, t), q(e);
|
|
434
434
|
}
|
|
435
435
|
function P(e, t = !1) {
|
|
436
|
-
const o =
|
|
436
|
+
const o = y.get(e);
|
|
437
437
|
o && (o.classList.remove("show"), O.set(e, !1), C(e, "toggleApprovalWorkflowPanel", !1), t && e.focus({ preventScroll: !0 }));
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
const o =
|
|
439
|
+
function ue(e, t) {
|
|
440
|
+
const o = ee(e);
|
|
441
441
|
return (typeof t == "boolean" ? t : !o) ? A(e) : P(e), !0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
|
|
445
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "a";
|
|
443
|
+
function V(e) {
|
|
444
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
446
445
|
}
|
|
447
446
|
function Ce(e) {
|
|
448
|
-
const t = e
|
|
449
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
447
|
+
const t = V(e);
|
|
448
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "a";
|
|
450
449
|
}
|
|
451
450
|
function Te(e) {
|
|
452
|
-
const t = e
|
|
453
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
451
|
+
const t = V(e);
|
|
452
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "r";
|
|
454
453
|
}
|
|
455
454
|
function Le(e) {
|
|
456
|
-
const t = e
|
|
457
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
455
|
+
const t = V(e);
|
|
456
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "p";
|
|
458
457
|
}
|
|
459
458
|
function Re(e) {
|
|
459
|
+
const t = V(e);
|
|
460
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "d";
|
|
461
|
+
}
|
|
462
|
+
function Me(e) {
|
|
460
463
|
R = e, T || (T = (t) => {
|
|
461
464
|
D();
|
|
462
465
|
const o = t.target, a = o == null ? void 0 : o.closest(w);
|
|
@@ -464,67 +467,67 @@ function Re(e) {
|
|
|
464
467
|
g = a;
|
|
465
468
|
const r = p.get(a) || e;
|
|
466
469
|
p.set(a, r), f(a, r);
|
|
467
|
-
const n =
|
|
468
|
-
n && (
|
|
470
|
+
const n = y.get(a);
|
|
471
|
+
n && (B(n, a), U(a, n));
|
|
469
472
|
}, document.addEventListener("focusin", T, !0)), L || (L = (t) => {
|
|
470
473
|
if (t.defaultPrevented) return;
|
|
471
|
-
const o =
|
|
474
|
+
const o = Ce(t), a = Te(t), r = Le(t), n = Re(t), l = t.key === "Escape";
|
|
472
475
|
if (!l && !o && !a && !r && !n)
|
|
473
476
|
return;
|
|
474
477
|
D();
|
|
475
478
|
const s = t.target, u = !!(s != null && s.closest(`.${d} input, .${d} textarea, .${d} select`));
|
|
476
|
-
if (!
|
|
479
|
+
if (!we(s) && !ye())
|
|
477
480
|
return;
|
|
478
481
|
const i = x(void 0, !1);
|
|
479
482
|
if (!i) return;
|
|
480
483
|
const b = p.get(i) || R || e;
|
|
481
484
|
p.set(i, b);
|
|
482
|
-
const
|
|
483
|
-
if (g = i, l &&
|
|
485
|
+
const E = f(i, b);
|
|
486
|
+
if (g = i, l && ee(i)) {
|
|
484
487
|
t.preventDefault(), P(i, !0);
|
|
485
488
|
return;
|
|
486
489
|
}
|
|
487
490
|
if (!u) {
|
|
488
491
|
if (o) {
|
|
489
|
-
t.preventDefault(), t.stopPropagation(),
|
|
492
|
+
t.preventDefault(), t.stopPropagation(), ue(i);
|
|
490
493
|
return;
|
|
491
494
|
}
|
|
492
495
|
if (a) {
|
|
493
|
-
t.preventDefault(), t.stopPropagation(),
|
|
496
|
+
t.preventDefault(), t.stopPropagation(), $(i, "review", b, b.defaultActor) && A(i);
|
|
494
497
|
return;
|
|
495
498
|
}
|
|
496
499
|
if (r) {
|
|
497
|
-
t.preventDefault(), t.stopPropagation(),
|
|
500
|
+
t.preventDefault(), t.stopPropagation(), Z(i, b, b.defaultActor, "Approved via keyboard shortcut.") && A(i);
|
|
498
501
|
return;
|
|
499
502
|
}
|
|
500
|
-
n && (t.preventDefault(), t.stopPropagation(),
|
|
503
|
+
n && (t.preventDefault(), t.stopPropagation(), E.status !== "draft" && $(i, "draft", b, b.defaultActor) && A(i));
|
|
501
504
|
}
|
|
502
505
|
}, document.addEventListener("keydown", L, !0)), S || (S = () => {
|
|
503
|
-
D(),
|
|
504
|
-
!o.isConnected || !t.isConnected || (
|
|
506
|
+
D(), y.forEach((t, o) => {
|
|
507
|
+
!o.isConnected || !t.isConnected || (B(t, o), U(o, t));
|
|
505
508
|
});
|
|
506
509
|
}, window.addEventListener("scroll", S, !0), window.addEventListener("resize", S));
|
|
507
510
|
}
|
|
508
|
-
function
|
|
511
|
+
function De(e) {
|
|
509
512
|
var o, a;
|
|
510
513
|
const t = I.get(e);
|
|
511
|
-
t && (e.classList.remove("rte-approval-locked-editor"), e.removeAttribute("data-approval-status"), e.removeAttribute("data-approval-locked"),
|
|
514
|
+
t && (e.classList.remove("rte-approval-locked-editor"), e.removeAttribute("data-approval-status"), e.removeAttribute("data-approval-locked"), se(
|
|
512
515
|
e,
|
|
513
516
|
(o = t.preApprovalContentEditable) != null ? o : t.originalContentEditable,
|
|
514
517
|
(a = t.preApprovalReadonly) != null ? a : t.originalReadonly
|
|
515
518
|
));
|
|
516
519
|
}
|
|
517
|
-
function De() {
|
|
518
|
-
T && (document.removeEventListener("focusin", T, !0), T = null), L && (document.removeEventListener("keydown", L, !0), L = null), S && (window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S), S = null), k.forEach((e) => e.remove()), k.clear(), H.forEach((e) => Me(e)), H.clear(), R = null, g = null;
|
|
519
|
-
}
|
|
520
520
|
function He() {
|
|
521
|
-
|
|
521
|
+
T && (document.removeEventListener("focusin", T, !0), T = null), L && (document.removeEventListener("keydown", L, !0), L = null), S && (window.removeEventListener("scroll", S, !0), window.removeEventListener("resize", S), S = null), y.forEach((e) => e.remove()), y.clear(), H.forEach((e) => De(e)), H.clear(), R = null, g = null;
|
|
522
|
+
}
|
|
523
|
+
function qe() {
|
|
524
|
+
if (typeof document == "undefined" || document.getElementById(oe)) return;
|
|
522
525
|
const e = document.createElement("style");
|
|
523
|
-
e.id =
|
|
526
|
+
e.id = oe, e.textContent = `
|
|
524
527
|
.rte-toolbar-group-items.${h},
|
|
525
528
|
.editora-toolbar-group-items.${h},
|
|
526
|
-
.rte-toolbar-group-items.${
|
|
527
|
-
.editora-toolbar-group-items.${
|
|
529
|
+
.rte-toolbar-group-items.${k},
|
|
530
|
+
.editora-toolbar-group-items.${k} {
|
|
528
531
|
display: flex;
|
|
529
532
|
border: 1px solid #ccc;
|
|
530
533
|
border-radius: 3px;
|
|
@@ -533,8 +536,8 @@ function He() {
|
|
|
533
536
|
|
|
534
537
|
.rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
535
538
|
.editora-toolbar-group-items.${h} .editora-toolbar-button,
|
|
536
|
-
.rte-toolbar-group-items.${
|
|
537
|
-
.editora-toolbar-group-items.${
|
|
539
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-button,
|
|
540
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-button {
|
|
538
541
|
border: none;
|
|
539
542
|
border-radius: 0;
|
|
540
543
|
border-right: 1px solid #ccc;
|
|
@@ -556,22 +559,22 @@ function He() {
|
|
|
556
559
|
|
|
557
560
|
.rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
558
561
|
.editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
559
|
-
.rte-toolbar-group-items.${
|
|
560
|
-
.editora-toolbar-group-items.${
|
|
562
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
563
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
561
564
|
border-right: none;
|
|
562
565
|
}
|
|
563
566
|
|
|
564
567
|
${v} .rte-toolbar-group-items.${h},
|
|
565
568
|
${v} .editora-toolbar-group-items.${h},
|
|
566
|
-
${v} .rte-toolbar-group-items.${
|
|
567
|
-
${v} .editora-toolbar-group-items.${
|
|
569
|
+
${v} .rte-toolbar-group-items.${k},
|
|
570
|
+
${v} .editora-toolbar-group-items.${k},
|
|
568
571
|
.${d}.rte-approval-theme-dark {
|
|
569
572
|
border-color: #566275;
|
|
570
573
|
}
|
|
571
574
|
${v} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
|
|
572
575
|
${v} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
|
|
573
|
-
${v} .rte-toolbar-group-items.${
|
|
574
|
-
${v} .editora-toolbar-group-items.${
|
|
576
|
+
${v} .rte-toolbar-group-items.${k} .rte-toolbar-button svg,
|
|
577
|
+
${v} .editora-toolbar-group-items.${k} .editora-toolbar-button svg
|
|
575
578
|
{
|
|
576
579
|
fill: none;
|
|
577
580
|
}
|
|
@@ -913,9 +916,9 @@ function He() {
|
|
|
913
916
|
}
|
|
914
917
|
`, document.head.appendChild(e);
|
|
915
918
|
}
|
|
916
|
-
const
|
|
919
|
+
const Pe = (e = {}) => {
|
|
917
920
|
const t = z(e);
|
|
918
|
-
return
|
|
921
|
+
return qe(), {
|
|
919
922
|
name: "approvalWorkflow",
|
|
920
923
|
toolbar: [
|
|
921
924
|
{
|
|
@@ -966,14 +969,14 @@ const qe = (e = {}) => {
|
|
|
966
969
|
const r = x(a);
|
|
967
970
|
if (!r) return !1;
|
|
968
971
|
const n = p.get(r) || t;
|
|
969
|
-
return p.set(r, n), f(r, n), g = r,
|
|
972
|
+
return p.set(r, n), f(r, n), g = r, ue(r, typeof o == "boolean" ? o : void 0);
|
|
970
973
|
},
|
|
971
974
|
requestApprovalReview: (o, a) => {
|
|
972
975
|
const r = x(a);
|
|
973
976
|
if (!r) return !1;
|
|
974
977
|
const n = p.get(r) || t;
|
|
975
978
|
p.set(r, n), f(r, n);
|
|
976
|
-
const l =
|
|
979
|
+
const l = $(r, "review", n, n.defaultActor);
|
|
977
980
|
return A(r), l;
|
|
978
981
|
},
|
|
979
982
|
approveDocument: (o, a) => {
|
|
@@ -981,7 +984,7 @@ const qe = (e = {}) => {
|
|
|
981
984
|
if (!r) return !1;
|
|
982
985
|
const n = p.get(r) || t;
|
|
983
986
|
p.set(r, n), f(r, n);
|
|
984
|
-
const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.comment || "") : typeof o == "string" ? o : "", u =
|
|
987
|
+
const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.comment || "") : typeof o == "string" ? o : "", u = Z(r, n, l, s);
|
|
985
988
|
return u && A(r), u;
|
|
986
989
|
},
|
|
987
990
|
reopenDraft: (o, a) => {
|
|
@@ -989,7 +992,7 @@ const qe = (e = {}) => {
|
|
|
989
992
|
if (!r) return !1;
|
|
990
993
|
const n = p.get(r) || t;
|
|
991
994
|
p.set(r, n), f(r, n);
|
|
992
|
-
const l =
|
|
995
|
+
const l = $(r, "draft", n, n.defaultActor);
|
|
993
996
|
return l && A(r), l;
|
|
994
997
|
},
|
|
995
998
|
addApprovalComment: (o, a) => {
|
|
@@ -997,15 +1000,15 @@ const qe = (e = {}) => {
|
|
|
997
1000
|
if (!r) return !1;
|
|
998
1001
|
const n = p.get(r) || t;
|
|
999
1002
|
p.set(r, n), f(r, n);
|
|
1000
|
-
const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.message || "") : typeof o == "string" ? o : "", u =
|
|
1003
|
+
const l = typeof o == "object" && o ? String(o.author || "") : n.defaultActor, s = typeof o == "object" && o ? String(o.message || "") : typeof o == "string" ? o : "", u = de(r, s, l, n);
|
|
1001
1004
|
return u && A(r), u;
|
|
1002
1005
|
},
|
|
1003
1006
|
setApprovalStatus: (o, a) => {
|
|
1004
1007
|
const r = x(a);
|
|
1005
1008
|
if (!r || !o) return !1;
|
|
1006
|
-
const n =
|
|
1009
|
+
const n = le(o), l = p.get(r) || t;
|
|
1007
1010
|
p.set(r, l), f(r, l);
|
|
1008
|
-
const s =
|
|
1011
|
+
const s = $(r, n, l, l.defaultActor);
|
|
1009
1012
|
return s && A(r), s;
|
|
1010
1013
|
},
|
|
1011
1014
|
setApprovalWorkflowOptions: (o, a) => {
|
|
@@ -1029,7 +1032,7 @@ const qe = (e = {}) => {
|
|
|
1029
1032
|
if (!r) return !1;
|
|
1030
1033
|
const n = p.get(r) || t;
|
|
1031
1034
|
p.set(r, n);
|
|
1032
|
-
const l = f(r, n), s =
|
|
1035
|
+
const l = f(r, n), s = pe(l);
|
|
1033
1036
|
if (typeof o == "function")
|
|
1034
1037
|
try {
|
|
1035
1038
|
o(s);
|
|
@@ -1058,7 +1061,7 @@ const qe = (e = {}) => {
|
|
|
1058
1061
|
init: function(a) {
|
|
1059
1062
|
_ += 1;
|
|
1060
1063
|
const r = this && typeof this.__pluginConfig == "object" ? z({ ...t, ...this.__pluginConfig }) : t;
|
|
1061
|
-
|
|
1064
|
+
Me(r);
|
|
1062
1065
|
const n = x(
|
|
1063
1066
|
a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
|
|
1064
1067
|
!1
|
|
@@ -1066,11 +1069,11 @@ const qe = (e = {}) => {
|
|
|
1066
1069
|
n && (p.set(n, r), f(n, r), g = n, q(n));
|
|
1067
1070
|
},
|
|
1068
1071
|
destroy: () => {
|
|
1069
|
-
_ = Math.max(0, _ - 1), !(_ > 0) &&
|
|
1072
|
+
_ = Math.max(0, _ - 1), !(_ > 0) && He();
|
|
1070
1073
|
}
|
|
1071
1074
|
};
|
|
1072
1075
|
};
|
|
1073
1076
|
export {
|
|
1074
|
-
|
|
1077
|
+
Pe as ApprovalWorkflowPlugin
|
|
1075
1078
|
};
|
|
1076
|
-
//# sourceMappingURL=ApprovalWorkflowPlugin.native-
|
|
1079
|
+
//# sourceMappingURL=ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs.map
|