@editora/plugins 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_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 +119 -42
- package/dist/code.esm.js +2560 -760
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Te = "__editoraCommandEditorRoot", ve = "rte-translation-workflow-styles",
|
|
1
|
+
const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", Te = "__editoraCommandEditorRoot", ve = "rte-translation-workflow-styles", u = "rte-translation-workflow-panel", y = "translation-workflow", $ = "translationWorkflow", h = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', $e = [
|
|
2
2
|
"p",
|
|
3
3
|
"h1",
|
|
4
4
|
"h2",
|
|
@@ -97,63 +97,59 @@ const S = ".rte-content, .editora-content", ke = "[data-editora-editor], .rte-ed
|
|
|
97
97
|
tokenMismatchMessage: "Tokens/placeholders do not match source segment.",
|
|
98
98
|
untranslatedMessage: "Segment appears untranslated (same as source).",
|
|
99
99
|
lengthOutOfRangeMessage: "Translation length is outside expected locale range."
|
|
100
|
-
},
|
|
101
|
-
let
|
|
100
|
+
}, c = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new WeakMap(), le = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new Set();
|
|
101
|
+
let X = 0, _e = 0, Ae = 0, Fe = 0, k = null, x = null, D = null, z = null, N = null, O = null, I = null, _ = null;
|
|
102
102
|
function m(e) {
|
|
103
103
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
104
104
|
}
|
|
105
105
|
function We(e) {
|
|
106
106
|
return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return Number.isFinite(e) ? Math.max(
|
|
108
|
+
function C(e, t, r) {
|
|
109
|
+
return Number.isFinite(e) ? Math.max(t, Math.min(r, e)) : t;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function A(e) {
|
|
112
112
|
return (e || "").trim() || "en-US";
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function W(e) {
|
|
115
115
|
return e.trim().toLowerCase();
|
|
116
116
|
}
|
|
117
117
|
function Ke(e) {
|
|
118
118
|
return e.replace(/"/g, """);
|
|
119
119
|
}
|
|
120
|
-
function Ve(e,
|
|
121
|
-
return e.length <=
|
|
120
|
+
function Ve(e, t = 120) {
|
|
121
|
+
return e.length <= t ? e : `${e.slice(0, Math.max(0, t - 1)).trimEnd()}…`;
|
|
122
122
|
}
|
|
123
123
|
function Re(e) {
|
|
124
|
-
const
|
|
125
|
-
return !
|
|
126
|
-
}
|
|
127
|
-
function je(e,
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (t[a] !== r[a])
|
|
133
|
-
return !1;
|
|
124
|
+
const t = e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);
|
|
125
|
+
return !t || t.length === 0 ? [] : t.map((r) => r.trim()).filter(Boolean);
|
|
126
|
+
}
|
|
127
|
+
function je(e, t) {
|
|
128
|
+
const r = Re(e).sort(), n = Re(t).sort();
|
|
129
|
+
if (r.length !== n.length) return !1;
|
|
130
|
+
for (let a = 0; a < r.length; a += 1)
|
|
131
|
+
if (r[a] !== n[a]) return !1;
|
|
134
132
|
return !0;
|
|
135
133
|
}
|
|
136
|
-
function Ue(e,
|
|
137
|
-
const
|
|
138
|
-
return
|
|
139
|
-
const l =
|
|
140
|
-
if (!l)
|
|
141
|
-
return;
|
|
134
|
+
function Ue(e, t) {
|
|
135
|
+
const r = Array.isArray(t) && t.length > 0 ? t : Ee, n = [], a = /* @__PURE__ */ new Set();
|
|
136
|
+
return r.forEach((o) => {
|
|
137
|
+
const l = W(o.locale || "");
|
|
138
|
+
if (!l) return;
|
|
142
139
|
const s = l;
|
|
143
|
-
a.has(s) || (a.add(s),
|
|
140
|
+
a.has(s) || (a.add(s), n.push({
|
|
144
141
|
locale: s,
|
|
145
142
|
label: (o.label || l).trim() || l,
|
|
146
|
-
minLengthRatio:
|
|
147
|
-
maxLengthRatio:
|
|
143
|
+
minLengthRatio: C(Number(o.minLengthRatio ?? 0.5), 0.1, 3),
|
|
144
|
+
maxLengthRatio: C(Number(o.maxLengthRatio ?? 1.8), 0.2, 4),
|
|
148
145
|
requireDifferentFromSource: o.requireDifferentFromSource !== !1,
|
|
149
146
|
preserveTokens: o.preserveTokens !== !1
|
|
150
147
|
}));
|
|
151
148
|
}), e.forEach((o) => {
|
|
152
|
-
const l =
|
|
153
|
-
if (a.has(l))
|
|
154
|
-
return;
|
|
149
|
+
const l = W(o);
|
|
150
|
+
if (a.has(l)) return;
|
|
155
151
|
const s = Ee.find((i) => l.startsWith(i.locale));
|
|
156
|
-
|
|
152
|
+
n.push(
|
|
157
153
|
s ? { ...s, locale: l, label: o } : {
|
|
158
154
|
locale: l,
|
|
159
155
|
label: o,
|
|
@@ -163,33 +159,32 @@ function Ue(e, n) {
|
|
|
163
159
|
preserveTokens: !0
|
|
164
160
|
}
|
|
165
161
|
);
|
|
166
|
-
}),
|
|
162
|
+
}), n;
|
|
167
163
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
164
|
+
function oe(e = {}) {
|
|
165
|
+
const t = e.normalizeText || We, r = A(e.sourceLocale || "en-US"), n = A(e.targetLocale || "fr-FR"), a = /* @__PURE__ */ new Set([r, n]);
|
|
170
166
|
(Array.isArray(e.locales) ? e.locales : []).forEach((s) => {
|
|
171
|
-
if (typeof s != "string")
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
i && a.add(i);
|
|
167
|
+
if (typeof s != "string") return;
|
|
168
|
+
const i = A(s);
|
|
169
|
+
a.add(i);
|
|
175
170
|
});
|
|
176
171
|
const o = Array.from(a), l = Ue(o, e.localeRules);
|
|
177
172
|
return {
|
|
178
|
-
sourceLocale:
|
|
179
|
-
targetLocale:
|
|
173
|
+
sourceLocale: r,
|
|
174
|
+
targetLocale: n,
|
|
180
175
|
locales: o,
|
|
181
176
|
localeRules: l,
|
|
182
177
|
enableRealtime: e.enableRealtime !== !1,
|
|
183
|
-
debounceMs:
|
|
184
|
-
maxIssues:
|
|
185
|
-
maxSegments:
|
|
186
|
-
minSourceLengthForRatio:
|
|
178
|
+
debounceMs: C(Number(e.debounceMs ?? 260), 60, 2e3),
|
|
179
|
+
maxIssues: C(Number(e.maxIssues ?? 120), 5, 1e3),
|
|
180
|
+
maxSegments: C(Number(e.maxSegments ?? 600), 20, 3e3),
|
|
181
|
+
minSourceLengthForRatio: C(Number(e.minSourceLengthForRatio ?? 8), 2, 100),
|
|
187
182
|
segmentSelector: (e.segmentSelector || $e).trim() || $e,
|
|
188
183
|
labels: {
|
|
189
184
|
...Oe,
|
|
190
185
|
...e.labels || {}
|
|
191
186
|
},
|
|
192
|
-
normalizeText:
|
|
187
|
+
normalizeText: t
|
|
193
188
|
};
|
|
194
189
|
}
|
|
195
190
|
function Ge(e) {
|
|
@@ -197,13 +192,13 @@ function Ge(e) {
|
|
|
197
192
|
sourceLocale: e.sourceLocale,
|
|
198
193
|
targetLocale: e.targetLocale,
|
|
199
194
|
locales: [...e.locales],
|
|
200
|
-
localeRules: e.localeRules.map((
|
|
201
|
-
locale:
|
|
202
|
-
label:
|
|
203
|
-
minLengthRatio:
|
|
204
|
-
maxLengthRatio:
|
|
205
|
-
requireDifferentFromSource:
|
|
206
|
-
preserveTokens:
|
|
195
|
+
localeRules: e.localeRules.map((t) => ({
|
|
196
|
+
locale: t.locale,
|
|
197
|
+
label: t.label,
|
|
198
|
+
minLengthRatio: t.minLengthRatio,
|
|
199
|
+
maxLengthRatio: t.maxLengthRatio,
|
|
200
|
+
requireDifferentFromSource: t.requireDifferentFromSource,
|
|
201
|
+
preserveTokens: t.preserveTokens
|
|
207
202
|
})),
|
|
208
203
|
enableRealtime: e.enableRealtime,
|
|
209
204
|
debounceMs: e.debounceMs,
|
|
@@ -215,186 +210,164 @@ function Ge(e) {
|
|
|
215
210
|
normalizeText: e.normalizeText
|
|
216
211
|
};
|
|
217
212
|
}
|
|
218
|
-
function
|
|
213
|
+
function xe(e) {
|
|
219
214
|
return e.closest(ke) || e;
|
|
220
215
|
}
|
|
221
|
-
function
|
|
222
|
-
if (!e)
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
const n = e.querySelector(S);
|
|
227
|
-
return n instanceof HTMLElement ? n : null;
|
|
216
|
+
function K(e) {
|
|
217
|
+
if (!e) return null;
|
|
218
|
+
if (e.matches(S)) return e;
|
|
219
|
+
const t = e.querySelector(S);
|
|
220
|
+
return t instanceof HTMLElement ? t : null;
|
|
228
221
|
}
|
|
229
222
|
function Ye() {
|
|
230
|
-
if (typeof window > "u")
|
|
231
|
-
return null;
|
|
223
|
+
if (typeof window > "u") return null;
|
|
232
224
|
const e = window[Te];
|
|
233
|
-
if (!(e instanceof HTMLElement))
|
|
234
|
-
return null;
|
|
225
|
+
if (!(e instanceof HTMLElement)) return null;
|
|
235
226
|
window[Te] = null;
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (a)
|
|
243
|
-
return a;
|
|
227
|
+
const t = K(e);
|
|
228
|
+
if (t) return t;
|
|
229
|
+
const r = e.closest(ke);
|
|
230
|
+
if (r) {
|
|
231
|
+
const a = K(r);
|
|
232
|
+
if (a) return a;
|
|
244
233
|
}
|
|
245
|
-
const
|
|
246
|
-
return
|
|
234
|
+
const n = e.closest(S);
|
|
235
|
+
return n instanceof HTMLElement ? n : null;
|
|
247
236
|
}
|
|
248
237
|
function Ze(e) {
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
252
|
-
let
|
|
253
|
-
for (;
|
|
254
|
-
if (
|
|
255
|
-
return
|
|
256
|
-
|
|
238
|
+
const t = e.closest("[data-editora-editor]");
|
|
239
|
+
if (t && K(t) === e)
|
|
240
|
+
return t;
|
|
241
|
+
let r = e;
|
|
242
|
+
for (; r; ) {
|
|
243
|
+
if (r.matches(ke) && (r === e || K(r) === e))
|
|
244
|
+
return r;
|
|
245
|
+
r = r.parentElement;
|
|
257
246
|
}
|
|
258
|
-
return
|
|
247
|
+
return xe(e);
|
|
259
248
|
}
|
|
260
249
|
function Ce(e) {
|
|
261
250
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
262
251
|
}
|
|
263
|
-
function
|
|
252
|
+
function ee(e) {
|
|
264
253
|
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;
|
|
265
254
|
}
|
|
266
255
|
function Je(e) {
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return te(t) ? !0 : te(document.documentElement) || te(document.body);
|
|
256
|
+
const t = xe(e);
|
|
257
|
+
if (ee(t)) return !0;
|
|
258
|
+
const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
|
|
259
|
+
return ee(r) ? !0 : ee(document.documentElement) || ee(document.body);
|
|
272
260
|
}
|
|
273
|
-
function ge(e,
|
|
274
|
-
e.classList.remove("rte-translation-workflow-theme-dark"), Je(
|
|
261
|
+
function ge(e, t) {
|
|
262
|
+
e.classList.remove("rte-translation-workflow-theme-dark"), Je(t) && e.classList.add("rte-translation-workflow-theme-dark");
|
|
275
263
|
}
|
|
276
264
|
function Qe(e) {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const c = i;
|
|
286
|
-
if ((n = c.matches) != null && n.call(c, S) || (t = c.matches) != null && t.call(c, `.${d}`) || (r = c.querySelector) != null && r.call(c, S) || (a = c.querySelector) != null && a.call(c, `.${d}`))
|
|
265
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
266
|
+
const r = e[t];
|
|
267
|
+
if (!(r.type !== "childList" || r.removedNodes.length === 0))
|
|
268
|
+
for (let n = 0; n < r.removedNodes.length; n += 1) {
|
|
269
|
+
const a = r.removedNodes[n];
|
|
270
|
+
if (a.nodeType !== Node.ELEMENT_NODE) continue;
|
|
271
|
+
const o = a;
|
|
272
|
+
if (o.matches?.(S) || o.matches?.(`.${u}`) || o.querySelector?.(S) || o.querySelector?.(`.${u}`))
|
|
287
273
|
return !0;
|
|
288
274
|
}
|
|
289
275
|
}
|
|
290
276
|
return !1;
|
|
291
277
|
}
|
|
292
|
-
function
|
|
293
|
-
Array.from(
|
|
294
|
-
|
|
278
|
+
function ae() {
|
|
279
|
+
Array.from(U).forEach((t) => {
|
|
280
|
+
t.isConnected || Se(t);
|
|
295
281
|
});
|
|
296
282
|
}
|
|
297
|
-
function T(e,
|
|
298
|
-
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const i = U(e.editorElement);
|
|
303
|
-
if (i)
|
|
304
|
-
return i;
|
|
283
|
+
function T(e, t = !0, r = !0) {
|
|
284
|
+
if (ae(), e?.contentElement instanceof HTMLElement) return e.contentElement;
|
|
285
|
+
if (e?.editorElement instanceof HTMLElement) {
|
|
286
|
+
const s = K(e.editorElement);
|
|
287
|
+
if (s) return s;
|
|
305
288
|
}
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
return r;
|
|
289
|
+
const n = Ye();
|
|
290
|
+
if (n) return n;
|
|
309
291
|
const a = window.getSelection();
|
|
310
292
|
if (a && a.rangeCount > 0) {
|
|
311
|
-
const
|
|
293
|
+
const s = Ce(a.getRangeAt(0).startContainer)?.closest(
|
|
312
294
|
S
|
|
313
295
|
);
|
|
314
|
-
if (
|
|
315
|
-
return i;
|
|
296
|
+
if (s) return s;
|
|
316
297
|
}
|
|
317
298
|
const o = document.activeElement;
|
|
318
299
|
if (o) {
|
|
319
|
-
if (o.matches(S))
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (i)
|
|
323
|
-
return i;
|
|
300
|
+
if (o.matches(S)) return o;
|
|
301
|
+
const s = o.closest(S);
|
|
302
|
+
if (s) return s;
|
|
324
303
|
}
|
|
325
|
-
if (
|
|
304
|
+
if (r && x && x.isConnected)
|
|
326
305
|
return x;
|
|
327
|
-
if (!
|
|
328
|
-
return null;
|
|
306
|
+
if (!t) return null;
|
|
329
307
|
const l = document.querySelector(S);
|
|
330
308
|
return l instanceof HTMLElement ? l : null;
|
|
331
309
|
}
|
|
332
310
|
function Xe(e) {
|
|
333
|
-
const
|
|
334
|
-
if (n) {
|
|
335
|
-
const r = n.closest(`.${d}`);
|
|
336
|
-
if (r) {
|
|
337
|
-
const o = Array.from(p.entries()).find(([, l]) => l === r);
|
|
338
|
-
if (o)
|
|
339
|
-
return o[0];
|
|
340
|
-
}
|
|
341
|
-
const a = n.closest(S);
|
|
342
|
-
if (a)
|
|
343
|
-
return a;
|
|
344
|
-
}
|
|
345
|
-
const t = document.activeElement;
|
|
311
|
+
const t = e.target;
|
|
346
312
|
if (t) {
|
|
347
|
-
const
|
|
348
|
-
if (
|
|
349
|
-
const o = Array.from(p.entries()).find(([, l]) => l ===
|
|
350
|
-
if (o)
|
|
351
|
-
return o[0];
|
|
313
|
+
const n = t.closest(`.${u}`);
|
|
314
|
+
if (n) {
|
|
315
|
+
const o = Array.from(p.entries()).find(([, l]) => l === n);
|
|
316
|
+
if (o) return o[0];
|
|
352
317
|
}
|
|
353
318
|
const a = t.closest(S);
|
|
354
|
-
if (a)
|
|
355
|
-
|
|
319
|
+
if (a) return a;
|
|
320
|
+
}
|
|
321
|
+
const r = document.activeElement;
|
|
322
|
+
if (r) {
|
|
323
|
+
const n = r.closest(`.${u}`);
|
|
324
|
+
if (n) {
|
|
325
|
+
const o = Array.from(p.entries()).find(([, l]) => l === n);
|
|
326
|
+
if (o) return o[0];
|
|
327
|
+
}
|
|
328
|
+
const a = r.closest(S);
|
|
329
|
+
if (a) return a;
|
|
356
330
|
}
|
|
357
331
|
return null;
|
|
358
332
|
}
|
|
359
|
-
function fe(e,
|
|
360
|
-
const
|
|
333
|
+
function fe(e, t, r) {
|
|
334
|
+
const n = Ze(e);
|
|
361
335
|
Array.from(
|
|
362
|
-
|
|
363
|
-
`.rte-toolbar-button[data-command="${
|
|
336
|
+
n.querySelectorAll(
|
|
337
|
+
`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
|
|
364
338
|
)
|
|
365
339
|
).forEach((o) => {
|
|
366
|
-
o.classList.toggle("active",
|
|
340
|
+
o.classList.toggle("active", r), o.setAttribute("data-active", r ? "true" : "false"), o.setAttribute("aria-pressed", r ? "true" : "false");
|
|
367
341
|
});
|
|
368
342
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
371
|
-
typeof
|
|
372
|
-
}
|
|
373
|
-
function et(e,
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
|
|
377
|
-
const a = t.split("-")[0], o = e.localeRules.find((l) => j(l.locale).split("-")[0] === a);
|
|
343
|
+
function we(e) {
|
|
344
|
+
const t = le.get(e);
|
|
345
|
+
typeof t == "number" && (window.clearTimeout(t), le.delete(e));
|
|
346
|
+
}
|
|
347
|
+
function et(e, t) {
|
|
348
|
+
const r = W(t), n = e.localeRules.find((l) => W(l.locale) === r);
|
|
349
|
+
if (n) return n;
|
|
350
|
+
const a = r.split("-")[0], o = e.localeRules.find((l) => W(l.locale).split("-")[0] === a);
|
|
378
351
|
return o || {
|
|
379
|
-
locale:
|
|
380
|
-
label:
|
|
352
|
+
locale: r,
|
|
353
|
+
label: t,
|
|
381
354
|
minLengthRatio: 0.5,
|
|
382
355
|
maxLengthRatio: 1.8,
|
|
383
356
|
requireDifferentFromSource: !0,
|
|
384
357
|
preserveTokens: !0
|
|
385
358
|
};
|
|
386
359
|
}
|
|
387
|
-
function
|
|
360
|
+
function te(e, t, r, n = {}) {
|
|
388
361
|
return Ae += 1, {
|
|
389
362
|
id: `translation-workflow-issue-${Ae}`,
|
|
390
363
|
type: e,
|
|
391
|
-
severity:
|
|
392
|
-
message:
|
|
393
|
-
...
|
|
364
|
+
severity: t,
|
|
365
|
+
message: r,
|
|
366
|
+
...n
|
|
394
367
|
};
|
|
395
368
|
}
|
|
396
|
-
function
|
|
397
|
-
if (
|
|
369
|
+
function ie(e, t) {
|
|
370
|
+
if (t) {
|
|
398
371
|
e.hasAttribute("data-translation-prev-contenteditable") || e.setAttribute(
|
|
399
372
|
"data-translation-prev-contenteditable",
|
|
400
373
|
e.hasAttribute("contenteditable") && e.getAttribute("contenteditable") || "inherit"
|
|
@@ -402,107 +375,101 @@ function ce(e, n) {
|
|
|
402
375
|
return;
|
|
403
376
|
}
|
|
404
377
|
if (e.removeAttribute("data-translation-locked"), e.removeAttribute("aria-readonly"), e.classList.remove("rte-translation-segment-locked"), e.hasAttribute("data-translation-prev-contenteditable")) {
|
|
405
|
-
const
|
|
406
|
-
|
|
378
|
+
const r = e.getAttribute("data-translation-prev-contenteditable") || "";
|
|
379
|
+
r === "inherit" ? e.setAttribute("contenteditable", "true") : e.setAttribute("contenteditable", r), e.removeAttribute("data-translation-prev-contenteditable");
|
|
407
380
|
} else
|
|
408
381
|
e.setAttribute("contenteditable", "true");
|
|
409
382
|
}
|
|
410
|
-
function
|
|
411
|
-
return e.querySelector(`[data-translation-segment-id="${Ke(
|
|
383
|
+
function ce(e, t) {
|
|
384
|
+
return e.querySelector(`[data-translation-segment-id="${Ke(t)}"]`);
|
|
412
385
|
}
|
|
413
386
|
function He(e) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const r = new Set(t);
|
|
425
|
-
return t.filter((a) => {
|
|
387
|
+
const t = window.getSelection();
|
|
388
|
+
if (!t || t.rangeCount === 0) return null;
|
|
389
|
+
const r = Ce(t.getRangeAt(0).startContainer);
|
|
390
|
+
return !r || !e.contains(r) ? null : r.closest("[data-translation-segment-id]");
|
|
391
|
+
}
|
|
392
|
+
function tt(e, t) {
|
|
393
|
+
const r = Array.from(e.querySelectorAll(t));
|
|
394
|
+
if (r.length <= 1) return r;
|
|
395
|
+
const n = new Set(r);
|
|
396
|
+
return r.filter((a) => {
|
|
426
397
|
let o = a.parentElement;
|
|
427
398
|
for (; o && o !== e; ) {
|
|
428
|
-
if (
|
|
399
|
+
if (n.has(o))
|
|
429
400
|
return !1;
|
|
430
401
|
o = o.parentElement;
|
|
431
402
|
}
|
|
432
403
|
return !0;
|
|
433
404
|
});
|
|
434
405
|
}
|
|
435
|
-
function nt(e,
|
|
436
|
-
let
|
|
437
|
-
if (!
|
|
406
|
+
function nt(e, t, r) {
|
|
407
|
+
let n = (r || "").trim();
|
|
408
|
+
if (!n || t.has(n)) {
|
|
438
409
|
do
|
|
439
|
-
|
|
440
|
-
while (
|
|
441
|
-
e.setAttribute("data-translation-segment-id",
|
|
410
|
+
n = `translation-segment-${_e++}`;
|
|
411
|
+
while (t.has(n));
|
|
412
|
+
e.setAttribute("data-translation-segment-id", n);
|
|
442
413
|
}
|
|
443
|
-
return
|
|
444
|
-
}
|
|
445
|
-
function me(e,
|
|
446
|
-
if (
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
ce(a, !0);
|
|
454
|
-
const o = n.lockedHtmlBySegmentId.get(r);
|
|
414
|
+
return n;
|
|
415
|
+
}
|
|
416
|
+
function me(e, t) {
|
|
417
|
+
if (t.lockedSegmentIds.size === 0) return !1;
|
|
418
|
+
let r = !1;
|
|
419
|
+
return t.lockedSegmentIds.forEach((n) => {
|
|
420
|
+
const a = ce(e, n);
|
|
421
|
+
if (!a) return;
|
|
422
|
+
ie(a, !0);
|
|
423
|
+
const o = t.lockedHtmlBySegmentId.get(n);
|
|
455
424
|
if (typeof o == "string") {
|
|
456
|
-
a.innerHTML !== o && (a.innerHTML = o,
|
|
425
|
+
a.innerHTML !== o && (a.innerHTML = o, r = !0);
|
|
457
426
|
return;
|
|
458
427
|
}
|
|
459
|
-
|
|
460
|
-
}),
|
|
461
|
-
}
|
|
462
|
-
function M(e,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
t.lockedHtmlBySegmentId.set(c, i.innerHTML);
|
|
428
|
+
t.lockedHtmlBySegmentId.set(n, a.innerHTML);
|
|
429
|
+
}), r;
|
|
430
|
+
}
|
|
431
|
+
function M(e, t, r) {
|
|
432
|
+
const n = tt(e, t.segmentSelector), a = [], o = /* @__PURE__ */ new Set();
|
|
433
|
+
for (let l = 0; l < n.length && !(a.length >= t.maxSegments); l += 1) {
|
|
434
|
+
const s = n[l], i = nt(s, o, s.getAttribute("data-translation-segment-id")), d = r.lockedSegmentIds.has(i), g = s.getAttribute("data-translation-locked") === "true", w = d || g;
|
|
435
|
+
if (w)
|
|
436
|
+
if (r.lockedSegmentIds.add(i), ie(s, !0), !r.lockedHtmlBySegmentId.has(i))
|
|
437
|
+
r.lockedHtmlBySegmentId.set(i, s.innerHTML);
|
|
470
438
|
else {
|
|
471
|
-
const
|
|
472
|
-
|
|
439
|
+
const B = r.lockedHtmlBySegmentId.get(i) || "";
|
|
440
|
+
s.innerHTML !== B && (s.innerHTML = B);
|
|
473
441
|
}
|
|
474
442
|
else
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const K = t.sourceTextBySegmentId.get(c) || C;
|
|
443
|
+
r.lockedHtmlBySegmentId.delete(i);
|
|
444
|
+
const v = t.normalizeText(s.textContent || "");
|
|
445
|
+
if (!v) continue;
|
|
446
|
+
r.sourceTextBySegmentId.has(i) || r.sourceTextBySegmentId.set(i, v);
|
|
447
|
+
const G = r.sourceTextBySegmentId.get(i) || v;
|
|
481
448
|
a.push({
|
|
482
|
-
id:
|
|
483
|
-
tagName:
|
|
449
|
+
id: i,
|
|
450
|
+
tagName: s.tagName.toLowerCase(),
|
|
484
451
|
index: a.length,
|
|
485
|
-
text:
|
|
486
|
-
sourceText:
|
|
487
|
-
locked:
|
|
488
|
-
}), o.add(
|
|
452
|
+
text: v,
|
|
453
|
+
sourceText: G,
|
|
454
|
+
locked: w
|
|
455
|
+
}), o.add(i);
|
|
489
456
|
}
|
|
490
|
-
return Array.from(
|
|
491
|
-
o.has(
|
|
492
|
-
}), Array.from(
|
|
493
|
-
o.has(
|
|
494
|
-
}), Array.from(
|
|
495
|
-
(!o.has(
|
|
496
|
-
}), (!
|
|
497
|
-
}
|
|
498
|
-
function b(e,
|
|
499
|
-
|
|
500
|
-
let
|
|
501
|
-
return
|
|
502
|
-
sourceLocale:
|
|
503
|
-
targetLocale:
|
|
457
|
+
return Array.from(r.sourceTextBySegmentId.keys()).forEach((l) => {
|
|
458
|
+
o.has(l) || r.sourceTextBySegmentId.delete(l);
|
|
459
|
+
}), Array.from(r.lockedSegmentIds.keys()).forEach((l) => {
|
|
460
|
+
o.has(l) || r.lockedSegmentIds.delete(l);
|
|
461
|
+
}), Array.from(r.lockedHtmlBySegmentId.keys()).forEach((l) => {
|
|
462
|
+
(!o.has(l) || !r.lockedSegmentIds.has(l)) && r.lockedHtmlBySegmentId.delete(l);
|
|
463
|
+
}), (!r.selectedSegmentId || !a.some((l) => l.id === r.selectedSegmentId)) && (r.selectedSegmentId = a[0]?.id || null), a;
|
|
464
|
+
}
|
|
465
|
+
function b(e, t) {
|
|
466
|
+
c.has(e) || c.set(e, t);
|
|
467
|
+
let r = q.get(e);
|
|
468
|
+
return r || (r = {
|
|
469
|
+
sourceLocale: t.sourceLocale,
|
|
470
|
+
targetLocale: t.targetLocale,
|
|
504
471
|
selectedSegmentId: null,
|
|
505
|
-
realtimeEnabled:
|
|
472
|
+
realtimeEnabled: t.enableRealtime,
|
|
506
473
|
segments: [],
|
|
507
474
|
issues: [],
|
|
508
475
|
sourceTextBySegmentId: /* @__PURE__ */ new Map(),
|
|
@@ -510,41 +477,40 @@ function b(e, n) {
|
|
|
510
477
|
lockedHtmlBySegmentId: /* @__PURE__ */ new Map(),
|
|
511
478
|
snapshot: "",
|
|
512
479
|
lastRunAt: null
|
|
513
|
-
},
|
|
480
|
+
}, q.set(e, r)), U.add(e), r;
|
|
514
481
|
}
|
|
515
482
|
function Se(e) {
|
|
516
|
-
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
const a =
|
|
522
|
-
a &&
|
|
523
|
-
}),
|
|
483
|
+
we(e);
|
|
484
|
+
const t = p.get(e);
|
|
485
|
+
t && t.remove(), p.delete(e), j.delete(e);
|
|
486
|
+
const r = q.get(e);
|
|
487
|
+
r && (r.lockedSegmentIds.forEach((n) => {
|
|
488
|
+
const a = ce(e, n);
|
|
489
|
+
a && ie(a, !1);
|
|
490
|
+
}), r.lockedHtmlBySegmentId.clear()), c.delete(e), re.delete(e), q.delete(e), U.delete(e), x === e && (x = null);
|
|
524
491
|
}
|
|
525
492
|
function ye(e) {
|
|
526
|
-
return
|
|
493
|
+
return j.get(e) === !0;
|
|
527
494
|
}
|
|
528
|
-
function be(e,
|
|
529
|
-
if (!
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
n.style.width = `${r}px`, n.style.left = `${o}px`, n.style.top = `${l}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
|
|
495
|
+
function be(e, t) {
|
|
496
|
+
if (!t.classList.contains("show")) return;
|
|
497
|
+
const r = xe(e).getBoundingClientRect(), n = Math.min(window.innerWidth - 20, 520), a = Math.max(10, window.innerWidth - n - 10), o = Math.min(Math.max(10, r.right - n), a), l = Math.max(10, Math.min(window.innerHeight - 10, r.top + 12));
|
|
498
|
+
t.style.width = `${n}px`, t.style.left = `${o}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
|
|
533
499
|
}
|
|
534
|
-
function
|
|
535
|
-
const
|
|
536
|
-
|
|
500
|
+
function H(e, t) {
|
|
501
|
+
const r = e.querySelector(".rte-translation-live");
|
|
502
|
+
r && (r.textContent = t);
|
|
537
503
|
}
|
|
538
|
-
function rt(e,
|
|
539
|
-
return `${e.innerHTML}::${
|
|
504
|
+
function rt(e, t) {
|
|
505
|
+
return `${e.innerHTML}::${t.sourceLocale}::${t.targetLocale}::${Array.from(t.lockedSegmentIds).sort().join("|")}`;
|
|
540
506
|
}
|
|
541
|
-
function ot(e,
|
|
542
|
-
const
|
|
543
|
-
for (let o = 0; o < e.length && !(
|
|
544
|
-
const l = e[o], s =
|
|
507
|
+
function ot(e, t, r) {
|
|
508
|
+
const n = [], a = et(r, t.targetLocale);
|
|
509
|
+
for (let o = 0; o < e.length && !(n.length >= r.maxIssues); o += 1) {
|
|
510
|
+
const l = e[o], s = r.normalizeText(l.sourceText || ""), i = r.normalizeText(l.text || "");
|
|
545
511
|
if (!i) {
|
|
546
|
-
|
|
547
|
-
|
|
512
|
+
n.push(
|
|
513
|
+
te("missing-target", "error", r.labels.missingTargetMessage, {
|
|
548
514
|
segmentId: l.id,
|
|
549
515
|
sourceText: s,
|
|
550
516
|
targetText: i,
|
|
@@ -553,26 +519,26 @@ function ot(e, n, t) {
|
|
|
553
519
|
);
|
|
554
520
|
continue;
|
|
555
521
|
}
|
|
556
|
-
if (a.preserveTokens && s && !je(s, i) && (
|
|
557
|
-
|
|
522
|
+
if (a.preserveTokens && s && !je(s, i) && (n.push(
|
|
523
|
+
te("token-mismatch", "error", r.labels.tokenMismatchMessage, {
|
|
558
524
|
segmentId: l.id,
|
|
559
525
|
sourceText: s,
|
|
560
526
|
targetText: i,
|
|
561
527
|
suggestion: "Preserve placeholders/tokens exactly (for example {{name}}, %ID%, ${value})."
|
|
562
528
|
})
|
|
563
|
-
),
|
|
564
|
-
|
|
529
|
+
), n.length >= r.maxIssues) || a.requireDifferentFromSource && s && r.normalizeText(s) === r.normalizeText(i) && (n.push(
|
|
530
|
+
te("untranslated", "warning", r.labels.untranslatedMessage, {
|
|
565
531
|
segmentId: l.id,
|
|
566
532
|
sourceText: s,
|
|
567
533
|
targetText: i,
|
|
568
534
|
suggestion: "Translate the segment or mark it intentionally unchanged."
|
|
569
535
|
})
|
|
570
|
-
),
|
|
536
|
+
), n.length >= r.maxIssues))
|
|
571
537
|
break;
|
|
572
|
-
if (s.length >=
|
|
573
|
-
const
|
|
574
|
-
(
|
|
575
|
-
|
|
538
|
+
if (s.length >= r.minSourceLengthForRatio) {
|
|
539
|
+
const d = i.length / Math.max(1, s.length);
|
|
540
|
+
(d < a.minLengthRatio || d > a.maxLengthRatio) && n.push(
|
|
541
|
+
te("length-out-of-range", "warning", r.labels.lengthOutOfRangeMessage, {
|
|
576
542
|
segmentId: l.id,
|
|
577
543
|
sourceText: s,
|
|
578
544
|
targetText: i,
|
|
@@ -581,83 +547,80 @@ function ot(e, n, t) {
|
|
|
581
547
|
);
|
|
582
548
|
}
|
|
583
549
|
}
|
|
584
|
-
return
|
|
550
|
+
return n;
|
|
585
551
|
}
|
|
586
552
|
function qe(e) {
|
|
587
|
-
const
|
|
553
|
+
const t = c.get(e) || k, r = q.get(e);
|
|
588
554
|
return {
|
|
589
|
-
sourceLocale:
|
|
590
|
-
targetLocale:
|
|
591
|
-
realtimeEnabled:
|
|
592
|
-
selectedSegmentId:
|
|
593
|
-
segmentCount:
|
|
594
|
-
lockedSegmentCount:
|
|
595
|
-
issues:
|
|
596
|
-
segments:
|
|
597
|
-
id:
|
|
598
|
-
tagName:
|
|
599
|
-
index:
|
|
600
|
-
sourceLength:
|
|
601
|
-
targetLength:
|
|
602
|
-
locked:
|
|
603
|
-
}))
|
|
604
|
-
lastRunAt:
|
|
555
|
+
sourceLocale: r?.sourceLocale || t?.sourceLocale || "en-US",
|
|
556
|
+
targetLocale: r?.targetLocale || t?.targetLocale || "fr-FR",
|
|
557
|
+
realtimeEnabled: r?.realtimeEnabled === !0,
|
|
558
|
+
selectedSegmentId: r?.selectedSegmentId || null,
|
|
559
|
+
segmentCount: r?.segments.length || 0,
|
|
560
|
+
lockedSegmentCount: r ? r.segments.filter((n) => n.locked).length : 0,
|
|
561
|
+
issues: r?.issues ? r.issues.map((n) => ({ ...n })) : [],
|
|
562
|
+
segments: r?.segments.map((n) => ({
|
|
563
|
+
id: n.id,
|
|
564
|
+
tagName: n.tagName,
|
|
565
|
+
index: n.index,
|
|
566
|
+
sourceLength: n.sourceText.length,
|
|
567
|
+
targetLength: n.text.length,
|
|
568
|
+
locked: n.locked
|
|
569
|
+
})) || [],
|
|
570
|
+
lastRunAt: r?.lastRunAt || null
|
|
605
571
|
};
|
|
606
572
|
}
|
|
607
|
-
function
|
|
608
|
-
const
|
|
609
|
-
fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime",
|
|
573
|
+
function E(e) {
|
|
574
|
+
const t = q.get(e), r = t && t.selectedSegmentId ? t.segments.find((n) => n.id === t.selectedSegmentId) : null;
|
|
575
|
+
fe(e, "toggleTranslationWorkflowPanel", ye(e)), fe(e, "toggleTranslationRealtime", t?.realtimeEnabled === !0), fe(e, "toggleTranslationSegmentLock", r?.locked === !0);
|
|
610
576
|
}
|
|
611
|
-
function at(e,
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
614
|
-
return;
|
|
577
|
+
function at(e, t) {
|
|
578
|
+
const r = ce(e, t);
|
|
579
|
+
if (!r) return;
|
|
615
580
|
try {
|
|
616
|
-
|
|
581
|
+
r.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
617
582
|
} catch {
|
|
618
583
|
}
|
|
619
|
-
const
|
|
620
|
-
if (!(!
|
|
584
|
+
const n = window.getSelection();
|
|
585
|
+
if (!(!n || typeof document.createRange != "function"))
|
|
621
586
|
try {
|
|
622
587
|
const a = document.createRange();
|
|
623
|
-
a.selectNodeContents(
|
|
588
|
+
a.selectNodeContents(r), a.collapse(!0), n.removeAllRanges(), n.addRange(a), e.focus({ preventScroll: !0 });
|
|
624
589
|
} catch {
|
|
625
590
|
}
|
|
626
591
|
}
|
|
627
|
-
function
|
|
628
|
-
const
|
|
629
|
-
if (!
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const f = r.issues.length, z = r.selectedSegmentId ? ` • ${t.labels.selectedSegmentPrefix}: ${r.selectedSegmentId}` : "";
|
|
643
|
-
c.textContent = `${t.labels.summaryPrefix}: ${r.sourceLocale} → ${r.targetLocale} • ${f} issue${f === 1 ? "" : "s"}${z}`;
|
|
592
|
+
function R(e) {
|
|
593
|
+
const t = p.get(e);
|
|
594
|
+
if (!t) return;
|
|
595
|
+
const r = c.get(e) || k;
|
|
596
|
+
if (!r) return;
|
|
597
|
+
const n = b(e, r), a = t.querySelector(".rte-translation-source-label");
|
|
598
|
+
a && (a.textContent = r.labels.sourceLocaleLabel);
|
|
599
|
+
const o = t.querySelector(".rte-translation-target-label");
|
|
600
|
+
o && (o.textContent = r.labels.targetLocaleLabel);
|
|
601
|
+
const l = t.querySelector('[data-field="source-locale"]'), s = t.querySelector('[data-field="target-locale"]'), i = r.locales.map((f) => `<option value="${m(f)}">${m(f)}</option>`).join("");
|
|
602
|
+
l && (l.innerHTML = i, l.value = n.sourceLocale), s && (s.innerHTML = i, s.value = n.targetLocale);
|
|
603
|
+
const d = t.querySelector(".rte-translation-summary");
|
|
604
|
+
if (d) {
|
|
605
|
+
const f = n.issues.length, P = n.selectedSegmentId ? ` • ${r.labels.selectedSegmentPrefix}: ${n.selectedSegmentId}` : "";
|
|
606
|
+
d.textContent = `${r.labels.summaryPrefix}: ${n.sourceLocale} → ${n.targetLocale} • ${f} issue${f === 1 ? "" : "s"}${P}`;
|
|
644
607
|
}
|
|
645
|
-
const g =
|
|
646
|
-
g && (g.textContent =
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
const Le =
|
|
658
|
-
Le && Le.setAttribute("aria-label",
|
|
659
|
-
const
|
|
660
|
-
|
|
608
|
+
const g = t.querySelector(".rte-translation-helper");
|
|
609
|
+
g && (g.textContent = r.labels.helperText);
|
|
610
|
+
const w = t.querySelector(".rte-translation-shortcut");
|
|
611
|
+
w && (w.textContent = r.labels.shortcutText);
|
|
612
|
+
const v = t.querySelector('[data-action="run-validation"]');
|
|
613
|
+
v && (v.textContent = r.labels.validateText);
|
|
614
|
+
const G = t.querySelector('[data-action="capture-source"]');
|
|
615
|
+
G && (G.textContent = r.labels.captureSourceText);
|
|
616
|
+
const B = t.querySelector('[data-action="toggle-realtime"]');
|
|
617
|
+
B && (B.textContent = n.realtimeEnabled ? r.labels.realtimeOnText : r.labels.realtimeOffText, B.setAttribute("aria-pressed", n.realtimeEnabled ? "true" : "false"));
|
|
618
|
+
const Y = t.querySelector('[data-action="lock-selected"]'), ue = n.selectedSegmentId && n.segments.find((f) => f.id === n.selectedSegmentId) || null;
|
|
619
|
+
Y && (Y.textContent = ue?.locked ? r.labels.unlockSelectedText : r.labels.lockSelectedText, Y.disabled = !ue, Y.setAttribute("aria-pressed", ue?.locked ? "true" : "false"));
|
|
620
|
+
const Le = t.querySelector('[data-action="close"]');
|
|
621
|
+
Le && Le.setAttribute("aria-label", r.labels.closeText);
|
|
622
|
+
const Z = t.querySelector(".rte-translation-issues"), F = t.querySelector(".rte-translation-empty");
|
|
623
|
+
Z && (Z.setAttribute("aria-label", r.labels.issuesLabel), n.issues.length === 0 ? (Z.innerHTML = "", F && (F.hidden = !1, F.textContent = r.labels.noIssuesText)) : (F && (F.hidden = !0), Z.innerHTML = n.issues.map((f) => `
|
|
661
624
|
<li class="rte-translation-issue ${f.severity === "error" ? "error" : f.severity === "warning" ? "warning" : "info"}" role="listitem" data-segment-id="${m(
|
|
662
625
|
f.segmentId || ""
|
|
663
626
|
)}">
|
|
@@ -665,11 +628,11 @@ function A(e) {
|
|
|
665
628
|
${f.suggestion ? `<p class="rte-translation-issue-suggestion">${m(f.suggestion)}</p>` : ""}
|
|
666
629
|
</li>
|
|
667
630
|
`).join("")));
|
|
668
|
-
const de =
|
|
669
|
-
de && (de.setAttribute("aria-label",
|
|
670
|
-
const
|
|
631
|
+
const de = t.querySelector(".rte-translation-segments");
|
|
632
|
+
de && (de.setAttribute("aria-label", r.labels.segmentsLabel), de.innerHTML = n.segments.map((f) => {
|
|
633
|
+
const P = f.id === n.selectedSegmentId ? "selected" : "", Ne = f.locked ? "locked" : "";
|
|
671
634
|
return `
|
|
672
|
-
<li class="rte-translation-segment-item ${
|
|
635
|
+
<li class="rte-translation-segment-item ${P} ${Ne}" role="option" aria-selected="${f.id === n.selectedSegmentId ? "true" : "false"}" data-segment-id="${m(f.id)}">
|
|
673
636
|
<button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(
|
|
674
637
|
f.id
|
|
675
638
|
)}" title="${m(f.text)}">
|
|
@@ -678,41 +641,39 @@ function A(e) {
|
|
|
678
641
|
</button>
|
|
679
642
|
<button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(
|
|
680
643
|
f.id
|
|
681
|
-
)}" aria-label="${f.locked ?
|
|
644
|
+
)}" aria-label="${f.locked ? r.labels.unlockSegmentAriaLabel : r.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked ? "true" : "false"}"></button>
|
|
682
645
|
</li>
|
|
683
646
|
`;
|
|
684
647
|
}).join(""));
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
const f =
|
|
688
|
-
|
|
648
|
+
const J = t.querySelector(".rte-translation-source-preview"), Q = t.querySelector(".rte-translation-target-preview");
|
|
649
|
+
if (J || Q) {
|
|
650
|
+
const f = n.selectedSegmentId && n.segments.find((P) => P.id === n.selectedSegmentId) || null;
|
|
651
|
+
J && (J.textContent = f?.sourceText || "—", J.setAttribute("aria-label", r.labels.sourcePreviewLabel)), Q && (Q.textContent = f?.text || "—", Q.setAttribute("aria-label", r.labels.targetPreviewLabel));
|
|
689
652
|
}
|
|
690
|
-
|
|
653
|
+
t.setAttribute("aria-label", r.labels.panelAriaLabel);
|
|
691
654
|
}
|
|
692
655
|
function Be(e) {
|
|
693
|
-
const
|
|
694
|
-
if (!
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const a = b(e, r), o = me(e, a);
|
|
707
|
-
a.segments = M(e, r, a);
|
|
656
|
+
const t = c.get(e) || k;
|
|
657
|
+
if (!t) return;
|
|
658
|
+
we(e);
|
|
659
|
+
const r = window.setTimeout(() => {
|
|
660
|
+
le.delete(e), L(e, "realtime", !1);
|
|
661
|
+
}, t.debounceMs);
|
|
662
|
+
le.set(e, r);
|
|
663
|
+
}
|
|
664
|
+
function L(e, t, r) {
|
|
665
|
+
const n = c.get(e) || k;
|
|
666
|
+
if (!n) return [];
|
|
667
|
+
const a = b(e, n), o = me(e, a);
|
|
668
|
+
a.segments = M(e, n, a);
|
|
708
669
|
const l = rt(e, a);
|
|
709
|
-
if (!
|
|
670
|
+
if (!r && a.snapshot === l)
|
|
710
671
|
return a.issues;
|
|
711
|
-
a.issues = ot(a.segments, a,
|
|
672
|
+
a.issues = ot(a.segments, a, n), a.lastRunAt = (/* @__PURE__ */ new Date()).toISOString(), a.snapshot = l, R(e), E(e), e.dispatchEvent(
|
|
712
673
|
new CustomEvent("editora:translation-workflow-validation", {
|
|
713
674
|
bubbles: !0,
|
|
714
675
|
detail: {
|
|
715
|
-
reason:
|
|
676
|
+
reason: t,
|
|
716
677
|
state: qe(e)
|
|
717
678
|
}
|
|
718
679
|
})
|
|
@@ -720,48 +681,43 @@ function L(e, n, t) {
|
|
|
720
681
|
const s = p.get(e);
|
|
721
682
|
if (s) {
|
|
722
683
|
if (o)
|
|
723
|
-
return
|
|
724
|
-
|
|
684
|
+
return H(s, n.labels.readonlySegmentMessage), a.issues;
|
|
685
|
+
H(
|
|
725
686
|
s,
|
|
726
|
-
a.issues.length === 0 ?
|
|
687
|
+
a.issues.length === 0 ? n.labels.noIssuesText : `${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} detected.`
|
|
727
688
|
);
|
|
728
689
|
}
|
|
729
690
|
return a.issues;
|
|
730
691
|
}
|
|
731
692
|
function Pe(e) {
|
|
732
|
-
const
|
|
733
|
-
if (!
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}), t.snapshot = "", L(e, "capture-source", !0);
|
|
693
|
+
const t = c.get(e) || k;
|
|
694
|
+
if (!t) return !1;
|
|
695
|
+
const r = b(e, t), n = M(e, t, r);
|
|
696
|
+
n.forEach((o) => {
|
|
697
|
+
r.sourceTextBySegmentId.set(o.id, o.text);
|
|
698
|
+
}), r.snapshot = "", L(e, "capture-source", !0);
|
|
739
699
|
const a = p.get(e);
|
|
740
|
-
return a &&
|
|
700
|
+
return a && H(a, t.labels.sourceCapturedMessage), e.dispatchEvent(
|
|
741
701
|
new CustomEvent("editora:translation-source-captured", {
|
|
742
702
|
bubbles: !0,
|
|
743
703
|
detail: {
|
|
744
|
-
sourceLocale:
|
|
745
|
-
segmentCount:
|
|
704
|
+
sourceLocale: r.sourceLocale,
|
|
705
|
+
segmentCount: n.length
|
|
746
706
|
}
|
|
747
707
|
})
|
|
748
708
|
), !0;
|
|
749
709
|
}
|
|
750
|
-
function
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
if (!
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
if (!s)
|
|
762
|
-
return !1;
|
|
763
|
-
const i = typeof t == "boolean" ? t : !a.lockedSegmentIds.has(l);
|
|
764
|
-
return i ? (a.lockedSegmentIds.add(l), a.lockedHtmlBySegmentId.set(l, s.innerHTML)) : (a.lockedSegmentIds.delete(l), a.lockedHtmlBySegmentId.delete(l)), ce(s, i), a.selectedSegmentId = l, a.snapshot = "", L(e, "lock-segment", !0), e.dispatchEvent(
|
|
710
|
+
function se(e, t, r) {
|
|
711
|
+
const n = c.get(e) || k;
|
|
712
|
+
if (!n) return !1;
|
|
713
|
+
const a = b(e, n);
|
|
714
|
+
a.segments = M(e, n, a);
|
|
715
|
+
const o = He(e)?.getAttribute("data-translation-segment-id") || null, l = t || o || a.selectedSegmentId || a.segments[0]?.id || null;
|
|
716
|
+
if (!l) return !1;
|
|
717
|
+
const s = ce(e, l);
|
|
718
|
+
if (!s) return !1;
|
|
719
|
+
const i = typeof r == "boolean" ? r : !a.lockedSegmentIds.has(l);
|
|
720
|
+
return i ? (a.lockedSegmentIds.add(l), a.lockedHtmlBySegmentId.set(l, s.innerHTML)) : (a.lockedSegmentIds.delete(l), a.lockedHtmlBySegmentId.delete(l)), ie(s, i), a.selectedSegmentId = l, a.snapshot = "", L(e, "lock-segment", !0), e.dispatchEvent(
|
|
765
721
|
new CustomEvent("editora:translation-segment-lock", {
|
|
766
722
|
bubbles: !0,
|
|
767
723
|
detail: {
|
|
@@ -771,63 +727,57 @@ function ie(e, n, t) {
|
|
|
771
727
|
})
|
|
772
728
|
), !0;
|
|
773
729
|
}
|
|
774
|
-
function De(e,
|
|
775
|
-
const
|
|
776
|
-
if (!
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
const
|
|
790
|
-
if (!
|
|
791
|
-
return !1;
|
|
792
|
-
const r = b(e, t);
|
|
793
|
-
if (r.segments = M(e, t, r), r.segments.length === 0)
|
|
794
|
-
return !1;
|
|
730
|
+
function De(e, t) {
|
|
731
|
+
const r = c.get(e) || k;
|
|
732
|
+
if (!r) return !1;
|
|
733
|
+
const n = b(e, r), a = typeof t == "boolean" ? t : !n.realtimeEnabled;
|
|
734
|
+
return n.realtimeEnabled = a, a ? Be(e) : we(e), R(e), E(e), !0;
|
|
735
|
+
}
|
|
736
|
+
function pe(e, t, r = !0) {
|
|
737
|
+
const n = c.get(e) || k;
|
|
738
|
+
if (!n) return !1;
|
|
739
|
+
const a = b(e, n);
|
|
740
|
+
return a.segments = M(e, n, a), a.segments.some((o) => o.id === t) ? (a.selectedSegmentId = t, R(e), E(e), r && at(e, t), !0) : !1;
|
|
741
|
+
}
|
|
742
|
+
function ne(e, t) {
|
|
743
|
+
const r = c.get(e) || k;
|
|
744
|
+
if (!r) return !1;
|
|
745
|
+
const n = b(e, r);
|
|
746
|
+
if (n.segments = M(e, r, n), n.segments.length === 0) return !1;
|
|
795
747
|
const a = Math.max(
|
|
796
748
|
0,
|
|
797
|
-
|
|
749
|
+
n.segments.findIndex((s) => s.id === n.selectedSegmentId)
|
|
798
750
|
);
|
|
799
751
|
let o = a;
|
|
800
|
-
|
|
801
|
-
const l =
|
|
752
|
+
t === "start" ? o = 0 : t === "end" ? o = n.segments.length - 1 : o = C(a + t, 0, n.segments.length - 1);
|
|
753
|
+
const l = n.segments[o];
|
|
802
754
|
return l ? pe(e, l.id, !0) : !1;
|
|
803
755
|
}
|
|
804
|
-
function
|
|
805
|
-
const
|
|
806
|
-
|
|
756
|
+
function V(e, t = !1) {
|
|
757
|
+
const r = p.get(e);
|
|
758
|
+
r && (r.classList.remove("show"), j.set(e, !1), E(e), t && e.focus({ preventScroll: !0 }));
|
|
807
759
|
}
|
|
808
760
|
function he(e) {
|
|
809
|
-
const
|
|
810
|
-
p.forEach((
|
|
811
|
-
a !== e &&
|
|
812
|
-
}),
|
|
813
|
-
const t = n.querySelector('[data-field="target-locale"]');
|
|
814
|
-
t == null || t.focus();
|
|
761
|
+
const t = ut(e);
|
|
762
|
+
p.forEach((n, a) => {
|
|
763
|
+
a !== e && V(a, !1);
|
|
764
|
+
}), t.classList.add("show"), j.set(e, !0), L(e, "panel-open", !1), R(e), be(e, t), E(e), t.querySelector('[data-field="target-locale"]')?.focus();
|
|
815
765
|
}
|
|
816
|
-
function ze(e,
|
|
817
|
-
const
|
|
818
|
-
return (typeof
|
|
766
|
+
function ze(e, t) {
|
|
767
|
+
const r = ye(e);
|
|
768
|
+
return (typeof t == "boolean" ? t : !r) ? he(e) : V(e, !1), !0;
|
|
819
769
|
}
|
|
820
770
|
function lt(e) {
|
|
821
|
-
const
|
|
822
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey &&
|
|
771
|
+
const t = e.key.toLowerCase();
|
|
772
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
|
|
823
773
|
}
|
|
824
774
|
function st(e) {
|
|
825
|
-
const
|
|
826
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey &&
|
|
775
|
+
const t = e.key.toLowerCase();
|
|
776
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
|
|
827
777
|
}
|
|
828
778
|
function it(e) {
|
|
829
|
-
const
|
|
830
|
-
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey &&
|
|
779
|
+
const t = e.key.toLowerCase();
|
|
780
|
+
return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "k";
|
|
831
781
|
}
|
|
832
782
|
function ct(e) {
|
|
833
783
|
return e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey ? !0 : e.key === "Backspace" || e.key === "Delete" || e.key === "Enter";
|
|
@@ -836,17 +786,16 @@ function Ie(e) {
|
|
|
836
786
|
return e instanceof HTMLElement ? e.closest('[data-translation-locked="true"]') : null;
|
|
837
787
|
}
|
|
838
788
|
function ut(e) {
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
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 = `
|
|
789
|
+
const t = p.get(e);
|
|
790
|
+
if (t) return t;
|
|
791
|
+
const r = c.get(e) || k || oe();
|
|
792
|
+
b(e, r);
|
|
793
|
+
const n = `rte-translation-workflow-panel-${Fe++}`, a = `${n}-source`, o = `${n}-target`, l = document.createElement("section");
|
|
794
|
+
return l.className = u, l.id = n, l.setAttribute("role", "dialog"), l.setAttribute("aria-modal", "false"), l.setAttribute("aria-label", r.labels.panelAriaLabel), l.innerHTML = `
|
|
846
795
|
<header class="rte-translation-header">
|
|
847
|
-
<h2 class="rte-translation-title">${m(
|
|
796
|
+
<h2 class="rte-translation-title">${m(r.labels.panelTitle)}</h2>
|
|
848
797
|
<button type="button" class="rte-translation-icon-btn" data-action="close" aria-label="${m(
|
|
849
|
-
|
|
798
|
+
r.labels.closeText
|
|
850
799
|
)}">✕</button>
|
|
851
800
|
</header>
|
|
852
801
|
<div class="rte-translation-body">
|
|
@@ -870,46 +819,45 @@ function ut(e) {
|
|
|
870
819
|
<p class="rte-translation-helper"></p>
|
|
871
820
|
<p class="rte-translation-shortcut"></p>
|
|
872
821
|
<div class="rte-translation-grid">
|
|
873
|
-
<section class="rte-translation-segments-wrap" aria-label="${m(
|
|
874
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
822
|
+
<section class="rte-translation-segments-wrap" aria-label="${m(r.labels.segmentsLabel)}">
|
|
823
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.segmentsLabel)}</h3>
|
|
875
824
|
<ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(
|
|
876
|
-
|
|
825
|
+
r.labels.segmentsLabel
|
|
877
826
|
)}"></ul>
|
|
878
827
|
</section>
|
|
879
828
|
<section class="rte-translation-preview-wrap">
|
|
880
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
881
|
-
|
|
829
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.sourcePreviewLabel)} / ${m(
|
|
830
|
+
r.labels.targetPreviewLabel
|
|
882
831
|
)}</h3>
|
|
883
832
|
<div class="rte-translation-preview-block">
|
|
884
|
-
<p class="rte-translation-preview-label">${m(
|
|
833
|
+
<p class="rte-translation-preview-label">${m(r.labels.sourcePreviewLabel)}</p>
|
|
885
834
|
<p class="rte-translation-source-preview"></p>
|
|
886
835
|
</div>
|
|
887
836
|
<div class="rte-translation-preview-block">
|
|
888
|
-
<p class="rte-translation-preview-label">${m(
|
|
837
|
+
<p class="rte-translation-preview-label">${m(r.labels.targetPreviewLabel)}</p>
|
|
889
838
|
<p class="rte-translation-target-preview"></p>
|
|
890
839
|
</div>
|
|
891
840
|
</section>
|
|
892
841
|
</div>
|
|
893
842
|
<section class="rte-translation-issues-wrap">
|
|
894
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
895
|
-
<ul class="rte-translation-issues" role="list" aria-label="${m(
|
|
843
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.issuesLabel)}</h3>
|
|
844
|
+
<ul class="rte-translation-issues" role="list" aria-label="${m(r.labels.issuesLabel)}"></ul>
|
|
896
845
|
<p class="rte-translation-empty" hidden></p>
|
|
897
846
|
</section>
|
|
898
847
|
</div>
|
|
899
848
|
<div class="rte-translation-live" aria-live="polite" aria-atomic="true"></div>
|
|
900
849
|
`, l.addEventListener("click", (s) => {
|
|
901
850
|
const i = s.target;
|
|
902
|
-
if (!i)
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
R && pe(e, R, !0);
|
|
851
|
+
if (!i) return;
|
|
852
|
+
const d = i.closest("[data-action]");
|
|
853
|
+
if (!d) {
|
|
854
|
+
const v = i.closest(".rte-translation-issue[data-segment-id]")?.getAttribute("data-segment-id") || "";
|
|
855
|
+
v && pe(e, v, !0);
|
|
908
856
|
return;
|
|
909
857
|
}
|
|
910
|
-
const g =
|
|
858
|
+
const g = d.getAttribute("data-action");
|
|
911
859
|
if (g === "close") {
|
|
912
|
-
|
|
860
|
+
V(e, !0);
|
|
913
861
|
return;
|
|
914
862
|
}
|
|
915
863
|
if (g === "run-validation") {
|
|
@@ -921,7 +869,7 @@ function ut(e) {
|
|
|
921
869
|
return;
|
|
922
870
|
}
|
|
923
871
|
if (g === "lock-selected") {
|
|
924
|
-
|
|
872
|
+
se(e);
|
|
925
873
|
return;
|
|
926
874
|
}
|
|
927
875
|
if (g === "toggle-realtime") {
|
|
@@ -929,139 +877,126 @@ function ut(e) {
|
|
|
929
877
|
return;
|
|
930
878
|
}
|
|
931
879
|
if (g === "select-segment") {
|
|
932
|
-
const
|
|
933
|
-
|
|
880
|
+
const w = d.getAttribute("data-segment-id") || "";
|
|
881
|
+
w && pe(e, w, !0);
|
|
934
882
|
return;
|
|
935
883
|
}
|
|
936
884
|
if (g === "toggle-lock") {
|
|
937
|
-
const
|
|
938
|
-
|
|
885
|
+
const w = d.getAttribute("data-segment-id") || "";
|
|
886
|
+
w && se(e, w);
|
|
939
887
|
}
|
|
940
888
|
}), l.addEventListener("change", (s) => {
|
|
941
889
|
const i = s.target;
|
|
942
|
-
if (!(i instanceof HTMLSelectElement))
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return;
|
|
947
|
-
const g = b(e, c);
|
|
890
|
+
if (!(i instanceof HTMLSelectElement)) return;
|
|
891
|
+
const d = c.get(e) || k;
|
|
892
|
+
if (!d) return;
|
|
893
|
+
const g = b(e, d);
|
|
948
894
|
if (i.getAttribute("data-field") === "source-locale") {
|
|
949
|
-
g.sourceLocale =
|
|
895
|
+
g.sourceLocale = A(i.value), g.snapshot = "", L(e, "source-locale-change", !0);
|
|
950
896
|
return;
|
|
951
897
|
}
|
|
952
|
-
i.getAttribute("data-field") === "target-locale" && (g.targetLocale =
|
|
898
|
+
i.getAttribute("data-field") === "target-locale" && (g.targetLocale = A(i.value), g.snapshot = "", L(e, "target-locale-change", !0));
|
|
953
899
|
}), l.addEventListener("keydown", (s) => {
|
|
954
900
|
const i = s.target;
|
|
955
901
|
if (s.key === "Escape") {
|
|
956
|
-
s.preventDefault(),
|
|
902
|
+
s.preventDefault(), V(e, !0);
|
|
957
903
|
return;
|
|
958
904
|
}
|
|
959
|
-
!
|
|
960
|
-
}), ge(l, e), document.body.appendChild(l), p.set(e, l),
|
|
905
|
+
!i?.closest(".rte-translation-segments") || !Me.has(s.key) || (s.preventDefault(), s.key === "ArrowUp" ? ne(e, -1) : s.key === "ArrowDown" ? ne(e, 1) : s.key === "Home" ? ne(e, "start") : s.key === "End" && ne(e, "end"));
|
|
906
|
+
}), ge(l, e), document.body.appendChild(l), p.set(e, l), j.set(e, !1), R(e), l;
|
|
961
907
|
}
|
|
962
908
|
function dt(e) {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
if (!
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (!a)
|
|
981
|
-
return;
|
|
982
|
-
const o = b(r, a), l = me(r, o);
|
|
983
|
-
if (o.segments = M(r, a, o), !o.realtimeEnabled) {
|
|
909
|
+
k = e, D || (D = (t) => {
|
|
910
|
+
ae();
|
|
911
|
+
const n = t.target?.closest(S);
|
|
912
|
+
if (!n) return;
|
|
913
|
+
const a = c.get(n) || e, o = b(n, a);
|
|
914
|
+
c.set(n, a), x = n;
|
|
915
|
+
const l = He(n)?.getAttribute("data-translation-segment-id") || null;
|
|
916
|
+
l && (o.selectedSegmentId = l), E(n);
|
|
917
|
+
const s = p.get(n);
|
|
918
|
+
s && (ge(s, n), be(n, s), R(n));
|
|
919
|
+
}, document.addEventListener("focusin", D, !0)), z || (z = (t) => {
|
|
920
|
+
const n = t.target?.closest(S);
|
|
921
|
+
if (!n) return;
|
|
922
|
+
const a = c.get(n) || k;
|
|
923
|
+
if (!a) return;
|
|
924
|
+
const o = b(n, a), l = me(n, o);
|
|
925
|
+
if (o.segments = M(n, a, o), !o.realtimeEnabled) {
|
|
984
926
|
if (l) {
|
|
985
|
-
const s = p.get(
|
|
986
|
-
s &&
|
|
927
|
+
const s = p.get(n);
|
|
928
|
+
s && H(s, a.labels.readonlySegmentMessage);
|
|
987
929
|
}
|
|
988
|
-
|
|
930
|
+
R(n), E(n);
|
|
989
931
|
return;
|
|
990
932
|
}
|
|
991
|
-
Be(
|
|
992
|
-
}, document.addEventListener("input",
|
|
993
|
-
const
|
|
994
|
-
if (!a)
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
if (
|
|
1004
|
-
|
|
1005
|
-
const t = n.target;
|
|
1006
|
-
if ((t == null ? void 0 : t.closest(`.${d}`)) && n.key !== "Escape" && !Me.has(n.key))
|
|
1007
|
-
return;
|
|
1008
|
-
const a = n.key === "Escape", o = lt(n), l = st(n), s = it(n), i = Ie(t);
|
|
933
|
+
Be(n);
|
|
934
|
+
}, document.addEventListener("input", z, !0)), N || (N = (t) => {
|
|
935
|
+
const r = t, n = r.target, a = n?.closest(S);
|
|
936
|
+
if (!a) return;
|
|
937
|
+
const o = Ie(n);
|
|
938
|
+
if (!o || !a.contains(o)) return;
|
|
939
|
+
r.preventDefault();
|
|
940
|
+
const l = p.get(a), s = c.get(a) || k;
|
|
941
|
+
l && s && H(l, s.labels.readonlySegmentMessage);
|
|
942
|
+
}, document.addEventListener("beforeinput", N, !0)), O || (O = (t) => {
|
|
943
|
+
if (t.defaultPrevented) return;
|
|
944
|
+
const r = t.target;
|
|
945
|
+
if (r?.closest(`.${u}`) && t.key !== "Escape" && !Me.has(t.key)) return;
|
|
946
|
+
const a = t.key === "Escape", o = lt(t), l = st(t), s = it(t), i = Ie(r);
|
|
1009
947
|
if (!a && !o && !l && !s && !i)
|
|
1010
948
|
return;
|
|
1011
|
-
const
|
|
1012
|
-
if (!
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
n.preventDefault(), G(c, !0);
|
|
949
|
+
const d = Xe(t);
|
|
950
|
+
if (!d) return;
|
|
951
|
+
const g = c.get(d) || k || e;
|
|
952
|
+
if (b(d, g), c.set(d, g), x = d, a && ye(d)) {
|
|
953
|
+
t.preventDefault(), V(d, !0);
|
|
1017
954
|
return;
|
|
1018
955
|
}
|
|
1019
|
-
if (i &&
|
|
1020
|
-
|
|
1021
|
-
const
|
|
1022
|
-
|
|
956
|
+
if (i && d.contains(i) && ct(t)) {
|
|
957
|
+
t.preventDefault();
|
|
958
|
+
const w = p.get(d);
|
|
959
|
+
w && H(w, g.labels.readonlySegmentMessage);
|
|
1023
960
|
return;
|
|
1024
961
|
}
|
|
1025
962
|
if (o) {
|
|
1026
|
-
|
|
963
|
+
t.preventDefault(), t.stopPropagation(), ze(d);
|
|
1027
964
|
return;
|
|
1028
965
|
}
|
|
1029
966
|
if (l) {
|
|
1030
|
-
|
|
967
|
+
t.preventDefault(), t.stopPropagation(), L(d, "shortcut", !0);
|
|
1031
968
|
return;
|
|
1032
969
|
}
|
|
1033
|
-
s && (
|
|
1034
|
-
}, document.addEventListener("keydown",
|
|
1035
|
-
|
|
1036
|
-
!
|
|
970
|
+
s && (t.preventDefault(), t.stopPropagation(), se(d));
|
|
971
|
+
}, document.addEventListener("keydown", O, !0)), I || (I = () => {
|
|
972
|
+
ae(), p.forEach((t, r) => {
|
|
973
|
+
!r.isConnected || !t.isConnected || (ge(t, r), be(r, t));
|
|
1037
974
|
});
|
|
1038
|
-
}, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !
|
|
1039
|
-
Qe(
|
|
1040
|
-
const a =
|
|
1041
|
-
if (!a || a.lockedSegmentIds.size === 0 || !me(
|
|
1042
|
-
return;
|
|
975
|
+
}, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !_ && typeof MutationObserver < "u" && document.body && (_ = new MutationObserver((t) => {
|
|
976
|
+
Qe(t) && ae(), t.some((n) => n.type === "characterData" ? !0 : n.type === "childList" && (n.addedNodes.length > 0 || n.removedNodes.length > 0)) && U.forEach((n) => {
|
|
977
|
+
const a = q.get(n);
|
|
978
|
+
if (!a || a.lockedSegmentIds.size === 0 || !me(n, a)) return;
|
|
1043
979
|
a.snapshot = "";
|
|
1044
|
-
const l =
|
|
1045
|
-
s && l &&
|
|
980
|
+
const l = c.get(n) || k, s = p.get(n);
|
|
981
|
+
s && l && H(s, l.labels.readonlySegmentMessage), l && (a.segments = M(n, l, a), R(n), E(n));
|
|
1046
982
|
});
|
|
1047
|
-
}),
|
|
983
|
+
}), _.observe(document.body, {
|
|
1048
984
|
childList: !0,
|
|
1049
985
|
subtree: !0,
|
|
1050
986
|
characterData: !0
|
|
1051
987
|
}));
|
|
1052
988
|
}
|
|
1053
989
|
function ft() {
|
|
1054
|
-
|
|
990
|
+
D && (document.removeEventListener("focusin", D, !0), D = null), z && (document.removeEventListener("input", z, !0), z = null), N && (document.removeEventListener("beforeinput", N, !0), N = null), O && (document.removeEventListener("keydown", O, !0), O = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), _ && (_.disconnect(), _ = null), p.forEach((t) => t.remove()), p.clear(), Array.from(U).forEach((t) => Se(t)), k = null, x = null;
|
|
1055
991
|
}
|
|
1056
992
|
function gt() {
|
|
1057
|
-
if (typeof document > "u" || document.getElementById(ve))
|
|
1058
|
-
return;
|
|
993
|
+
if (typeof document > "u" || document.getElementById(ve)) return;
|
|
1059
994
|
const e = document.createElement("style");
|
|
1060
995
|
e.id = ve, e.textContent = `
|
|
1061
996
|
.rte-toolbar-group-items.${y},
|
|
1062
997
|
.editora-toolbar-group-items.${y},
|
|
1063
|
-
.rte-toolbar-group-items.${
|
|
1064
|
-
.editora-toolbar-group-items.${
|
|
998
|
+
.rte-toolbar-group-items.${$},
|
|
999
|
+
.editora-toolbar-group-items.${$} {
|
|
1065
1000
|
display: flex;
|
|
1066
1001
|
border: 1px solid #cbd5e1;
|
|
1067
1002
|
border-radius: 4px;
|
|
@@ -1070,8 +1005,8 @@ function gt() {
|
|
|
1070
1005
|
|
|
1071
1006
|
.rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
1072
1007
|
.editora-toolbar-group-items.${y} .editora-toolbar-button,
|
|
1073
|
-
.rte-toolbar-group-items.${
|
|
1074
|
-
.editora-toolbar-group-items.${
|
|
1008
|
+
.rte-toolbar-group-items.${$} .rte-toolbar-button,
|
|
1009
|
+
.editora-toolbar-group-items.${$} .editora-toolbar-button {
|
|
1075
1010
|
border: none;
|
|
1076
1011
|
border-right: 1px solid #cbd5e1;
|
|
1077
1012
|
border-radius: 0;
|
|
@@ -1079,15 +1014,15 @@ function gt() {
|
|
|
1079
1014
|
|
|
1080
1015
|
.rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
1081
1016
|
.editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
1082
|
-
.rte-toolbar-group-items.${
|
|
1083
|
-
.editora-toolbar-group-items.${
|
|
1017
|
+
.rte-toolbar-group-items.${$} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
1018
|
+
.editora-toolbar-group-items.${$} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
1084
1019
|
border-right: none;
|
|
1085
1020
|
}
|
|
1086
1021
|
|
|
1087
|
-
${
|
|
1088
|
-
${
|
|
1089
|
-
${
|
|
1090
|
-
${
|
|
1022
|
+
${h} .rte-toolbar-group-items.${y},
|
|
1023
|
+
${h} .editora-toolbar-group-items.${y},
|
|
1024
|
+
${h} .rte-toolbar-group-items.${$},
|
|
1025
|
+
${h} .editora-toolbar-group-items.${$} {
|
|
1091
1026
|
border-color: #566275;
|
|
1092
1027
|
}
|
|
1093
1028
|
.rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
@@ -1098,29 +1033,29 @@ function gt() {
|
|
|
1098
1033
|
.editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
|
|
1099
1034
|
background: #ccc;
|
|
1100
1035
|
}
|
|
1101
|
-
${
|
|
1102
|
-
${
|
|
1103
|
-
${
|
|
1104
|
-
${
|
|
1036
|
+
${h} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
|
|
1037
|
+
${h} .editora-toolbar-group-items.${y} .editora-toolbar-button svg,
|
|
1038
|
+
${h} .rte-toolbar-group-items.${$} .rte-toolbar-button svg,
|
|
1039
|
+
${h} .editora-toolbar-group-items.${$} .editora-toolbar-button svg
|
|
1105
1040
|
{
|
|
1106
1041
|
fill: none;
|
|
1107
1042
|
}
|
|
1108
|
-
${
|
|
1109
|
-
${
|
|
1043
|
+
${h} .rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
1044
|
+
${h} .editora-toolbar-group-items.${y} .editora-toolbar-button
|
|
1110
1045
|
{
|
|
1111
1046
|
border-color: #566275;
|
|
1112
1047
|
}
|
|
1113
1048
|
|
|
1114
|
-
${
|
|
1115
|
-
${
|
|
1116
|
-
${
|
|
1117
|
-
${
|
|
1118
|
-
${
|
|
1119
|
-
${
|
|
1049
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
1050
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
1051
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
1052
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
1053
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
|
|
1054
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
|
|
1120
1055
|
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
1121
1056
|
}
|
|
1122
1057
|
|
|
1123
|
-
.${
|
|
1058
|
+
.${u} {
|
|
1124
1059
|
position: fixed;
|
|
1125
1060
|
z-index: 12000;
|
|
1126
1061
|
display: none;
|
|
@@ -1134,12 +1069,12 @@ function gt() {
|
|
|
1134
1069
|
overflow: hidden;
|
|
1135
1070
|
}
|
|
1136
1071
|
|
|
1137
|
-
.${
|
|
1072
|
+
.${u}.show {
|
|
1138
1073
|
display: flex;
|
|
1139
1074
|
flex-direction: column;
|
|
1140
1075
|
}
|
|
1141
1076
|
|
|
1142
|
-
.${
|
|
1077
|
+
.${u}.rte-translation-workflow-theme-dark {
|
|
1143
1078
|
border-color: #334155;
|
|
1144
1079
|
background: #0f172a;
|
|
1145
1080
|
color: #e2e8f0;
|
|
@@ -1156,7 +1091,7 @@ function gt() {
|
|
|
1156
1091
|
background: linear-gradient(180deg, #eff6ff 0%, #e2e8f0 100%);
|
|
1157
1092
|
}
|
|
1158
1093
|
|
|
1159
|
-
.${
|
|
1094
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-header {
|
|
1160
1095
|
border-color: #1e293b;
|
|
1161
1096
|
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
1162
1097
|
}
|
|
@@ -1192,14 +1127,14 @@ function gt() {
|
|
|
1192
1127
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
1193
1128
|
}
|
|
1194
1129
|
|
|
1195
|
-
.${
|
|
1130
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
|
|
1196
1131
|
border-color: #475569;
|
|
1197
1132
|
background: #0f172a;
|
|
1198
1133
|
color: #e2e8f0;
|
|
1199
1134
|
}
|
|
1200
1135
|
|
|
1201
|
-
.${
|
|
1202
|
-
.${
|
|
1136
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:hover,
|
|
1137
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:focus-visible {
|
|
1203
1138
|
border-color: #60a5fa;
|
|
1204
1139
|
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
1205
1140
|
}
|
|
@@ -1230,8 +1165,8 @@ function gt() {
|
|
|
1230
1165
|
color: #334155;
|
|
1231
1166
|
}
|
|
1232
1167
|
|
|
1233
|
-
.${
|
|
1234
|
-
.${
|
|
1168
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-label,
|
|
1169
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-label {
|
|
1235
1170
|
color: #cbd5e1;
|
|
1236
1171
|
}
|
|
1237
1172
|
|
|
@@ -1251,7 +1186,7 @@ function gt() {
|
|
|
1251
1186
|
outline: none;
|
|
1252
1187
|
}
|
|
1253
1188
|
|
|
1254
|
-
.${
|
|
1189
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-select {
|
|
1255
1190
|
border-color: #334155;
|
|
1256
1191
|
background: #0b1220;
|
|
1257
1192
|
color: #e2e8f0;
|
|
@@ -1266,9 +1201,9 @@ function gt() {
|
|
|
1266
1201
|
color: #475569;
|
|
1267
1202
|
}
|
|
1268
1203
|
|
|
1269
|
-
.${
|
|
1270
|
-
.${
|
|
1271
|
-
.${
|
|
1204
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-summary,
|
|
1205
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-helper,
|
|
1206
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-shortcut {
|
|
1272
1207
|
color: #94a3b8;
|
|
1273
1208
|
}
|
|
1274
1209
|
|
|
@@ -1313,13 +1248,13 @@ function gt() {
|
|
|
1313
1248
|
background: #155e75;
|
|
1314
1249
|
}
|
|
1315
1250
|
|
|
1316
|
-
.${
|
|
1251
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn {
|
|
1317
1252
|
border-color: #334155;
|
|
1318
1253
|
background: #111827;
|
|
1319
1254
|
color: #e2e8f0;
|
|
1320
1255
|
}
|
|
1321
1256
|
|
|
1322
|
-
.${
|
|
1257
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
|
|
1323
1258
|
border-color: #22d3ee;
|
|
1324
1259
|
background: #0e7490;
|
|
1325
1260
|
color: #ecfeff;
|
|
@@ -1341,9 +1276,9 @@ function gt() {
|
|
|
1341
1276
|
min-height: 120px;
|
|
1342
1277
|
}
|
|
1343
1278
|
|
|
1344
|
-
.${
|
|
1345
|
-
.${
|
|
1346
|
-
.${
|
|
1279
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segments-wrap,
|
|
1280
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-preview-wrap,
|
|
1281
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issues-wrap {
|
|
1347
1282
|
border-color: #334155;
|
|
1348
1283
|
background: #0b1220;
|
|
1349
1284
|
}
|
|
@@ -1355,7 +1290,7 @@ function gt() {
|
|
|
1355
1290
|
color: #334155;
|
|
1356
1291
|
}
|
|
1357
1292
|
|
|
1358
|
-
.${
|
|
1293
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
|
|
1359
1294
|
color: #cbd5e1;
|
|
1360
1295
|
}
|
|
1361
1296
|
|
|
@@ -1390,12 +1325,12 @@ function gt() {
|
|
|
1390
1325
|
background: #fffbeb;
|
|
1391
1326
|
}
|
|
1392
1327
|
|
|
1393
|
-
.${
|
|
1328
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
|
|
1394
1329
|
border-color: #334155;
|
|
1395
1330
|
background: #111827;
|
|
1396
1331
|
}
|
|
1397
1332
|
|
|
1398
|
-
.${
|
|
1333
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
|
|
1399
1334
|
border-color: rgba(245, 158, 11, 0.72);
|
|
1400
1335
|
background: rgba(120, 53, 15, 0.28);
|
|
1401
1336
|
}
|
|
@@ -1423,11 +1358,11 @@ function gt() {
|
|
|
1423
1358
|
line-height: 1.3;
|
|
1424
1359
|
}
|
|
1425
1360
|
|
|
1426
|
-
.${
|
|
1361
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
|
|
1427
1362
|
color: #94a3b8;
|
|
1428
1363
|
}
|
|
1429
1364
|
|
|
1430
|
-
.${
|
|
1365
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
|
|
1431
1366
|
color: #e2e8f0;
|
|
1432
1367
|
}
|
|
1433
1368
|
|
|
@@ -1457,7 +1392,7 @@ function gt() {
|
|
|
1457
1392
|
opacity: 1;
|
|
1458
1393
|
}
|
|
1459
1394
|
|
|
1460
|
-
.${
|
|
1395
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
|
|
1461
1396
|
border-color: #334155;
|
|
1462
1397
|
background: #111827;
|
|
1463
1398
|
}
|
|
@@ -1489,12 +1424,12 @@ function gt() {
|
|
|
1489
1424
|
color: #1f2937;
|
|
1490
1425
|
}
|
|
1491
1426
|
|
|
1492
|
-
.${
|
|
1427
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
|
|
1493
1428
|
color: #94a3b8;
|
|
1494
1429
|
}
|
|
1495
1430
|
|
|
1496
|
-
.${
|
|
1497
|
-
.${
|
|
1431
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
|
|
1432
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
|
|
1498
1433
|
border-color: #334155;
|
|
1499
1434
|
background: #111827;
|
|
1500
1435
|
color: #e2e8f0;
|
|
@@ -1535,23 +1470,23 @@ function gt() {
|
|
|
1535
1470
|
background: #f0f9ff;
|
|
1536
1471
|
}
|
|
1537
1472
|
|
|
1538
|
-
.${
|
|
1473
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue {
|
|
1539
1474
|
border-color: #334155;
|
|
1540
1475
|
background: #111827;
|
|
1541
1476
|
color: #e2e8f0;
|
|
1542
1477
|
}
|
|
1543
1478
|
|
|
1544
|
-
.${
|
|
1479
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
|
|
1545
1480
|
border-color: rgba(239, 68, 68, 0.7);
|
|
1546
1481
|
background: rgba(127, 29, 29, 0.28);
|
|
1547
1482
|
}
|
|
1548
1483
|
|
|
1549
|
-
.${
|
|
1484
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
|
|
1550
1485
|
border-color: rgba(245, 158, 11, 0.72);
|
|
1551
1486
|
background: rgba(120, 53, 15, 0.28);
|
|
1552
1487
|
}
|
|
1553
1488
|
|
|
1554
|
-
.${
|
|
1489
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
|
|
1555
1490
|
border-color: rgba(14, 165, 233, 0.7);
|
|
1556
1491
|
background: rgba(7, 89, 133, 0.28);
|
|
1557
1492
|
}
|
|
@@ -1568,11 +1503,11 @@ function gt() {
|
|
|
1568
1503
|
color: #475569;
|
|
1569
1504
|
}
|
|
1570
1505
|
|
|
1571
|
-
.${
|
|
1506
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
|
|
1572
1507
|
color: #e2e8f0;
|
|
1573
1508
|
}
|
|
1574
1509
|
|
|
1575
|
-
.${
|
|
1510
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
|
|
1576
1511
|
color: #cbd5e1;
|
|
1577
1512
|
}
|
|
1578
1513
|
|
|
@@ -1600,13 +1535,13 @@ function gt() {
|
|
|
1600
1535
|
border-radius: 4px;
|
|
1601
1536
|
}
|
|
1602
1537
|
|
|
1603
|
-
${
|
|
1538
|
+
${h} [data-translation-locked="true"].rte-translation-segment-locked {
|
|
1604
1539
|
outline-color: rgba(245, 158, 11, 0.75);
|
|
1605
1540
|
background: rgba(120, 53, 15, 0.22);
|
|
1606
1541
|
}
|
|
1607
1542
|
|
|
1608
1543
|
@media (max-width: 920px) {
|
|
1609
|
-
.${
|
|
1544
|
+
.${u} {
|
|
1610
1545
|
left: 10px !important;
|
|
1611
1546
|
right: 10px;
|
|
1612
1547
|
top: 10px !important;
|
|
@@ -1623,7 +1558,7 @@ function gt() {
|
|
|
1623
1558
|
`, document.head.appendChild(e);
|
|
1624
1559
|
}
|
|
1625
1560
|
const mt = (e = {}) => {
|
|
1626
|
-
const
|
|
1561
|
+
const t = oe(e), r = /* @__PURE__ */ new Set();
|
|
1627
1562
|
return gt(), {
|
|
1628
1563
|
name: "translationWorkflow",
|
|
1629
1564
|
toolbar: [
|
|
@@ -1664,93 +1599,83 @@ const mt = (e = {}) => {
|
|
|
1664
1599
|
}
|
|
1665
1600
|
],
|
|
1666
1601
|
commands: {
|
|
1667
|
-
translationWorkflow: (
|
|
1602
|
+
translationWorkflow: (n, a) => {
|
|
1668
1603
|
const o = T(a, !1, !1);
|
|
1669
|
-
if (!o)
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
return b(o, l), u.set(o, l), x = o, he(o), !0;
|
|
1604
|
+
if (!o) return !1;
|
|
1605
|
+
const l = c.get(o) || t;
|
|
1606
|
+
return b(o, l), c.set(o, l), x = o, he(o), !0;
|
|
1673
1607
|
},
|
|
1674
|
-
openTranslationWorkflowPanel: (
|
|
1608
|
+
openTranslationWorkflowPanel: (n, a) => {
|
|
1675
1609
|
const o = T(a, !1, !1);
|
|
1676
|
-
if (!o)
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
return b(o, l), u.set(o, l), x = o, he(o), !0;
|
|
1610
|
+
if (!o) return !1;
|
|
1611
|
+
const l = c.get(o) || t;
|
|
1612
|
+
return b(o, l), c.set(o, l), x = o, he(o), !0;
|
|
1680
1613
|
},
|
|
1681
|
-
toggleTranslationWorkflowPanel: (
|
|
1614
|
+
toggleTranslationWorkflowPanel: (n, a) => {
|
|
1682
1615
|
const o = T(a, !1, !1);
|
|
1683
|
-
if (!o)
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
return b(o, l), u.set(o, l), x = o, ze(o, typeof r == "boolean" ? r : void 0);
|
|
1616
|
+
if (!o) return !1;
|
|
1617
|
+
const l = c.get(o) || t;
|
|
1618
|
+
return b(o, l), c.set(o, l), x = o, ze(o, typeof n == "boolean" ? n : void 0);
|
|
1687
1619
|
},
|
|
1688
|
-
runTranslationLocaleValidation: (
|
|
1620
|
+
runTranslationLocaleValidation: (n, a) => {
|
|
1689
1621
|
const o = T(a, !1, !1);
|
|
1690
|
-
if (!o)
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
return b(o, l), u.set(o, l), x = o, L(o, "command", !0), !0;
|
|
1622
|
+
if (!o) return !1;
|
|
1623
|
+
const l = c.get(o) || t;
|
|
1624
|
+
return b(o, l), c.set(o, l), x = o, L(o, "command", !0), !0;
|
|
1694
1625
|
},
|
|
1695
|
-
toggleTranslationRealtime: (
|
|
1626
|
+
toggleTranslationRealtime: (n, a) => {
|
|
1696
1627
|
const o = T(a, !1, !1);
|
|
1697
|
-
if (!o)
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
return b(o, l), u.set(o, l), x = o, De(o, typeof r == "boolean" ? r : void 0);
|
|
1628
|
+
if (!o) return !1;
|
|
1629
|
+
const l = c.get(o) || t;
|
|
1630
|
+
return b(o, l), c.set(o, l), x = o, De(o, typeof n == "boolean" ? n : void 0);
|
|
1701
1631
|
},
|
|
1702
|
-
toggleTranslationSegmentLock: (
|
|
1632
|
+
toggleTranslationSegmentLock: (n, a) => {
|
|
1703
1633
|
const o = T(a, !1, !1);
|
|
1704
|
-
if (!o)
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
return ie(o, i, s);
|
|
1634
|
+
if (!o) return !1;
|
|
1635
|
+
const l = c.get(o) || t;
|
|
1636
|
+
b(o, l), c.set(o, l), x = o;
|
|
1637
|
+
const s = typeof n == "boolean" ? n : n?.locked, i = typeof n == "object" ? n?.segmentId : void 0;
|
|
1638
|
+
return se(o, i, s);
|
|
1710
1639
|
},
|
|
1711
|
-
setTranslationLocales: (
|
|
1640
|
+
setTranslationLocales: (n, a) => {
|
|
1712
1641
|
const o = T(a, !1, !1);
|
|
1713
|
-
if (!o || !
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
return u.set(o, l), typeof r.sourceLocale == "string" && r.sourceLocale.trim() && (s.sourceLocale = E(r.sourceLocale)), typeof r.targetLocale == "string" && r.targetLocale.trim() && (s.targetLocale = E(r.targetLocale)), s.snapshot = "", L(o, "set-locales", !0), !0;
|
|
1642
|
+
if (!o || !n || typeof n != "object") return !1;
|
|
1643
|
+
const l = c.get(o) || t, s = b(o, l);
|
|
1644
|
+
return c.set(o, l), typeof n.sourceLocale == "string" && n.sourceLocale.trim() && (s.sourceLocale = A(n.sourceLocale)), typeof n.targetLocale == "string" && n.targetLocale.trim() && (s.targetLocale = A(n.targetLocale)), s.snapshot = "", L(o, "set-locales", !0), !0;
|
|
1717
1645
|
},
|
|
1718
|
-
captureTranslationSourceSnapshot: (
|
|
1646
|
+
captureTranslationSourceSnapshot: (n, a) => {
|
|
1719
1647
|
const o = T(a, !1, !1);
|
|
1720
|
-
if (!o)
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
return b(o, l), u.set(o, l), x = o, Pe(o);
|
|
1648
|
+
if (!o) return !1;
|
|
1649
|
+
const l = c.get(o) || t;
|
|
1650
|
+
return b(o, l), c.set(o, l), x = o, Pe(o);
|
|
1724
1651
|
},
|
|
1725
|
-
setTranslationWorkflowOptions: (
|
|
1652
|
+
setTranslationWorkflowOptions: (n, a) => {
|
|
1726
1653
|
const o = T(a, !1, !1);
|
|
1727
|
-
if (!o || !
|
|
1728
|
-
|
|
1729
|
-
const l = u.get(o) || n, s = oe.get(o) || Ge(l), i = {
|
|
1654
|
+
if (!o || !n || typeof n != "object") return !1;
|
|
1655
|
+
const l = c.get(o) || t, s = re.get(o) || Ge(l), i = {
|
|
1730
1656
|
...s,
|
|
1731
|
-
...
|
|
1657
|
+
...n,
|
|
1732
1658
|
labels: {
|
|
1733
1659
|
...s.labels || {},
|
|
1734
|
-
...
|
|
1660
|
+
...n.labels || {}
|
|
1735
1661
|
},
|
|
1736
|
-
localeRules: Array.isArray(
|
|
1737
|
-
locales: Array.isArray(
|
|
1738
|
-
normalizeText:
|
|
1739
|
-
},
|
|
1740
|
-
|
|
1741
|
-
const g = b(o,
|
|
1742
|
-
return typeof
|
|
1662
|
+
localeRules: Array.isArray(n.localeRules) ? n.localeRules : s.localeRules,
|
|
1663
|
+
locales: Array.isArray(n.locales) ? n.locales : s.locales,
|
|
1664
|
+
normalizeText: n.normalizeText || l.normalizeText
|
|
1665
|
+
}, d = oe(i);
|
|
1666
|
+
c.set(o, d), re.set(o, i);
|
|
1667
|
+
const g = b(o, d);
|
|
1668
|
+
return typeof n.enableRealtime == "boolean" && (g.realtimeEnabled = n.enableRealtime), typeof n.sourceLocale == "string" && n.sourceLocale.trim() && (g.sourceLocale = A(n.sourceLocale)), typeof n.targetLocale == "string" && n.targetLocale.trim() && (g.targetLocale = A(n.targetLocale)), g.snapshot = "", L(o, "set-options", !0), R(o), E(o), !0;
|
|
1743
1669
|
},
|
|
1744
|
-
getTranslationWorkflowState: (
|
|
1670
|
+
getTranslationWorkflowState: (n, a) => {
|
|
1745
1671
|
const o = T(a, !1, !1);
|
|
1746
|
-
if (!o)
|
|
1747
|
-
|
|
1748
|
-
const l = u.get(o) || n;
|
|
1672
|
+
if (!o) return !1;
|
|
1673
|
+
const l = c.get(o) || t;
|
|
1749
1674
|
b(o, l);
|
|
1750
1675
|
const s = qe(o);
|
|
1751
|
-
if (typeof
|
|
1676
|
+
if (typeof n == "function")
|
|
1752
1677
|
try {
|
|
1753
|
-
|
|
1678
|
+
n(s);
|
|
1754
1679
|
} catch {
|
|
1755
1680
|
}
|
|
1756
1681
|
return o.__translationWorkflowState = s, o.dispatchEvent(
|
|
@@ -1770,22 +1695,21 @@ const mt = (e = {}) => {
|
|
|
1770
1695
|
"Mod-Alt-Shift-K": "toggleTranslationSegmentLock"
|
|
1771
1696
|
},
|
|
1772
1697
|
init: function(a) {
|
|
1773
|
-
|
|
1774
|
-
const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l =
|
|
1698
|
+
X += 1;
|
|
1699
|
+
const o = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, l = oe(o);
|
|
1775
1700
|
dt(l);
|
|
1776
1701
|
const s = T(
|
|
1777
|
-
a
|
|
1702
|
+
a?.editorElement ? { editorElement: a.editorElement } : void 0,
|
|
1778
1703
|
!1,
|
|
1779
1704
|
!1
|
|
1780
1705
|
);
|
|
1781
|
-
if (!s)
|
|
1782
|
-
|
|
1783
|
-
x = s, t.add(s);
|
|
1706
|
+
if (!s) return;
|
|
1707
|
+
x = s, r.add(s);
|
|
1784
1708
|
const i = b(s, l);
|
|
1785
|
-
|
|
1709
|
+
c.set(s, l), re.set(s, o), i.segments = M(s, l, i), L(s, "init", !0), E(s);
|
|
1786
1710
|
},
|
|
1787
1711
|
destroy: () => {
|
|
1788
|
-
|
|
1712
|
+
r.forEach((n) => Se(n)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && ft();
|
|
1789
1713
|
}
|
|
1790
1714
|
};
|
|
1791
1715
|
};
|