@editora/plugins 1.0.22 → 1.1.0
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 +1 -1
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
- package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
- package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-D3S8BhIM.js +42 -0
- package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +12 -12
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +90 -83
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +1 -619
- package/dist/media-manager.esm.js +30 -1017
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/index.d.ts +183 -2
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { f as ft } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
|
+
const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", et = "__editoraCommandEditorRoot", ot = "rte-approval-workflow-styles", d = "rte-approval-panel", h = "approval", k = "approvalWorkflow", g = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', mt = {
|
|
2
3
|
panelTitle: "Approval Workflow",
|
|
3
4
|
panelAriaLabel: "Approval workflow panel",
|
|
4
5
|
statusLabel: "Status",
|
|
@@ -22,16 +23,16 @@ const w = ".rte-content, .editora-content", F = "[data-editora-editor], .rte-edi
|
|
|
22
23
|
lockedSuffix: "Locked",
|
|
23
24
|
shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",
|
|
24
25
|
approveCommentRequiredText: "Approval comment is required."
|
|
25
|
-
},
|
|
26
|
+
}, bt = {
|
|
26
27
|
draft: "statusDraftText",
|
|
27
28
|
review: "statusReviewText",
|
|
28
29
|
approved: "statusApprovedText"
|
|
29
30
|
}, s = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new Set();
|
|
30
|
-
let _ = 0,
|
|
31
|
+
let _ = 0, gt = 0, rt = 0, at = 0, R = null, v = null, T = null, L = null, S = null;
|
|
31
32
|
function p(t) {
|
|
32
33
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function vt(t) {
|
|
35
36
|
return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
36
37
|
}
|
|
37
38
|
function lt(t) {
|
|
@@ -45,10 +46,10 @@ function z(t = {}) {
|
|
|
45
46
|
requireCommentOnApprove: !!t.requireCommentOnApprove,
|
|
46
47
|
defaultActor: (t.defaultActor || "system").trim() || "system",
|
|
47
48
|
labels: {
|
|
48
|
-
...
|
|
49
|
+
...mt,
|
|
49
50
|
...t.labels || {}
|
|
50
51
|
},
|
|
51
|
-
normalizeText: t.normalizeText ||
|
|
52
|
+
normalizeText: t.normalizeText || vt
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
function Y(t) {
|
|
@@ -60,7 +61,7 @@ function K(t) {
|
|
|
60
61
|
const e = t.querySelector(w);
|
|
61
62
|
return e instanceof HTMLElement ? e : null;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function ht() {
|
|
64
65
|
if (typeof window > "u") return null;
|
|
65
66
|
const t = window[et];
|
|
66
67
|
if (!(t instanceof HTMLElement)) return null;
|
|
@@ -74,7 +75,7 @@ function vt() {
|
|
|
74
75
|
}
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function xt(t) {
|
|
78
79
|
const e = t.closest("[data-editora-editor]");
|
|
79
80
|
if (e && K(e) === t)
|
|
80
81
|
return e;
|
|
@@ -89,14 +90,14 @@ function ht(t) {
|
|
|
89
90
|
function W(t) {
|
|
90
91
|
return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function wt(t) {
|
|
93
94
|
const e = Y(t);
|
|
94
95
|
if (W(e)) return !0;
|
|
95
96
|
const o = e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
96
97
|
return W(o) ? !0 : W(document.documentElement) || W(document.body);
|
|
97
98
|
}
|
|
98
99
|
function B(t, e) {
|
|
99
|
-
t.classList.remove("rte-approval-theme-dark"),
|
|
100
|
+
t.classList.remove("rte-approval-theme-dark"), wt(e) && t.classList.add("rte-approval-theme-dark");
|
|
100
101
|
}
|
|
101
102
|
function it(t) {
|
|
102
103
|
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
|
|
@@ -109,7 +110,7 @@ function x(t, e = !0) {
|
|
|
109
110
|
const l = n.querySelector(w);
|
|
110
111
|
if (l instanceof HTMLElement) return l;
|
|
111
112
|
}
|
|
112
|
-
const o =
|
|
113
|
+
const o = ht();
|
|
113
114
|
if (o) return o;
|
|
114
115
|
const a = window.getSelection();
|
|
115
116
|
if (a && a.rangeCount > 0) {
|
|
@@ -129,17 +130,17 @@ function D() {
|
|
|
129
130
|
e.isConnected || (y.get(e)?.remove(), y.delete(e), O.delete(e), s.delete(e), I.delete(e), H.delete(e), v === e && (v = null));
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function yt(t) {
|
|
133
134
|
return t ? !!(t.closest(`.${d}`) || t.closest(w) || t.closest(F)) : !1;
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function kt() {
|
|
136
137
|
const t = window.getSelection();
|
|
137
138
|
if (!t || t.rangeCount === 0) return !1;
|
|
138
139
|
const e = t.getRangeAt(0).startContainer;
|
|
139
140
|
return !!it(e)?.closest(w);
|
|
140
141
|
}
|
|
141
142
|
function C(t, e, o) {
|
|
142
|
-
const a =
|
|
143
|
+
const a = xt(t);
|
|
143
144
|
Array.from(
|
|
144
145
|
a.querySelectorAll(
|
|
145
146
|
`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`
|
|
@@ -166,7 +167,7 @@ function J(t, e) {
|
|
|
166
167
|
function Q() {
|
|
167
168
|
return rt += 1, `approval-comment-${Date.now().toString(36)}-${rt.toString(36)}`;
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
function At() {
|
|
170
171
|
return at += 1, `approval-signoff-${Date.now().toString(36)}-${at.toString(36)}`;
|
|
171
172
|
}
|
|
172
173
|
function ct(t) {
|
|
@@ -178,8 +179,8 @@ function ct(t) {
|
|
|
178
179
|
updatedAt: t.updatedAt
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
-
const o =
|
|
182
|
+
function St(t, e) {
|
|
183
|
+
const o = bt[t];
|
|
183
184
|
return e.labels[o] || t;
|
|
184
185
|
}
|
|
185
186
|
function pt(t, e, o) {
|
|
@@ -215,7 +216,7 @@ function M(t, e) {
|
|
|
215
216
|
const o = t.querySelector(".rte-approval-live");
|
|
216
217
|
o && (o.textContent = e);
|
|
217
218
|
}
|
|
218
|
-
function
|
|
219
|
+
function Et(t, e) {
|
|
219
220
|
const o = ct(e);
|
|
220
221
|
t.__approvalWorkflowState = o, t.dispatchEvent(
|
|
221
222
|
new CustomEvent("editora:approval-state-changed", {
|
|
@@ -226,14 +227,14 @@ function St(t, e) {
|
|
|
226
227
|
})
|
|
227
228
|
);
|
|
228
229
|
}
|
|
229
|
-
function
|
|
230
|
+
function P(t) {
|
|
230
231
|
const e = y.get(t);
|
|
231
232
|
if (!e) return;
|
|
232
233
|
const o = s.get(t) || R;
|
|
233
234
|
if (!o) return;
|
|
234
235
|
const a = f(t, o), r = e.querySelector(".rte-approval-summary"), n = e.querySelector('[data-action="request-review"]'), l = e.querySelector('[data-action="approve"]'), c = e.querySelector('[data-action="reopen-draft"]'), u = e.querySelector(".rte-approval-comments-list"), m = e.querySelector(".rte-approval-signoffs-list");
|
|
235
236
|
if (r) {
|
|
236
|
-
const i =
|
|
237
|
+
const i = St(a.status, o);
|
|
237
238
|
r.textContent = `${o.labels.summaryPrefix}: ${i} | Comments: ${a.comments.length} | Sign-offs: ${a.signoffs.length}${a.locked ? ` | ${o.labels.lockedSuffix}` : ""}`;
|
|
238
239
|
}
|
|
239
240
|
n && (n.disabled = a.status !== "draft"), l && (l.disabled = a.status === "approved"), c && (c.disabled = a.status === "draft"), u && (a.comments.length === 0 ? u.innerHTML = `<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>` : u.innerHTML = a.comments.slice().reverse().map(
|
|
@@ -263,7 +264,7 @@ function q(t) {
|
|
|
263
264
|
).join(""));
|
|
264
265
|
}
|
|
265
266
|
function G(t, e, o) {
|
|
266
|
-
e.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), pt(t, e, o),
|
|
267
|
+
e.updatedAt = (/* @__PURE__ */ new Date()).toISOString(), pt(t, e, o), P(t), Et(t, e);
|
|
267
268
|
}
|
|
268
269
|
function nt(t, e, o, a) {
|
|
269
270
|
t.comments.push({
|
|
@@ -297,7 +298,7 @@ function Z(t, e, o, a) {
|
|
|
297
298
|
if (e.requireCommentOnApprove && !n) return !1;
|
|
298
299
|
const l = f(t, e), c = t.innerHTML;
|
|
299
300
|
return l.status = "approved", l.signoffs.push({
|
|
300
|
-
id:
|
|
301
|
+
id: At(),
|
|
301
302
|
author: r,
|
|
302
303
|
comment: n || void 0,
|
|
303
304
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -312,7 +313,7 @@ function Z(t, e, o, a) {
|
|
|
312
313
|
function N(t, e) {
|
|
313
314
|
return t.querySelector(`[data-field="${e}"]`);
|
|
314
315
|
}
|
|
315
|
-
function
|
|
316
|
+
function $t(t) {
|
|
316
317
|
const e = N(t, "actor")?.value || "", o = N(t, "comment")?.value || "";
|
|
317
318
|
return { actor: e, comment: o };
|
|
318
319
|
}
|
|
@@ -321,10 +322,10 @@ function U(t, e) {
|
|
|
321
322
|
const a = Y(t).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), c = Math.max(10, Math.min(window.innerHeight - 10 - 280, a.top + 12));
|
|
322
323
|
e.style.width = `${r}px`, e.style.left = `${l}px`, e.style.top = `${c}px`, e.style.maxHeight = `${Math.max(280, window.innerHeight - 24)}px`;
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
+
function Ct(t) {
|
|
325
326
|
const e = y.get(t);
|
|
326
327
|
if (e) return e;
|
|
327
|
-
const o = s.get(t) || R || z(), a = `rte-approval-panel-${
|
|
328
|
+
const o = s.get(t) || R || z(), a = `rte-approval-panel-${gt++}`, r = document.createElement("section");
|
|
328
329
|
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 = `
|
|
329
330
|
<header class="rte-approval-header">
|
|
330
331
|
<h2 class="rte-approval-title">${p(o.labels.panelTitle)}</h2>
|
|
@@ -385,10 +386,10 @@ function $t(t) {
|
|
|
385
386
|
if (!c) return;
|
|
386
387
|
const u = c.getAttribute("data-action") || "", m = s.get(t) || R || o;
|
|
387
388
|
if (s.set(t, m), f(t, m), u === "close") {
|
|
388
|
-
|
|
389
|
+
q(t, !0);
|
|
389
390
|
return;
|
|
390
391
|
}
|
|
391
|
-
const i =
|
|
392
|
+
const i = $t(r);
|
|
392
393
|
if (u === "request-review") {
|
|
393
394
|
$(t, "review", m, i.actor || m.defaultActor) && M(r, "Status changed to review.");
|
|
394
395
|
return;
|
|
@@ -416,47 +417,47 @@ function $t(t) {
|
|
|
416
417
|
return;
|
|
417
418
|
}
|
|
418
419
|
}), r.addEventListener("keydown", (n) => {
|
|
419
|
-
n.key === "Escape" && (n.preventDefault(),
|
|
420
|
-
}), B(r, t), document.body.appendChild(r), y.set(t, r), O.set(t, !1),
|
|
420
|
+
n.key === "Escape" && (n.preventDefault(), q(t, !0));
|
|
421
|
+
}), B(r, t), document.body.appendChild(r), y.set(t, r), O.set(t, !1), P(t), r;
|
|
421
422
|
}
|
|
422
423
|
function tt(t) {
|
|
423
424
|
return O.get(t) === !0;
|
|
424
425
|
}
|
|
425
426
|
function A(t) {
|
|
426
427
|
D();
|
|
427
|
-
const e =
|
|
428
|
+
const e = Ct(t);
|
|
428
429
|
y.forEach((o, a) => {
|
|
429
|
-
a !== t &&
|
|
430
|
-
}), e.classList.add("show"), O.set(t, !0), C(t, "toggleApprovalWorkflowPanel", !0), B(e, t), U(t, e),
|
|
430
|
+
a !== t && q(a, !1);
|
|
431
|
+
}), e.classList.add("show"), O.set(t, !0), C(t, "toggleApprovalWorkflowPanel", !0), B(e, t), U(t, e), P(t), ft(e);
|
|
431
432
|
}
|
|
432
|
-
function
|
|
433
|
+
function q(t, e = !1) {
|
|
433
434
|
const o = y.get(t);
|
|
434
435
|
o && (o.classList.remove("show"), O.set(t, !1), C(t, "toggleApprovalWorkflowPanel", !1), e && t.focus({ preventScroll: !0 }));
|
|
435
436
|
}
|
|
436
437
|
function ut(t, e) {
|
|
437
438
|
const o = tt(t);
|
|
438
|
-
return (typeof e == "boolean" ? e : !o) ? A(t) :
|
|
439
|
+
return (typeof e == "boolean" ? e : !o) ? A(t) : q(t), !0;
|
|
439
440
|
}
|
|
440
441
|
function V(t) {
|
|
441
442
|
return typeof t.key == "string" ? t.key.toLowerCase() : "";
|
|
442
443
|
}
|
|
443
|
-
function
|
|
444
|
+
function Tt(t) {
|
|
444
445
|
const e = V(t);
|
|
445
446
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "a";
|
|
446
447
|
}
|
|
447
|
-
function
|
|
448
|
+
function Lt(t) {
|
|
448
449
|
const e = V(t);
|
|
449
450
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "r";
|
|
450
451
|
}
|
|
451
|
-
function
|
|
452
|
+
function Rt(t) {
|
|
452
453
|
const e = V(t);
|
|
453
454
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "p";
|
|
454
455
|
}
|
|
455
|
-
function
|
|
456
|
+
function Mt(t) {
|
|
456
457
|
const e = V(t);
|
|
457
458
|
return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "d";
|
|
458
459
|
}
|
|
459
|
-
function
|
|
460
|
+
function Dt(t) {
|
|
460
461
|
R = t, T || (T = (e) => {
|
|
461
462
|
D();
|
|
462
463
|
const a = e.target?.closest(w);
|
|
@@ -468,12 +469,12 @@ function Mt(t) {
|
|
|
468
469
|
n && (B(n, a), U(a, n));
|
|
469
470
|
}, document.addEventListener("focusin", T, !0)), L || (L = (e) => {
|
|
470
471
|
if (e.defaultPrevented) return;
|
|
471
|
-
const o =
|
|
472
|
+
const o = Tt(e), a = Lt(e), r = Rt(e), n = Mt(e), l = e.key === "Escape";
|
|
472
473
|
if (!l && !o && !a && !r && !n)
|
|
473
474
|
return;
|
|
474
475
|
D();
|
|
475
476
|
const c = e.target, u = !!c?.closest(`.${d} input, .${d} textarea, .${d} select`);
|
|
476
|
-
if (!
|
|
477
|
+
if (!yt(c) && !kt())
|
|
477
478
|
return;
|
|
478
479
|
const i = x(void 0, !1);
|
|
479
480
|
if (!i) return;
|
|
@@ -481,7 +482,7 @@ function Mt(t) {
|
|
|
481
482
|
s.set(i, b);
|
|
482
483
|
const E = f(i, b);
|
|
483
484
|
if (v = i, l && tt(i)) {
|
|
484
|
-
e.preventDefault(),
|
|
485
|
+
e.preventDefault(), q(i, !0);
|
|
485
486
|
return;
|
|
486
487
|
}
|
|
487
488
|
if (!u) {
|
|
@@ -505,7 +506,7 @@ function Mt(t) {
|
|
|
505
506
|
});
|
|
506
507
|
}, window.addEventListener("scroll", S, !0), window.addEventListener("resize", S));
|
|
507
508
|
}
|
|
508
|
-
function
|
|
509
|
+
function Ht(t) {
|
|
509
510
|
const e = I.get(t);
|
|
510
511
|
e && (t.classList.remove("rte-approval-locked-editor"), t.removeAttribute("data-approval-status"), t.removeAttribute("data-approval-locked"), st(
|
|
511
512
|
t,
|
|
@@ -513,8 +514,8 @@ function Dt(t) {
|
|
|
513
514
|
e.preApprovalReadonly ?? e.originalReadonly
|
|
514
515
|
));
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
-
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((t) => t.remove()), y.clear(), H.forEach((t) =>
|
|
517
|
+
function Pt() {
|
|
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), y.forEach((t) => t.remove()), y.clear(), H.forEach((t) => Ht(t)), H.clear(), R = null, v = null;
|
|
518
519
|
}
|
|
519
520
|
function qt() {
|
|
520
521
|
if (typeof document > "u" || document.getElementById(ot)) return;
|
|
@@ -853,7 +854,7 @@ function qt() {
|
|
|
853
854
|
|
|
854
855
|
.rte-approval-item-time {
|
|
855
856
|
font-size: 11px;
|
|
856
|
-
color: #
|
|
857
|
+
color: #475569;
|
|
857
858
|
}
|
|
858
859
|
|
|
859
860
|
.${d}.rte-approval-theme-dark .rte-approval-item-time {
|
|
@@ -872,7 +873,7 @@ function qt() {
|
|
|
872
873
|
border-radius: 8px;
|
|
873
874
|
padding: 8px;
|
|
874
875
|
font-size: 12px;
|
|
875
|
-
color: #
|
|
876
|
+
color: #475569;
|
|
876
877
|
}
|
|
877
878
|
|
|
878
879
|
.${d}.rte-approval-theme-dark .rte-approval-empty {
|
|
@@ -883,7 +884,7 @@ function qt() {
|
|
|
883
884
|
.rte-approval-shortcut {
|
|
884
885
|
margin: 0;
|
|
885
886
|
font-size: 11px;
|
|
886
|
-
color: #
|
|
887
|
+
color: #475569;
|
|
887
888
|
}
|
|
888
889
|
|
|
889
890
|
.${d}.rte-approval-theme-dark .rte-approval-shortcut {
|
|
@@ -912,7 +913,7 @@ function qt() {
|
|
|
912
913
|
}
|
|
913
914
|
`, document.head.appendChild(t);
|
|
914
915
|
}
|
|
915
|
-
const
|
|
916
|
+
const _t = (t = {}) => {
|
|
916
917
|
const e = z(t);
|
|
917
918
|
return qt(), {
|
|
918
919
|
name: "approvalWorkflow",
|
|
@@ -959,7 +960,7 @@ const Pt = (t = {}) => {
|
|
|
959
960
|
const r = x(a);
|
|
960
961
|
if (!r) return !1;
|
|
961
962
|
const n = s.get(r) || e;
|
|
962
|
-
return s.set(r, n), f(r, n), v = r, A(r),
|
|
963
|
+
return s.set(r, n), f(r, n), v = r, A(r), P(r), !0;
|
|
963
964
|
},
|
|
964
965
|
toggleApprovalWorkflowPanel: (o, a) => {
|
|
965
966
|
const r = x(a);
|
|
@@ -1057,18 +1058,18 @@ const Pt = (t = {}) => {
|
|
|
1057
1058
|
init: function(a) {
|
|
1058
1059
|
_ += 1;
|
|
1059
1060
|
const r = this && typeof this.__pluginConfig == "object" ? z({ ...e, ...this.__pluginConfig }) : e;
|
|
1060
|
-
|
|
1061
|
+
Dt(r);
|
|
1061
1062
|
const n = x(
|
|
1062
1063
|
a?.editorElement ? { editorElement: a.editorElement } : void 0,
|
|
1063
1064
|
!1
|
|
1064
1065
|
);
|
|
1065
|
-
n && (s.set(n, r), f(n, r), v = n,
|
|
1066
|
+
n && (s.set(n, r), f(n, r), v = n, P(n));
|
|
1066
1067
|
},
|
|
1067
1068
|
destroy: () => {
|
|
1068
|
-
_ = Math.max(0, _ - 1), !(_ > 0) &&
|
|
1069
|
+
_ = Math.max(0, _ - 1), !(_ > 0) && Pt();
|
|
1069
1070
|
}
|
|
1070
1071
|
};
|
|
1071
1072
|
};
|
|
1072
1073
|
export {
|
|
1073
|
-
|
|
1074
|
+
_t as ApprovalWorkflowPlugin
|
|
1074
1075
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./notify-BkbzMopb.js"),P=require("./anchoredPopover-Cygmit_o.js"),R=require("./dialogHelpers-BxSQ7A6M.js");let l=null,L=null,g=null,y=null,i="#ffff00";const k='[data-theme="dark"], .dark, .editora-theme-dark',q=["#000000","#ffffff","#808080","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb"];function A(){const e=window.getSelection();if(e&&e.rangeCount>0){const r=e.getRangeAt(0).startContainer,n=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(n){const o=n.closest('[data-editora-editor="true"], .rte-editor, .editora-editor');if(o)return o}}const t=document.activeElement;return t?t.closest('[data-editora-editor="true"], .rte-editor, .editora-editor'):null}function M(e){const t=window.__editoraLastCommand,c=window.__editoraLastCommandButton;if(t===e&&c&&c.isConnected){const a=window.getComputedStyle(c),s=c.getBoundingClientRect();if(a.display!=="none"&&a.visibility!=="hidden"&&a.pointerEvents!=="none"&&!(s.width===0&&s.height===0))return c}const r=a=>{for(const s of a){const d=window.getComputedStyle(s),p=s.getBoundingClientRect();if(!(d.display==="none"||d.visibility==="hidden"||d.pointerEvents==="none")&&!(p.width===0&&p.height===0))return s}return null},n=A();if(n){const a=Array.from(n.querySelectorAll(`[data-command="${e}"]`)),s=r(a);if(s)return s}const o=Array.from(document.querySelectorAll(`[data-command="${e}"]`));return r(o)}function _(e){if(e?.closest(k))return!0;const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer;if((r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)}function I(){if(document.getElementById("rte-bg-color-picker-styles"))return;const e=document.createElement("style");e.id="rte-bg-color-picker-styles",e.textContent=`
|
|
2
2
|
.rte-bg-color-picker {
|
|
3
3
|
position: fixed;
|
|
4
4
|
background: white;
|
|
@@ -215,4 +215,4 @@
|
|
|
215
215
|
.rte-bg-color-picker.rte-theme-dark .rte-bg-color-text-input:focus {
|
|
216
216
|
border-color: #58a6ff;
|
|
217
217
|
}
|
|
218
|
-
`,document.head.appendChild(e)}function
|
|
218
|
+
`,document.head.appendChild(e)}function U(){const e=document.createElement("div");e.className="rte-bg-color-picker",_(L)&&e.classList.add("rte-theme-dark"),e.addEventListener("click",h=>h.stopPropagation());const t=document.createElement("div");t.className="rte-bg-color-picker-header";const c=document.createElement("span");c.className="rte-bg-color-picker-title",c.textContent="Background Color";const r=document.createElement("button");r.type="button",r.className="rte-bg-color-picker-close",r.id="rte-bg-color-close",r.setAttribute("aria-label","Close"),r.textContent="×",t.appendChild(c),t.appendChild(r);const n=document.createElement("div");n.className="rte-bg-color-picker-body";const o=document.createElement("div");o.className="rte-bg-color-section";const a=document.createElement("div");a.className="rte-bg-color-preview";const s=document.createElement("div");s.className="rte-bg-color-preview-swatch",s.id="rte-bg-color-preview-swatch";const d=document.createElement("span");d.className="rte-bg-color-preview-hex",d.id="rte-bg-color-preview-hex",a.appendChild(s),a.appendChild(d),o.appendChild(a);const p=document.createElement("div");p.className="rte-bg-color-section";const E=document.createElement("div");E.className="rte-bg-color-section-label",E.textContent="Colors";const x=document.createElement("div");x.className="rte-bg-color-grid",x.id="rte-bg-color-grid",q.forEach(h=>{const f=document.createElement("button");f.type="button",f.className="rte-bg-color-swatch",f.style.backgroundColor=h,f.dataset.color=h,f.title=h,x.appendChild(f)}),p.appendChild(E),p.appendChild(x);const C=document.createElement("div");C.className="rte-bg-color-section";const S=document.createElement("div");S.className="rte-bg-color-section-label",S.textContent="Custom";const v=document.createElement("div");v.className="rte-bg-color-custom";const b=document.createElement("input");b.type="color",b.className="rte-bg-color-input",b.id="rte-bg-color-input",b.setAttribute("aria-label","Custom background colour"),b.value=i;const u=document.createElement("input");return u.type="text",u.className="rte-bg-color-text-input",u.id="rte-bg-color-text-input",u.placeholder="#FFFF00",u.value=i.toUpperCase(),u.maxLength=7,v.appendChild(b),v.appendChild(u),C.appendChild(S),C.appendChild(v),n.appendChild(o),n.appendChild(p),n.appendChild(C),e.appendChild(t),e.appendChild(n),e}function F(){if(!l)return;l.querySelector("#rte-bg-color-close")?.addEventListener("click",()=>m());const t=l.querySelector("#rte-bg-color-grid");t&&t.addEventListener("click",n=>{const o=n.target;if(o.classList.contains("rte-bg-color-swatch")){const a=o.dataset.color;a&&(i=a,w(a),m())}});const c=l.querySelector("#rte-bg-color-input");c&&(c.addEventListener("change",n=>{const o=n.target.value.toUpperCase();i=o,w(o),m()}),c.addEventListener("input",n=>{i=n.target.value.toUpperCase(),B(),N()}));const r=l.querySelector("#rte-bg-color-text-input");r&&(r.addEventListener("change",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o),/^#[0-9A-F]{6}$/i.test(o)&&(i=o.toUpperCase(),w(i),m())}),r.addEventListener("input",n=>{let o=n.target.value.trim();o&&!o.startsWith("#")&&(o="#"+o,r.value=o),/^#[0-9A-F]{6}$/i.test(o)&&(i=o.toUpperCase(),B(),N())}))}function B(){if(!l)return;const e=l.querySelector("#rte-bg-color-preview-swatch"),t=l.querySelector("#rte-bg-color-preview-hex"),c=l.querySelector("#rte-bg-color-input"),r=l.querySelector("#rte-bg-color-text-input");e&&(e.style.backgroundColor=i),t&&(t.textContent=i.toUpperCase()),c&&(c.value=i),r&&(r.value=i.toUpperCase())}function N(){if(!l)return;l.querySelectorAll(".rte-bg-color-swatch").forEach(t=>{t.dataset.color?.toUpperCase()===i.toUpperCase()?t.classList.add("selected"):t.classList.remove("selected")})}function z(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return"#ffff00";const c=e.getRangeAt(0).commonAncestorContainer,r=c.nodeType===1?c:c.parentElement;if(r){const n=r.closest('[style*="background-color"]');if(n){const o=n.style.backgroundColor;if(o)return H(o)}}return"#ffff00"}catch{return"#ffff00"}}function H(e){if(e.startsWith("#"))return e.toUpperCase();const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t){const c=parseInt(t[1]),r=parseInt(t[2]),n=parseInt(t[3]);return"#"+[c,r,n].map(o=>{const a=o.toString(16);return a.length===1?"0"+a:a}).join("").toUpperCase()}return"#ffff00"}function w(e){const t=P.applyColorToSelection({color:e,className:"rte-bg-color",styleProperty:"backgroundColor",commands:["hiliteColor","backColor"],savedRange:y,getActiveEditorRoot:A,warnMessage:"[BackgroundColor] Could not apply highlight for current selection"});return t&&console.log("[BackgroundColor] Applied color:",e),t}function m(){const e=!!l&&l.contains(document.activeElement),t=y,c=e?A():null;g&&(g.destroy(),g=null),l&&(l.remove(),l=null),L=null,y=null,e&&R.returnFocusToText(c,t)}function O(){if(I(),l)return m(),!0;const e=M("openBackgroundColorPicker");if(!e)return!1;const t=window.getSelection();return!t||t.isCollapsed?(T.notify("Please select text to apply background color"),!1):(t.rangeCount>0&&(y=t.getRangeAt(0).cloneRange()),i=z(),l=U(),document.body.appendChild(l),L=e,g&&(g.destroy(),g=null),g=P.attachAnchoredPopover({popover:l,anchor:e,onClose:m,gap:8,margin:8,zIndex:1e4,label:"Background color",initialFocus:".rte-bg-color-swatch.selected, .rte-bg-color-swatch"}),B(),N(),F(),!0)}const D=()=>({name:"backgroundColor",marks:{backgroundColor:{attrs:{color:{default:"#ffffff"}},parseDOM:[{tag:'span[style*="background-color"]',getAttrs:e=>{const r=(e.getAttribute("style")||"").match(/background-color:\s*([^;]+)/);return r?{color:r[1]}:null}},{tag:"mark",getAttrs:e=>({color:e.style.backgroundColor||"#ffff00"})}],toDOM:e=>["span",{style:`background-color: ${e.attrs?.color||"#ffffff"}`,class:"rte-bg-color"},0]}},toolbar:[{label:"Background Color",command:"openBackgroundColorPicker",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path class="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z" fill="#000000"></path><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 0 1 2.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"></path></g></svg>',shortcut:"Mod-Shift-h"}],commands:{openBackgroundColorPicker:()=>O(),setBackgroundColor:e=>e?w(e):!1},keymap:{"Mod-Shift-h":"openBackgroundColorPicker"}});exports.BackgroundColorPlugin=D;
|