@editora/plugins 1.0.10 → 1.0.11
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +501 -506
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
package/dist/doc-schema.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const S = ".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",
|
|
1
|
+
const S = ".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", v = "document-schema", T = "doc-schema", H = "docSchema", E = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Me = {
|
|
2
2
|
panelTitle: "Document Schema",
|
|
3
3
|
panelAriaLabel: "Document schema panel",
|
|
4
4
|
schemaLabel: "Schema",
|
|
@@ -21,7 +21,7 @@ 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, Ae = 0, ge = 0, w = null, p = null, q = null, z = null, B = null,
|
|
24
|
+
let W = 0, Ae = 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
|
}
|
|
@@ -31,7 +31,7 @@ function Le(e) {
|
|
|
31
31
|
function P(e, t, n) {
|
|
32
32
|
return Number.isFinite(e) ? Math.max(t, Math.min(n, e)) : t;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function xe(e) {
|
|
35
35
|
return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
36
36
|
}
|
|
37
37
|
function ce(e, t) {
|
|
@@ -87,51 +87,47 @@ function pe() {
|
|
|
87
87
|
}
|
|
88
88
|
function Oe(e, t, n) {
|
|
89
89
|
const r = n(e.title || "");
|
|
90
|
-
if (!r)
|
|
91
|
-
|
|
92
|
-
const s = ye(n(e.id || r)) || `section-${t + 1}`, o = P(Number(e.minOccurrences ?? 1), 0, 20), a = Math.max(1, o), l = P(Number(e.maxOccurrences ?? a), o, 40), c = n(e.placeholder || ""), i = Array.isArray(e.aliases) ? e.aliases.map((x) => n(x)).filter(Boolean) : [], d = [r, ...i].map((x) => ce(x, n)).filter(Boolean);
|
|
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((y) => n(y)).filter(Boolean) : [], d = [r, ...l].map((y) => ce(y, n)).filter(Boolean);
|
|
93
92
|
return {
|
|
94
93
|
id: s,
|
|
95
94
|
title: r,
|
|
96
95
|
minOccurrences: o,
|
|
97
|
-
maxOccurrences:
|
|
98
|
-
placeholder:
|
|
96
|
+
maxOccurrences: c,
|
|
97
|
+
placeholder: i,
|
|
99
98
|
matchKeys: Array.from(new Set(d))
|
|
100
99
|
};
|
|
101
100
|
}
|
|
102
101
|
function Se(e, t) {
|
|
103
102
|
const n = Array.isArray(e) && e.length > 0 ? e : pe(), r = [], s = /* @__PURE__ */ new Set();
|
|
104
103
|
return n.forEach((o, a) => {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return;
|
|
118
|
-
let N = y.id, Ie = 1;
|
|
104
|
+
const c = t(o.label || "");
|
|
105
|
+
if (!c) return;
|
|
106
|
+
const i = xe(t(o.id || c)) || `schema-${a + 1}`;
|
|
107
|
+
let l = i, d = 1;
|
|
108
|
+
for (; s.has(l); )
|
|
109
|
+
l = `${i}-${d++}`;
|
|
110
|
+
s.add(l);
|
|
111
|
+
const y = Array.isArray(o.sections) ? o.sections : [], f = [], k = /* @__PURE__ */ new Set();
|
|
112
|
+
if (y.forEach(($, h) => {
|
|
113
|
+
const x = Oe($, h, t);
|
|
114
|
+
if (!x) return;
|
|
115
|
+
let N = x.id, Ie = 1;
|
|
119
116
|
for (; k.has(N); )
|
|
120
|
-
N = `${
|
|
117
|
+
N = `${x.id}-${Ie++}`;
|
|
121
118
|
k.add(N), f.push({
|
|
122
|
-
...
|
|
119
|
+
...x,
|
|
123
120
|
id: N
|
|
124
121
|
});
|
|
125
|
-
}), f.length === 0)
|
|
126
|
-
return;
|
|
122
|
+
}), f.length === 0) return;
|
|
127
123
|
const O = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
|
|
128
124
|
f.forEach(($, h) => {
|
|
129
|
-
A.set($.id, h), $.matchKeys.forEach((
|
|
130
|
-
O.has(
|
|
125
|
+
A.set($.id, h), $.matchKeys.forEach((x) => {
|
|
126
|
+
O.has(x) || O.set(x, $);
|
|
131
127
|
});
|
|
132
128
|
}), r.push({
|
|
133
|
-
id:
|
|
134
|
-
label:
|
|
129
|
+
id: l,
|
|
130
|
+
label: c,
|
|
135
131
|
description: t(o.description || ""),
|
|
136
132
|
strictOrder: o.strictOrder !== !1,
|
|
137
133
|
allowUnknownHeadings: !!o.allowUnknownHeadings,
|
|
@@ -142,8 +138,7 @@ function Se(e, t) {
|
|
|
142
138
|
}), r.length > 0 ? r : Se(pe(), t);
|
|
143
139
|
}
|
|
144
140
|
function Z(e = {}) {
|
|
145
|
-
|
|
146
|
-
const t = e.normalizeText || Le, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((a) => a.id === r) ? r : ((o = n[0]) == null ? void 0 : o.id) || null;
|
|
141
|
+
const t = e.normalizeText || Le, n = Se(e.schemas, t), r = t(e.defaultSchemaId || ""), s = n.some((o) => o.id === r) ? r : n[0]?.id || null;
|
|
147
142
|
return {
|
|
148
143
|
schemas: n,
|
|
149
144
|
defaultSchemaId: s,
|
|
@@ -157,7 +152,7 @@ function Z(e = {}) {
|
|
|
157
152
|
normalizeText: t
|
|
158
153
|
};
|
|
159
154
|
}
|
|
160
|
-
function
|
|
155
|
+
function He(e) {
|
|
161
156
|
return {
|
|
162
157
|
schemas: e.schemas.map((t) => ({
|
|
163
158
|
id: t.id,
|
|
@@ -185,28 +180,22 @@ function le(e) {
|
|
|
185
180
|
return e.closest(ie) || e;
|
|
186
181
|
}
|
|
187
182
|
function U(e) {
|
|
188
|
-
if (!e)
|
|
189
|
-
|
|
190
|
-
if (e.matches(S))
|
|
191
|
-
return e;
|
|
183
|
+
if (!e) return null;
|
|
184
|
+
if (e.matches(S)) return e;
|
|
192
185
|
const t = e.querySelector(S);
|
|
193
186
|
return t instanceof HTMLElement ? t : null;
|
|
194
187
|
}
|
|
195
|
-
function
|
|
196
|
-
if (typeof window > "u")
|
|
197
|
-
return null;
|
|
188
|
+
function Re() {
|
|
189
|
+
if (typeof window > "u") return null;
|
|
198
190
|
const e = window[fe];
|
|
199
|
-
if (!(e instanceof HTMLElement))
|
|
200
|
-
return null;
|
|
191
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
201
192
|
window[fe] = null;
|
|
202
193
|
const t = U(e);
|
|
203
|
-
if (t)
|
|
204
|
-
return t;
|
|
194
|
+
if (t) return t;
|
|
205
195
|
const n = e.closest(ie);
|
|
206
196
|
if (n) {
|
|
207
197
|
const s = U(n);
|
|
208
|
-
if (s)
|
|
209
|
-
return s;
|
|
198
|
+
if (s) return s;
|
|
210
199
|
}
|
|
211
200
|
const r = e.closest(S);
|
|
212
201
|
return r instanceof HTMLElement ? r : null;
|
|
@@ -223,7 +212,7 @@ function De(e) {
|
|
|
223
212
|
}
|
|
224
213
|
return le(e);
|
|
225
214
|
}
|
|
226
|
-
function
|
|
215
|
+
function ye(e) {
|
|
227
216
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
228
217
|
}
|
|
229
218
|
function Y(e) {
|
|
@@ -231,8 +220,7 @@ function Y(e) {
|
|
|
231
220
|
}
|
|
232
221
|
function Ne(e) {
|
|
233
222
|
const t = le(e);
|
|
234
|
-
if (Y(t))
|
|
235
|
-
return !0;
|
|
223
|
+
if (Y(t)) return !0;
|
|
236
224
|
const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
237
225
|
return Y(n) ? !0 : Y(document.documentElement) || Y(document.body);
|
|
238
226
|
}
|
|
@@ -240,16 +228,14 @@ function oe(e, t) {
|
|
|
240
228
|
e.classList.remove("rte-doc-schema-theme-dark"), Ne(t) && e.classList.add("rte-doc-schema-theme-dark");
|
|
241
229
|
}
|
|
242
230
|
function Pe(e) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const i = c;
|
|
252
|
-
if ((t = i.matches) != null && t.call(i, S) || (n = i.matches) != null && n.call(i, `.${m}`) || (r = i.querySelector) != null && r.call(i, S) || (s = i.querySelector) != null && s.call(i, `.${m}`))
|
|
231
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
232
|
+
const n = e[t];
|
|
233
|
+
if (!(n.type !== "childList" || n.removedNodes.length === 0))
|
|
234
|
+
for (let r = 0; r < n.removedNodes.length; r += 1) {
|
|
235
|
+
const s = n.removedNodes[r];
|
|
236
|
+
if (s.nodeType !== Node.ELEMENT_NODE) continue;
|
|
237
|
+
const o = s;
|
|
238
|
+
if (o.matches?.(S) || o.matches?.(`.${m}`) || o.querySelector?.(S) || o.querySelector?.(`.${m}`))
|
|
253
239
|
return !0;
|
|
254
240
|
}
|
|
255
241
|
}
|
|
@@ -261,37 +247,29 @@ function Q() {
|
|
|
261
247
|
});
|
|
262
248
|
}
|
|
263
249
|
function I(e, t = !0, n = !0) {
|
|
264
|
-
|
|
265
|
-
if (
|
|
266
|
-
return e.contentElement;
|
|
267
|
-
if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
|
|
250
|
+
if (Q(), e?.contentElement instanceof HTMLElement) return e.contentElement;
|
|
251
|
+
if (e?.editorElement instanceof HTMLElement) {
|
|
268
252
|
const c = U(e.editorElement);
|
|
269
|
-
if (c)
|
|
270
|
-
return c;
|
|
253
|
+
if (c) return c;
|
|
271
254
|
}
|
|
272
|
-
const r =
|
|
273
|
-
if (r)
|
|
274
|
-
return r;
|
|
255
|
+
const r = Re();
|
|
256
|
+
if (r) return r;
|
|
275
257
|
const s = window.getSelection();
|
|
276
258
|
if (s && s.rangeCount > 0) {
|
|
277
|
-
const c = (
|
|
259
|
+
const c = ye(s.getRangeAt(0).startContainer)?.closest(
|
|
278
260
|
S
|
|
279
261
|
);
|
|
280
|
-
if (c)
|
|
281
|
-
return c;
|
|
262
|
+
if (c) return c;
|
|
282
263
|
}
|
|
283
264
|
const o = document.activeElement;
|
|
284
265
|
if (o) {
|
|
285
|
-
if (o.matches(S))
|
|
286
|
-
return o;
|
|
266
|
+
if (o.matches(S)) return o;
|
|
287
267
|
const c = o.closest(S);
|
|
288
|
-
if (c)
|
|
289
|
-
return c;
|
|
268
|
+
if (c) return c;
|
|
290
269
|
}
|
|
291
270
|
if (n && p && p.isConnected)
|
|
292
271
|
return p;
|
|
293
|
-
if (!t)
|
|
294
|
-
return null;
|
|
272
|
+
if (!t) return null;
|
|
295
273
|
const a = document.querySelector(S);
|
|
296
274
|
return a instanceof HTMLElement ? a : null;
|
|
297
275
|
}
|
|
@@ -301,24 +279,20 @@ function _e(e) {
|
|
|
301
279
|
const r = t.closest(`.${m}`);
|
|
302
280
|
if (r) {
|
|
303
281
|
const o = Array.from(b.entries()).find(([, a]) => a === r);
|
|
304
|
-
if (o)
|
|
305
|
-
return o[0];
|
|
282
|
+
if (o) return o[0];
|
|
306
283
|
}
|
|
307
284
|
const s = t.closest(S);
|
|
308
|
-
if (s)
|
|
309
|
-
return s;
|
|
285
|
+
if (s) return s;
|
|
310
286
|
}
|
|
311
287
|
const n = document.activeElement;
|
|
312
288
|
if (n) {
|
|
313
289
|
const r = n.closest(`.${m}`);
|
|
314
290
|
if (r) {
|
|
315
291
|
const o = Array.from(b.entries()).find(([, a]) => a === r);
|
|
316
|
-
if (o)
|
|
317
|
-
return o[0];
|
|
292
|
+
if (o) return o[0];
|
|
318
293
|
}
|
|
319
294
|
const s = n.closest(S);
|
|
320
|
-
if (s)
|
|
321
|
-
return s;
|
|
295
|
+
if (s) return s;
|
|
322
296
|
}
|
|
323
297
|
return null;
|
|
324
298
|
}
|
|
@@ -340,8 +314,7 @@ function L(e, t) {
|
|
|
340
314
|
return t && e.schemas.find((n) => n.id === t) || null;
|
|
341
315
|
}
|
|
342
316
|
function re(e) {
|
|
343
|
-
|
|
344
|
-
return e.defaultSchemaId || ((t = e.schemas[0]) == null ? void 0 : t.id) || null;
|
|
317
|
+
return e.defaultSchemaId || e.schemas[0]?.id || null;
|
|
345
318
|
}
|
|
346
319
|
function g(e, t) {
|
|
347
320
|
u.has(e) || u.set(e, t);
|
|
@@ -358,18 +331,16 @@ function g(e, t) {
|
|
|
358
331
|
}, j.set(e, n)), (!n.activeSchemaId || !L(t, n.activeSchemaId)) && (n.activeSchemaId = re(t)), ne.add(e), n;
|
|
359
332
|
}
|
|
360
333
|
function ue(e) {
|
|
361
|
-
|
|
362
|
-
de(e), (t = b.get(e)) == null || t.remove(), b.delete(e), F.delete(e), u.delete(e), X.delete(e), j.delete(e), ne.delete(e), p === e && (p = null);
|
|
334
|
+
de(e), b.get(e)?.remove(), b.delete(e), F.delete(e), u.delete(e), X.delete(e), j.delete(e), ne.delete(e), p === e && (p = null);
|
|
363
335
|
}
|
|
364
336
|
function me(e) {
|
|
365
337
|
return F.get(e) === !0;
|
|
366
338
|
}
|
|
367
|
-
function
|
|
339
|
+
function ve(e) {
|
|
368
340
|
return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
|
|
369
341
|
}
|
|
370
342
|
function se(e, t) {
|
|
371
|
-
if (!t.classList.contains("show"))
|
|
372
|
-
return;
|
|
343
|
+
if (!t.classList.contains("show")) return;
|
|
373
344
|
const n = le(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 440), s = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, n.right - r), s), a = Math.max(10, Math.min(window.innerHeight - 10, n.top + 12));
|
|
374
345
|
t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${a}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
|
|
375
346
|
}
|
|
@@ -381,58 +352,52 @@ function qe(e, t) {
|
|
|
381
352
|
const n = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), r = [];
|
|
382
353
|
return n.forEach((s, o) => {
|
|
383
354
|
const a = t(s.textContent || "");
|
|
384
|
-
if (!a)
|
|
385
|
-
|
|
386
|
-
const l = Number(s.tagName.slice(1)) || 0, c = ce(a, t);
|
|
355
|
+
if (!a) return;
|
|
356
|
+
const c = Number(s.tagName.slice(1)) || 0, i = ce(a, t);
|
|
387
357
|
r.push({
|
|
388
358
|
text: a,
|
|
389
|
-
key:
|
|
359
|
+
key: i,
|
|
390
360
|
index: o,
|
|
391
|
-
level:
|
|
361
|
+
level: c
|
|
392
362
|
});
|
|
393
363
|
}), r;
|
|
394
364
|
}
|
|
395
|
-
function
|
|
365
|
+
function Ee(e, t, n) {
|
|
396
366
|
const r = Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")), s = [];
|
|
397
367
|
return r.forEach((o) => {
|
|
398
368
|
const a = n(o.textContent || "");
|
|
399
|
-
if (!a)
|
|
400
|
-
|
|
401
|
-
const l = ce(a, n), c = l && t.matchKeyToSection.get(l) || null, i = c ? t.orderBySectionId.get(c.id) ?? null : null, d = P(Number(o.tagName.slice(1)) || 0, 1, 6);
|
|
369
|
+
if (!a) return;
|
|
370
|
+
const c = ce(a, n), i = c && t.matchKeyToSection.get(c) || null, l = i ? t.orderBySectionId.get(i.id) ?? null : null, d = P(Number(o.tagName.slice(1)) || 0, 1, 6);
|
|
402
371
|
s.push({
|
|
403
372
|
element: o,
|
|
404
373
|
level: d,
|
|
405
|
-
section:
|
|
406
|
-
order:
|
|
374
|
+
section: i,
|
|
375
|
+
order: l
|
|
407
376
|
});
|
|
408
377
|
}), s;
|
|
409
378
|
}
|
|
410
379
|
function ze(e, t = 2) {
|
|
411
|
-
const n = e.filter((
|
|
412
|
-
if (r.length === 0)
|
|
413
|
-
return t;
|
|
380
|
+
const n = e.filter((i) => i.section).map((i) => i.level), r = n.length > 0 ? n : e.map((i) => i.level);
|
|
381
|
+
if (r.length === 0) return t;
|
|
414
382
|
const s = /* @__PURE__ */ new Map();
|
|
415
|
-
r.forEach((
|
|
416
|
-
s.has(
|
|
417
|
-
const d = s.get(
|
|
383
|
+
r.forEach((i, l) => {
|
|
384
|
+
s.has(i) || s.set(i, { count: 0, firstIndex: l });
|
|
385
|
+
const d = s.get(i);
|
|
418
386
|
d.count += 1;
|
|
419
387
|
});
|
|
420
|
-
let o = t, a = -1,
|
|
421
|
-
return s.forEach((
|
|
422
|
-
(
|
|
388
|
+
let o = t, a = -1, c = Number.MAX_SAFE_INTEGER;
|
|
389
|
+
return s.forEach((i, l) => {
|
|
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);
|
|
423
391
|
}), P(o, 1, 6);
|
|
424
392
|
}
|
|
425
393
|
function Be(e) {
|
|
426
|
-
var o;
|
|
427
394
|
const t = window.getSelection();
|
|
428
|
-
if (!t || t.rangeCount === 0)
|
|
429
|
-
return null;
|
|
395
|
+
if (!t || t.rangeCount === 0) return null;
|
|
430
396
|
const n = t.getRangeAt(0);
|
|
431
|
-
if ((
|
|
432
|
-
return null;
|
|
397
|
+
if (ye(n.startContainer)?.closest(S) !== e) return null;
|
|
433
398
|
if (n.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
434
|
-
const
|
|
435
|
-
return { parent:
|
|
399
|
+
const o = n.startContainer, a = o.childNodes[n.startOffset] || null;
|
|
400
|
+
return { parent: o, referenceNode: a };
|
|
436
401
|
}
|
|
437
402
|
const s = n.startContainer.parentNode;
|
|
438
403
|
return s ? {
|
|
@@ -441,8 +406,7 @@ function Be(e) {
|
|
|
441
406
|
} : null;
|
|
442
407
|
}
|
|
443
408
|
function Ke(e, t, n, r) {
|
|
444
|
-
|
|
445
|
-
const s = ve(e, n, r), o = n.orderBySectionId.get(t.id);
|
|
409
|
+
const s = Ee(e, n, r), o = n.orderBySectionId.get(t.id);
|
|
446
410
|
if (typeof o != "number" || s.length === 0)
|
|
447
411
|
return { parent: e, referenceNode: null };
|
|
448
412
|
const a = s.find((i) => typeof i.order == "number" && i.order > o);
|
|
@@ -451,15 +415,15 @@ function Ke(e, t, n, r) {
|
|
|
451
415
|
parent: a.element.parentNode,
|
|
452
416
|
referenceNode: a.element
|
|
453
417
|
};
|
|
454
|
-
let
|
|
418
|
+
let c = -1;
|
|
455
419
|
for (let i = 0; i < s.length; i += 1) {
|
|
456
|
-
const
|
|
457
|
-
typeof
|
|
420
|
+
const l = s[i];
|
|
421
|
+
typeof l.order == "number" && l.order < o && (c = i);
|
|
458
422
|
}
|
|
459
|
-
if (
|
|
460
|
-
const i =
|
|
423
|
+
if (c >= 0) {
|
|
424
|
+
const i = s[c + 1]?.element || null;
|
|
461
425
|
return {
|
|
462
|
-
parent:
|
|
426
|
+
parent: i?.parentNode || s[c].element.parentNode || e,
|
|
463
427
|
referenceNode: i
|
|
464
428
|
};
|
|
465
429
|
}
|
|
@@ -468,8 +432,8 @@ function Ke(e, t, n, r) {
|
|
|
468
432
|
function Ve(e, t, n, r) {
|
|
469
433
|
const s = e.ownerDocument || document, o = `h${P(r, 1, 6)}`, a = s.createElement(o);
|
|
470
434
|
a.setAttribute("data-doc-schema-section", t.id), a.textContent = t.title;
|
|
471
|
-
const
|
|
472
|
-
return
|
|
435
|
+
const c = s.createElement("p");
|
|
436
|
+
return c.textContent = t.placeholder || n.labels.defaultPlaceholderText, [a, c];
|
|
473
437
|
}
|
|
474
438
|
function V(e, t, n, r = {}) {
|
|
475
439
|
return ge += 1, {
|
|
@@ -485,59 +449,58 @@ function J(e, t, n) {
|
|
|
485
449
|
}
|
|
486
450
|
function je(e, t, n) {
|
|
487
451
|
const r = qe(e, n.normalizeText), s = [], o = /* @__PURE__ */ new Map(), a = [];
|
|
488
|
-
for (let
|
|
489
|
-
const
|
|
490
|
-
if (!
|
|
491
|
-
|
|
492
|
-
const d = t.matchKeyToSection.get(i.key);
|
|
452
|
+
for (let i = 0; i < r.length && !(s.length >= n.maxIssues); i += 1) {
|
|
453
|
+
const l = r[i];
|
|
454
|
+
if (!l.key) continue;
|
|
455
|
+
const d = t.matchKeyToSection.get(l.key);
|
|
493
456
|
if (d) {
|
|
494
|
-
o.set(d.id, (o.get(d.id) || 0) + 1), a.push({ section: d, heading:
|
|
457
|
+
o.set(d.id, (o.get(d.id) || 0) + 1), a.push({ section: d, heading: l });
|
|
495
458
|
continue;
|
|
496
459
|
}
|
|
497
460
|
t.allowUnknownHeadings || s.push(
|
|
498
461
|
V(
|
|
499
462
|
"unknown-heading",
|
|
500
463
|
"warning",
|
|
501
|
-
J(n.labels.unknownHeadingMessage, null,
|
|
464
|
+
J(n.labels.unknownHeadingMessage, null, l.text),
|
|
502
465
|
{
|
|
503
|
-
headingText:
|
|
466
|
+
headingText: l.text,
|
|
504
467
|
suggestion: "Map this heading to a schema alias or remove it from strict structure mode."
|
|
505
468
|
}
|
|
506
469
|
)
|
|
507
470
|
);
|
|
508
471
|
}
|
|
509
|
-
let
|
|
510
|
-
for (let
|
|
511
|
-
const
|
|
512
|
-
d <
|
|
472
|
+
let c = 0;
|
|
473
|
+
for (let i = 0; i < t.sections.length && !(s.length >= n.maxIssues); i += 1) {
|
|
474
|
+
const l = t.sections[i], d = o.get(l.id) || 0;
|
|
475
|
+
d < l.minOccurrences && (c += 1, s.push(
|
|
513
476
|
V(
|
|
514
477
|
"missing-section",
|
|
515
478
|
"error",
|
|
516
|
-
J(n.labels.missingSectionMessage,
|
|
479
|
+
J(n.labels.missingSectionMessage, l.title, null),
|
|
517
480
|
{
|
|
518
|
-
sectionId:
|
|
519
|
-
sectionTitle:
|
|
520
|
-
suggestion: `Add heading "${
|
|
481
|
+
sectionId: l.id,
|
|
482
|
+
sectionTitle: l.title,
|
|
483
|
+
suggestion: `Add heading "${l.title}" to satisfy schema requirements.`
|
|
521
484
|
}
|
|
522
485
|
)
|
|
523
|
-
)), d >
|
|
486
|
+
)), d > l.maxOccurrences && s.length < n.maxIssues && s.push(
|
|
524
487
|
V(
|
|
525
488
|
"duplicate-section",
|
|
526
489
|
"warning",
|
|
527
|
-
J(n.labels.duplicateSectionMessage,
|
|
490
|
+
J(n.labels.duplicateSectionMessage, l.title, null),
|
|
528
491
|
{
|
|
529
|
-
sectionId:
|
|
530
|
-
sectionTitle:
|
|
531
|
-
suggestion: `Keep at most ${
|
|
492
|
+
sectionId: l.id,
|
|
493
|
+
sectionTitle: l.title,
|
|
494
|
+
suggestion: `Keep at most ${l.maxOccurrences} instance(s) of "${l.title}".`
|
|
532
495
|
}
|
|
533
496
|
)
|
|
534
497
|
);
|
|
535
498
|
}
|
|
536
499
|
if (t.strictOrder && s.length < n.maxIssues) {
|
|
537
|
-
let
|
|
538
|
-
for (let
|
|
539
|
-
const d = a[
|
|
540
|
-
|
|
500
|
+
let i = -1;
|
|
501
|
+
for (let l = 0; l < a.length && !(s.length >= n.maxIssues); l += 1) {
|
|
502
|
+
const d = a[l], y = t.orderBySectionId.get(d.section.id) ?? l;
|
|
503
|
+
y < i ? s.push(
|
|
541
504
|
V(
|
|
542
505
|
"out-of-order",
|
|
543
506
|
"warning",
|
|
@@ -549,65 +512,63 @@ function je(e, t, n) {
|
|
|
549
512
|
suggestion: `Move "${d.section.title}" after earlier required sections.`
|
|
550
513
|
}
|
|
551
514
|
)
|
|
552
|
-
) :
|
|
515
|
+
) : i = y;
|
|
553
516
|
}
|
|
554
517
|
}
|
|
555
518
|
return {
|
|
556
519
|
issues: s,
|
|
557
520
|
headingCount: r.length,
|
|
558
521
|
recognizedHeadingCount: a.length,
|
|
559
|
-
missingCount:
|
|
522
|
+
missingCount: c
|
|
560
523
|
};
|
|
561
524
|
}
|
|
562
525
|
function we(e) {
|
|
563
|
-
const t = u.get(e) || w, n = j.get(e), r = t ? L(t,
|
|
526
|
+
const t = u.get(e) || w, n = j.get(e), r = t ? L(t, n?.activeSchemaId || null) : null;
|
|
564
527
|
return {
|
|
565
|
-
activeSchemaId:
|
|
566
|
-
activeSchemaLabel:
|
|
567
|
-
realtimeEnabled:
|
|
568
|
-
issues: n
|
|
569
|
-
headingCount:
|
|
570
|
-
recognizedHeadingCount:
|
|
571
|
-
missingCount:
|
|
572
|
-
lastRunAt:
|
|
528
|
+
activeSchemaId: n?.activeSchemaId || null,
|
|
529
|
+
activeSchemaLabel: r?.label || null,
|
|
530
|
+
realtimeEnabled: n?.realtimeEnabled === !0,
|
|
531
|
+
issues: n?.issues ? n.issues.map((s) => ({ ...s })) : [],
|
|
532
|
+
headingCount: n?.headingCount || 0,
|
|
533
|
+
recognizedHeadingCount: n?.recognizedHeadingCount || 0,
|
|
534
|
+
missingCount: n?.missingCount || 0,
|
|
535
|
+
lastRunAt: n?.lastRunAt || null
|
|
573
536
|
};
|
|
574
537
|
}
|
|
575
538
|
function D(e) {
|
|
576
539
|
const t = j.get(e);
|
|
577
|
-
be(e, "toggleDocSchemaPanel", me(e)), be(e, "toggleDocSchemaRealtime",
|
|
540
|
+
be(e, "toggleDocSchemaPanel", me(e)), be(e, "toggleDocSchemaRealtime", t?.realtimeEnabled === !0);
|
|
578
541
|
}
|
|
579
542
|
function _(e) {
|
|
580
543
|
const t = b.get(e);
|
|
581
|
-
if (!t)
|
|
582
|
-
return;
|
|
544
|
+
if (!t) return;
|
|
583
545
|
const n = u.get(e) || w;
|
|
584
|
-
if (!n)
|
|
585
|
-
return;
|
|
546
|
+
if (!n) return;
|
|
586
547
|
const r = g(e, n), s = L(n, r.activeSchemaId), o = t.querySelector(".rte-doc-schema-label");
|
|
587
548
|
o && (o.textContent = n.labels.schemaLabel);
|
|
588
549
|
const a = t.querySelector('[data-field="schema"]');
|
|
589
550
|
a && (a.innerHTML = n.schemas.map((h) => `<option value="${M(h.id)}">${M(h.label)}</option>`).join(""), a.value = r.activeSchemaId || "");
|
|
590
|
-
const
|
|
591
|
-
if (l) {
|
|
592
|
-
const h = (s == null ? void 0 : s.description) || "";
|
|
593
|
-
l.textContent = h ? `${n.labels.schemaDescriptionPrefix}: ${h}` : "", l.hidden = !h;
|
|
594
|
-
}
|
|
595
|
-
const c = t.querySelector(".rte-doc-schema-summary");
|
|
551
|
+
const c = t.querySelector(".rte-doc-schema-description");
|
|
596
552
|
if (c) {
|
|
597
|
-
const h =
|
|
598
|
-
c.textContent = `${n.labels.
|
|
553
|
+
const h = s?.description || "";
|
|
554
|
+
c.textContent = h ? `${n.labels.schemaDescriptionPrefix}: ${h}` : "", c.hidden = !h;
|
|
555
|
+
}
|
|
556
|
+
const i = t.querySelector(".rte-doc-schema-summary");
|
|
557
|
+
if (i) {
|
|
558
|
+
const h = s?.label || "N/A", x = r.issues.length;
|
|
559
|
+
i.textContent = `${n.labels.summaryPrefix}: ${h} • ${x} issue${x === 1 ? "" : "s"}`;
|
|
599
560
|
}
|
|
600
|
-
const
|
|
601
|
-
|
|
561
|
+
const l = t.querySelector(".rte-doc-schema-helper");
|
|
562
|
+
l && (l.textContent = n.labels.helperText);
|
|
602
563
|
const d = t.querySelector(".rte-doc-schema-shortcut");
|
|
603
564
|
d && (d.textContent = n.labels.shortcutText);
|
|
604
|
-
const
|
|
605
|
-
|
|
565
|
+
const y = t.querySelector('[data-action="run-validation"]');
|
|
566
|
+
y && (y.textContent = n.labels.validateText);
|
|
606
567
|
const f = t.querySelector('[data-action="insert-missing"]');
|
|
607
568
|
if (f) {
|
|
608
569
|
f.textContent = n.labels.insertMissingText;
|
|
609
|
-
const h = r.issues.some((
|
|
610
|
-
f.disabled = !h ||
|
|
570
|
+
const h = r.issues.some((x) => x.type === "missing-section");
|
|
571
|
+
f.disabled = !h || ve(e);
|
|
611
572
|
}
|
|
612
573
|
const k = t.querySelector('[data-action="toggle-realtime"]');
|
|
613
574
|
k && (k.textContent = r.realtimeEnabled ? n.labels.realtimeOnText : n.labels.realtimeOffText, k.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
|
|
@@ -615,9 +576,9 @@ function _(e) {
|
|
|
615
576
|
O && O.setAttribute("aria-label", n.labels.closeText);
|
|
616
577
|
const A = t.querySelector(".rte-doc-schema-issues"), $ = t.querySelector(".rte-doc-schema-empty");
|
|
617
578
|
A && (A.setAttribute("aria-label", n.labels.issueListLabel), r.issues.length === 0 ? (A.innerHTML = "", $ && ($.hidden = !1, $.textContent = n.labels.noIssuesText)) : ($ && ($.hidden = !0), A.innerHTML = r.issues.map((h) => {
|
|
618
|
-
const
|
|
579
|
+
const x = h.severity === "error" ? "error" : h.severity === "warning" ? "warning" : "info", N = h.sectionTitle || h.headingText || "";
|
|
619
580
|
return `
|
|
620
|
-
<li class="rte-doc-schema-issue ${
|
|
581
|
+
<li class="rte-doc-schema-issue ${x}" role="listitem">
|
|
621
582
|
<p class="rte-doc-schema-issue-message">${M(h.message)}${N ? `: <strong>${M(N)}</strong>` : ""}</p>
|
|
622
583
|
${h.suggestion ? `<p class="rte-doc-schema-issue-suggestion">${M(h.suggestion)}</p>` : ""}
|
|
623
584
|
</li>
|
|
@@ -632,17 +593,14 @@ function ae(e) {
|
|
|
632
593
|
const t = Fe(e);
|
|
633
594
|
b.forEach((r, s) => {
|
|
634
595
|
s !== e && G(s, !1);
|
|
635
|
-
}), t.classList.add("show"), F.set(e, !0), _(e), se(e, t), D(e);
|
|
636
|
-
const n = t.querySelector('[data-field="schema"]');
|
|
637
|
-
n == null || n.focus(), C(e, "panel-open", !1);
|
|
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);
|
|
638
597
|
}
|
|
639
598
|
function ke(e, t) {
|
|
640
599
|
const n = me(e);
|
|
641
600
|
return (typeof t == "boolean" ? t : !n) ? ae(e) : G(e, !1), !0;
|
|
642
601
|
}
|
|
643
602
|
function Ue(e, t) {
|
|
644
|
-
if (t === e.innerHTML)
|
|
645
|
-
return;
|
|
603
|
+
if (t === e.innerHTML) return;
|
|
646
604
|
const n = window.execEditorCommand || window.executeEditorCommand;
|
|
647
605
|
if (typeof n == "function")
|
|
648
606
|
try {
|
|
@@ -655,20 +613,19 @@ function Ge(e) {
|
|
|
655
613
|
}
|
|
656
614
|
function C(e, t, n) {
|
|
657
615
|
const r = u.get(e) || w;
|
|
658
|
-
if (!r)
|
|
659
|
-
return [];
|
|
616
|
+
if (!r) return [];
|
|
660
617
|
const s = g(e, r), o = b.get(e), a = e.innerHTML;
|
|
661
618
|
if (!n && s.snapshot === a)
|
|
662
619
|
return s.issues;
|
|
663
|
-
const
|
|
664
|
-
if (!
|
|
620
|
+
const c = L(r, s.activeSchemaId);
|
|
621
|
+
if (!c)
|
|
665
622
|
return s.issues = [
|
|
666
623
|
V("missing-section", "error", "No active schema is configured for this editor.", {
|
|
667
624
|
suggestion: "Set `defaultSchemaId` or update schema options."
|
|
668
625
|
})
|
|
669
626
|
], s.headingCount = 0, s.recognizedHeadingCount = 0, s.missingCount = 1, s.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), s.snapshot = a, _(e), D(e), s.issues;
|
|
670
|
-
const
|
|
671
|
-
return s.issues =
|
|
627
|
+
const i = je(e, c, r);
|
|
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(
|
|
672
629
|
new CustomEvent("editora:doc-schema-validation", {
|
|
673
630
|
bubbles: !0,
|
|
674
631
|
detail: {
|
|
@@ -678,13 +635,12 @@ function C(e, t, n) {
|
|
|
678
635
|
})
|
|
679
636
|
), o && ee(
|
|
680
637
|
o,
|
|
681
|
-
|
|
638
|
+
i.issues.length === 0 ? r.labels.noIssuesText : `${i.issues.length} issue${i.issues.length === 1 ? "" : "s"} detected.`
|
|
682
639
|
), s.issues;
|
|
683
640
|
}
|
|
684
641
|
function $e(e) {
|
|
685
642
|
const t = u.get(e) || w;
|
|
686
|
-
if (!t)
|
|
687
|
-
return;
|
|
643
|
+
if (!t) return;
|
|
688
644
|
de(e);
|
|
689
645
|
const n = window.setTimeout(() => {
|
|
690
646
|
te.delete(e), C(e, "realtime", !1);
|
|
@@ -693,21 +649,18 @@ function $e(e) {
|
|
|
693
649
|
}
|
|
694
650
|
function Ce(e, t) {
|
|
695
651
|
const n = u.get(e) || w;
|
|
696
|
-
if (!n)
|
|
697
|
-
return !1;
|
|
652
|
+
if (!n) return !1;
|
|
698
653
|
const r = g(e, n), s = typeof t == "boolean" ? t : !r.realtimeEnabled;
|
|
699
654
|
return r.realtimeEnabled = s, s ? $e(e) : de(e), _(e), D(e), !0;
|
|
700
655
|
}
|
|
701
656
|
function Te(e) {
|
|
702
657
|
const t = u.get(e) || w;
|
|
703
|
-
if (!t)
|
|
704
|
-
return !1;
|
|
658
|
+
if (!t) return !1;
|
|
705
659
|
const n = g(e, t), r = b.get(e);
|
|
706
|
-
if (
|
|
660
|
+
if (ve(e))
|
|
707
661
|
return r && ee(r, t.labels.readonlyMessage), !1;
|
|
708
662
|
const s = L(t, n.activeSchemaId);
|
|
709
|
-
if (!s)
|
|
710
|
-
return !1;
|
|
663
|
+
if (!s) return !1;
|
|
711
664
|
C(e, "insert-missing-pre", !0);
|
|
712
665
|
const o = Array.from(
|
|
713
666
|
new Set(
|
|
@@ -716,12 +669,12 @@ function Te(e) {
|
|
|
716
669
|
), a = s.sections.filter((f) => o.includes(f.id));
|
|
717
670
|
if (a.length === 0)
|
|
718
671
|
return r && ee(r, t.labels.noIssuesText), !1;
|
|
719
|
-
const
|
|
672
|
+
const c = e.innerHTML, i = Ee(e, s, t.normalizeText), l = ze(i, 2), d = Be(e);
|
|
720
673
|
a.forEach((f) => {
|
|
721
|
-
const k = s.strictOrder ? Ke(e, f, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = Ve(e, f, t,
|
|
674
|
+
const k = s.strictOrder ? Ke(e, f, s, t.normalizeText) : d || { parent: e, referenceNode: null }, [O, A] = Ve(e, f, t, l);
|
|
722
675
|
k.parent.insertBefore(O, k.referenceNode), k.parent.insertBefore(A, k.referenceNode);
|
|
723
|
-
}), Ue(e,
|
|
724
|
-
const
|
|
676
|
+
}), Ue(e, c), Ge(e), C(e, "insert-missing-post", !0);
|
|
677
|
+
const y = a.map((f) => f.title).join(", ");
|
|
725
678
|
return e.dispatchEvent(
|
|
726
679
|
new CustomEvent("editora:doc-schema-insert-missing", {
|
|
727
680
|
bubbles: !0,
|
|
@@ -730,12 +683,11 @@ function Te(e) {
|
|
|
730
683
|
sectionIds: a.map((f) => f.id)
|
|
731
684
|
}
|
|
732
685
|
})
|
|
733
|
-
), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${
|
|
686
|
+
), r && ee(r, `${t.labels.insertedSummaryPrefix}: ${y}`), !0;
|
|
734
687
|
}
|
|
735
688
|
function Fe(e) {
|
|
736
689
|
const t = b.get(e);
|
|
737
|
-
if (t)
|
|
738
|
-
return t;
|
|
690
|
+
if (t) return t;
|
|
739
691
|
const n = u.get(e) || w || Z();
|
|
740
692
|
g(e, n);
|
|
741
693
|
const r = `rte-doc-schema-panel-${Ae++}`, s = `${r}-schema`, o = document.createElement("section");
|
|
@@ -765,32 +717,29 @@ function Fe(e) {
|
|
|
765
717
|
</div>
|
|
766
718
|
<div class="rte-doc-schema-live" aria-live="polite" aria-atomic="true"></div>
|
|
767
719
|
`, o.addEventListener("click", (a) => {
|
|
768
|
-
const
|
|
769
|
-
if (!
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
if (i === "close") {
|
|
720
|
+
const i = a.target?.closest("[data-action]");
|
|
721
|
+
if (!i) return;
|
|
722
|
+
const l = i.getAttribute("data-action");
|
|
723
|
+
if (l === "close") {
|
|
773
724
|
G(e, !0);
|
|
774
725
|
return;
|
|
775
726
|
}
|
|
776
|
-
if (
|
|
727
|
+
if (l === "run-validation") {
|
|
777
728
|
C(e, "panel-button", !0);
|
|
778
729
|
return;
|
|
779
730
|
}
|
|
780
|
-
if (
|
|
731
|
+
if (l === "insert-missing") {
|
|
781
732
|
Te(e);
|
|
782
733
|
return;
|
|
783
734
|
}
|
|
784
|
-
|
|
735
|
+
l === "toggle-realtime" && Ce(e);
|
|
785
736
|
}), o.addEventListener("change", (a) => {
|
|
786
|
-
const
|
|
787
|
-
if (!(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
const i = g(e, c), d = l.value;
|
|
793
|
-
L(c, d) && (i.activeSchemaId = d, i.snapshot = "", C(e, "schema-change", !0));
|
|
737
|
+
const c = a.target;
|
|
738
|
+
if (!(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "schema") return;
|
|
739
|
+
const i = u.get(e) || w;
|
|
740
|
+
if (!i) return;
|
|
741
|
+
const l = g(e, i), d = c.value;
|
|
742
|
+
L(i, d) && (l.activeSchemaId = d, l.snapshot = "", C(e, "schema-change", !0));
|
|
794
743
|
}), o.addEventListener("keydown", (a) => {
|
|
795
744
|
a.key === "Escape" && (a.preventDefault(), G(e, !0));
|
|
796
745
|
}), oe(o, e), document.body.appendChild(o), b.set(e, o), F.set(e, !1), _(e), o;
|
|
@@ -806,28 +755,21 @@ function Ye(e) {
|
|
|
806
755
|
function Je(e) {
|
|
807
756
|
w = e, q || (q = (t) => {
|
|
808
757
|
Q();
|
|
809
|
-
const
|
|
810
|
-
if (!r)
|
|
811
|
-
return;
|
|
758
|
+
const r = t.target?.closest(S);
|
|
759
|
+
if (!r) return;
|
|
812
760
|
const s = u.get(r) || e;
|
|
813
761
|
g(r, s), u.set(r, s), p = r, D(r);
|
|
814
762
|
const o = b.get(r);
|
|
815
763
|
o && (oe(o, r), se(r, o), _(r));
|
|
816
764
|
}, document.addEventListener("focusin", q, !0)), z || (z = (t) => {
|
|
817
|
-
const
|
|
818
|
-
if (!r)
|
|
819
|
-
return;
|
|
765
|
+
const r = t.target?.closest(S);
|
|
766
|
+
if (!r) return;
|
|
820
767
|
const s = u.get(r) || w;
|
|
821
768
|
!s || !g(r, s).realtimeEnabled || $e(r);
|
|
822
769
|
}, document.addEventListener("input", z, !0)), B || (B = (t) => {
|
|
823
|
-
if (t.defaultPrevented)
|
|
824
|
-
return;
|
|
825
|
-
const n = t.target;
|
|
826
|
-
if (n != null && n.closest(`.${m}`) && t.key !== "Escape")
|
|
827
|
-
return;
|
|
770
|
+
if (t.defaultPrevented || t.target?.closest(`.${m}`) && t.key !== "Escape") return;
|
|
828
771
|
const r = _e(t);
|
|
829
|
-
if (!r)
|
|
830
|
-
return;
|
|
772
|
+
if (!r) return;
|
|
831
773
|
const s = u.get(r) || w || e;
|
|
832
774
|
if (g(r, s), u.set(r, s), p = r, t.key === "Escape" && me(r)) {
|
|
833
775
|
t.preventDefault(), G(r, !0);
|
|
@@ -838,11 +780,11 @@ function Je(e) {
|
|
|
838
780
|
return;
|
|
839
781
|
}
|
|
840
782
|
Ye(t) && (t.preventDefault(), t.stopPropagation(), C(r, "shortcut", !0));
|
|
841
|
-
}, document.addEventListener("keydown", B, !0)),
|
|
783
|
+
}, document.addEventListener("keydown", B, !0)), R || (R = () => {
|
|
842
784
|
Q(), b.forEach((t, n) => {
|
|
843
785
|
!n.isConnected || !t.isConnected || (oe(t, n), se(n, t));
|
|
844
786
|
});
|
|
845
|
-
}, window.addEventListener("scroll",
|
|
787
|
+
}, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !K && typeof MutationObserver < "u" && document.body && (K = new MutationObserver((t) => {
|
|
846
788
|
Pe(t) && Q();
|
|
847
789
|
}), K.observe(document.body, {
|
|
848
790
|
childList: !0,
|
|
@@ -850,66 +792,65 @@ function Je(e) {
|
|
|
850
792
|
}));
|
|
851
793
|
}
|
|
852
794
|
function Xe() {
|
|
853
|
-
q && (document.removeEventListener("focusin", q, !0), q = null), z && (document.removeEventListener("input", z, !0), z = null), B && (document.removeEventListener("keydown", B, !0), B = null),
|
|
795
|
+
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;
|
|
854
796
|
}
|
|
855
797
|
function Ze() {
|
|
856
|
-
if (typeof document > "u" || document.getElementById(he))
|
|
857
|
-
return;
|
|
798
|
+
if (typeof document > "u" || document.getElementById(he)) return;
|
|
858
799
|
const e = document.createElement("style");
|
|
859
800
|
e.id = he, e.textContent = `
|
|
860
|
-
.rte-toolbar-group-items.${
|
|
861
|
-
.editora-toolbar-group-items.${
|
|
801
|
+
.rte-toolbar-group-items.${v},
|
|
802
|
+
.editora-toolbar-group-items.${v},
|
|
862
803
|
.rte-toolbar-group-items.${T},
|
|
863
804
|
.editora-toolbar-group-items.${T},
|
|
864
|
-
.rte-toolbar-group-items.${
|
|
865
|
-
.editora-toolbar-group-items.${
|
|
805
|
+
.rte-toolbar-group-items.${H},
|
|
806
|
+
.editora-toolbar-group-items.${H} {
|
|
866
807
|
display: flex;
|
|
867
808
|
border: 1px solid #cbd5e1;
|
|
868
809
|
border-radius: 4px;
|
|
869
810
|
background: #ffffff;
|
|
870
811
|
}
|
|
871
812
|
|
|
872
|
-
.rte-toolbar-group-items.${
|
|
873
|
-
.editora-toolbar-group-items.${
|
|
813
|
+
.rte-toolbar-group-items.${v} .rte-toolbar-button,
|
|
814
|
+
.editora-toolbar-group-items.${v} .editora-toolbar-button,
|
|
874
815
|
.rte-toolbar-group-items.${T} .rte-toolbar-button,
|
|
875
816
|
.editora-toolbar-group-items.${T} .editora-toolbar-button,
|
|
876
|
-
.rte-toolbar-group-items.${
|
|
877
|
-
.editora-toolbar-group-items.${
|
|
817
|
+
.rte-toolbar-group-items.${H} .rte-toolbar-button,
|
|
818
|
+
.editora-toolbar-group-items.${H} .editora-toolbar-button {
|
|
878
819
|
border: none;
|
|
879
820
|
border-right: 1px solid #cbd5e1;
|
|
880
821
|
border-radius: 0;
|
|
881
822
|
}
|
|
882
823
|
|
|
883
|
-
.rte-toolbar-group-items.${
|
|
884
|
-
.editora-toolbar-group-items.${
|
|
824
|
+
.rte-toolbar-group-items.${v} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
825
|
+
.editora-toolbar-group-items.${v} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
885
826
|
.rte-toolbar-group-items.${T} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
886
827
|
.editora-toolbar-group-items.${T} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
887
|
-
.rte-toolbar-group-items.${
|
|
888
|
-
.editora-toolbar-group-items.${
|
|
828
|
+
.rte-toolbar-group-items.${H} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
829
|
+
.editora-toolbar-group-items.${H} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
889
830
|
border-right: none;
|
|
890
831
|
}
|
|
891
832
|
|
|
892
|
-
${
|
|
893
|
-
${
|
|
894
|
-
${
|
|
895
|
-
${
|
|
896
|
-
${
|
|
897
|
-
${
|
|
833
|
+
${E} .rte-toolbar-group-items.${v},
|
|
834
|
+
${E} .editora-toolbar-group-items.${v},
|
|
835
|
+
${E} .rte-toolbar-group-items.${T},
|
|
836
|
+
${E} .editora-toolbar-group-items.${T},
|
|
837
|
+
${E} .rte-toolbar-group-items.${H},
|
|
838
|
+
${E} .editora-toolbar-group-items.${H} {
|
|
898
839
|
border-color: #566275;
|
|
899
840
|
}
|
|
900
841
|
.rte-toolbar-button[data-command="toggleDocSchemaRealtime"].active,
|
|
901
842
|
.editora-toolbar-button[data-command="toggleDocSchemaRealtime"].active {
|
|
902
843
|
background-color: #ccc;
|
|
903
844
|
}
|
|
904
|
-
${
|
|
905
|
-
${
|
|
906
|
-
${
|
|
907
|
-
${
|
|
845
|
+
${E} .rte-toolbar-group-items.${v} .rte-toolbar-button svg,
|
|
846
|
+
${E} .editora-toolbar-group-items.${v} .editora-toolbar-button svg,
|
|
847
|
+
${E} .rte-toolbar-group-items.${T} .rte-toolbar-button svg,
|
|
848
|
+
${E} .editora-toolbar-group-items.${T} .editora-toolbar-button svg
|
|
908
849
|
{
|
|
909
850
|
fill: none;
|
|
910
851
|
}
|
|
911
|
-
${
|
|
912
|
-
${
|
|
852
|
+
${E} .rte-toolbar-group-items.${v} .rte-toolbar-button,
|
|
853
|
+
${E} .editora-toolbar-group-items.${v} .editora-toolbar-button
|
|
913
854
|
{
|
|
914
855
|
border-color: #566275;
|
|
915
856
|
}
|
|
@@ -1264,89 +1205,80 @@ const Qe = (e = {}) => {
|
|
|
1264
1205
|
commands: {
|
|
1265
1206
|
docSchema: (r, s) => {
|
|
1266
1207
|
const o = I(s, !1, !1);
|
|
1267
|
-
if (!o)
|
|
1268
|
-
return !1;
|
|
1208
|
+
if (!o) return !1;
|
|
1269
1209
|
const a = u.get(o) || t;
|
|
1270
1210
|
return g(o, a), u.set(o, a), p = o, ae(o), !0;
|
|
1271
1211
|
},
|
|
1272
1212
|
openDocSchemaPanel: (r, s) => {
|
|
1273
1213
|
const o = I(s, !1, !1);
|
|
1274
|
-
if (!o)
|
|
1275
|
-
return !1;
|
|
1214
|
+
if (!o) return !1;
|
|
1276
1215
|
const a = u.get(o) || t;
|
|
1277
1216
|
return g(o, a), u.set(o, a), p = o, ae(o), !0;
|
|
1278
1217
|
},
|
|
1279
1218
|
toggleDocSchemaPanel: (r, s) => {
|
|
1280
1219
|
const o = I(s, !1, !1);
|
|
1281
|
-
if (!o)
|
|
1282
|
-
return !1;
|
|
1220
|
+
if (!o) return !1;
|
|
1283
1221
|
const a = u.get(o) || t;
|
|
1284
1222
|
return g(o, a), u.set(o, a), p = o, ke(o, typeof r == "boolean" ? r : void 0);
|
|
1285
1223
|
},
|
|
1286
1224
|
runDocSchemaValidation: (r, s) => {
|
|
1287
1225
|
const o = I(s, !1, !1);
|
|
1288
|
-
if (!o)
|
|
1289
|
-
return !1;
|
|
1226
|
+
if (!o) return !1;
|
|
1290
1227
|
const a = u.get(o) || t;
|
|
1291
1228
|
return g(o, a), u.set(o, a), p = o, C(o, "command", !0), !0;
|
|
1292
1229
|
},
|
|
1293
1230
|
insertMissingDocSchemaSections: (r, s) => {
|
|
1294
1231
|
const o = I(s, !1, !1);
|
|
1295
|
-
if (!o)
|
|
1296
|
-
return !1;
|
|
1232
|
+
if (!o) return !1;
|
|
1297
1233
|
const a = u.get(o) || t;
|
|
1298
1234
|
return g(o, a), u.set(o, a), p = o, Te(o);
|
|
1299
1235
|
},
|
|
1300
1236
|
toggleDocSchemaRealtime: (r, s) => {
|
|
1301
1237
|
const o = I(s, !1, !1);
|
|
1302
|
-
if (!o)
|
|
1303
|
-
return !1;
|
|
1238
|
+
if (!o) return !1;
|
|
1304
1239
|
const a = u.get(o) || t;
|
|
1305
1240
|
return g(o, a), u.set(o, a), p = o, Ce(o, typeof r == "boolean" ? r : void 0);
|
|
1306
1241
|
},
|
|
1307
1242
|
setDocSchemaMode: (r, s) => {
|
|
1308
1243
|
const o = I(s, !1, !1);
|
|
1309
|
-
if (!o)
|
|
1310
|
-
|
|
1311
|
-
const a = u.get(o) || t, l = g(o, a);
|
|
1244
|
+
if (!o) return !1;
|
|
1245
|
+
const a = u.get(o) || t, c = g(o, a);
|
|
1312
1246
|
u.set(o, a);
|
|
1313
|
-
const
|
|
1314
|
-
return !
|
|
1247
|
+
const i = typeof r == "string" ? r : r?.schemaId || r?.id;
|
|
1248
|
+
return !i || !L(a, i) ? !1 : (c.activeSchemaId = i, c.snapshot = "", C(o, "set-mode", !0), !0);
|
|
1315
1249
|
},
|
|
1316
1250
|
setDocSchemaOptions: (r, s) => {
|
|
1317
1251
|
const o = I(s, !1, !1);
|
|
1318
|
-
if (!o || !r || typeof r != "object")
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
...l,
|
|
1252
|
+
if (!o || !r || typeof r != "object") return !1;
|
|
1253
|
+
const a = u.get(o) || t, c = X.get(o) || He(a), i = {
|
|
1254
|
+
...c,
|
|
1322
1255
|
...r,
|
|
1323
1256
|
labels: {
|
|
1324
|
-
...
|
|
1257
|
+
...c.labels || {},
|
|
1325
1258
|
...r.labels || {}
|
|
1326
1259
|
},
|
|
1327
|
-
schemas: Array.isArray(r.schemas) ? r.schemas :
|
|
1260
|
+
schemas: Array.isArray(r.schemas) ? r.schemas : c.schemas,
|
|
1328
1261
|
normalizeText: r.normalizeText || a.normalizeText
|
|
1329
|
-
},
|
|
1330
|
-
u.set(o,
|
|
1331
|
-
const d = g(o,
|
|
1332
|
-
return typeof r.enableRealtime == "boolean" && (d.realtimeEnabled = r.enableRealtime), (!d.activeSchemaId || !L(
|
|
1262
|
+
}, l = Z(i);
|
|
1263
|
+
u.set(o, l), X.set(o, i);
|
|
1264
|
+
const d = g(o, l);
|
|
1265
|
+
return typeof r.enableRealtime == "boolean" && (d.realtimeEnabled = r.enableRealtime), (!d.activeSchemaId || !L(l, d.activeSchemaId)) && (d.activeSchemaId = re(l)), typeof r.defaultSchemaId == "string" && L(l, r.defaultSchemaId) && (d.activeSchemaId = r.defaultSchemaId), d.snapshot = "", C(o, "set-options", !0), _(o), D(o), !0;
|
|
1333
1266
|
},
|
|
1334
1267
|
getDocSchemaState: (r, s) => {
|
|
1335
1268
|
const o = I(s, !1, !1);
|
|
1336
|
-
if (!o)
|
|
1337
|
-
return !1;
|
|
1269
|
+
if (!o) return !1;
|
|
1338
1270
|
const a = u.get(o) || t;
|
|
1339
1271
|
g(o, a);
|
|
1340
|
-
const
|
|
1272
|
+
const c = we(o);
|
|
1341
1273
|
if (typeof r == "function")
|
|
1342
1274
|
try {
|
|
1343
|
-
r(
|
|
1275
|
+
r(c);
|
|
1344
1276
|
} catch {
|
|
1345
1277
|
}
|
|
1346
|
-
return o.__docSchemaState =
|
|
1278
|
+
return o.__docSchemaState = c, o.dispatchEvent(
|
|
1347
1279
|
new CustomEvent("editora:doc-schema-state", {
|
|
1348
1280
|
bubbles: !0,
|
|
1349
|
-
detail:
|
|
1281
|
+
detail: c
|
|
1350
1282
|
})
|
|
1351
1283
|
), !0;
|
|
1352
1284
|
}
|
|
@@ -1361,12 +1293,12 @@ const Qe = (e = {}) => {
|
|
|
1361
1293
|
W += 1;
|
|
1362
1294
|
const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Z(o);
|
|
1363
1295
|
Je(a);
|
|
1364
|
-
const
|
|
1365
|
-
s
|
|
1296
|
+
const c = I(
|
|
1297
|
+
s?.editorElement ? { editorElement: s.editorElement } : void 0,
|
|
1366
1298
|
!1,
|
|
1367
1299
|
!1
|
|
1368
1300
|
);
|
|
1369
|
-
|
|
1301
|
+
c && (p = c, n.add(c), g(c, a), u.set(c, a), X.set(c, o), D(c), C(c, "init", !0));
|
|
1370
1302
|
},
|
|
1371
1303
|
destroy: () => {
|
|
1372
1304
|
n.forEach((r) => ue(r)), n.clear(), W = Math.max(0, W - 1), !(W > 0) && Xe();
|