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