@editora/core 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor",
|
|
1
|
+
const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ve = "__editoraCommandEditorRoot", $e = "rte-translation-workflow-styles", d = "rte-translation-workflow-panel", y = "translation-workflow", $ = "translationWorkflow", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ee = [
|
|
2
2
|
"p",
|
|
3
3
|
"h1",
|
|
4
4
|
"h2",
|
|
@@ -11,7 +11,7 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
|
|
|
11
11
|
"th",
|
|
12
12
|
"blockquote",
|
|
13
13
|
"figcaption"
|
|
14
|
-
].join(", "),
|
|
14
|
+
].join(", "), Ce = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "Home", "End"]), Ae = [
|
|
15
15
|
{
|
|
16
16
|
locale: "en",
|
|
17
17
|
label: "English",
|
|
@@ -68,7 +68,7 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
|
|
|
68
68
|
requireDifferentFromSource: !0,
|
|
69
69
|
preserveTokens: !0
|
|
70
70
|
}
|
|
71
|
-
],
|
|
71
|
+
], _e = {
|
|
72
72
|
panelTitle: "Translation Workflow",
|
|
73
73
|
panelAriaLabel: "Translation workflow panel",
|
|
74
74
|
sourceLocaleLabel: "Source Locale",
|
|
@@ -98,11 +98,11 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
|
|
|
98
98
|
untranslatedMessage: "Segment appears untranslated (same as source).",
|
|
99
99
|
lengthOutOfRangeMessage: "Translation length is outside expected locale range."
|
|
100
100
|
}, u = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new Set();
|
|
101
|
-
let ee = 0,
|
|
101
|
+
let ee = 0, Fe = 0, Re = 0, We = 0, w = null, x = null, N = null, O = null, _ = null, F = null, I = null, W = null;
|
|
102
102
|
function m(e) {
|
|
103
103
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Ke(e) {
|
|
106
106
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
107
107
|
}
|
|
108
108
|
function B(e, n, t) {
|
|
@@ -114,25 +114,25 @@ function A(e) {
|
|
|
114
114
|
function j(e) {
|
|
115
115
|
return e.trim().toLowerCase();
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Ve(e) {
|
|
118
118
|
return e.replace(/"/g, """);
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function je(e, n = 120) {
|
|
121
121
|
return e.length <= n ? e : `${e.slice(0, Math.max(0, n - 1)).trimEnd()}…`;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function Ie(e) {
|
|
124
124
|
const n = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
|
|
125
125
|
return !n || n.length === 0 ? [] : n.map((t) => t.trim()).filter(Boolean);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
const t =
|
|
127
|
+
function Ue(e, n) {
|
|
128
|
+
const t = Ie(e).sort(), r = Ie(n).sort();
|
|
129
129
|
if (t.length !== r.length) return !1;
|
|
130
130
|
for (let a = 0; a < t.length; a += 1)
|
|
131
131
|
if (t[a] !== r[a]) return !1;
|
|
132
132
|
return !0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
const t = Array.isArray(n) && n.length > 0 ? n :
|
|
134
|
+
function Ge(e, n) {
|
|
135
|
+
const t = Array.isArray(n) && n.length > 0 ? n : Ae, r = [], a = /* @__PURE__ */ new Set();
|
|
136
136
|
return t.forEach((o) => {
|
|
137
137
|
var i, c;
|
|
138
138
|
const l = j(o.locale || "");
|
|
@@ -149,7 +149,7 @@ function Ue(e, n) {
|
|
|
149
149
|
}), e.forEach((o) => {
|
|
150
150
|
const l = j(o);
|
|
151
151
|
if (a.has(l)) return;
|
|
152
|
-
const s =
|
|
152
|
+
const s = Ae.find((i) => l.startsWith(i.locale));
|
|
153
153
|
r.push(
|
|
154
154
|
s ? { ...s, locale: l, label: o } : {
|
|
155
155
|
locale: l,
|
|
@@ -164,13 +164,13 @@ function Ue(e, n) {
|
|
|
164
164
|
}
|
|
165
165
|
function ae(e = {}) {
|
|
166
166
|
var s, i, c, g;
|
|
167
|
-
const n = e.normalizeText ||
|
|
167
|
+
const n = e.normalizeText || Ke, t = A(e.sourceLocale || "en-US"), r = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([t, r]);
|
|
168
168
|
(Array.isArray(e.locales) ? e.locales : []).forEach((p) => {
|
|
169
169
|
if (typeof p != "string") return;
|
|
170
170
|
const v = A(p);
|
|
171
171
|
a.add(v);
|
|
172
172
|
});
|
|
173
|
-
const o = Array.from(a), l =
|
|
173
|
+
const o = Array.from(a), l = Ge(o, e.localeRules);
|
|
174
174
|
return {
|
|
175
175
|
sourceLocale: t,
|
|
176
176
|
targetLocale: r,
|
|
@@ -181,15 +181,15 @@ function ae(e = {}) {
|
|
|
181
181
|
maxIssues: B(Number((i = e.maxIssues) != null ? i : 120), 5, 1e3),
|
|
182
182
|
maxSegments: B(Number((c = e.maxSegments) != null ? c : 600), 20, 3e3),
|
|
183
183
|
minSourceLengthForRatio: B(Number((g = e.minSourceLengthForRatio) != null ? g : 8), 2, 100),
|
|
184
|
-
segmentSelector: (e.segmentSelector ||
|
|
184
|
+
segmentSelector: (e.segmentSelector || Ee).trim() || Ee,
|
|
185
185
|
labels: {
|
|
186
|
-
...
|
|
186
|
+
..._e,
|
|
187
187
|
...e.labels || {}
|
|
188
188
|
},
|
|
189
189
|
normalizeText: n
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function Ye(e) {
|
|
193
193
|
return {
|
|
194
194
|
sourceLocale: e.sourceLocale,
|
|
195
195
|
targetLocale: e.targetLocale,
|
|
@@ -221,11 +221,11 @@ function U(e) {
|
|
|
221
221
|
const n = e.querySelector(S);
|
|
222
222
|
return n instanceof HTMLElement ? n : null;
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Ze() {
|
|
225
225
|
if (typeof window == "undefined") return null;
|
|
226
|
-
const e = window[
|
|
226
|
+
const e = window[ve];
|
|
227
227
|
if (!(e instanceof HTMLElement)) return null;
|
|
228
|
-
window[
|
|
228
|
+
window[ve] = null;
|
|
229
229
|
const n = U(e);
|
|
230
230
|
if (n) return n;
|
|
231
231
|
const t = e.closest(ke);
|
|
@@ -236,7 +236,7 @@ function Ye() {
|
|
|
236
236
|
const r = e.closest(S);
|
|
237
237
|
return r instanceof HTMLElement ? r : null;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Je(e) {
|
|
240
240
|
const n = e.closest("[data-editora-editor]");
|
|
241
241
|
if (n && U(n) === e)
|
|
242
242
|
return n;
|
|
@@ -248,22 +248,22 @@ function Ze(e) {
|
|
|
248
248
|
}
|
|
249
249
|
return we(e);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function He(e) {
|
|
252
252
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
253
253
|
}
|
|
254
254
|
function te(e) {
|
|
255
255
|
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;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Qe(e) {
|
|
258
258
|
const n = we(e);
|
|
259
259
|
if (te(n)) return !0;
|
|
260
260
|
const t = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
261
261
|
return te(t) ? !0 : te(document.documentElement) || te(document.body);
|
|
262
262
|
}
|
|
263
263
|
function ge(e, n) {
|
|
264
|
-
e.classList.remove("rte-translation-workflow-theme-dark"),
|
|
264
|
+
e.classList.remove("rte-translation-workflow-theme-dark"), Qe(n) && e.classList.add("rte-translation-workflow-theme-dark");
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Xe(e) {
|
|
267
267
|
var n, t, r, a;
|
|
268
268
|
for (let o = 0; o < e.length; o += 1) {
|
|
269
269
|
const l = e[o];
|
|
@@ -290,11 +290,11 @@ function T(e, n = !0, t = !0) {
|
|
|
290
290
|
const i = U(e.editorElement);
|
|
291
291
|
if (i) return i;
|
|
292
292
|
}
|
|
293
|
-
const r =
|
|
293
|
+
const r = Ze();
|
|
294
294
|
if (r) return r;
|
|
295
295
|
const a = window.getSelection();
|
|
296
296
|
if (a && a.rangeCount > 0) {
|
|
297
|
-
const i = (s =
|
|
297
|
+
const i = (s = He(a.getRangeAt(0).startContainer)) == null ? void 0 : s.closest(
|
|
298
298
|
S
|
|
299
299
|
);
|
|
300
300
|
if (i) return i;
|
|
@@ -311,7 +311,7 @@ function T(e, n = !0, t = !0) {
|
|
|
311
311
|
const l = document.querySelector(S);
|
|
312
312
|
return l instanceof HTMLElement ? l : null;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function et(e) {
|
|
315
315
|
const n = e.target;
|
|
316
316
|
if (n) {
|
|
317
317
|
const r = n.closest(`.${d}`);
|
|
@@ -335,7 +335,7 @@ function Xe(e) {
|
|
|
335
335
|
return null;
|
|
336
336
|
}
|
|
337
337
|
function fe(e, n, t) {
|
|
338
|
-
const r =
|
|
338
|
+
const r = Je(e);
|
|
339
339
|
Array.from(
|
|
340
340
|
r.querySelectorAll(
|
|
341
341
|
`.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
|
|
@@ -348,7 +348,7 @@ function xe(e) {
|
|
|
348
348
|
const n = se.get(e);
|
|
349
349
|
typeof n == "number" && (window.clearTimeout(n), se.delete(e));
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function tt(e, n) {
|
|
352
352
|
const t = j(n), r = e.localeRules.find((l) => j(l.locale) === t);
|
|
353
353
|
if (r) return r;
|
|
354
354
|
const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
|
|
@@ -362,8 +362,8 @@ function et(e, n) {
|
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
function ne(e, n, t, r = {}) {
|
|
365
|
-
return
|
|
366
|
-
id: `translation-workflow-issue-${
|
|
365
|
+
return Re += 1, {
|
|
366
|
+
id: `translation-workflow-issue-${Re}`,
|
|
367
367
|
type: e,
|
|
368
368
|
severity: n,
|
|
369
369
|
message: t,
|
|
@@ -385,15 +385,15 @@ function ce(e, n) {
|
|
|
385
385
|
e.setAttribute("contenteditable", "true");
|
|
386
386
|
}
|
|
387
387
|
function ue(e, n) {
|
|
388
|
-
return e.querySelector(`[data-translation-segment-id="${
|
|
388
|
+
return e.querySelector(`[data-translation-segment-id="${Ve(n)}"]`);
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function qe(e) {
|
|
391
391
|
const n = window.getSelection();
|
|
392
392
|
if (!n || n.rangeCount === 0) return null;
|
|
393
|
-
const t =
|
|
393
|
+
const t = He(n.getRangeAt(0).startContainer);
|
|
394
394
|
return !t || !e.contains(t) ? null : t.closest("[data-translation-segment-id]");
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function nt(e, n) {
|
|
397
397
|
const t = Array.from(e.querySelectorAll(n));
|
|
398
398
|
if (t.length <= 1) return t;
|
|
399
399
|
const r = new Set(t);
|
|
@@ -407,11 +407,11 @@ function tt(e, n) {
|
|
|
407
407
|
return !0;
|
|
408
408
|
});
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function rt(e, n, t) {
|
|
411
411
|
let r = (t || "").trim();
|
|
412
412
|
if (!r || n.has(r)) {
|
|
413
413
|
do
|
|
414
|
-
r = `translation-segment-${
|
|
414
|
+
r = `translation-segment-${Fe++}`;
|
|
415
415
|
while (n.has(r));
|
|
416
416
|
e.setAttribute("data-translation-segment-id", r);
|
|
417
417
|
}
|
|
@@ -434,9 +434,9 @@ function me(e, n) {
|
|
|
434
434
|
}
|
|
435
435
|
function M(e, n, t) {
|
|
436
436
|
var l;
|
|
437
|
-
const r =
|
|
437
|
+
const r = nt(e, n.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
|
|
438
438
|
for (let s = 0; s < r.length && !(a.length >= n.maxSegments); s += 1) {
|
|
439
|
-
const i = r[s], c =
|
|
439
|
+
const i = r[s], c = rt(i, o, i.getAttribute("data-translation-segment-id")), g = t.lockedSegmentIds.has(c), p = i.getAttribute("data-translation-locked") === "true", v = g || p;
|
|
440
440
|
if (v)
|
|
441
441
|
if (t.lockedSegmentIds.add(c), ce(i, !0), !t.lockedHtmlBySegmentId.has(c))
|
|
442
442
|
t.lockedHtmlBySegmentId.set(c, i.innerHTML);
|
|
@@ -506,11 +506,11 @@ function P(e, n) {
|
|
|
506
506
|
const t = e.querySelector(".rte-translation-live");
|
|
507
507
|
t && (t.textContent = n);
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function ot(e, n) {
|
|
510
510
|
return `${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
const r = [], a =
|
|
512
|
+
function at(e, n, t) {
|
|
513
|
+
const r = [], a = tt(t, n.targetLocale);
|
|
514
514
|
for (let o = 0; o < e.length && !(r.length >= t.maxIssues); o += 1) {
|
|
515
515
|
const l = e[o], s = t.normalizeText(l.sourceText || ""), i = t.normalizeText(l.text || "");
|
|
516
516
|
if (!i) {
|
|
@@ -524,7 +524,7 @@ function ot(e, n, t) {
|
|
|
524
524
|
);
|
|
525
525
|
continue;
|
|
526
526
|
}
|
|
527
|
-
if (a.preserveTokens && s && !
|
|
527
|
+
if (a.preserveTokens && s && !Ue(s, i) && (r.push(
|
|
528
528
|
ne("token-mismatch", "error", t.labels.tokenMismatchMessage, {
|
|
529
529
|
segmentId: l.id,
|
|
530
530
|
sourceText: s,
|
|
@@ -554,7 +554,7 @@ function ot(e, n, t) {
|
|
|
554
554
|
}
|
|
555
555
|
return r;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Be(e) {
|
|
558
558
|
const n = u.get(e) || w, t = D.get(e);
|
|
559
559
|
return {
|
|
560
560
|
sourceLocale: (t == null ? void 0 : t.sourceLocale) || (n == null ? void 0 : n.sourceLocale) || "en-US",
|
|
@@ -579,7 +579,7 @@ function E(e) {
|
|
|
579
579
|
const n = D.get(e), t = n && n.selectedSegmentId ? n.segments.find((r) => r.id === n.selectedSegmentId) : null;
|
|
580
580
|
fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime", (n == null ? void 0 : n.realtimeEnabled) === !0), fe(e, "toggleTranslationSegmentLock", (t == null ? void 0 : t.locked) === !0);
|
|
581
581
|
}
|
|
582
|
-
function
|
|
582
|
+
function lt(e, n) {
|
|
583
583
|
const t = ue(e, n);
|
|
584
584
|
if (!t) return;
|
|
585
585
|
try {
|
|
@@ -622,8 +622,8 @@ function R(e) {
|
|
|
622
622
|
K && (K.textContent = r.realtimeEnabled ? t.labels.realtimeOnText : t.labels.realtimeOffText, K.setAttribute("aria-pressed", r.realtimeEnabled ? "true" : "false"));
|
|
623
623
|
const H = n.querySelector('[data-action="lock-selected"]'), q = r.selectedSegmentId && r.segments.find((f) => f.id === r.selectedSegmentId) || null;
|
|
624
624
|
H && (H.textContent = q != null && q.locked ? t.labels.unlockSelectedText : t.labels.lockSelectedText, H.disabled = !q, H.setAttribute("aria-pressed", q != null && q.locked ? "true" : "false"));
|
|
625
|
-
const
|
|
626
|
-
|
|
625
|
+
const Te = n.querySelector('[data-action="close"]');
|
|
626
|
+
Te && Te.setAttribute("aria-label", t.labels.closeText);
|
|
627
627
|
const J = n.querySelector(".rte-translation-issues"), V = n.querySelector(".rte-translation-empty");
|
|
628
628
|
J && (J.setAttribute("aria-label", t.labels.issuesLabel), r.issues.length === 0 ? (J.innerHTML = "", V && (V.hidden = !1, V.textContent = t.labels.noIssuesText)) : (V && (V.hidden = !0), J.innerHTML = r.issues.map((f) => `
|
|
629
629
|
<li class="rte-translation-issue ${f.severity === "error" ? "error" : f.severity === "warning" ? "warning" : "info"}" role="listitem" data-segment-id="${m(
|
|
@@ -635,14 +635,14 @@ function R(e) {
|
|
|
635
635
|
`).join("")));
|
|
636
636
|
const de = n.querySelector(".rte-translation-segments");
|
|
637
637
|
de && (de.setAttribute("aria-label", t.labels.segmentsLabel), de.innerHTML = r.segments.map((f) => {
|
|
638
|
-
const z = f.id === r.selectedSegmentId ? "selected" : "",
|
|
638
|
+
const z = f.id === r.selectedSegmentId ? "selected" : "", Oe = f.locked ? "locked" : "";
|
|
639
639
|
return `
|
|
640
|
-
<li class="rte-translation-segment-item ${z} ${
|
|
640
|
+
<li class="rte-translation-segment-item ${z} ${Oe}" role="option" aria-selected="${f.id === r.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
|
|
641
641
|
<button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
|
|
642
642
|
f.id
|
|
643
643
|
)}" title="${m(f.text)}">
|
|
644
644
|
<span class="rte-translation-segment-meta">#${f.index + 1} • ${m(f.tagName)}</span>
|
|
645
|
-
<span class="rte-translation-segment-text">${m(
|
|
645
|
+
<span class="rte-translation-segment-text">${m(je(f.text, 110))}</span>
|
|
646
646
|
</button>
|
|
647
647
|
<button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
|
|
648
648
|
f.id
|
|
@@ -657,7 +657,7 @@ function R(e) {
|
|
|
657
657
|
}
|
|
658
658
|
n.setAttribute("aria-label", t.labels.panelAriaLabel);
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function Pe(e) {
|
|
661
661
|
const n = u.get(e) || w;
|
|
662
662
|
if (!n) return;
|
|
663
663
|
xe(e);
|
|
@@ -671,15 +671,15 @@ function L(e, n, t) {
|
|
|
671
671
|
if (!r) return [];
|
|
672
672
|
const a = b(e, r), o = me(e, a);
|
|
673
673
|
a.segments = M(e, r, a);
|
|
674
|
-
const l =
|
|
674
|
+
const l = ot(e, a);
|
|
675
675
|
if (!t && a.snapshot === l)
|
|
676
676
|
return a.issues;
|
|
677
|
-
a.issues =
|
|
677
|
+
a.issues = at(a.segments, a, r), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
|
|
678
678
|
new CustomEvent("editora:translation-workflow-validation", {
|
|
679
679
|
bubbles: !0,
|
|
680
680
|
detail: {
|
|
681
681
|
reason: n,
|
|
682
|
-
state:
|
|
682
|
+
state: Be(e)
|
|
683
683
|
}
|
|
684
684
|
})
|
|
685
685
|
);
|
|
@@ -694,7 +694,7 @@ function L(e, n, t) {
|
|
|
694
694
|
}
|
|
695
695
|
return a.issues;
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function De(e) {
|
|
698
698
|
const n = u.get(e) || w;
|
|
699
699
|
if (!n) return !1;
|
|
700
700
|
const t = b(e, n), r = M(e, n, t);
|
|
@@ -718,7 +718,7 @@ function ie(e, n, t) {
|
|
|
718
718
|
if (!r) return !1;
|
|
719
719
|
const a = b(e, r);
|
|
720
720
|
a.segments = M(e, r, a);
|
|
721
|
-
const o = ((c =
|
|
721
|
+
const o = ((c = qe(e)) == null ? void 0 : c.getAttribute("data-translation-segment-id")) || null, l = n || o || a.selectedSegmentId || ((g = a.segments[0]) == null ? void 0 : g.id) || null;
|
|
722
722
|
if (!l) return !1;
|
|
723
723
|
const s = ue(e, l);
|
|
724
724
|
if (!s) return !1;
|
|
@@ -733,17 +733,17 @@ function ie(e, n, t) {
|
|
|
733
733
|
})
|
|
734
734
|
), !0;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function ze(e, n) {
|
|
737
737
|
const t = u.get(e) || w;
|
|
738
738
|
if (!t) return !1;
|
|
739
739
|
const r = b(e, t), a = typeof n == "boolean" ? n : !r.realtimeEnabled;
|
|
740
|
-
return r.realtimeEnabled = a, a ?
|
|
740
|
+
return r.realtimeEnabled = a, a ? Pe(e) : xe(e), R(e), E(e), !0;
|
|
741
741
|
}
|
|
742
742
|
function pe(e, n, t = !0) {
|
|
743
743
|
const r = u.get(e) || w;
|
|
744
744
|
if (!r) return !1;
|
|
745
745
|
const a = b(e, r);
|
|
746
|
-
return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t &&
|
|
746
|
+
return a.segments = M(e, r, a), a.segments.some((o) => o.id === n) ? (a.selectedSegmentId = n, R(e), E(e), t && lt(e, n), !0) : !1;
|
|
747
747
|
}
|
|
748
748
|
function re(e, n) {
|
|
749
749
|
const t = u.get(e) || w;
|
|
@@ -764,41 +764,44 @@ function G(e, n = !1) {
|
|
|
764
764
|
t && (t.classList.remove("show"), Y.set(e, !1), E(e), n && e.focus({ preventScroll: !0 }));
|
|
765
765
|
}
|
|
766
766
|
function he(e) {
|
|
767
|
-
const n =
|
|
767
|
+
const n = dt(e);
|
|
768
768
|
h.forEach((r, a) => {
|
|
769
769
|
a !== e && G(a, !1);
|
|
770
770
|
}), n.classList.add("show"), Y.set(e, !0), L(e, "panel-open", !1), R(e), be(e, n), E(e);
|
|
771
771
|
const t = n.querySelector('[data-field="target-locale"]');
|
|
772
772
|
t == null || t.focus();
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Ne(e, n) {
|
|
775
775
|
const t = ye(e);
|
|
776
776
|
return (typeof n == "boolean" ? n : !t) ? he(e) : G(e, !1), !0;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
779
|
-
|
|
780
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
|
|
778
|
+
function Le(e) {
|
|
779
|
+
return typeof e.key == "string" ? e.key.toLowerCase() : "";
|
|
781
780
|
}
|
|
782
781
|
function st(e) {
|
|
783
|
-
const n = e
|
|
784
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "
|
|
782
|
+
const n = Le(e);
|
|
783
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "l";
|
|
785
784
|
}
|
|
786
785
|
function it(e) {
|
|
787
|
-
const n = e
|
|
788
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "
|
|
786
|
+
const n = Le(e);
|
|
787
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "v";
|
|
789
788
|
}
|
|
790
789
|
function ct(e) {
|
|
790
|
+
const n = Le(e);
|
|
791
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && n === "k";
|
|
792
|
+
}
|
|
793
|
+
function ut(e) {
|
|
791
794
|
return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
|
|
792
795
|
}
|
|
793
|
-
function
|
|
796
|
+
function Me(e) {
|
|
794
797
|
return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
|
|
795
798
|
}
|
|
796
|
-
function
|
|
799
|
+
function dt(e) {
|
|
797
800
|
const n = h.get(e);
|
|
798
801
|
if (n) return n;
|
|
799
802
|
const t = u.get(e) || w || ae();
|
|
800
803
|
b(e, t);
|
|
801
|
-
const r = `rte-translation-workflow-panel-${
|
|
804
|
+
const r = `rte-translation-workflow-panel-${We++}`, a = `${r}-source`, o = `${r}-target`, l = document.createElement("section");
|
|
802
805
|
return l.className = d, l.id = r, l.setAttribute("role", "dialog"), l.setAttribute("aria-modal", "false"), l.setAttribute("aria-label", t.labels.panelAriaLabel), l.innerHTML = `
|
|
803
806
|
<header class="rte-translation-header">
|
|
804
807
|
<h2 class="rte-translation-title">${m(t.labels.panelTitle)}</h2>
|
|
@@ -873,7 +876,7 @@ function ut(e) {
|
|
|
873
876
|
return;
|
|
874
877
|
}
|
|
875
878
|
if (g === "capture-source") {
|
|
876
|
-
|
|
879
|
+
De(e);
|
|
877
880
|
return;
|
|
878
881
|
}
|
|
879
882
|
if (g === "lock-selected") {
|
|
@@ -881,7 +884,7 @@ function ut(e) {
|
|
|
881
884
|
return;
|
|
882
885
|
}
|
|
883
886
|
if (g === "toggle-realtime") {
|
|
884
|
-
|
|
887
|
+
ze(e);
|
|
885
888
|
return;
|
|
886
889
|
}
|
|
887
890
|
if (g === "select-segment") {
|
|
@@ -910,10 +913,10 @@ function ut(e) {
|
|
|
910
913
|
s.preventDefault(), G(e, !0);
|
|
911
914
|
return;
|
|
912
915
|
}
|
|
913
|
-
!(i != null && i.closest(".rte-translation-segments")) || !
|
|
916
|
+
!(i != null && i.closest(".rte-translation-segments")) || !Ce.has(s.key) || (s.preventDefault(), s.key === "ArrowUp" ? re(e, -1) : s.key === "ArrowDown" ? re(e, 1) : s.key === "Home" ? re(e, "start") : s.key === "End" && re(e, "end"));
|
|
914
917
|
}), ge(l, e), document.body.appendChild(l), h.set(e, l), Y.set(e, !1), R(e), l;
|
|
915
918
|
}
|
|
916
|
-
function
|
|
919
|
+
function ft(e) {
|
|
917
920
|
w = e, N || (N = (n) => {
|
|
918
921
|
var i;
|
|
919
922
|
le();
|
|
@@ -921,7 +924,7 @@ function dt(e) {
|
|
|
921
924
|
if (!r) return;
|
|
922
925
|
const a = u.get(r) || e, o = b(r, a);
|
|
923
926
|
u.set(r, a), x = r;
|
|
924
|
-
const l = ((i =
|
|
927
|
+
const l = ((i = qe(r)) == null ? void 0 : i.getAttribute("data-translation-segment-id")) || null;
|
|
925
928
|
l && (o.selectedSegmentId = l), E(r);
|
|
926
929
|
const s = h.get(r);
|
|
927
930
|
s && (ge(s, r), be(r, s), R(r));
|
|
@@ -939,11 +942,11 @@ function dt(e) {
|
|
|
939
942
|
R(r), E(r);
|
|
940
943
|
return;
|
|
941
944
|
}
|
|
942
|
-
|
|
945
|
+
Pe(r);
|
|
943
946
|
}, document.addEventListener("input", O, !0)), _ || (_ = (n) => {
|
|
944
947
|
const t = n, r = t.target, a = r == null ? void 0 : r.closest(S);
|
|
945
948
|
if (!a) return;
|
|
946
|
-
const o =
|
|
949
|
+
const o = Me(r);
|
|
947
950
|
if (!o || !a.contains(o)) return;
|
|
948
951
|
t.preventDefault();
|
|
949
952
|
const l = h.get(a), s = u.get(a) || w;
|
|
@@ -951,25 +954,25 @@ function dt(e) {
|
|
|
951
954
|
}, document.addEventListener("beforeinput", _, !0)), F || (F = (n) => {
|
|
952
955
|
if (n.defaultPrevented) return;
|
|
953
956
|
const t = n.target;
|
|
954
|
-
if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !
|
|
955
|
-
const a = n.key === "Escape", o =
|
|
957
|
+
if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Ce.has(n.key)) return;
|
|
958
|
+
const a = n.key === "Escape", o = st(n), l = it(n), s = ct(n), i = Me(t);
|
|
956
959
|
if (!a && !o && !l && !s && !i)
|
|
957
960
|
return;
|
|
958
|
-
const c =
|
|
961
|
+
const c = et(n);
|
|
959
962
|
if (!c) return;
|
|
960
963
|
const g = u.get(c) || w || e;
|
|
961
964
|
if (b(c, g), u.set(c, g), x = c, a && ye(c)) {
|
|
962
965
|
n.preventDefault(), G(c, !0);
|
|
963
966
|
return;
|
|
964
967
|
}
|
|
965
|
-
if (i && c.contains(i) &&
|
|
968
|
+
if (i && c.contains(i) && ut(n)) {
|
|
966
969
|
n.preventDefault();
|
|
967
970
|
const p = h.get(c);
|
|
968
971
|
p && P(p, g.labels.readonlySegmentMessage);
|
|
969
972
|
return;
|
|
970
973
|
}
|
|
971
974
|
if (o) {
|
|
972
|
-
n.preventDefault(), n.stopPropagation(),
|
|
975
|
+
n.preventDefault(), n.stopPropagation(), Ne(c);
|
|
973
976
|
return;
|
|
974
977
|
}
|
|
975
978
|
if (l) {
|
|
@@ -982,7 +985,7 @@ function dt(e) {
|
|
|
982
985
|
!t.isConnected || !n.isConnected || (ge(n, t), be(t, n));
|
|
983
986
|
});
|
|
984
987
|
}, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !W && typeof MutationObserver != "undefined" && document.body && (W = new MutationObserver((n) => {
|
|
985
|
-
|
|
988
|
+
Xe(n) && le(), n.some((r) => r.type === "characterData" ? !0 : r.type === "childList" && (r.addedNodes.length > 0 || r.removedNodes.length > 0)) && Z.forEach((r) => {
|
|
986
989
|
const a = D.get(r);
|
|
987
990
|
if (!a || a.lockedSegmentIds.size === 0 || !me(r, a)) return;
|
|
988
991
|
a.snapshot = "";
|
|
@@ -995,13 +998,13 @@ function dt(e) {
|
|
|
995
998
|
characterData: !0
|
|
996
999
|
}));
|
|
997
1000
|
}
|
|
998
|
-
function
|
|
1001
|
+
function gt() {
|
|
999
1002
|
N && (document.removeEventListener("focusin", N, !0), N = null), O && (document.removeEventListener("input", O, !0), O = null), _ && (document.removeEventListener("beforeinput", _, !0), _ = null), F && (document.removeEventListener("keydown", F, !0), F = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), W && (W.disconnect(), W = null), h.forEach((n) => n.remove()), h.clear(), Array.from(Z).forEach((n) => Se(n)), w = null, x = null;
|
|
1000
1003
|
}
|
|
1001
|
-
function
|
|
1002
|
-
if (typeof document == "undefined" || document.getElementById(
|
|
1004
|
+
function mt() {
|
|
1005
|
+
if (typeof document == "undefined" || document.getElementById($e)) return;
|
|
1003
1006
|
const e = document.createElement("style");
|
|
1004
|
-
e.id =
|
|
1007
|
+
e.id = $e, e.textContent = `
|
|
1005
1008
|
.rte-toolbar-group-items.${y},
|
|
1006
1009
|
.editora-toolbar-group-items.${y},
|
|
1007
1010
|
.rte-toolbar-group-items.${$},
|
|
@@ -1566,9 +1569,9 @@ function gt() {
|
|
|
1566
1569
|
}
|
|
1567
1570
|
`, document.head.appendChild(e);
|
|
1568
1571
|
}
|
|
1569
|
-
const
|
|
1572
|
+
const bt = (e = {}) => {
|
|
1570
1573
|
const n = ae(e), t = /* @__PURE__ */ new Set();
|
|
1571
|
-
return
|
|
1574
|
+
return mt(), {
|
|
1572
1575
|
name: "translationWorkflow",
|
|
1573
1576
|
toolbar: [
|
|
1574
1577
|
{
|
|
@@ -1624,7 +1627,7 @@ const mt = (e = {}) => {
|
|
|
1624
1627
|
const o = T(a, !1, !1);
|
|
1625
1628
|
if (!o) return !1;
|
|
1626
1629
|
const l = u.get(o) || n;
|
|
1627
|
-
return b(o, l), u.set(o, l), x = o,
|
|
1630
|
+
return b(o, l), u.set(o, l), x = o, Ne(o, typeof r == "boolean" ? r : void 0);
|
|
1628
1631
|
},
|
|
1629
1632
|
runTranslationLocaleValidation: (r, a) => {
|
|
1630
1633
|
const o = T(a, !1, !1);
|
|
@@ -1636,7 +1639,7 @@ const mt = (e = {}) => {
|
|
|
1636
1639
|
const o = T(a, !1, !1);
|
|
1637
1640
|
if (!o) return !1;
|
|
1638
1641
|
const l = u.get(o) || n;
|
|
1639
|
-
return b(o, l), u.set(o, l), x = o,
|
|
1642
|
+
return b(o, l), u.set(o, l), x = o, ze(o, typeof r == "boolean" ? r : void 0);
|
|
1640
1643
|
},
|
|
1641
1644
|
toggleTranslationSegmentLock: (r, a) => {
|
|
1642
1645
|
const o = T(a, !1, !1);
|
|
@@ -1656,12 +1659,12 @@ const mt = (e = {}) => {
|
|
|
1656
1659
|
const o = T(a, !1, !1);
|
|
1657
1660
|
if (!o) return !1;
|
|
1658
1661
|
const l = u.get(o) || n;
|
|
1659
|
-
return b(o, l), u.set(o, l), x = o,
|
|
1662
|
+
return b(o, l), u.set(o, l), x = o, De(o);
|
|
1660
1663
|
},
|
|
1661
1664
|
setTranslationWorkflowOptions: (r, a) => {
|
|
1662
1665
|
const o = T(a, !1, !1);
|
|
1663
1666
|
if (!o || !r || typeof r != "object") return !1;
|
|
1664
|
-
const l = u.get(o) || n, s = oe.get(o) ||
|
|
1667
|
+
const l = u.get(o) || n, s = oe.get(o) || Ye(l), i = {
|
|
1665
1668
|
...s,
|
|
1666
1669
|
...r,
|
|
1667
1670
|
labels: {
|
|
@@ -1681,7 +1684,7 @@ const mt = (e = {}) => {
|
|
|
1681
1684
|
if (!o) return !1;
|
|
1682
1685
|
const l = u.get(o) || n;
|
|
1683
1686
|
b(o, l);
|
|
1684
|
-
const s =
|
|
1687
|
+
const s = Be(o);
|
|
1685
1688
|
if (typeof r == "function")
|
|
1686
1689
|
try {
|
|
1687
1690
|
r(s);
|
|
@@ -1706,7 +1709,7 @@ const mt = (e = {}) => {
|
|
|
1706
1709
|
init: function(a) {
|
|
1707
1710
|
ee += 1;
|
|
1708
1711
|
const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = ae(o);
|
|
1709
|
-
|
|
1712
|
+
ft(l);
|
|
1710
1713
|
const s = T(
|
|
1711
1714
|
a != null && a.editorElement ? { editorElement: a.editorElement } : void 0,
|
|
1712
1715
|
!1,
|
|
@@ -1718,11 +1721,11 @@ const mt = (e = {}) => {
|
|
|
1718
1721
|
u.set(s, l), oe.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
|
|
1719
1722
|
},
|
|
1720
1723
|
destroy: () => {
|
|
1721
|
-
t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) &&
|
|
1724
|
+
t.forEach((r) => Se(r)), t.clear(), ee = Math.max(0, ee - 1), !(ee > 0) && gt();
|
|
1722
1725
|
}
|
|
1723
1726
|
};
|
|
1724
1727
|
};
|
|
1725
1728
|
export {
|
|
1726
|
-
|
|
1729
|
+
bt as TranslationWorkflowPlugin
|
|
1727
1730
|
};
|
|
1728
|
-
//# sourceMappingURL=TranslationWorkflowPlugin.native-
|
|
1731
|
+
//# sourceMappingURL=TranslationWorkflowPlugin.native-DdF16tgT.mjs.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as n } from "./inlineFormatting-DJ0-NZtx.mjs";
|
|
2
|
+
const a = () => ({
|
|
2
3
|
name: "underline",
|
|
3
4
|
// Schema definition for underline mark
|
|
4
5
|
marks: {
|
|
@@ -21,7 +22,10 @@ const e = () => ({
|
|
|
21
22
|
/**
|
|
22
23
|
* Toggle underline formatting on current selection
|
|
23
24
|
*/
|
|
24
|
-
toggleUnderline: () => (
|
|
25
|
+
toggleUnderline: (l, e) => n({
|
|
26
|
+
command: "underline",
|
|
27
|
+
context: e
|
|
28
|
+
})
|
|
25
29
|
},
|
|
26
30
|
// Keyboard shortcuts
|
|
27
31
|
keymap: {
|
|
@@ -30,6 +34,6 @@ const e = () => ({
|
|
|
30
34
|
}
|
|
31
35
|
});
|
|
32
36
|
export {
|
|
33
|
-
|
|
37
|
+
a as UnderlinePlugin
|
|
34
38
|
};
|
|
35
|
-
//# sourceMappingURL=UnderlinePlugin.native-
|
|
39
|
+
//# sourceMappingURL=UnderlinePlugin.native-DZzg23rv.mjs.map
|