@editora/core 1.0.7 → 1.0.9

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.
Files changed (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,801 @@
1
+ const $ = ".rte-content, .editora-content", d = '[data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark', l = "rte-version-diff-overlay", J = "rte-version-diff-styles", fe = {
2
+ title: "Version Diff",
3
+ baseline: "Baseline",
4
+ current: "Current",
5
+ noChanges: "No changes detected between baseline and current content.",
6
+ loading: "Preparing diff...",
7
+ tabInline: "Inline Diff",
8
+ tabSideBySide: "Side by Side",
9
+ refresh: "Refresh",
10
+ setBaseline: "Set Current as Baseline",
11
+ close: "Close",
12
+ mode: "Mode",
13
+ ignoreWhitespace: "Ignore whitespace",
14
+ largeDocFallback: "Large document fallback mode applied for performance."
15
+ }, w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
16
+ let j = 0, H = null, z = null, V = null, S = null, M = null, D = null;
17
+ function u(e) {
18
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
19
+ }
20
+ function de(e) {
21
+ return {
22
+ ...fe,
23
+ ...e || {}
24
+ };
25
+ }
26
+ function N(e, i = !0) {
27
+ if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
28
+ return e.contentElement;
29
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
30
+ const r = e.editorElement;
31
+ if (r.matches($))
32
+ return r;
33
+ const o = r.querySelector($);
34
+ if (o instanceof HTMLElement)
35
+ return o;
36
+ }
37
+ const t = window.getSelection();
38
+ if (t && t.rangeCount > 0) {
39
+ const r = t.getRangeAt(0).startContainer, o = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement, f = o == null ? void 0 : o.closest($);
40
+ if (f)
41
+ return f;
42
+ }
43
+ const n = document.activeElement;
44
+ if (n) {
45
+ if (n.matches($))
46
+ return n;
47
+ const r = n.closest($);
48
+ if (r)
49
+ return r;
50
+ }
51
+ return D && D.isConnected ? D : i ? document.querySelector($) : null;
52
+ }
53
+ function O(e) {
54
+ return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
55
+ }
56
+ function P(e) {
57
+ if (!e)
58
+ return !1;
59
+ const i = e.getAttribute("data-theme") || e.getAttribute("theme");
60
+ if (i && i.toLowerCase() === "dark")
61
+ return !0;
62
+ const t = e.classList;
63
+ return t.contains("dark") || t.contains("editora-theme-dark") || t.contains("rte-theme-dark");
64
+ }
65
+ function Q(e) {
66
+ const i = O(e);
67
+ if (P(i))
68
+ return !0;
69
+ const t = i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
70
+ return !!(P(t) || P(document.documentElement) || P(document.body));
71
+ }
72
+ function ce(e) {
73
+ const i = document.createElement("textarea");
74
+ return i.innerHTML = e, i.value;
75
+ }
76
+ function W(e) {
77
+ const t = O(e).getAttribute("data-initial-content");
78
+ return t ? ce(t) : e.innerHTML;
79
+ }
80
+ function te(e) {
81
+ return e.replace(/\r\n?/g, `
82
+ `);
83
+ }
84
+ function X(e) {
85
+ const i = document.createElement("div"), t = e.replace(/<br\s*\/?>/gi, `
86
+ `).replace(/<\/(p|div|h1|h2|h3|h4|h5|h6|li|tr|blockquote|pre|section|article)>/gi, `$&
87
+ `);
88
+ i.innerHTML = t;
89
+ const n = i.textContent || "";
90
+ return te(n).replace(/\u00a0/g, " ").replace(/\n{3,}/g, `
91
+
92
+ `).trim();
93
+ }
94
+ function Z(e, i, t) {
95
+ let n = te(e);
96
+ if (t && (n = n.replace(/[ \t]+/g, " ").replace(/\n{3,}/g, `
97
+
98
+ `).trim()), !n)
99
+ return [];
100
+ if (i === "line")
101
+ return n.split(`
102
+ `);
103
+ if (t)
104
+ return n.split(/\s+/).filter(Boolean);
105
+ const r = [], o = n.split(`
106
+ `);
107
+ return o.forEach((f, g) => {
108
+ const c = f.split(/[ \t]+/).filter(Boolean);
109
+ r.push(...c), g < o.length - 1 && r.push(`
110
+ `);
111
+ }), r;
112
+ }
113
+ function ue(e, i, t) {
114
+ if (e.length === 0)
115
+ return "";
116
+ if (i === "line")
117
+ return e.join(`
118
+ `);
119
+ if (t)
120
+ return e.join(" ");
121
+ let n = "";
122
+ for (let r = 0; r < e.length; r += 1) {
123
+ const o = e[r];
124
+ if (o === `
125
+ `) {
126
+ n = n.replace(/[ \t]+$/g, ""), n += `
127
+ `;
128
+ continue;
129
+ }
130
+ n.length > 0 && !n.endsWith(`
131
+ `) && (n += " "), n += o;
132
+ }
133
+ return n;
134
+ }
135
+ function pe(e, i, t) {
136
+ const n = [];
137
+ return e.forEach((r) => {
138
+ const o = n[n.length - 1];
139
+ if (o && o.type === r.type) {
140
+ o.tokens.push(r.token);
141
+ return;
142
+ }
143
+ n.push({ type: r.type, tokens: [r.token] });
144
+ }), n.map((r) => ({
145
+ type: r.type,
146
+ value: ue(r.tokens, i, t),
147
+ count: r.tokens.length
148
+ }));
149
+ }
150
+ function be(e, i) {
151
+ let t = 0;
152
+ for (; t < e.length && t < i.length && e[t] === i[t]; )
153
+ t += 1;
154
+ let n = e.length - 1, r = i.length - 1;
155
+ for (; n >= t && r >= t && e[n] === i[r]; )
156
+ n -= 1, r -= 1;
157
+ const o = e.slice(0, t), f = n < e.length - 1 ? e.slice(n + 1) : [], g = t <= n ? e.slice(t, n + 1) : [], c = t <= r ? i.slice(t, r + 1) : [];
158
+ return { prefix: o, suffix: f, aMiddle: g, bMiddle: c };
159
+ }
160
+ function he(e, i, t, n, r, o) {
161
+ if (e.length === 0 && i.length === 0)
162
+ return { segments: [], insertedCount: 0, deletedCount: 0, equalCount: 0, usedFallback: !1 };
163
+ const { prefix: f, suffix: g, aMiddle: c, bMiddle: b } = be(e, i);
164
+ let m = [];
165
+ f.forEach((a) => m.push({ type: "equal", token: a }));
166
+ const F = c.length * b.length, T = c.length > o || b.length > o || F > r;
167
+ if (T)
168
+ c.forEach((a) => m.push({ type: "delete", token: a })), b.forEach((a) => m.push({ type: "insert", token: a }));
169
+ else {
170
+ const a = Array.from({ length: c.length + 1 }, () => new Uint32Array(b.length + 1));
171
+ for (let k = c.length - 1; k >= 0; k -= 1) {
172
+ const A = a[k], I = a[k + 1];
173
+ for (let x = b.length - 1; x >= 0; x -= 1)
174
+ A[x] = c[k] === b[x] ? I[x + 1] + 1 : Math.max(I[x], A[x + 1]);
175
+ }
176
+ let h = 0, p = 0;
177
+ for (; h < c.length && p < b.length; )
178
+ c[h] === b[p] ? (m.push({ type: "equal", token: c[h] }), h += 1, p += 1) : a[h + 1][p] >= a[h][p + 1] ? (m.push({ type: "delete", token: c[h] }), h += 1) : (m.push({ type: "insert", token: b[p] }), p += 1);
179
+ for (; h < c.length; )
180
+ m.push({ type: "delete", token: c[h] }), h += 1;
181
+ for (; p < b.length; )
182
+ m.push({ type: "insert", token: b[p] }), p += 1;
183
+ }
184
+ g.forEach((a) => m.push({ type: "equal", token: a }));
185
+ const q = pe(m, t, n);
186
+ let B = 0, L = 0, K = 0;
187
+ return q.forEach((a) => {
188
+ a.type === "insert" && (B += a.count), a.type === "delete" && (L += a.count), a.type === "equal" && (K += a.count);
189
+ }), {
190
+ segments: q,
191
+ insertedCount: B,
192
+ deletedCount: L,
193
+ equalCount: K,
194
+ usedFallback: T
195
+ };
196
+ }
197
+ function re(e) {
198
+ return u(e.value).replace(/\n/g, `
199
+ `);
200
+ }
201
+ function ve(e, i) {
202
+ return e.length === 0 ? `<p class="rte-version-diff-empty">${u(i.noChanges)}</p>` : e.map((t) => `<span class="${t.type === "equal" ? "rte-version-diff-equal" : t.type === "insert" ? "rte-version-diff-insert" : "rte-version-diff-delete"}">${re(t)}</span>`).join("");
203
+ }
204
+ function me(e, i) {
205
+ if (e.length === 0) {
206
+ const r = `<p class="rte-version-diff-empty">${u(i.noChanges)}</p>`;
207
+ return { baselineHtml: r, currentHtml: r };
208
+ }
209
+ const t = [], n = [];
210
+ return e.forEach((r) => {
211
+ const o = re(r);
212
+ if (r.type === "equal") {
213
+ t.push(`<span class="rte-version-diff-equal">${o}</span>`), n.push(`<span class="rte-version-diff-equal">${o}</span>`);
214
+ return;
215
+ }
216
+ if (r.type === "delete") {
217
+ t.push(`<span class="rte-version-diff-delete">${o}</span>`);
218
+ return;
219
+ }
220
+ n.push(`<span class="rte-version-diff-insert">${o}</span>`);
221
+ }), {
222
+ baselineHtml: t.join(""),
223
+ currentHtml: n.join("")
224
+ };
225
+ }
226
+ function ge(e) {
227
+ const i = e.metaKey || e.ctrlKey, n = (typeof e.key == "string" ? e.key : "").toLowerCase(), r = typeof e.code == "string" ? e.code.toLowerCase() : "", o = i && e.altKey && !e.shiftKey && (n === "d" || r === "keyd"), f = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (n === "f8" || r === "f8");
228
+ return o || f;
229
+ }
230
+ function ye() {
231
+ if (typeof document == "undefined" || document.getElementById(J))
232
+ return;
233
+ const e = document.createElement("style");
234
+ e.id = J, e.textContent = `
235
+ .${l} {
236
+ position: fixed;
237
+ inset: 0;
238
+ background: rgba(15, 23, 42, 0.55);
239
+ z-index: 2147483646;
240
+ display: flex;
241
+ align-items: center;
242
+ justify-content: center;
243
+ padding: 20px;
244
+ }
245
+
246
+ .rte-version-diff-dialog {
247
+ width: min(980px, 96vw);
248
+ max-height: min(90vh, 860px);
249
+ background: #ffffff;
250
+ color: #0f172a;
251
+ border: 1px solid #d7dee8;
252
+ border-radius: 8px;
253
+ display: flex;
254
+ flex-direction: column;
255
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.3);
256
+ overflow: hidden;
257
+ }
258
+
259
+ .rte-version-diff-header,
260
+ .rte-version-diff-footer {
261
+ padding: 12px 14px;
262
+ border-bottom: 1px solid #e2e8f0;
263
+ background: #f8fafc;
264
+ display: flex;
265
+ align-items: center;
266
+ gap: 10px;
267
+ flex-wrap: wrap;
268
+ }
269
+
270
+ .rte-version-diff-footer {
271
+ border-top: 1px solid #e2e8f0;
272
+ border-bottom: none;
273
+ justify-content: space-between;
274
+ }
275
+
276
+ .rte-version-diff-title {
277
+ margin: 0;
278
+ font-size: 16px;
279
+ font-weight: 700;
280
+ flex: 1;
281
+ }
282
+
283
+ .rte-version-diff-controls {
284
+ display: flex;
285
+ align-items: center;
286
+ gap: 10px;
287
+ flex-wrap: wrap;
288
+ }
289
+
290
+ .rte-version-diff-select,
291
+ .rte-version-diff-btn {
292
+ border: 1px solid #cbd5e1;
293
+ background: #ffffff;
294
+ color: #0f172a;
295
+ border-radius: 6px;
296
+ min-height: 34px;
297
+ padding: 6px 10px;
298
+ font-size: 13px;
299
+ cursor: pointer;
300
+ }
301
+
302
+ .rte-version-diff-btn:hover,
303
+ .rte-version-diff-btn:focus-visible,
304
+ .rte-version-diff-select:focus-visible {
305
+ outline: none;
306
+ border-color: #3b82f6;
307
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
308
+ }
309
+
310
+ .rte-version-diff-btn-primary {
311
+ background: #2563eb;
312
+ border-color: #2563eb;
313
+ color: #ffffff;
314
+ }
315
+
316
+ .rte-version-diff-btn-primary:hover {
317
+ background: #1d4ed8;
318
+ }
319
+
320
+ .rte-version-diff-close-btn {
321
+ border: 1px solid #cbd5e1;
322
+ border-radius: 6px;
323
+ min-height: 34px;
324
+ min-width: 34px;
325
+ width: 34px;
326
+ height: 34px;
327
+ padding: 0;
328
+ display: inline-flex;
329
+ align-items: center;
330
+ justify-content: center;
331
+ background: #ffffff;
332
+ color: #0f172a;
333
+ font-size: 16px;
334
+ line-height: 1;
335
+ font-weight: 600;
336
+ }
337
+
338
+ .rte-version-diff-close-btn:hover,
339
+ .rte-version-diff-close-btn:focus-visible {
340
+ border-color: #3b82f6;
341
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
342
+ background: #ffffff;
343
+ outline: none;
344
+ }
345
+
346
+ .rte-version-diff-tabs {
347
+ display: flex;
348
+ gap: 6px;
349
+ border-bottom: 1px solid #e2e8f0;
350
+ background: #f8fafc;
351
+ padding: 8px 14px;
352
+ }
353
+
354
+ .rte-version-diff-tab {
355
+ border: 1px solid #cbd5e1;
356
+ background: #ffffff;
357
+ color: #0f172a;
358
+ border-radius: 6px;
359
+ min-height: 32px;
360
+ padding: 4px 10px;
361
+ font-size: 13px;
362
+ cursor: pointer;
363
+ }
364
+
365
+ .rte-version-diff-tab[aria-selected="true"] {
366
+ background: #dbeafe;
367
+ border-color: #60a5fa;
368
+ color: #1e3a8a;
369
+ }
370
+
371
+ .rte-version-diff-body {
372
+ flex: 1;
373
+ overflow: auto;
374
+ padding: 10px 14px 14px;
375
+ background: #ffffff;
376
+ }
377
+
378
+ .rte-version-diff-summary {
379
+ font-size: 12px;
380
+ color: #475569;
381
+ margin-bottom: 10px;
382
+ display: flex;
383
+ gap: 14px;
384
+ flex-wrap: wrap;
385
+ }
386
+
387
+ .rte-version-diff-panel {
388
+ display: none;
389
+ }
390
+
391
+ .rte-version-diff-panel.active {
392
+ display: block;
393
+ }
394
+
395
+ .rte-version-diff-inline,
396
+ .rte-version-diff-side-pane {
397
+ border: 1px solid #dbe3ec;
398
+ border-radius: 6px;
399
+ padding: 10px;
400
+ min-height: 140px;
401
+ max-height: 50vh;
402
+ overflow: auto;
403
+ white-space: pre-wrap;
404
+ word-break: break-word;
405
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
406
+ font-size: 12px;
407
+ line-height: 1.5;
408
+ background: #ffffff;
409
+ }
410
+
411
+ .rte-version-diff-side-grid {
412
+ display: grid;
413
+ grid-template-columns: 1fr 1fr;
414
+ gap: 10px;
415
+ }
416
+
417
+ .rte-version-diff-pane-title {
418
+ margin: 0 0 6px;
419
+ font-size: 12px;
420
+ font-weight: 700;
421
+ color: #334155;
422
+ }
423
+
424
+ .rte-version-diff-equal { color: inherit; }
425
+ .rte-version-diff-insert {
426
+ background: rgba(22, 163, 74, 0.18);
427
+ color: #14532d;
428
+ border-radius: 2px;
429
+ }
430
+ .rte-version-diff-delete {
431
+ background: rgba(220, 38, 38, 0.18);
432
+ color: #7f1d1d;
433
+ text-decoration: line-through;
434
+ border-radius: 2px;
435
+ }
436
+
437
+ .rte-version-diff-empty {
438
+ margin: 0;
439
+ color: #64748b;
440
+ font-size: 13px;
441
+ }
442
+
443
+ ${d} .rte-version-diff-dialog,
444
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-dialog {
445
+ background: #1f2937;
446
+ color: #e5e7eb;
447
+ border-color: #334155;
448
+ }
449
+
450
+ ${d} .rte-version-diff-header,
451
+ ${d} .rte-version-diff-footer,
452
+ ${d} .rte-version-diff-tabs,
453
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-header,
454
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-footer,
455
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-tabs {
456
+ background: #111827;
457
+ border-color: #334155;
458
+ }
459
+
460
+ ${d} .rte-version-diff-body,
461
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-body {
462
+ background: #1f2937;
463
+ }
464
+
465
+ ${d} .rte-version-diff-select,
466
+ ${d} .rte-version-diff-btn,
467
+ ${d} .rte-version-diff-tab,
468
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-select,
469
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-btn,
470
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-tab {
471
+ background: #0f172a;
472
+ color: #e5e7eb;
473
+ border-color: #475569;
474
+ }
475
+
476
+ ${d} .rte-version-diff-close-btn,
477
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn {
478
+ background: #0f172a;
479
+ border-color: #475569;
480
+ color: #e2e8f0;
481
+ }
482
+
483
+ ${d} .rte-version-diff-close-btn:hover,
484
+ ${d} .rte-version-diff-close-btn:focus-visible,
485
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn:hover,
486
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn:focus-visible {
487
+ border-color: #60a5fa;
488
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
489
+ outline: none;
490
+ }
491
+
492
+ ${d} .rte-version-diff-tab[aria-selected="true"],
493
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-tab[aria-selected="true"] {
494
+ background: #1e3a8a;
495
+ border-color: #3b82f6;
496
+ color: #dbeafe;
497
+ }
498
+
499
+ ${d} .rte-version-diff-inline,
500
+ ${d} .rte-version-diff-side-pane,
501
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-inline,
502
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-side-pane {
503
+ background: #0f172a;
504
+ border-color: #334155;
505
+ color: #e5e7eb;
506
+ }
507
+
508
+ ${d} .rte-version-diff-pane-title,
509
+ ${d} .rte-version-diff-summary,
510
+ ${d} .rte-version-diff-empty,
511
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-pane-title,
512
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-summary,
513
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-empty {
514
+ color: #94a3b8;
515
+ }
516
+
517
+ ${d} .rte-version-diff-insert,
518
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-insert {
519
+ background: rgba(22, 163, 74, 0.25);
520
+ color: #bbf7d0;
521
+ }
522
+
523
+ ${d} .rte-version-diff-delete,
524
+ .${l}.rte-version-diff-theme-dark .rte-version-diff-delete {
525
+ background: rgba(220, 38, 38, 0.25);
526
+ color: #fecaca;
527
+ }
528
+ :is(${d}) .rte-toolbar-item .rte-toolbar-button[data-command="openVersionDiff"] svg{
529
+ fill: none;
530
+ }
531
+ `, document.head.appendChild(e);
532
+ }
533
+ async function ke(e, i, t) {
534
+ if (t != null)
535
+ return t;
536
+ if (typeof i.getBaselineHtml == "function") {
537
+ const o = O(e), f = await Promise.resolve(i.getBaselineHtml({ editor: e, editorRoot: o }));
538
+ if (typeof f == "string")
539
+ return f;
540
+ }
541
+ const n = w.get(e);
542
+ if (typeof n == "string")
543
+ return n;
544
+ if (typeof i.baselineHtml == "string")
545
+ return i.baselineHtml;
546
+ const r = W(e);
547
+ return w.set(e, r), r;
548
+ }
549
+ function xe(e) {
550
+ const i = e.querySelector(
551
+ 'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
552
+ );
553
+ i == null || i.focus();
554
+ }
555
+ function $e(e, i) {
556
+ if (e.key !== "Tab")
557
+ return;
558
+ const t = Array.from(i.querySelectorAll(
559
+ 'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
560
+ )).filter((f) => !f.hasAttribute("disabled"));
561
+ if (t.length === 0)
562
+ return;
563
+ const n = t[0], r = t[t.length - 1], o = document.activeElement;
564
+ e.shiftKey && o === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && o === r && (e.preventDefault(), n.focus());
565
+ }
566
+ function ne() {
567
+ z && (z(), z = null);
568
+ }
569
+ function ee(e) {
570
+ !e || w.has(e) || w.set(e, W(e));
571
+ }
572
+ function Ee(e) {
573
+ var i, t;
574
+ return {
575
+ baselineHtml: e.baselineHtml,
576
+ getBaselineHtml: e.getBaselineHtml,
577
+ mode: e.mode || "word",
578
+ ignoreWhitespace: e.ignoreWhitespace !== !1,
579
+ maxTokens: Math.max(200, (i = e.maxTokens) != null ? i : 1200),
580
+ maxMatrixSize: Math.max(5e4, (t = e.maxMatrixSize) != null ? t : 1e6),
581
+ labels: de(e.labels)
582
+ };
583
+ }
584
+ function ie(e, i, t) {
585
+ var _;
586
+ ne(), D = e, R.set(e, i);
587
+ const n = document.createElement("div");
588
+ n.className = l, Q(e) && n.classList.add("rte-version-diff-theme-dark");
589
+ const r = document.createElement("section");
590
+ r.className = "rte-version-diff-dialog", r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), r.setAttribute("aria-labelledby", "rte-version-diff-title");
591
+ const o = i.labels;
592
+ let f = (t == null ? void 0 : t.mode) || i.mode, g = (_ = t == null ? void 0 : t.ignoreWhitespace) != null ? _ : i.ignoreWhitespace, c = "inline";
593
+ r.innerHTML = `
594
+ <header class="rte-version-diff-header">
595
+ <h2 id="rte-version-diff-title" class="rte-version-diff-title">${u(o.title)}</h2>
596
+ <div class="rte-version-diff-controls">
597
+ <label>
598
+ <span>${u(o.mode)}:</span>
599
+ <select class="rte-version-diff-select" aria-label="${u(o.mode)}">
600
+ <option value="word">Word</option>
601
+ <option value="line">Line</option>
602
+ </select>
603
+ </label>
604
+ <label class="rte-version-diff-checkbox">
605
+ <input type="checkbox" class="rte-version-diff-ignore-ws" ${g ? "checked" : ""}>
606
+ ${u(o.ignoreWhitespace)}
607
+ </label>
608
+ <button type="button" class="rte-version-diff-btn rte-version-diff-set-baseline" aria-label="${u(o.setBaseline)}">${u(o.setBaseline)}</button>
609
+ <button type="button" class="rte-version-diff-btn" data-action="refresh" aria-label="${u(o.refresh)}">${u(o.refresh)}</button>
610
+ <button type="button" class="rte-version-diff-btn rte-version-diff-close-btn" data-action="close" aria-label="${u(o.close)}">✕</button>
611
+ </div>
612
+ </header>
613
+
614
+ <div class="rte-version-diff-tabs" role="tablist" aria-label="Diff views">
615
+ <button type="button" role="tab" class="rte-version-diff-tab" data-tab="inline" aria-selected="true">${u(o.tabInline)}</button>
616
+ <button type="button" role="tab" class="rte-version-diff-tab" data-tab="side" aria-selected="false">${u(o.tabSideBySide)}</button>
617
+ </div>
618
+
619
+ <main class="rte-version-diff-body">
620
+ <div class="rte-version-diff-summary" aria-live="polite"></div>
621
+ <section class="rte-version-diff-panel active" data-panel="inline" role="tabpanel">
622
+ <div class="rte-version-diff-inline" aria-label="Inline diff result"></div>
623
+ </section>
624
+ <section class="rte-version-diff-panel" data-panel="side" role="tabpanel">
625
+ <div class="rte-version-diff-side-grid">
626
+ <div>
627
+ <h3 class="rte-version-diff-pane-title">${u(o.baseline)}</h3>
628
+ <div class="rte-version-diff-side-pane" data-side="baseline" aria-label="${u(o.baseline)}"></div>
629
+ </div>
630
+ <div>
631
+ <h3 class="rte-version-diff-pane-title">${u(o.current)}</h3>
632
+ <div class="rte-version-diff-side-pane" data-side="current" aria-label="${u(o.current)}"></div>
633
+ </div>
634
+ </div>
635
+ </section>
636
+ </main>
637
+
638
+ <footer class="rte-version-diff-footer">
639
+ <small>Shortcut: Ctrl/Cmd + Alt + D (fallback: F8)</small>
640
+ <small>Esc: close</small>
641
+ </footer>
642
+ `, n.appendChild(r), document.body.appendChild(n);
643
+ const b = r.querySelector(".rte-version-diff-select");
644
+ b.value = f;
645
+ const m = r.querySelector(".rte-version-diff-ignore-ws"), F = r.querySelector(".rte-version-diff-summary"), T = r.querySelector(".rte-version-diff-inline"), q = r.querySelector('[data-side="baseline"]'), B = r.querySelector('[data-side="current"]');
646
+ let L = 0;
647
+ const K = () => {
648
+ const s = `<p class="rte-version-diff-empty">${u(o.loading)}</p>`;
649
+ T.innerHTML = s, q.innerHTML = s, B.innerHTML = s, F.textContent = "";
650
+ }, a = async (s) => {
651
+ var Y;
652
+ L += 1;
653
+ const v = L;
654
+ n.classList.toggle("rte-version-diff-theme-dark", Q(e)), K();
655
+ const y = e.innerHTML;
656
+ let E = "";
657
+ try {
658
+ E = await ke(e, i, s != null ? s : t == null ? void 0 : t.baselineHtml);
659
+ } catch (Se) {
660
+ E = (Y = w.get(e)) != null ? Y : W(e);
661
+ }
662
+ if (v !== L || !n.isConnected)
663
+ return;
664
+ const oe = X(E), se = X(y), ae = Z(oe, f, g), le = Z(se, f, g), C = he(
665
+ ae,
666
+ le,
667
+ f,
668
+ g,
669
+ i.maxMatrixSize,
670
+ i.maxTokens
671
+ ), G = me(C.segments, o);
672
+ T.innerHTML = ve(C.segments, o), q.innerHTML = G.baselineHtml, B.innerHTML = G.currentHtml;
673
+ const U = [
674
+ `+${C.insertedCount} inserted`,
675
+ `-${C.deletedCount} deleted`,
676
+ `${C.equalCount} unchanged`
677
+ ];
678
+ C.usedFallback && U.push(o.largeDocFallback), F.textContent = U.join(" | ");
679
+ }, h = (s) => {
680
+ c = s, r.querySelectorAll(".rte-version-diff-tab").forEach((v) => {
681
+ const y = v.getAttribute("data-tab") === s;
682
+ v.setAttribute("aria-selected", y ? "true" : "false"), v.tabIndex = y ? 0 : -1;
683
+ }), r.querySelectorAll(".rte-version-diff-panel").forEach((v) => {
684
+ v.classList.toggle("active", v.getAttribute("data-panel") === s);
685
+ });
686
+ }, p = () => {
687
+ n.removeEventListener("keydown", I, !0), n.removeEventListener("click", A), document.removeEventListener("keydown", k, !0), n.parentNode && n.parentNode.removeChild(n), z = null, e.focus({ preventScroll: !0 });
688
+ }, k = (s) => {
689
+ s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), p());
690
+ }, A = (s) => {
691
+ s.target === n && p();
692
+ }, I = (s) => {
693
+ if (s.key === "Escape") {
694
+ s.preventDefault(), p();
695
+ return;
696
+ }
697
+ if ($e(s, r), s.target && s.target.classList.contains("rte-version-diff-tab") && (s.key === "ArrowRight" || s.key === "ArrowLeft")) {
698
+ s.preventDefault();
699
+ const v = c === "inline" ? "side" : "inline";
700
+ h(v);
701
+ const y = r.querySelector(`.rte-version-diff-tab[data-tab="${v}"]`);
702
+ y == null || y.focus();
703
+ }
704
+ };
705
+ r.addEventListener("click", (s) => {
706
+ const v = s.target, y = v.getAttribute("data-action");
707
+ if (y === "close") {
708
+ p();
709
+ return;
710
+ }
711
+ if (y === "refresh") {
712
+ a();
713
+ return;
714
+ }
715
+ const E = v.getAttribute("data-tab");
716
+ (E === "inline" || E === "side") && h(E);
717
+ }), b.addEventListener("change", () => {
718
+ f = b.value === "line" ? "line" : "word", a();
719
+ }), m.addEventListener("change", () => {
720
+ g = m.checked, a();
721
+ }), r.querySelector(".rte-version-diff-set-baseline").addEventListener("click", () => {
722
+ w.set(e, e.innerHTML), a(e.innerHTML);
723
+ }), n.addEventListener("keydown", I, !0), n.addEventListener("click", A), document.addEventListener("keydown", k, !0), z = p, xe(r), a();
724
+ }
725
+ function we(e) {
726
+ V = e, !H && (H = (i) => {
727
+ if (!ge(i))
728
+ return;
729
+ if (document.querySelector(`.${l}`)) {
730
+ i.preventDefault();
731
+ return;
732
+ }
733
+ const t = i.target;
734
+ if (!!(t != null && t.closest("input, textarea, select")))
735
+ return;
736
+ const r = N(void 0, !1);
737
+ if (!r || r.getAttribute("contenteditable") === "false")
738
+ return;
739
+ i.preventDefault(), i.stopPropagation();
740
+ const o = R.get(r) || V || e;
741
+ ie(r, o);
742
+ }, document.addEventListener("keydown", H, !0));
743
+ }
744
+ function Le() {
745
+ H && (document.removeEventListener("keydown", H, !0), H = null, V = null);
746
+ }
747
+ function Ce() {
748
+ S || (S = (e) => {
749
+ const i = e.target, t = i == null ? void 0 : i.closest($);
750
+ t && (D = t, ee(t));
751
+ }, document.addEventListener("focusin", S, !0)), M || (M = (e) => {
752
+ const t = e.target, n = t == null ? void 0 : t.closest($);
753
+ n && n.getAttribute("contenteditable") !== "false" && (D = n, ee(n));
754
+ }, document.addEventListener("beforeinput", M, !0));
755
+ }
756
+ function He() {
757
+ S && (document.removeEventListener("focusin", S, !0), S = null), M && (document.removeEventListener("beforeinput", M, !0), M = null);
758
+ }
759
+ const Me = (e = {}) => {
760
+ const i = Ee(e);
761
+ return ye(), {
762
+ name: "versionDiff",
763
+ toolbar: [
764
+ {
765
+ id: "versionDiff",
766
+ label: "Version Diff",
767
+ command: "openVersionDiff",
768
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="4.5" width="7" height="15" rx="1.5" stroke="currentColor" stroke-width="1.8"></rect><rect x="13.5" y="4.5" width="7" height="15" rx="1.5" stroke="currentColor" stroke-width="1.8"></rect><path d="M5.5 12h3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path><path d="M15.5 12h3m-1.5-1.5v3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg>'
769
+ }
770
+ ],
771
+ commands: {
772
+ openVersionDiff: (t, n) => {
773
+ const r = N(n);
774
+ return r ? (R.set(r, i), ie(r, i, t), !0) : !1;
775
+ },
776
+ setVersionDiffBaseline: (t, n) => {
777
+ const r = N(n);
778
+ if (!r)
779
+ return !1;
780
+ R.set(r, i);
781
+ const o = typeof t == "string" ? t : typeof (t == null ? void 0 : t.html) == "string" ? t.html : r.innerHTML;
782
+ return w.set(r, o), !0;
783
+ }
784
+ },
785
+ keymap: {
786
+ "Mod-Alt-d": "openVersionDiff",
787
+ "Mod-Alt-D": "openVersionDiff",
788
+ F8: "openVersionDiff"
789
+ },
790
+ init: () => {
791
+ j += 1, we(i), Ce();
792
+ },
793
+ destroy: () => {
794
+ j = Math.max(0, j - 1), j === 0 && (ne(), Le(), He());
795
+ }
796
+ };
797
+ };
798
+ export {
799
+ Me as VersionDiffPlugin
800
+ };
801
+ //# sourceMappingURL=VersionDiffPlugin.native-5bbeff85.mjs.map