@editora/plugins 1.0.12 → 1.0.14
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/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 +27 -21
- package/dist/code.esm.js +72 -43
- 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
package/dist/doc-schema.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const y = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", fe = "__editoraCommandEditorRoot", he = "rte-doc-schema-styles", m = "rte-doc-schema-panel", E = "document-schema", T = "doc-schema", H = "docSchema", v = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ae = {
|
|
2
2
|
panelTitle: "Document Schema",
|
|
3
3
|
panelAriaLabel: "Document schema panel",
|
|
4
4
|
schemaLabel: "Schema",
|
|
@@ -21,11 +21,11 @@ const S = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-ed
|
|
|
21
21
|
unknownHeadingMessage: "Heading is not part of selected schema",
|
|
22
22
|
insertedSummaryPrefix: "Inserted missing sections"
|
|
23
23
|
}, u = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), ne = /* @__PURE__ */ new Set();
|
|
24
|
-
let W = 0,
|
|
24
|
+
let W = 0, Le = 0, ge = 0, w = null, p = null, q = null, z = null, B = null, R = null, K = null;
|
|
25
25
|
function M(e) {
|
|
26
26
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Oe(e) {
|
|
29
29
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
30
30
|
}
|
|
31
31
|
function P(e, t, n) {
|
|
@@ -85,10 +85,10 @@ function pe() {
|
|
|
85
85
|
}
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function He(e, t, n) {
|
|
89
89
|
const r = n(e.title || "");
|
|
90
90
|
if (!r) return null;
|
|
91
|
-
const s = xe(n(e.id || r)) || `section-${t + 1}`, o = P(Number(e.minOccurrences ?? 1), 0, 20), a = Math.max(1, o), c = P(Number(e.maxOccurrences ?? a), o, 40), i = n(e.placeholder || ""), l = Array.isArray(e.aliases) ? e.aliases.map((
|
|
91
|
+
const s = xe(n(e.id || r)) || `section-${t + 1}`, o = P(Number(e.minOccurrences ?? 1), 0, 20), a = Math.max(1, o), c = P(Number(e.maxOccurrences ?? a), o, 40), i = n(e.placeholder || ""), l = Array.isArray(e.aliases) ? e.aliases.map((S) => n(S)).filter(Boolean) : [], d = [r, ...l].map((S) => ce(S, n)).filter(Boolean);
|
|
92
92
|
return {
|
|
93
93
|
id: s,
|
|
94
94
|
title: r,
|
|
@@ -98,7 +98,7 @@ function Oe(e, t, n) {
|
|
|
98
98
|
matchKeys: Array.from(new Set(d))
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function ye(e, t) {
|
|
102
102
|
const n = Array.isArray(e) && e.length > 0 ? e : pe(), r = [], s = /* @__PURE__ */ new Set();
|
|
103
103
|
return n.forEach((o, a) => {
|
|
104
104
|
const c = t(o.label || "");
|
|
@@ -108,13 +108,13 @@ function Se(e, t) {
|
|
|
108
108
|
for (; s.has(l); )
|
|
109
109
|
l = `${i}-${d++}`;
|
|
110
110
|
s.add(l);
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
113
|
-
const x =
|
|
111
|
+
const S = Array.isArray(o.sections) ? o.sections : [], f = [], k = /* @__PURE__ */ new Set();
|
|
112
|
+
if (S.forEach(($, h) => {
|
|
113
|
+
const x = He($, h, t);
|
|
114
114
|
if (!x) return;
|
|
115
|
-
let N = x.id,
|
|
115
|
+
let N = x.id, Me = 1;
|
|
116
116
|
for (; k.has(N); )
|
|
117
|
-
N = `${x.id}-${
|
|
117
|
+
N = `${x.id}-${Me++}`;
|
|
118
118
|
k.add(N), f.push({
|
|
119
119
|
...x,
|
|
120
120
|
id: N
|
|
@@ -135,10 +135,10 @@ function Se(e, t) {
|
|
|
135
135
|
matchKeyToSection: O,
|
|
136
136
|
orderBySectionId: A
|
|
137
137
|
});
|
|
138
|
-
}), r.length > 0 ? r :
|
|
138
|
+
}), r.length > 0 ? r : ye(pe(), t);
|
|
139
139
|
}
|
|
140
140
|
function Z(e = {}) {
|
|
141
|
-
const t = e.normalizeText ||
|
|
141
|
+
const t = e.normalizeText || Oe, n = ye(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((o) => o.id === r) ? r : n[0]?.id || null;
|
|
142
142
|
return {
|
|
143
143
|
schemas: n,
|
|
144
144
|
defaultSchemaId: s,
|
|
@@ -146,13 +146,13 @@ function Z(e = {}) {
|
|
|
146
146
|
debounceMs: P(Number(e.debounceMs ?? 260), 60, 2e3),
|
|
147
147
|
maxIssues: P(Number(e.maxIssues ?? 80), 5, 500),
|
|
148
148
|
labels: {
|
|
149
|
-
...
|
|
149
|
+
...Ae,
|
|
150
150
|
...e.labels || {}
|
|
151
151
|
},
|
|
152
152
|
normalizeText: t
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Re(e) {
|
|
156
156
|
return {
|
|
157
157
|
schemas: e.schemas.map((t) => ({
|
|
158
158
|
id: t.id,
|
|
@@ -181,11 +181,11 @@ function le(e) {
|
|
|
181
181
|
}
|
|
182
182
|
function U(e) {
|
|
183
183
|
if (!e) return null;
|
|
184
|
-
if (e.matches(
|
|
185
|
-
const t = e.querySelector(
|
|
184
|
+
if (e.matches(y)) return e;
|
|
185
|
+
const t = e.querySelector(y);
|
|
186
186
|
return t instanceof HTMLElement ? t : null;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function De() {
|
|
189
189
|
if (typeof window > "u") return null;
|
|
190
190
|
const e = window[fe];
|
|
191
191
|
if (!(e instanceof HTMLElement)) return null;
|
|
@@ -197,10 +197,10 @@ function Re() {
|
|
|
197
197
|
const s = U(n);
|
|
198
198
|
if (s) return s;
|
|
199
199
|
}
|
|
200
|
-
const r = e.closest(
|
|
200
|
+
const r = e.closest(y);
|
|
201
201
|
return r instanceof HTMLElement ? r : null;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Ne(e) {
|
|
204
204
|
const t = e.closest("[data-editora-editor]");
|
|
205
205
|
if (t && U(t) === e)
|
|
206
206
|
return t;
|
|
@@ -212,22 +212,22 @@ function De(e) {
|
|
|
212
212
|
}
|
|
213
213
|
return le(e);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Se(e) {
|
|
216
216
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
217
217
|
}
|
|
218
218
|
function Y(e) {
|
|
219
219
|
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;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Pe(e) {
|
|
222
222
|
const t = le(e);
|
|
223
223
|
if (Y(t)) return !0;
|
|
224
224
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
225
225
|
return Y(n) ? !0 : Y(document.documentElement) || Y(document.body);
|
|
226
226
|
}
|
|
227
227
|
function oe(e, t) {
|
|
228
|
-
e.classList.remove("rte-doc-schema-theme-dark"),
|
|
228
|
+
e.classList.remove("rte-doc-schema-theme-dark"), Pe(t) && e.classList.add("rte-doc-schema-theme-dark");
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function _e(e) {
|
|
231
231
|
for (let t = 0; t < e.length; t += 1) {
|
|
232
232
|
const n = e[t];
|
|
233
233
|
if (!(n.type !== "childList" || n.removedNodes.length === 0))
|
|
@@ -235,7 +235,7 @@ function Pe(e) {
|
|
|
235
235
|
const s = n.removedNodes[r];
|
|
236
236
|
if (s.nodeType !== Node.ELEMENT_NODE) continue;
|
|
237
237
|
const o = s;
|
|
238
|
-
if (o.matches?.(
|
|
238
|
+
if (o.matches?.(y) || o.matches?.(`.${m}`) || o.querySelector?.(y) || o.querySelector?.(`.${m}`))
|
|
239
239
|
return !0;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -252,28 +252,28 @@ function I(e, t = !0, n = !0) {
|
|
|
252
252
|
const c = U(e.editorElement);
|
|
253
253
|
if (c) return c;
|
|
254
254
|
}
|
|
255
|
-
const r =
|
|
255
|
+
const r = De();
|
|
256
256
|
if (r) return r;
|
|
257
257
|
const s = window.getSelection();
|
|
258
258
|
if (s && s.rangeCount > 0) {
|
|
259
|
-
const c =
|
|
260
|
-
|
|
259
|
+
const c = Se(s.getRangeAt(0).startContainer)?.closest(
|
|
260
|
+
y
|
|
261
261
|
);
|
|
262
262
|
if (c) return c;
|
|
263
263
|
}
|
|
264
264
|
const o = document.activeElement;
|
|
265
265
|
if (o) {
|
|
266
|
-
if (o.matches(
|
|
267
|
-
const c = o.closest(
|
|
266
|
+
if (o.matches(y)) return o;
|
|
267
|
+
const c = o.closest(y);
|
|
268
268
|
if (c) return c;
|
|
269
269
|
}
|
|
270
270
|
if (n && p && p.isConnected)
|
|
271
271
|
return p;
|
|
272
272
|
if (!t) return null;
|
|
273
|
-
const a = document.querySelector(
|
|
273
|
+
const a = document.querySelector(y);
|
|
274
274
|
return a instanceof HTMLElement ? a : null;
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function qe(e) {
|
|
277
277
|
const t = e.target;
|
|
278
278
|
if (t) {
|
|
279
279
|
const r = t.closest(`.${m}`);
|
|
@@ -281,7 +281,7 @@ function _e(e) {
|
|
|
281
281
|
const o = Array.from(b.entries()).find(([, a]) => a === r);
|
|
282
282
|
if (o) return o[0];
|
|
283
283
|
}
|
|
284
|
-
const s = t.closest(
|
|
284
|
+
const s = t.closest(y);
|
|
285
285
|
if (s) return s;
|
|
286
286
|
}
|
|
287
287
|
const n = document.activeElement;
|
|
@@ -291,13 +291,13 @@ function _e(e) {
|
|
|
291
291
|
const o = Array.from(b.entries()).find(([, a]) => a === r);
|
|
292
292
|
if (o) return o[0];
|
|
293
293
|
}
|
|
294
|
-
const s = n.closest(
|
|
294
|
+
const s = n.closest(y);
|
|
295
295
|
if (s) return s;
|
|
296
296
|
}
|
|
297
297
|
return null;
|
|
298
298
|
}
|
|
299
299
|
function be(e, t, n) {
|
|
300
|
-
const r =
|
|
300
|
+
const r = Ne(e);
|
|
301
301
|
Array.from(
|
|
302
302
|
r.querySelectorAll(
|
|
303
303
|
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
@@ -336,7 +336,7 @@ function ue(e) {
|
|
|
336
336
|
function me(e) {
|
|
337
337
|
return F.get(e) === !0;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function Ee(e) {
|
|
340
340
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
341
341
|
}
|
|
342
342
|
function se(e, t) {
|
|
@@ -348,7 +348,7 @@ function ee(e, t) {
|
|
|
348
348
|
const n = e.querySelector(".rte-doc-schema-live");
|
|
349
349
|
n && (n.textContent = t);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function ze(e, t) {
|
|
352
352
|
const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), r = [];
|
|
353
353
|
return n.forEach((s, o) => {
|
|
354
354
|
const a = t(s.textContent || "");
|
|
@@ -362,7 +362,7 @@ function qe(e, t) {
|
|
|
362
362
|
});
|
|
363
363
|
}), r;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function ve(e, t, n) {
|
|
366
366
|
const r = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), s = [];
|
|
367
367
|
return r.forEach((o) => {
|
|
368
368
|
const a = n(o.textContent || "");
|
|
@@ -376,7 +376,7 @@ function Ee(e, t, n) {
|
|
|
376
376
|
});
|
|
377
377
|
}), s;
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Be(e, t = 2) {
|
|
380
380
|
const n = e.filter((i) => i.section).map((i) => i.level), r = n.length > 0 ? n : e.map((i) => i.level);
|
|
381
381
|
if (r.length === 0) return t;
|
|
382
382
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -390,11 +390,11 @@ function ze(e, t = 2) {
|
|
|
390
390
|
(i.count > a || i.count === a && i.firstIndex < c || i.count === a && i.firstIndex === c && l < o) && (o = l, a = i.count, c = i.firstIndex);
|
|
391
391
|
}), P(o, 1, 6);
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function Ke(e) {
|
|
394
394
|
const t = window.getSelection();
|
|
395
395
|
if (!t || t.rangeCount === 0) return null;
|
|
396
396
|
const n = t.getRangeAt(0);
|
|
397
|
-
if (
|
|
397
|
+
if (Se(n.startContainer)?.closest(y) !== e) return null;
|
|
398
398
|
if (n.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
399
399
|
const o = n.startContainer, a = o.childNodes[n.startOffset] || null;
|
|
400
400
|
return { parent: o, referenceNode: a };
|
|
@@ -405,8 +405,8 @@ function Be(e) {
|
|
|
405
405
|
referenceNode: n.startContainer.nextSibling || null
|
|
406
406
|
} : null;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
const s =
|
|
408
|
+
function Ve(e, t, n, r) {
|
|
409
|
+
const s = ve(e, n, r), o = n.orderBySectionId.get(t.id);
|
|
410
410
|
if (typeof o != "number" || s.length === 0)
|
|
411
411
|
return { parent: e, referenceNode: null };
|
|
412
412
|
const a = s.find((i) => typeof i.order == "number" && i.order > o);
|
|
@@ -429,7 +429,7 @@ function Ke(e, t, n, r) {
|
|
|
429
429
|
}
|
|
430
430
|
return { parent: e, referenceNode: null };
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function je(e, t, n, r) {
|
|
433
433
|
const s = e.ownerDocument || document, o = `h${P(r, 1, 6)}`, a = s.createElement(o);
|
|
434
434
|
a.setAttribute("data-doc-schema-section", t.id), a.textContent = t.title;
|
|
435
435
|
const c = s.createElement("p");
|
|
@@ -447,8 +447,8 @@ function V(e, t, n, r = {}) {
|
|
|
447
447
|
function J(e, t, n) {
|
|
448
448
|
return e.replace(/\{section\}/g, t || "").replace(/\{heading\}/g, n || "").trim();
|
|
449
449
|
}
|
|
450
|
-
function
|
|
451
|
-
const r =
|
|
450
|
+
function Ue(e, t, n) {
|
|
451
|
+
const r = ze(e, n.normalizeText), s = [], o = /* @__PURE__ */ new Map(), a = [];
|
|
452
452
|
for (let i = 0; i < r.length && !(s.length >= n.maxIssues); i += 1) {
|
|
453
453
|
const l = r[i];
|
|
454
454
|
if (!l.key) continue;
|
|
@@ -499,8 +499,8 @@ function je(e, t, n) {
|
|
|
499
499
|
if (t.strictOrder && s.length < n.maxIssues) {
|
|
500
500
|
let i = -1;
|
|
501
501
|
for (let l = 0; l < a.length && !(s.length >= n.maxIssues); l += 1) {
|
|
502
|
-
const d = a[l],
|
|
503
|
-
|
|
502
|
+
const d = a[l], S = t.orderBySectionId.get(d.section.id) ?? l;
|
|
503
|
+
S < i ? s.push(
|
|
504
504
|
V(
|
|
505
505
|
"out-of-order",
|
|
506
506
|
"warning",
|
|
@@ -512,7 +512,7 @@ function je(e, t, n) {
|
|
|
512
512
|
suggestion: `Move "${d.section.title}" after earlier required sections.`
|
|
513
513
|
}
|
|
514
514
|
)
|
|
515
|
-
) : i =
|
|
515
|
+
) : i = S;
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
return {
|
|
@@ -562,13 +562,13 @@ function _(e) {
|
|
|
562
562
|
l && (l.textContent = n.labels.helperText);
|
|
563
563
|
const d = t.querySelector(".rte-doc-schema-shortcut");
|
|
564
564
|
d && (d.textContent = n.labels.shortcutText);
|
|
565
|
-
const
|
|
566
|
-
|
|
565
|
+
const S = t.querySelector('[data-action="run-validation"]');
|
|
566
|
+
S && (S.textContent = n.labels.validateText);
|
|
567
567
|
const f = t.querySelector('[data-action="insert-missing"]');
|
|
568
568
|
if (f) {
|
|
569
569
|
f.textContent = n.labels.insertMissingText;
|
|
570
570
|
const h = r.issues.some((x) => x.type === "missing-section");
|
|
571
|
-
f.disabled = !h ||
|
|
571
|
+
f.disabled = !h || Ee(e);
|
|
572
572
|
}
|
|
573
573
|
const k = t.querySelector('[data-action="toggle-realtime"]');
|
|
574
574
|
k && (k.textContent = r.realtimeEnabled ? n.labels.realtimeOnText : n.labels.realtimeOffText, k.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
|
|
@@ -590,7 +590,7 @@ function G(e, t = !1) {
|
|
|
590
590
|
n && (n.classList.remove("show"), F.set(e, !1), D(e), t && e.focus({ preventScroll: !0 }));
|
|
591
591
|
}
|
|
592
592
|
function ae(e) {
|
|
593
|
-
const t =
|
|
593
|
+
const t = We(e);
|
|
594
594
|
b.forEach((r, s) => {
|
|
595
595
|
s !== e && G(s, !1);
|
|
596
596
|
}), t.classList.add("show"), F.set(e, !0), _(e), se(e, t), D(e), t.querySelector('[data-field="schema"]')?.focus(), C(e, "panel-open", !1);
|
|
@@ -599,7 +599,7 @@ function ke(e, t) {
|
|
|
599
599
|
const n = me(e);
|
|
600
600
|
return (typeof t == "boolean" ? t : !n) ? ae(e) : G(e, !1), !0;
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function Ge(e, t) {
|
|
603
603
|
if (t === e.innerHTML) return;
|
|
604
604
|
const n = window.execEditorCommand || window.executeEditorCommand;
|
|
605
605
|
if (typeof n == "function")
|
|
@@ -608,7 +608,7 @@ function Ue(e, t) {
|
|
|
608
608
|
} catch {
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function Fe(e) {
|
|
612
612
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
613
613
|
}
|
|
614
614
|
function C(e, t, n) {
|
|
@@ -624,7 +624,7 @@ function C(e, t, n) {
|
|
|
624
624
|
suggestion: "Set `defaultSchemaId` or update schema options."
|
|
625
625
|
})
|
|
626
626
|
], s.headingCount = 0, s.recognizedHeadingCount = 0, s.missingCount = 1, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), s.issues;
|
|
627
|
-
const i =
|
|
627
|
+
const i = Ue(e, c, r);
|
|
628
628
|
return s.issues = i.issues, s.headingCount = i.headingCount, s.recognizedHeadingCount = i.recognizedHeadingCount, s.missingCount = i.missingCount, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), e.dispatchEvent(
|
|
629
629
|
new CustomEvent("editora:doc-schema-validation", {
|
|
630
630
|
bubbles: !0,
|
|
@@ -657,7 +657,7 @@ function Te(e) {
|
|
|
657
657
|
const t = u.get(e) || w;
|
|
658
658
|
if (!t) return !1;
|
|
659
659
|
const n = g(e, t), r = b.get(e);
|
|
660
|
-
if (
|
|
660
|
+
if (Ee(e))
|
|
661
661
|
return r && ee(r, t.labels.readonlyMessage), !1;
|
|
662
662
|
const s = L(t, n.activeSchemaId);
|
|
663
663
|
if (!s) return !1;
|
|
@@ -669,12 +669,12 @@ function Te(e) {
|
|
|
669
669
|
), a = s.sections.filter((f) => o.includes(f.id));
|
|
670
670
|
if (a.length === 0)
|
|
671
671
|
return r && ee(r, t.labels.noIssuesText), !1;
|
|
672
|
-
const c = e.innerHTML, i =
|
|
672
|
+
const c = e.innerHTML, i = ve(e, s, t.normalizeText), l = Be(i, 2), d = Ke(e);
|
|
673
673
|
a.forEach((f) => {
|
|
674
|
-
const k = s.strictOrder ?
|
|
674
|
+
const k = s.strictOrder ? Ve(e, f, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = je(e, f, t, l);
|
|
675
675
|
k.parent.insertBefore(O, k.referenceNode), k.parent.insertBefore(A, k.referenceNode);
|
|
676
|
-
}),
|
|
677
|
-
const
|
|
676
|
+
}), Ge(e, c), Fe(e), C(e, "insert-missing-post", !0);
|
|
677
|
+
const S = a.map((f) => f.title).join(", ");
|
|
678
678
|
return e.dispatchEvent(
|
|
679
679
|
new CustomEvent("editora:doc-schema-insert-missing", {
|
|
680
680
|
bubbles: !0,
|
|
@@ -683,14 +683,14 @@ function Te(e) {
|
|
|
683
683
|
sectionIds: a.map((f) => f.id)
|
|
684
684
|
}
|
|
685
685
|
})
|
|
686
|
-
), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${
|
|
686
|
+
), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${S}`), !0;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function We(e) {
|
|
689
689
|
const t = b.get(e);
|
|
690
690
|
if (t) return t;
|
|
691
691
|
const n = u.get(e) || w || Z();
|
|
692
692
|
g(e, n);
|
|
693
|
-
const r = `rte-doc-schema-panel-${
|
|
693
|
+
const r = `rte-doc-schema-panel-${Le++}`, s = `${r}-schema`, o = document.createElement("section");
|
|
694
694
|
return o.className = m, o.id = r, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.innerHTML = `
|
|
695
695
|
<header class="rte-doc-schema-header">
|
|
696
696
|
<h2 class="rte-doc-schema-title">${M(n.labels.panelTitle)}</h2>
|
|
@@ -744,62 +744,65 @@ function Fe(e) {
|
|
|
744
744
|
a.key === "Escape" && (a.preventDefault(), G(e, !0));
|
|
745
745
|
}), oe(o, e), document.body.appendChild(o), b.set(e, o), F.set(e, !1), _(e), o;
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
|
|
749
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
747
|
+
function Ie(e) {
|
|
748
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
750
749
|
}
|
|
751
750
|
function Ye(e) {
|
|
752
|
-
const t = e
|
|
753
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "
|
|
751
|
+
const t = Ie(e);
|
|
752
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
|
|
754
753
|
}
|
|
755
754
|
function Je(e) {
|
|
755
|
+
const t = Ie(e);
|
|
756
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "j";
|
|
757
|
+
}
|
|
758
|
+
function Xe(e) {
|
|
756
759
|
w = e, q || (q = (t) => {
|
|
757
760
|
Q();
|
|
758
|
-
const r = t.target?.closest(
|
|
761
|
+
const r = t.target?.closest(y);
|
|
759
762
|
if (!r) return;
|
|
760
763
|
const s = u.get(r) || e;
|
|
761
764
|
g(r, s), u.set(r, s), p = r, D(r);
|
|
762
765
|
const o = b.get(r);
|
|
763
766
|
o && (oe(o, r), se(r, o), _(r));
|
|
764
767
|
}, document.addEventListener("focusin", q, !0)), z || (z = (t) => {
|
|
765
|
-
const r = t.target?.closest(
|
|
768
|
+
const r = t.target?.closest(y);
|
|
766
769
|
if (!r) return;
|
|
767
770
|
const s = u.get(r) || w;
|
|
768
771
|
!s || !g(r, s).realtimeEnabled || $e(r);
|
|
769
772
|
}, document.addEventListener("input", z, !0)), B || (B = (t) => {
|
|
770
773
|
if (t.defaultPrevented || t.target?.closest(`.${m}`) && t.key !== "Escape") return;
|
|
771
|
-
const r =
|
|
774
|
+
const r = qe(t);
|
|
772
775
|
if (!r) return;
|
|
773
776
|
const s = u.get(r) || w || e;
|
|
774
777
|
if (g(r, s), u.set(r, s), p = r, t.key === "Escape" && me(r)) {
|
|
775
778
|
t.preventDefault(), G(r, !0);
|
|
776
779
|
return;
|
|
777
780
|
}
|
|
778
|
-
if (
|
|
781
|
+
if (Ye(t)) {
|
|
779
782
|
t.preventDefault(), t.stopPropagation(), ke(r);
|
|
780
783
|
return;
|
|
781
784
|
}
|
|
782
|
-
|
|
785
|
+
Je(t) && (t.preventDefault(), t.stopPropagation(), C(r, "shortcut", !0));
|
|
783
786
|
}, document.addEventListener("keydown", B, !0)), R || (R = () => {
|
|
784
787
|
Q(), b.forEach((t, n) => {
|
|
785
788
|
!n.isConnected || !t.isConnected || (oe(t, n), se(n, t));
|
|
786
789
|
});
|
|
787
790
|
}, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !K && typeof MutationObserver < "u" && document.body && (K = new MutationObserver((t) => {
|
|
788
|
-
|
|
791
|
+
_e(t) && Q();
|
|
789
792
|
}), K.observe(document.body, {
|
|
790
793
|
childList: !0,
|
|
791
794
|
subtree: !0
|
|
792
795
|
}));
|
|
793
796
|
}
|
|
794
|
-
function
|
|
797
|
+
function Ze() {
|
|
795
798
|
q && (document.removeEventListener("focusin", q, !0), q = null), z && (document.removeEventListener("input", z, !0), z = null), B && (document.removeEventListener("keydown", B, !0), B = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), K && (K.disconnect(), K = null), b.forEach((t) => t.remove()), b.clear(), Array.from(ne).forEach((t) => ue(t)), w = null, p = null;
|
|
796
799
|
}
|
|
797
|
-
function
|
|
800
|
+
function Qe() {
|
|
798
801
|
if (typeof document > "u" || document.getElementById(he)) return;
|
|
799
802
|
const e = document.createElement("style");
|
|
800
803
|
e.id = he, e.textContent = `
|
|
801
|
-
.rte-toolbar-group-items.${
|
|
802
|
-
.editora-toolbar-group-items.${
|
|
804
|
+
.rte-toolbar-group-items.${E},
|
|
805
|
+
.editora-toolbar-group-items.${E},
|
|
803
806
|
.rte-toolbar-group-items.${T},
|
|
804
807
|
.editora-toolbar-group-items.${T},
|
|
805
808
|
.rte-toolbar-group-items.${H},
|
|
@@ -810,8 +813,8 @@ function Ze() {
|
|
|
810
813
|
background: #ffffff;
|
|
811
814
|
}
|
|
812
815
|
|
|
813
|
-
.rte-toolbar-group-items.${
|
|
814
|
-
.editora-toolbar-group-items.${
|
|
816
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
817
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-button,
|
|
815
818
|
.rte-toolbar-group-items.${T} .rte-toolbar-button,
|
|
816
819
|
.editora-toolbar-group-items.${T} .editora-toolbar-button,
|
|
817
820
|
.rte-toolbar-group-items.${H} .rte-toolbar-button,
|
|
@@ -821,8 +824,8 @@ function Ze() {
|
|
|
821
824
|
border-radius: 0;
|
|
822
825
|
}
|
|
823
826
|
|
|
824
|
-
.rte-toolbar-group-items.${
|
|
825
|
-
.editora-toolbar-group-items.${
|
|
827
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
828
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
826
829
|
.rte-toolbar-group-items.${T} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
827
830
|
.editora-toolbar-group-items.${T} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
828
831
|
.rte-toolbar-group-items.${H} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
@@ -830,27 +833,27 @@ function Ze() {
|
|
|
830
833
|
border-right: none;
|
|
831
834
|
}
|
|
832
835
|
|
|
833
|
-
${
|
|
834
|
-
${
|
|
835
|
-
${
|
|
836
|
-
${
|
|
837
|
-
${
|
|
838
|
-
${
|
|
836
|
+
${v} .rte-toolbar-group-items.${E},
|
|
837
|
+
${v} .editora-toolbar-group-items.${E},
|
|
838
|
+
${v} .rte-toolbar-group-items.${T},
|
|
839
|
+
${v} .editora-toolbar-group-items.${T},
|
|
840
|
+
${v} .rte-toolbar-group-items.${H},
|
|
841
|
+
${v} .editora-toolbar-group-items.${H} {
|
|
839
842
|
border-color: #566275;
|
|
840
843
|
}
|
|
841
844
|
.rte-toolbar-button[data-command="toggleDocSchemaRealtime"].active,
|
|
842
845
|
.editora-toolbar-button[data-command="toggleDocSchemaRealtime"].active {
|
|
843
846
|
background-color: #ccc;
|
|
844
847
|
}
|
|
845
|
-
${
|
|
846
|
-
${
|
|
847
|
-
${
|
|
848
|
-
${
|
|
848
|
+
${v} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
|
|
849
|
+
${v} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
|
|
850
|
+
${v} .rte-toolbar-group-items.${T} .rte-toolbar-button svg,
|
|
851
|
+
${v} .editora-toolbar-group-items.${T} .editora-toolbar-button svg
|
|
849
852
|
{
|
|
850
853
|
fill: none;
|
|
851
854
|
}
|
|
852
|
-
${
|
|
853
|
-
${
|
|
855
|
+
${v} .rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
856
|
+
${v} .editora-toolbar-group-items.${E} .editora-toolbar-button
|
|
854
857
|
{
|
|
855
858
|
border-color: #566275;
|
|
856
859
|
}
|
|
@@ -1168,9 +1171,9 @@ function Ze() {
|
|
|
1168
1171
|
}
|
|
1169
1172
|
`, document.head.appendChild(e);
|
|
1170
1173
|
}
|
|
1171
|
-
const
|
|
1174
|
+
const et = (e = {}) => {
|
|
1172
1175
|
const t = Z(e), n = /* @__PURE__ */ new Set();
|
|
1173
|
-
return
|
|
1176
|
+
return Qe(), {
|
|
1174
1177
|
name: "docSchema",
|
|
1175
1178
|
toolbar: [
|
|
1176
1179
|
{
|
|
@@ -1250,7 +1253,7 @@ const Qe = (e = {}) => {
|
|
|
1250
1253
|
setDocSchemaOptions: (r, s) => {
|
|
1251
1254
|
const o = I(s, !1, !1);
|
|
1252
1255
|
if (!o || !r || typeof r != "object") return !1;
|
|
1253
|
-
const a = u.get(o) || t, c = X.get(o) ||
|
|
1256
|
+
const a = u.get(o) || t, c = X.get(o) || Re(a), i = {
|
|
1254
1257
|
...c,
|
|
1255
1258
|
...r,
|
|
1256
1259
|
labels: {
|
|
@@ -1292,7 +1295,7 @@ const Qe = (e = {}) => {
|
|
|
1292
1295
|
init: function(s) {
|
|
1293
1296
|
W += 1;
|
|
1294
1297
|
const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Z(o);
|
|
1295
|
-
|
|
1298
|
+
Xe(a);
|
|
1296
1299
|
const c = I(
|
|
1297
1300
|
s?.editorElement ? { editorElement: s.editorElement } : void 0,
|
|
1298
1301
|
!1,
|
|
@@ -1301,10 +1304,10 @@ const Qe = (e = {}) => {
|
|
|
1301
1304
|
c && (p = c, n.add(c), g(c, a), u.set(c, a), X.set(c, o), D(c), C(c, "init", !0));
|
|
1302
1305
|
},
|
|
1303
1306
|
destroy: () => {
|
|
1304
|
-
n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) &&
|
|
1307
|
+
n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) && Ze();
|
|
1305
1308
|
}
|
|
1306
1309
|
};
|
|
1307
1310
|
};
|
|
1308
1311
|
export {
|
|
1309
|
-
|
|
1312
|
+
et as DocSchemaPlugin
|
|
1310
1313
|
};
|