@editora/plugins 1.0.11 → 1.0.13
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/approval-workflow.cjs.js +14 -14
- package/dist/approval-workflow.esm.js +265 -262
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +177 -15
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +95 -92
- package/dist/bold.cjs.js +1 -1
- package/dist/bold.esm.js +10 -6
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +124 -44
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +251 -191
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +131 -128
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +68 -36
- package/dist/code.cjs.js +121 -44
- package/dist/code.esm.js +2694 -889
- package/dist/content-rules.cjs.js +5 -5
- package/dist/content-rules.esm.js +104 -101
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +51 -48
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +97 -74
- package/dist/doc-schema.cjs.js +4 -4
- package/dist/doc-schema.esm.js +104 -101
- package/dist/embed-iframe.cjs.js +21 -4
- package/dist/embed-iframe.esm.js +279 -116
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +239 -56
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +74 -89
- package/dist/inlineFormatting-DOYOJdnD.js +1 -0
- package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +12 -8
- package/dist/math.cjs.js +27 -21
- package/dist/math.esm.js +218 -146
- package/dist/merge-tag.cjs.js +8 -2
- package/dist/merge-tag.esm.js +130 -111
- package/dist/pii-redaction.cjs.js +6 -6
- package/dist/pii-redaction.esm.js +169 -166
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +120 -117
- package/dist/special-characters.cjs.js +6 -10
- package/dist/special-characters.esm.js +97 -75
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +11 -25
- package/dist/translation-workflow.cjs.js +7 -7
- package/dist/translation-workflow.esm.js +103 -100
- package/dist/underline.cjs.js +1 -1
- package/dist/underline.esm.js +7 -3
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", we = "__editoraCommandEditorRoot", Ee = "rte-pii-redaction-styles", u = "rte-pii-redaction-panel", k = "pii-redaction", v = "piiRedaction", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', ge = typeof NodeFilter < "u" ? NodeFilter.SHOW_TEXT : 4, Oe = [
|
|
2
2
|
"email",
|
|
3
3
|
"phone",
|
|
4
4
|
"ssn",
|
|
@@ -6,7 +6,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
|
|
|
6
6
|
"ipv4",
|
|
7
7
|
"api-key",
|
|
8
8
|
"jwt"
|
|
9
|
-
],
|
|
9
|
+
], ze = {
|
|
10
10
|
panelTitle: "PII Redaction",
|
|
11
11
|
panelAriaLabel: "PII redaction panel",
|
|
12
12
|
scanText: "Scan PII",
|
|
@@ -23,7 +23,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
|
|
|
23
23
|
matchLabel: "Detected",
|
|
24
24
|
maskedLabel: "Masked",
|
|
25
25
|
excerptLabel: "Context"
|
|
26
|
-
},
|
|
26
|
+
}, Fe = {
|
|
27
27
|
email: {
|
|
28
28
|
label: "Email",
|
|
29
29
|
severity: "medium",
|
|
@@ -43,7 +43,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
|
|
|
43
43
|
label: "Credit Card",
|
|
44
44
|
severity: "high",
|
|
45
45
|
pattern: /\b(?:\d[ -]*?){13,19}\b/g,
|
|
46
|
-
validator: (e) =>
|
|
46
|
+
validator: (e) => We(e)
|
|
47
47
|
},
|
|
48
48
|
ipv4: {
|
|
49
49
|
label: "IPv4",
|
|
@@ -60,12 +60,12 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
|
|
|
60
60
|
severity: "high",
|
|
61
61
|
pattern: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g
|
|
62
62
|
}
|
|
63
|
-
}, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(),
|
|
64
|
-
let G = 0,
|
|
63
|
+
}, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Set();
|
|
64
|
+
let G = 0, He = 0, ve = 0, A = null, b = null, P = null, L = null, D = null, R = null, _ = null;
|
|
65
65
|
function p(e) {
|
|
66
66
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Be(e) {
|
|
69
69
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
70
70
|
}
|
|
71
71
|
function Y(e) {
|
|
@@ -78,20 +78,20 @@ function be(e) {
|
|
|
78
78
|
function X(e, t, n) {
|
|
79
79
|
return Math.max(t, Math.min(n, e));
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Ke(e, t) {
|
|
82
82
|
return e === "high" || e === "medium" || e === "low" ? e : t;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function qe(e) {
|
|
85
85
|
const t = (e || "*").slice(0, 1) || "*";
|
|
86
86
|
return /[A-Za-z0-9._%+\-\s]/.test(t) ? "*" : t;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function $e(e) {
|
|
89
89
|
let t = 2166136261;
|
|
90
90
|
for (let n = 0; n < e.length; n += 1)
|
|
91
91
|
t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
92
92
|
return t >>> 0;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function We(e) {
|
|
95
95
|
const t = e.replace(/\D/g, "");
|
|
96
96
|
if (t.length < 13 || t.length > 19) return !1;
|
|
97
97
|
let n = 0, r = !1;
|
|
@@ -101,8 +101,8 @@ function qe(e) {
|
|
|
101
101
|
}
|
|
102
102
|
return n % 10 === 0;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
const n =
|
|
104
|
+
function je(e, t) {
|
|
105
|
+
const n = Fe[e];
|
|
106
106
|
if (typeof t == "boolean")
|
|
107
107
|
return {
|
|
108
108
|
type: e,
|
|
@@ -125,34 +125,34 @@ function We(e, t) {
|
|
|
125
125
|
return {
|
|
126
126
|
type: e,
|
|
127
127
|
label: n.label,
|
|
128
|
-
severity:
|
|
128
|
+
severity: Ke(t.severity, n.severity),
|
|
129
129
|
enabled: t.enabled !== !1,
|
|
130
130
|
pattern: r,
|
|
131
131
|
validator: n.validator
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
function ee(e = {}) {
|
|
135
|
-
const t =
|
|
135
|
+
const t = Oe.map((r) => je(r, e.detectors?.[r])), n = t.map((r) => `${r.type}:${r.enabled ? "1" : "0"}:${r.severity}:${r.pattern.source}:${r.pattern.flags}`).join("|");
|
|
136
136
|
return {
|
|
137
137
|
enableRealtime: e.enableRealtime !== !1,
|
|
138
138
|
debounceMs: X(Number(e.debounceMs ?? 220), 60, 3e3),
|
|
139
139
|
maxFindings: X(Number(e.maxFindings ?? 140), 1, 500),
|
|
140
|
-
maskChar:
|
|
140
|
+
maskChar: qe(e.maskChar),
|
|
141
141
|
revealStart: X(Number(e.revealStart ?? 2), 0, 12),
|
|
142
142
|
revealEnd: X(Number(e.revealEnd ?? 2), 0, 12),
|
|
143
143
|
redactionMode: e.redactionMode === "mask" ? "mask" : "token",
|
|
144
144
|
redactionToken: (e.redactionToken || "REDACTED").trim() || "REDACTED",
|
|
145
145
|
skipInCodeBlocks: e.skipInCodeBlocks !== !1,
|
|
146
146
|
labels: {
|
|
147
|
-
...
|
|
147
|
+
...ze,
|
|
148
148
|
...e.labels || {}
|
|
149
149
|
},
|
|
150
|
-
normalizeText: e.normalizeText ||
|
|
150
|
+
normalizeText: e.normalizeText || Be,
|
|
151
151
|
detectors: t,
|
|
152
152
|
detectorSignature: n
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function se(e) {
|
|
156
156
|
const t = {};
|
|
157
157
|
return e.detectors.forEach((n) => {
|
|
158
158
|
t[n.type] = {
|
|
@@ -175,10 +175,10 @@ function ce(e) {
|
|
|
175
175
|
detectors: t
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function me(e) {
|
|
179
179
|
return e.closest(ae) || e;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Ze(e) {
|
|
182
182
|
const t = e.closest("[data-editora-editor]");
|
|
183
183
|
if (t && O(t) === e)
|
|
184
184
|
return t;
|
|
@@ -188,7 +188,7 @@ function je(e) {
|
|
|
188
188
|
return n;
|
|
189
189
|
n = n.parentElement;
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return me(e);
|
|
192
192
|
}
|
|
193
193
|
function O(e) {
|
|
194
194
|
if (!e) return null;
|
|
@@ -196,11 +196,11 @@ function O(e) {
|
|
|
196
196
|
const t = e.querySelector(x);
|
|
197
197
|
return t instanceof HTMLElement ? t : null;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Ve() {
|
|
200
200
|
if (typeof window > "u") return null;
|
|
201
|
-
const e = window[
|
|
201
|
+
const e = window[we];
|
|
202
202
|
if (!(e instanceof HTMLElement)) return null;
|
|
203
|
-
window[
|
|
203
|
+
window[we] = null;
|
|
204
204
|
const t = O(e);
|
|
205
205
|
if (t) return t;
|
|
206
206
|
const n = e.closest(ae);
|
|
@@ -214,19 +214,19 @@ function Ze() {
|
|
|
214
214
|
function J(e) {
|
|
215
215
|
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;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
const t =
|
|
217
|
+
function Ue(e) {
|
|
218
|
+
const t = me(e);
|
|
219
219
|
if (J(t)) return !0;
|
|
220
220
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
221
221
|
return J(n) ? !0 : J(document.documentElement) || J(document.body);
|
|
222
222
|
}
|
|
223
223
|
function ne(e, t) {
|
|
224
|
-
e.classList.remove("rte-pii-redaction-theme-dark"),
|
|
224
|
+
e.classList.remove("rte-pii-redaction-theme-dark"), Ue(t) && e.classList.add("rte-pii-redaction-theme-dark");
|
|
225
225
|
}
|
|
226
226
|
function re(e) {
|
|
227
227
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function he(e) {
|
|
230
230
|
const t = te.get(e);
|
|
231
231
|
typeof t == "number" && (window.clearTimeout(t), W.delete(t), te.delete(e));
|
|
232
232
|
}
|
|
@@ -253,10 +253,10 @@ function le(e = 0) {
|
|
|
253
253
|
}
|
|
254
254
|
function K() {
|
|
255
255
|
Array.from(q).forEach((t) => {
|
|
256
|
-
t.isConnected ||
|
|
256
|
+
t.isConnected || Te(t);
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Ge(e) {
|
|
260
260
|
for (let t = 0; t < e.length; t += 1) {
|
|
261
261
|
const n = e[t];
|
|
262
262
|
if (!(n.type !== "childList" || n.removedNodes.length === 0))
|
|
@@ -276,7 +276,7 @@ function T(e, t = !0) {
|
|
|
276
276
|
const o = e.editorElement, a = O(o);
|
|
277
277
|
if (a) return a;
|
|
278
278
|
}
|
|
279
|
-
const n =
|
|
279
|
+
const n = Ve();
|
|
280
280
|
if (n) return n;
|
|
281
281
|
const r = window.getSelection();
|
|
282
282
|
if (r && r.rangeCount > 0) {
|
|
@@ -289,13 +289,13 @@ function T(e, t = !0) {
|
|
|
289
289
|
const o = i.closest(x);
|
|
290
290
|
if (o) return o;
|
|
291
291
|
}
|
|
292
|
-
return
|
|
292
|
+
return b && b.isConnected ? b : (b && !b.isConnected && (b = null), t ? document.querySelector(x) : null);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
|
|
294
|
+
function Te(e) {
|
|
295
|
+
he(e), m.get(e)?.remove(), m.delete(e), Z.delete(e), f.delete(e), I.delete(e), E.delete(e), S.delete(e), ue.delete(e), Q.delete(e), q.delete(e), b === e && (b = null);
|
|
296
296
|
}
|
|
297
297
|
function C(e, t, n) {
|
|
298
|
-
const r =
|
|
298
|
+
const r = Ze(e);
|
|
299
299
|
Array.from(
|
|
300
300
|
r.querySelectorAll(
|
|
301
301
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -310,76 +310,76 @@ function w(e, t) {
|
|
|
310
310
|
function oe(e) {
|
|
311
311
|
return Z.get(e) === !0;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Ie(e, t, n, r) {
|
|
314
314
|
if (!e) return e;
|
|
315
315
|
if (e.length <= n + r)
|
|
316
316
|
return t.repeat(e.length);
|
|
317
317
|
const i = e.slice(0, n), o = r > 0 ? e.slice(e.length - r) : "";
|
|
318
318
|
return `${i}${t.repeat(Math.max(1, e.length - n - r))}${o}`;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function de(e, t, n) {
|
|
321
321
|
const r = e.replace(/\D/g, "");
|
|
322
322
|
if (r.length === 0) return e;
|
|
323
323
|
let i = 0;
|
|
324
324
|
const o = Math.max(0, r.length - n);
|
|
325
325
|
return e.split("").map((a) => /\d/.test(a) ? (i += 1, i <= o ? t : a) : a).join("");
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function Ye(e, t) {
|
|
328
328
|
const n = e.indexOf("@");
|
|
329
329
|
if (n <= 0) return e;
|
|
330
330
|
const r = e.slice(0, n), i = e.slice(n + 1);
|
|
331
331
|
return r.length <= 2 ? `${r[0] || ""}${t}[at]${i}` : `${r[0]}${t.repeat(Math.max(1, r.length - 2))}${r[r.length - 1]}[at]${i}`;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Xe(e, t) {
|
|
334
334
|
const n = e.split(".");
|
|
335
335
|
return n.length !== 4 ? e : `${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1, n[3].length))}`;
|
|
336
336
|
}
|
|
337
|
-
function Te(e, t, n) {
|
|
338
|
-
return e && (t === "email" ? Ge(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? se(e, n.maskChar, 4) : t === "ipv4" ? Ye(e, n.maskChar) : t === "api-key" || t === "jwt" ? $e(e, n.maskChar, 0, 0) : $e(e, n.maskChar, n.revealStart, n.revealEnd));
|
|
339
|
-
}
|
|
340
337
|
function Ce(e, t, n) {
|
|
341
|
-
return n.
|
|
338
|
+
return e && (t === "email" ? Ye(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? de(e, n.maskChar, 4) : t === "ipv4" ? Xe(e, n.maskChar) : t === "api-key" || t === "jwt" ? Ie(e, n.maskChar, 0, 0) : Ie(e, n.maskChar, n.revealStart, n.revealEnd));
|
|
342
339
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
340
|
+
function Re(e, t, n) {
|
|
341
|
+
return n.redactionMode === "mask" ? Ce(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
|
|
345
342
|
}
|
|
346
|
-
function
|
|
343
|
+
function Je(e) {
|
|
344
|
+
return ve += 1, `pii-${e}-${Date.now().toString(36)}-${ve.toString(36)}`;
|
|
345
|
+
}
|
|
346
|
+
function xe(e, t) {
|
|
347
347
|
return t.skipInCodeBlocks ? !!e.parentElement?.closest("code, pre, kbd, samp") : !1;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Qe(e, t) {
|
|
350
350
|
return t.some((n) => e.start < n.end && n.start < e.end);
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function et(e, t, n) {
|
|
353
353
|
const r = [];
|
|
354
354
|
t.filter((a) => a.enabled).forEach((a) => {
|
|
355
355
|
const l = be(a.pattern);
|
|
356
356
|
let c = l.exec(e);
|
|
357
357
|
for (; c && r.length < n * 5; ) {
|
|
358
|
-
const d = c[0] || "", s = c.index,
|
|
359
|
-
d &&
|
|
358
|
+
const d = c[0] || "", s = c.index, g = s + d.length;
|
|
359
|
+
d && g > s && (!a.validator || a.validator(d)) && r.push({
|
|
360
360
|
type: a.type,
|
|
361
361
|
severity: a.severity,
|
|
362
362
|
value: d,
|
|
363
363
|
start: s,
|
|
364
|
-
end:
|
|
364
|
+
end: g
|
|
365
365
|
}), l.lastIndex === c.index && (l.lastIndex += 1), c = l.exec(e);
|
|
366
366
|
}
|
|
367
367
|
}), r.sort((a, l) => a.start !== l.start ? a.start - l.start : l.end - a.end);
|
|
368
368
|
const o = [];
|
|
369
369
|
for (let a = 0; a < r.length && !(o.length >= n); a += 1) {
|
|
370
370
|
const l = r[a];
|
|
371
|
-
|
|
371
|
+
Qe({ start: l.start, end: l.end }, o) || o.push(l);
|
|
372
372
|
}
|
|
373
373
|
return o;
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function fe(e, t = 120) {
|
|
376
376
|
return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function tt(e, t, n) {
|
|
379
379
|
const r = Math.max(0, t - 28), i = Math.min(e.length, n + 28);
|
|
380
|
-
return
|
|
380
|
+
return fe(e.slice(r, i).trim(), 180);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function nt(e, t) {
|
|
383
383
|
const n = le(t);
|
|
384
384
|
return n.total = e.length, e.forEach((r) => {
|
|
385
385
|
n.byType[r.type] += 1, r.severity === "high" ? n.high += 1 : r.severity === "medium" ? n.medium += 1 : n.low += 1;
|
|
@@ -395,7 +395,7 @@ function z(e, t, n) {
|
|
|
395
395
|
const i = F(e, n);
|
|
396
396
|
r.textContent = i ? n.labels.realtimeOnText : n.labels.realtimeOffText, r.setAttribute("aria-pressed", i ? "true" : "false"), C(e, "togglePIIRealtime", i);
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function rt(e, t) {
|
|
399
399
|
e.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
400
400
|
const n = e.querySelector(".rte-pii-redaction-title");
|
|
401
401
|
n && (n.textContent = t.labels.panelTitle);
|
|
@@ -420,7 +420,7 @@ function H(e) {
|
|
|
420
420
|
return;
|
|
421
421
|
}
|
|
422
422
|
c.innerHTML = r.map((s) => {
|
|
423
|
-
const
|
|
423
|
+
const g = s.type.toUpperCase(), M = s.suggestion || "Redact this finding before export/share.", B = `${n.labels.locateText}: ${s.match}`, y = `${n.labels.redactText}: ${s.match}`, U = o ? 'disabled aria-disabled="true"' : "";
|
|
424
424
|
return `
|
|
425
425
|
<li class="rte-pii-redaction-item rte-pii-redaction-item-${s.severity}">
|
|
426
426
|
<button
|
|
@@ -432,10 +432,10 @@ function H(e) {
|
|
|
432
432
|
aria-label="${p(B)}"
|
|
433
433
|
>
|
|
434
434
|
<span class="rte-pii-redaction-badge">${p(s.severity.toUpperCase())}</span>
|
|
435
|
-
<span class="rte-pii-redaction-type">${p(
|
|
435
|
+
<span class="rte-pii-redaction-type">${p(g)}</span>
|
|
436
436
|
</button>
|
|
437
|
-
<p class="rte-pii-redaction-line"><strong>${p(n.labels.matchLabel)}:</strong> ${p(
|
|
438
|
-
<p class="rte-pii-redaction-line"><strong>${p(n.labels.maskedLabel)}:</strong> ${p(
|
|
437
|
+
<p class="rte-pii-redaction-line"><strong>${p(n.labels.matchLabel)}:</strong> ${p(fe(s.match, 80))}</p>
|
|
438
|
+
<p class="rte-pii-redaction-line"><strong>${p(n.labels.maskedLabel)}:</strong> ${p(fe(s.masked, 80))}</p>
|
|
439
439
|
${s.excerpt ? `<p class="rte-pii-redaction-line"><strong>${p(n.labels.excerptLabel)}:</strong> ${p(s.excerpt)}</p>` : ""}
|
|
440
440
|
<p class="rte-pii-redaction-help">${p(M)}</p>
|
|
441
441
|
<div class="rte-pii-redaction-item-actions">
|
|
@@ -448,16 +448,16 @@ function H(e) {
|
|
|
448
448
|
}).join("");
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function pe(e, t) {
|
|
452
452
|
if (!t.classList.contains("show")) return;
|
|
453
|
-
const r =
|
|
453
|
+
const r = me(e).getBoundingClientRect(), i = Math.min(window.innerWidth - 20, 390), o = Math.max(10, window.innerWidth - i - 10), a = Math.min(Math.max(10, r.right - i), o), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, r.top + 10));
|
|
454
454
|
t.style.width = `${i}px`, t.style.left = `${a}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
|
|
455
455
|
}
|
|
456
456
|
function F(e, t) {
|
|
457
457
|
const n = S.get(e);
|
|
458
458
|
return typeof n == "boolean" ? n : t ? t.enableRealtime : !0;
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function Se(e, t) {
|
|
461
461
|
if (t === e.innerHTML) return;
|
|
462
462
|
const n = window.execEditorCommand || window.executeEditorCommand;
|
|
463
463
|
if (typeof n == "function")
|
|
@@ -466,10 +466,10 @@ function Re(e, t) {
|
|
|
466
466
|
} catch {
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function Ae(e) {
|
|
470
470
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Me(e, t) {
|
|
473
473
|
e.dispatchEvent(
|
|
474
474
|
new CustomEvent("editora:pii-redacted", {
|
|
475
475
|
bubbles: !0,
|
|
@@ -479,13 +479,13 @@ function Ae(e, t) {
|
|
|
479
479
|
})
|
|
480
480
|
);
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Pe(e, t) {
|
|
483
483
|
return (I.get(e) || []).find((r) => r.id === t);
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function ot(e) {
|
|
486
486
|
const t = m.get(e);
|
|
487
487
|
if (t) return t;
|
|
488
|
-
const n = f.get(e) || A || ee(), r = `rte-pii-redaction-panel-${
|
|
488
|
+
const n = f.get(e) || A || ee(), r = `rte-pii-redaction-panel-${He++}`, i = document.createElement("section");
|
|
489
489
|
return i.className = u, i.id = r, i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "false"), i.setAttribute("aria-label", n.labels.panelAriaLabel), i.innerHTML = `
|
|
490
490
|
<header class="rte-pii-redaction-header">
|
|
491
491
|
<h2 class="rte-pii-redaction-title">${p(n.labels.panelTitle)}</h2>
|
|
@@ -529,18 +529,18 @@ function rt(e) {
|
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
531
|
if (c === "redact-all") {
|
|
532
|
-
|
|
532
|
+
ye(e, d);
|
|
533
533
|
return;
|
|
534
534
|
}
|
|
535
535
|
if (c === "locate-finding") {
|
|
536
|
-
const s = l.getAttribute("data-finding-id") || "",
|
|
537
|
-
if (!
|
|
538
|
-
|
|
536
|
+
const s = l.getAttribute("data-finding-id") || "", g = Pe(e, s);
|
|
537
|
+
if (!g) return;
|
|
538
|
+
lt(e, g, d);
|
|
539
539
|
return;
|
|
540
540
|
}
|
|
541
541
|
if (c === "redact-finding") {
|
|
542
542
|
const s = l.getAttribute("data-finding-id") || "";
|
|
543
|
-
|
|
543
|
+
_e(e, s, d);
|
|
544
544
|
}
|
|
545
545
|
}), i.addEventListener("keydown", (o) => {
|
|
546
546
|
if (o.key === "Escape") {
|
|
@@ -550,7 +550,7 @@ function rt(e) {
|
|
|
550
550
|
if (o.key !== "ArrowDown" && o.key !== "ArrowUp") return;
|
|
551
551
|
const a = Array.from(i.querySelectorAll('[data-role="finding-button"]'));
|
|
552
552
|
if (a.length === 0) return;
|
|
553
|
-
const l = document.activeElement, c = a.findIndex((
|
|
553
|
+
const l = document.activeElement, c = a.findIndex((g) => g === l);
|
|
554
554
|
if (c === -1) return;
|
|
555
555
|
o.preventDefault();
|
|
556
556
|
const d = o.key === "ArrowDown" ? 1 : -1, s = (c + d + a.length) % a.length;
|
|
@@ -563,20 +563,20 @@ function j(e, t = !1) {
|
|
|
563
563
|
}
|
|
564
564
|
function N(e) {
|
|
565
565
|
K();
|
|
566
|
-
const t =
|
|
566
|
+
const t = ot(e);
|
|
567
567
|
m.forEach((r, i) => {
|
|
568
568
|
i !== e && j(i, !1);
|
|
569
|
-
}), t.classList.add("show"), Z.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e),
|
|
569
|
+
}), t.classList.add("show"), Z.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), pe(e, t), H(e), t.querySelector('[data-action="run-scan"]')?.focus();
|
|
570
570
|
}
|
|
571
|
-
function
|
|
571
|
+
function Le(e, t) {
|
|
572
572
|
const n = oe(e);
|
|
573
573
|
return (typeof t == "boolean" ? t : !n) ? N(e) : j(e), !0;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function it(e, t) {
|
|
576
576
|
const n = t.normalizeText(e.innerText || e.textContent || ""), r = e.innerHTML;
|
|
577
|
-
return `${n.length}:${
|
|
577
|
+
return `${n.length}:${$e(n)}:${r.length}:${$e(r)}:${t.detectorSignature}`;
|
|
578
578
|
}
|
|
579
|
-
function
|
|
579
|
+
function at(e, t) {
|
|
580
580
|
const n = [], r = be(e.pattern);
|
|
581
581
|
let i = r.exec(t);
|
|
582
582
|
for (; i; ) {
|
|
@@ -585,21 +585,21 @@ function it(e, t) {
|
|
|
585
585
|
}
|
|
586
586
|
return n;
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function De(e, t, n) {
|
|
589
589
|
const r = n.detectors.find((c) => c.type === t.type && c.enabled);
|
|
590
590
|
if (!r) return null;
|
|
591
591
|
const i = t.match.toLowerCase();
|
|
592
592
|
let o = 0;
|
|
593
|
-
const a = document.createTreeWalker(e,
|
|
593
|
+
const a = document.createTreeWalker(e, ge, null);
|
|
594
594
|
let l = a.nextNode();
|
|
595
595
|
for (; l; ) {
|
|
596
|
-
if (!
|
|
597
|
-
const c =
|
|
596
|
+
if (!xe(l, n)) {
|
|
597
|
+
const c = at(r, l.data);
|
|
598
598
|
for (let d = 0; d < c.length; d += 1) {
|
|
599
599
|
const s = c[d];
|
|
600
600
|
if (s.value.toLowerCase() === i && (o += 1, o === t.occurrence)) {
|
|
601
|
-
const
|
|
602
|
-
return
|
|
601
|
+
const g = document.createRange();
|
|
602
|
+
return g.setStart(l, s.start), g.setEnd(l, s.end), g;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
}
|
|
@@ -607,35 +607,35 @@ function Le(e, t, n) {
|
|
|
607
607
|
}
|
|
608
608
|
return null;
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
const r =
|
|
610
|
+
function lt(e, t, n) {
|
|
611
|
+
const r = De(e, t, n);
|
|
612
612
|
if (!r) return !1;
|
|
613
613
|
const i = window.getSelection();
|
|
614
614
|
return i ? (i.removeAllRanges(), i.addRange(r), re(r.startContainer)?.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 }), !0) : !1;
|
|
615
615
|
}
|
|
616
616
|
async function h(e, t, n = !1) {
|
|
617
617
|
w(e, t);
|
|
618
|
-
const r =
|
|
619
|
-
if (!n &&
|
|
618
|
+
const r = it(e, t);
|
|
619
|
+
if (!n && ue.get(e) === r)
|
|
620
620
|
return I.get(e) || [];
|
|
621
621
|
const i = (Q.get(e) || 0) + 1;
|
|
622
622
|
Q.set(e, i);
|
|
623
|
-
const o = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e,
|
|
623
|
+
const o = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, ge, null);
|
|
624
624
|
let c = l.nextNode();
|
|
625
625
|
for (; c && o.length < t.maxFindings; ) {
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
const M =
|
|
626
|
+
const g = c.data || "";
|
|
627
|
+
if (g.trim() && !xe(c, t)) {
|
|
628
|
+
const M = et(g, t.detectors, t.maxFindings - o.length);
|
|
629
629
|
for (let B = 0; B < M.length && !(o.length >= t.maxFindings); B += 1) {
|
|
630
|
-
const y = M[B], U = `${y.type}:${y.value.toLowerCase()}`,
|
|
631
|
-
a.set(U,
|
|
632
|
-
id:
|
|
630
|
+
const y = M[B], U = `${y.type}:${y.value.toLowerCase()}`, ke = (a.get(U) || 0) + 1;
|
|
631
|
+
a.set(U, ke), o.push({
|
|
632
|
+
id: Je(y.type),
|
|
633
633
|
type: y.type,
|
|
634
634
|
severity: y.severity,
|
|
635
635
|
match: y.value,
|
|
636
|
-
masked:
|
|
637
|
-
occurrence:
|
|
638
|
-
excerpt:
|
|
636
|
+
masked: Ce(y.value, y.type, t),
|
|
637
|
+
occurrence: ke,
|
|
638
|
+
excerpt: tt(g, y.start, y.end),
|
|
639
639
|
suggestion: "Review and redact this value before external sharing."
|
|
640
640
|
});
|
|
641
641
|
}
|
|
@@ -644,8 +644,8 @@ async function h(e, t, n = !1) {
|
|
|
644
644
|
}
|
|
645
645
|
if (Q.get(e) !== i)
|
|
646
646
|
return I.get(e) || [];
|
|
647
|
-
const d = E.get(e)?.redactedCount || 0, s =
|
|
648
|
-
return
|
|
647
|
+
const d = E.get(e)?.redactedCount || 0, s = nt(o, d);
|
|
648
|
+
return ue.set(e, r), I.set(e, o), E.set(e, s), H(e), e.dispatchEvent(
|
|
649
649
|
new CustomEvent("editora:pii-scan", {
|
|
650
650
|
bubbles: !0,
|
|
651
651
|
detail: {
|
|
@@ -655,35 +655,35 @@ async function h(e, t, n = !1) {
|
|
|
655
655
|
})
|
|
656
656
|
), o;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function ct(e, t) {
|
|
659
659
|
let n = e, r = 0;
|
|
660
660
|
return t.detectors.filter((o) => o.enabled).forEach((o) => {
|
|
661
661
|
const a = be(o.pattern);
|
|
662
|
-
n = n.replace(a, (l) => o.validator && !o.validator(l) ? l : (r += 1,
|
|
662
|
+
n = n.replace(a, (l) => o.validator && !o.validator(l) ? l : (r += 1, Re(l, o.type, t)));
|
|
663
663
|
}), { nextValue: n, count: r };
|
|
664
664
|
}
|
|
665
|
-
async function
|
|
665
|
+
async function _e(e, t, n) {
|
|
666
666
|
if (V(e)) {
|
|
667
667
|
const d = m.get(e);
|
|
668
668
|
return d && ie(d, n.labels.readonlyRedactionText), !1;
|
|
669
669
|
}
|
|
670
|
-
const r =
|
|
670
|
+
const r = Pe(e, t);
|
|
671
671
|
if (!r) return !1;
|
|
672
|
-
const i =
|
|
672
|
+
const i = De(e, r, n);
|
|
673
673
|
if (!i) return !1;
|
|
674
|
-
const o = e.innerHTML, a =
|
|
674
|
+
const o = e.innerHTML, a = Re(r.match, r.type, n);
|
|
675
675
|
if (i.startContainer === i.endContainer && i.startContainer.nodeType === Node.TEXT_NODE) {
|
|
676
|
-
const d = i.startContainer, s = d.data,
|
|
677
|
-
d.data = `${s.slice(0,
|
|
676
|
+
const d = i.startContainer, s = d.data, g = i.startOffset, M = i.endOffset;
|
|
677
|
+
d.data = `${s.slice(0, g)}${a}${s.slice(M)}`;
|
|
678
678
|
} else
|
|
679
679
|
i.deleteContents(), i.insertNode(document.createTextNode(a));
|
|
680
|
-
|
|
680
|
+
Ae(e), Se(e, o);
|
|
681
681
|
const l = E.get(e)?.redactedCount || 0;
|
|
682
682
|
await h(e, n, !0);
|
|
683
683
|
const c = E.get(e);
|
|
684
|
-
return c && (c.redactedCount = l + 1, H(e)),
|
|
684
|
+
return c && (c.redactedCount = l + 1, H(e)), Me(e, 1), !0;
|
|
685
685
|
}
|
|
686
|
-
async function
|
|
686
|
+
async function ye(e, t) {
|
|
687
687
|
if (V(e)) {
|
|
688
688
|
const d = m.get(e);
|
|
689
689
|
return d && ie(d, t.labels.readonlyRedactionText), 0;
|
|
@@ -691,10 +691,10 @@ async function xe(e, t) {
|
|
|
691
691
|
(I.get(e) || []).length === 0 && await h(e, t, !0);
|
|
692
692
|
const r = e.innerHTML;
|
|
693
693
|
let i = 0;
|
|
694
|
-
const o = document.createTreeWalker(e,
|
|
694
|
+
const o = document.createTreeWalker(e, ge, null);
|
|
695
695
|
let a = o.nextNode();
|
|
696
696
|
for (; a; ) {
|
|
697
|
-
if (
|
|
697
|
+
if (xe(a, t)) {
|
|
698
698
|
a = o.nextNode();
|
|
699
699
|
continue;
|
|
700
700
|
}
|
|
@@ -703,42 +703,45 @@ async function xe(e, t) {
|
|
|
703
703
|
a = o.nextNode();
|
|
704
704
|
continue;
|
|
705
705
|
}
|
|
706
|
-
const s =
|
|
706
|
+
const s = ct(d, t);
|
|
707
707
|
s.count > 0 && s.nextValue !== d && (a.data = s.nextValue, i += s.count), a = o.nextNode();
|
|
708
708
|
}
|
|
709
709
|
if (i === 0) return 0;
|
|
710
|
-
|
|
710
|
+
Ae(e), Se(e, r);
|
|
711
711
|
const l = E.get(e)?.redactedCount || 0;
|
|
712
712
|
await h(e, t, !0);
|
|
713
713
|
const c = E.get(e);
|
|
714
|
-
return c && (c.redactedCount = l + i, H(e)),
|
|
714
|
+
return c && (c.redactedCount = l + i, H(e)), Me(e, i), i;
|
|
715
715
|
}
|
|
716
|
-
function
|
|
716
|
+
function Ne(e) {
|
|
717
717
|
const t = f.get(e) || A;
|
|
718
718
|
if (!t || !F(e, t) || V(e)) return;
|
|
719
|
-
|
|
719
|
+
he(e);
|
|
720
720
|
const n = window.setTimeout(() => {
|
|
721
721
|
W.delete(n), te.delete(e), h(e, t, !1);
|
|
722
722
|
}, t.debounceMs);
|
|
723
723
|
W.add(n), te.set(e, n);
|
|
724
724
|
}
|
|
725
|
-
function
|
|
726
|
-
|
|
727
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
|
|
725
|
+
function ce(e) {
|
|
726
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
728
727
|
}
|
|
729
728
|
function st(e) {
|
|
730
|
-
const t = e
|
|
731
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
729
|
+
const t = ce(e);
|
|
730
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
|
|
732
731
|
}
|
|
733
732
|
function dt(e) {
|
|
734
|
-
const t = e
|
|
735
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
733
|
+
const t = ce(e);
|
|
734
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
|
|
736
735
|
}
|
|
737
736
|
function ut(e) {
|
|
738
|
-
const t = e
|
|
739
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
737
|
+
const t = ce(e);
|
|
738
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
|
|
740
739
|
}
|
|
741
740
|
function ft(e) {
|
|
741
|
+
const t = ce(e);
|
|
742
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
|
|
743
|
+
}
|
|
744
|
+
function pt(e) {
|
|
742
745
|
const t = re(e.target);
|
|
743
746
|
if (t) {
|
|
744
747
|
const r = t.closest(x);
|
|
@@ -763,10 +766,10 @@ function ft(e) {
|
|
|
763
766
|
}
|
|
764
767
|
return null;
|
|
765
768
|
}
|
|
766
|
-
function
|
|
767
|
-
if (typeof document > "u" || document.getElementById(
|
|
769
|
+
function gt() {
|
|
770
|
+
if (typeof document > "u" || document.getElementById(Ee)) return;
|
|
768
771
|
const e = document.createElement("style");
|
|
769
|
-
e.id =
|
|
772
|
+
e.id = Ee, e.textContent = `
|
|
770
773
|
.rte-toolbar-group-items.${k},
|
|
771
774
|
.editora-toolbar-group-items.${k},
|
|
772
775
|
.rte-toolbar-group-items.${v},
|
|
@@ -1168,36 +1171,36 @@ function bt(e) {
|
|
|
1168
1171
|
K();
|
|
1169
1172
|
const r = t.target?.closest(x);
|
|
1170
1173
|
if (!r) return;
|
|
1171
|
-
|
|
1174
|
+
b = r;
|
|
1172
1175
|
const i = f.get(r) || e;
|
|
1173
1176
|
w(r, i), f.set(r, i), C(r, "togglePIIRedactionPanel", oe(r)), C(r, "togglePIIRealtime", F(r, i));
|
|
1174
1177
|
const o = m.get(r);
|
|
1175
|
-
o && (ne(o, r),
|
|
1178
|
+
o && (ne(o, r), pe(r, o), z(r, o, i));
|
|
1176
1179
|
}, document.addEventListener("focusin", P, !0)), L || (L = (t) => {
|
|
1177
1180
|
const r = t.target?.closest(x);
|
|
1178
|
-
r && (
|
|
1181
|
+
r && (b = r, Ne(r));
|
|
1179
1182
|
}, document.addEventListener("input", L, !0)), D || (D = (t) => {
|
|
1180
1183
|
if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
|
|
1181
|
-
const r =
|
|
1184
|
+
const r = pt(t);
|
|
1182
1185
|
if (!r) return;
|
|
1183
1186
|
const i = f.get(r) || A || e;
|
|
1184
|
-
if (w(r, i), f.set(r, i),
|
|
1187
|
+
if (w(r, i), f.set(r, i), b = r, t.key === "Escape" && oe(r)) {
|
|
1185
1188
|
t.preventDefault(), j(r, !0);
|
|
1186
1189
|
return;
|
|
1187
1190
|
}
|
|
1188
|
-
if (ct(t)) {
|
|
1189
|
-
t.preventDefault(), t.stopPropagation(), Pe(r);
|
|
1190
|
-
return;
|
|
1191
|
-
}
|
|
1192
1191
|
if (st(t)) {
|
|
1193
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1192
|
+
t.preventDefault(), t.stopPropagation(), Le(r);
|
|
1194
1193
|
return;
|
|
1195
1194
|
}
|
|
1196
1195
|
if (dt(t)) {
|
|
1197
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1196
|
+
t.preventDefault(), t.stopPropagation(), h(r, i, !0), N(r);
|
|
1198
1197
|
return;
|
|
1199
1198
|
}
|
|
1200
1199
|
if (ut(t)) {
|
|
1200
|
+
t.preventDefault(), t.stopPropagation(), V(r) || (ye(r, i), N(r));
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
if (ft(t)) {
|
|
1201
1204
|
t.preventDefault(), t.stopPropagation();
|
|
1202
1205
|
const o = !F(r, i);
|
|
1203
1206
|
S.set(r, o);
|
|
@@ -1206,21 +1209,21 @@ function bt(e) {
|
|
|
1206
1209
|
}
|
|
1207
1210
|
}, document.addEventListener("keydown", D, !0)), R || (R = () => {
|
|
1208
1211
|
K(), m.forEach((t, n) => {
|
|
1209
|
-
!n.isConnected || !t.isConnected || (ne(t, n),
|
|
1212
|
+
!n.isConnected || !t.isConnected || (ne(t, n), pe(n, t));
|
|
1210
1213
|
});
|
|
1211
1214
|
}, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !_ && typeof MutationObserver < "u" && document.body && (_ = new MutationObserver((t) => {
|
|
1212
|
-
|
|
1215
|
+
Ge(t) && K();
|
|
1213
1216
|
}), _.observe(document.body, {
|
|
1214
1217
|
childList: !0,
|
|
1215
1218
|
subtree: !0
|
|
1216
1219
|
}));
|
|
1217
1220
|
}
|
|
1218
|
-
function
|
|
1219
|
-
P && (document.removeEventListener("focusin", P, !0), P = null), L && (document.removeEventListener("input", L, !0), L = null), D && (document.removeEventListener("keydown", D, !0), D = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), _ && (_.disconnect(), _ = null), m.forEach((e) => e.remove()), m.clear(), q.forEach((e) =>
|
|
1221
|
+
function mt() {
|
|
1222
|
+
P && (document.removeEventListener("focusin", P, !0), P = null), L && (document.removeEventListener("input", L, !0), L = null), D && (document.removeEventListener("keydown", D, !0), D = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), _ && (_.disconnect(), _ = null), m.forEach((e) => e.remove()), m.clear(), q.forEach((e) => he(e)), q.clear(), A = null, b = null;
|
|
1220
1223
|
}
|
|
1221
|
-
const
|
|
1224
|
+
const ht = (e = {}) => {
|
|
1222
1225
|
const t = ee(e), n = /* @__PURE__ */ new Set();
|
|
1223
|
-
return
|
|
1226
|
+
return gt(), {
|
|
1224
1227
|
name: "piiRedaction",
|
|
1225
1228
|
toolbar: [
|
|
1226
1229
|
{
|
|
@@ -1265,35 +1268,35 @@ const mt = (e = {}) => {
|
|
|
1265
1268
|
const o = T(i);
|
|
1266
1269
|
if (!o) return !1;
|
|
1267
1270
|
const a = f.get(o) || t;
|
|
1268
|
-
return w(o, a), f.set(o, a),
|
|
1271
|
+
return w(o, a), f.set(o, a), b = o, N(o), h(o, a, !1), !0;
|
|
1269
1272
|
},
|
|
1270
1273
|
togglePIIRedactionPanel: (r, i) => {
|
|
1271
1274
|
const o = T(i);
|
|
1272
1275
|
if (!o) return !1;
|
|
1273
1276
|
const a = f.get(o) || t;
|
|
1274
|
-
w(o, a), f.set(o, a),
|
|
1275
|
-
const l =
|
|
1277
|
+
w(o, a), f.set(o, a), b = o;
|
|
1278
|
+
const l = Le(o, typeof r == "boolean" ? r : void 0);
|
|
1276
1279
|
return oe(o) && h(o, a, !1), l;
|
|
1277
1280
|
},
|
|
1278
1281
|
runPIIScan: async (r, i) => {
|
|
1279
1282
|
const o = T(i);
|
|
1280
1283
|
if (!o) return !1;
|
|
1281
1284
|
const a = f.get(o) || t;
|
|
1282
|
-
return w(o, a), f.set(o, a),
|
|
1285
|
+
return w(o, a), f.set(o, a), b = o, await h(o, a, !0), N(o), !0;
|
|
1283
1286
|
},
|
|
1284
1287
|
redactAllPII: async (r, i) => {
|
|
1285
1288
|
const o = T(i);
|
|
1286
1289
|
if (!o) return !1;
|
|
1287
1290
|
const a = f.get(o) || t;
|
|
1288
|
-
w(o, a), f.set(o, a),
|
|
1289
|
-
const l = await
|
|
1291
|
+
w(o, a), f.set(o, a), b = o;
|
|
1292
|
+
const l = await ye(o, a);
|
|
1290
1293
|
return l > 0 && N(o), l > 0;
|
|
1291
1294
|
},
|
|
1292
1295
|
redactPIIFinding: async (r, i) => {
|
|
1293
1296
|
const o = T(i);
|
|
1294
1297
|
if (!o || typeof r != "string" || !r) return !1;
|
|
1295
1298
|
const a = f.get(o) || t;
|
|
1296
|
-
return w(o, a), f.set(o, a),
|
|
1299
|
+
return w(o, a), f.set(o, a), b = o, _e(o, r, a);
|
|
1297
1300
|
},
|
|
1298
1301
|
togglePIIRealtime: (r, i) => {
|
|
1299
1302
|
const o = T(i);
|
|
@@ -1328,21 +1331,21 @@ const mt = (e = {}) => {
|
|
|
1328
1331
|
const o = T(i);
|
|
1329
1332
|
if (!o || !r || typeof r != "object") return !1;
|
|
1330
1333
|
const a = f.get(o) || t, l = ee({
|
|
1331
|
-
...
|
|
1334
|
+
...se(a),
|
|
1332
1335
|
...r,
|
|
1333
1336
|
labels: {
|
|
1334
1337
|
...a.labels,
|
|
1335
1338
|
...r.labels || {}
|
|
1336
1339
|
},
|
|
1337
1340
|
detectors: {
|
|
1338
|
-
...
|
|
1341
|
+
...se(a).detectors || {},
|
|
1339
1342
|
...r.detectors || {}
|
|
1340
1343
|
},
|
|
1341
1344
|
normalizeText: r.normalizeText || a.normalizeText
|
|
1342
1345
|
});
|
|
1343
1346
|
f.set(o, l), typeof r.enableRealtime == "boolean" && S.set(o, r.enableRealtime);
|
|
1344
1347
|
const c = m.get(o);
|
|
1345
|
-
return c && (
|
|
1348
|
+
return c && (rt(c, l), H(o), z(o, c, l)), h(o, l, !0), !0;
|
|
1346
1349
|
}
|
|
1347
1350
|
},
|
|
1348
1351
|
keymap: {
|
|
@@ -1357,21 +1360,21 @@ const mt = (e = {}) => {
|
|
|
1357
1360
|
},
|
|
1358
1361
|
init: function(i) {
|
|
1359
1362
|
G += 1;
|
|
1360
|
-
const o = this && typeof this.__pluginConfig == "object" ? ee({ ...
|
|
1363
|
+
const o = this && typeof this.__pluginConfig == "object" ? ee({ ...se(t), ...this.__pluginConfig }) : t;
|
|
1361
1364
|
bt(o);
|
|
1362
1365
|
const a = T(
|
|
1363
1366
|
i?.editorElement ? { editorElement: i.editorElement } : void 0,
|
|
1364
1367
|
!1
|
|
1365
1368
|
);
|
|
1366
|
-
a && (
|
|
1369
|
+
a && (b = a, n.add(a), w(a, o), f.set(a, o), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", o.enableRealtime), o.enableRealtime && Ne(a));
|
|
1367
1370
|
},
|
|
1368
1371
|
destroy: () => {
|
|
1369
|
-
n.forEach((r) =>
|
|
1372
|
+
n.forEach((r) => Te(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (W.forEach((r) => {
|
|
1370
1373
|
window.clearTimeout(r);
|
|
1371
|
-
}), W.clear(),
|
|
1374
|
+
}), W.clear(), mt());
|
|
1372
1375
|
}
|
|
1373
1376
|
};
|
|
1374
1377
|
};
|
|
1375
1378
|
export {
|
|
1376
|
-
|
|
1379
|
+
ht as PIIRedactionPlugin
|
|
1377
1380
|
};
|