@editora/core 1.0.15 → 1.0.17

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 (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-XsYC_KdJ.mjs +3923 -0
  48. package/dist/index-_eKRBZPq.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2055 -476
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2223 -643
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -1,4 +1,5 @@
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 = {
1
+ import { i as fe } from "./dialogHelpers-DBf7WqYH.mjs";
2
+ 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", de = {
2
3
  title: "Version Diff",
3
4
  baseline: "Baseline",
4
5
  current: "Current",
@@ -17,9 +18,9 @@ let j = 0, H = null, z = null, V = null, S = null, M = null, D = null;
17
18
  function u(e) {
18
19
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
19
20
  }
20
- function de(e) {
21
+ function ce(e) {
21
22
  return {
22
- ...fe,
23
+ ...de,
23
24
  ...e || {}
24
25
  };
25
26
  }
@@ -60,13 +61,13 @@ function Q(e) {
60
61
  const t = i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
61
62
  return !!(P(t) || P(document.documentElement) || P(document.body));
62
63
  }
63
- function ce(e) {
64
+ function ue(e) {
64
65
  const i = document.createElement("textarea");
65
66
  return i.innerHTML = e, i.value;
66
67
  }
67
68
  function W(e) {
68
69
  const t = O(e).getAttribute("data-initial-content");
69
- return t ? ce(t) : e.innerHTML;
70
+ return t ? ue(t) : e.innerHTML;
70
71
  }
71
72
  function te(e) {
72
73
  return e.replace(/\r\n?/g, `
@@ -100,7 +101,7 @@ function Z(e, i, t) {
100
101
  `);
101
102
  }), r;
102
103
  }
103
- function ue(e, i, t) {
104
+ function pe(e, i, t) {
104
105
  if (e.length === 0) return "";
105
106
  if (i === "line") return e.join(`
106
107
  `);
@@ -119,7 +120,7 @@ function ue(e, i, t) {
119
120
  }
120
121
  return n;
121
122
  }
122
- function pe(e, i, t) {
123
+ function be(e, i, t) {
123
124
  const n = [];
124
125
  return e.forEach((r) => {
125
126
  const o = n[n.length - 1];
@@ -130,11 +131,11 @@ function pe(e, i, t) {
130
131
  n.push({ type: r.type, tokens: [r.token] });
131
132
  }), n.map((r) => ({
132
133
  type: r.type,
133
- value: ue(r.tokens, i, t),
134
+ value: pe(r.tokens, i, t),
134
135
  count: r.tokens.length
135
136
  }));
136
137
  }
137
- function be(e, i) {
138
+ function he(e, i) {
138
139
  let t = 0;
139
140
  for (; t < e.length && t < i.length && e[t] === i[t]; )
140
141
  t += 1;
@@ -144,11 +145,10 @@ function be(e, i) {
144
145
  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) : [];
145
146
  return { prefix: o, suffix: f, aMiddle: g, bMiddle: c };
146
147
  }
147
- function he(e, i, t, n, r, o) {
148
+ function ve(e, i, t, n, r, o) {
148
149
  if (e.length === 0 && i.length === 0)
149
150
  return { segments: [], insertedCount: 0, deletedCount: 0, equalCount: 0, usedFallback: !1 };
150
- const { prefix: f, suffix: g, aMiddle: c, bMiddle: b } = be(e, i);
151
- let m = [];
151
+ const { prefix: f, suffix: g, aMiddle: c, bMiddle: b } = he(e, i), m = [];
152
152
  f.forEach((a) => m.push({ type: "equal", token: a }));
153
153
  const F = c.length * b.length, T = c.length > o || b.length > o || F > r;
154
154
  if (T)
@@ -169,7 +169,7 @@ function he(e, i, t, n, r, o) {
169
169
  m.push({ type: "insert", token: b[p] }), p += 1;
170
170
  }
171
171
  g.forEach((a) => m.push({ type: "equal", token: a }));
172
- const q = pe(m, t, n);
172
+ const q = be(m, t, n);
173
173
  let B = 0, L = 0, K = 0;
174
174
  return q.forEach((a) => {
175
175
  a.type === "insert" && (B += a.count), a.type === "delete" && (L += a.count), a.type === "equal" && (K += a.count);
@@ -185,10 +185,10 @@ function re(e) {
185
185
  return u(e.value).replace(/\n/g, `
186
186
  `);
187
187
  }
188
- function ve(e, i) {
188
+ function me(e, i) {
189
189
  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("");
190
190
  }
191
- function me(e, i) {
191
+ function ge(e, i) {
192
192
  if (e.length === 0) {
193
193
  const r = `<p class="rte-version-diff-empty">${u(i.noChanges)}</p>`;
194
194
  return { baselineHtml: r, currentHtml: r };
@@ -210,11 +210,11 @@ function me(e, i) {
210
210
  currentHtml: n.join("")
211
211
  };
212
212
  }
213
- function ge(e) {
213
+ function ye(e) {
214
214
  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");
215
215
  return o || f;
216
216
  }
217
- function ye() {
217
+ function ke() {
218
218
  if (typeof document == "undefined" || document.getElementById(J)) return;
219
219
  const e = document.createElement("style");
220
220
  e.id = J, e.textContent = `
@@ -516,7 +516,7 @@ function ye() {
516
516
  }
517
517
  `, document.head.appendChild(e);
518
518
  }
519
- async function ke(e, i, t) {
519
+ async function xe(e, i, t) {
520
520
  if (t != null) return t;
521
521
  if (typeof i.getBaselineHtml == "function") {
522
522
  const o = O(e), f = await Promise.resolve(i.getBaselineHtml({ editor: e, editorRoot: o }));
@@ -528,13 +528,13 @@ async function ke(e, i, t) {
528
528
  const r = W(e);
529
529
  return w.set(e, r), r;
530
530
  }
531
- function xe(e) {
531
+ function $e(e) {
532
532
  const i = e.querySelector(
533
533
  'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
534
534
  );
535
535
  i == null || i.focus();
536
536
  }
537
- function $e(e, i) {
537
+ function Ee(e, i) {
538
538
  if (e.key !== "Tab") return;
539
539
  const t = Array.from(i.querySelectorAll(
540
540
  'button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
@@ -549,7 +549,7 @@ function ne() {
549
549
  function ee(e) {
550
550
  !e || w.has(e) || w.set(e, W(e));
551
551
  }
552
- function Ee(e) {
552
+ function we(e) {
553
553
  var i, t;
554
554
  return {
555
555
  baselineHtml: e.baselineHtml,
@@ -558,14 +558,14 @@ function Ee(e) {
558
558
  ignoreWhitespace: e.ignoreWhitespace !== !1,
559
559
  maxTokens: Math.max(200, (i = e.maxTokens) != null ? i : 1200),
560
560
  maxMatrixSize: Math.max(5e4, (t = e.maxMatrixSize) != null ? t : 1e6),
561
- labels: de(e.labels)
561
+ labels: ce(e.labels)
562
562
  };
563
563
  }
564
564
  function ie(e, i, t) {
565
565
  var _;
566
566
  ne(), D = e, R.set(e, i);
567
567
  const n = document.createElement("div");
568
- n.className = l, Q(e) && n.classList.add("rte-version-diff-theme-dark");
568
+ fe(n), n.className = l, Q(e) && n.classList.add("rte-version-diff-theme-dark");
569
569
  const r = document.createElement("section");
570
570
  r.className = "rte-version-diff-dialog", r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), r.setAttribute("aria-labelledby", "rte-version-diff-title");
571
571
  const o = i.labels;
@@ -635,20 +635,20 @@ function ie(e, i, t) {
635
635
  const y = e.innerHTML;
636
636
  let E = "";
637
637
  try {
638
- E = await ke(e, i, s != null ? s : t == null ? void 0 : t.baselineHtml);
639
- } catch (Se) {
638
+ E = await xe(e, i, s != null ? s : t == null ? void 0 : t.baselineHtml);
639
+ } catch (Me) {
640
640
  E = (Y = w.get(e)) != null ? Y : W(e);
641
641
  }
642
642
  if (v !== L || !n.isConnected) return;
643
- const oe = X(E), se = X(y), ae = Z(oe, f, g), le = Z(se, f, g), C = he(
643
+ const oe = X(E), se = X(y), ae = Z(oe, f, g), le = Z(se, f, g), C = ve(
644
644
  ae,
645
645
  le,
646
646
  f,
647
647
  g,
648
648
  i.maxMatrixSize,
649
649
  i.maxTokens
650
- ), G = me(C.segments, o);
651
- T.innerHTML = ve(C.segments, o), q.innerHTML = G.baselineHtml, B.innerHTML = G.currentHtml;
650
+ ), G = ge(C.segments, o);
651
+ T.innerHTML = me(C.segments, o), q.innerHTML = G.baselineHtml, B.innerHTML = G.currentHtml;
652
652
  const U = [
653
653
  `+${C.insertedCount} inserted`,
654
654
  `-${C.deletedCount} deleted`,
@@ -673,7 +673,7 @@ function ie(e, i, t) {
673
673
  s.preventDefault(), p();
674
674
  return;
675
675
  }
676
- if ($e(s, r), s.target && s.target.classList.contains("rte-version-diff-tab") && (s.key === "ArrowRight" || s.key === "ArrowLeft")) {
676
+ if (Ee(s, r), s.target && s.target.classList.contains("rte-version-diff-tab") && (s.key === "ArrowRight" || s.key === "ArrowLeft")) {
677
677
  s.preventDefault();
678
678
  const v = c === "inline" ? "side" : "inline";
679
679
  h(v);
@@ -699,11 +699,11 @@ function ie(e, i, t) {
699
699
  g = m.checked, a();
700
700
  }), r.querySelector(".rte-version-diff-set-baseline").addEventListener("click", () => {
701
701
  w.set(e, e.innerHTML), a(e.innerHTML);
702
- }), n.addEventListener("keydown", I, !0), n.addEventListener("click", A), document.addEventListener("keydown", k, !0), z = p, xe(r), a();
702
+ }), n.addEventListener("keydown", I, !0), n.addEventListener("click", A), document.addEventListener("keydown", k, !0), z = p, $e(r), a();
703
703
  }
704
- function we(e) {
704
+ function Le(e) {
705
705
  V = e, !H && (H = (i) => {
706
- if (!ge(i)) return;
706
+ if (!ye(i)) return;
707
707
  if (document.querySelector(`.${l}`)) {
708
708
  i.preventDefault();
709
709
  return;
@@ -717,10 +717,10 @@ function we(e) {
717
717
  ie(r, o);
718
718
  }, document.addEventListener("keydown", H, !0));
719
719
  }
720
- function Le() {
720
+ function Ce() {
721
721
  H && (document.removeEventListener("keydown", H, !0), H = null, V = null);
722
722
  }
723
- function Ce() {
723
+ function He() {
724
724
  S || (S = (e) => {
725
725
  const i = e.target, t = i == null ? void 0 : i.closest($);
726
726
  t && (D = t, ee(t));
@@ -729,12 +729,12 @@ function Ce() {
729
729
  n && n.getAttribute("contenteditable") !== "false" && (D = n, ee(n));
730
730
  }, document.addEventListener("beforeinput", M, !0));
731
731
  }
732
- function He() {
732
+ function Se() {
733
733
  S && (document.removeEventListener("focusin", S, !0), S = null), M && (document.removeEventListener("beforeinput", M, !0), M = null);
734
734
  }
735
- const Me = (e = {}) => {
736
- const i = Ee(e);
737
- return ye(), {
735
+ const Te = (e = {}) => {
736
+ const i = we(e);
737
+ return ke(), {
738
738
  name: "versionDiff",
739
739
  toolbar: [
740
740
  {
@@ -763,14 +763,14 @@ const Me = (e = {}) => {
763
763
  F8: "openVersionDiff"
764
764
  },
765
765
  init: () => {
766
- j += 1, we(i), Ce();
766
+ j += 1, Le(i), He();
767
767
  },
768
768
  destroy: () => {
769
- j = Math.max(0, j - 1), j === 0 && (ne(), Le(), He());
769
+ j = Math.max(0, j - 1), j === 0 && (ne(), Ce(), Se());
770
770
  }
771
771
  };
772
772
  };
773
773
  export {
774
- Me as VersionDiffPlugin
774
+ Te as VersionDiffPlugin
775
775
  };
776
- //# sourceMappingURL=VersionDiffPlugin.native-Bvxgy--t.mjs.map
776
+ //# sourceMappingURL=VersionDiffPlugin.native-Ca1fMWUJ.mjs.map
@@ -0,0 +1,116 @@
1
+ import { r as b } from "./historyHelpers-B0-4mq1E.mjs";
2
+ const A = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
3
+ function p(e) {
4
+ return !!e.cloneContents().querySelector(A);
5
+ }
6
+ function m(e, n) {
7
+ var o, r;
8
+ const t = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : (o = e == null ? void 0 : e.parentElement) != null ? o : null;
9
+ return (t == null ? void 0 : t.closest('[contenteditable="true"]')) || ((r = n()) == null ? void 0 : r.querySelector('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
10
+ }
11
+ function v(e, n) {
12
+ const t = m(e, n);
13
+ t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
14
+ }
15
+ function S(e, n) {
16
+ let o = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
17
+ for (; o && o !== document.body; ) {
18
+ if (o.classList.contains(n)) {
19
+ const r = document.createRange();
20
+ if (r.selectNodeContents(o), r.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && r.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
21
+ return o;
22
+ }
23
+ o = o.parentElement;
24
+ }
25
+ return null;
26
+ }
27
+ function M(e) {
28
+ var c, l;
29
+ const n = window.getSelection(), t = (l = (c = e.savedRange) == null ? void 0 : c.commonAncestorContainer) != null ? l : n && n.rangeCount > 0 ? n.getRangeAt(0).commonAncestorContainer : null, o = m(t, e.getActiveEditorRoot), r = o ? o.innerHTML : null, s = T(e);
30
+ return s && o && r !== null && b(o, r), s;
31
+ }
32
+ function T(e) {
33
+ try {
34
+ if (e.savedRange) {
35
+ const c = window.getSelection();
36
+ c && (c.removeAllRanges(), c.addRange(e.savedRange.cloneRange()));
37
+ }
38
+ const n = window.getSelection();
39
+ if (!n || n.rangeCount === 0 || n.isCollapsed)
40
+ return !1;
41
+ const t = n.getRangeAt(0);
42
+ if (t.collapsed)
43
+ return !1;
44
+ const o = S(t, e.className);
45
+ if (o)
46
+ return e.styleProperty === "backgroundColor" ? o.style.backgroundColor = e.color : o.style.color = e.color, v(o, e.getActiveEditorRoot), !0;
47
+ const r = m(
48
+ t.commonAncestorContainer,
49
+ e.getActiveEditorRoot
50
+ );
51
+ r == null || r.focus({ preventScroll: !0 });
52
+ try {
53
+ document.execCommand("styleWithCSS", !1, "true");
54
+ } catch (c) {
55
+ }
56
+ let s = !1;
57
+ if (e.commands.forEach((c) => {
58
+ s || (s = document.execCommand(c, !1, e.color));
59
+ }), !s && !p(t)) {
60
+ const c = document.createElement("span");
61
+ e.styleProperty === "backgroundColor" ? c.style.backgroundColor = e.color : c.style.color = e.color, c.className = e.className;
62
+ const l = t.extractContents();
63
+ c.appendChild(l), t.insertNode(c), t.setStartAfter(c), t.collapse(!0), n.removeAllRanges(), n.addRange(t), s = !0;
64
+ }
65
+ return s ? (v(t.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
66
+ } catch (n) {
67
+ return e.warnMessage ? console.error(e.warnMessage, n) : console.error("[ColorApply] Failed to apply color", n), !1;
68
+ }
69
+ }
70
+ function k({
71
+ popover: e,
72
+ anchor: n,
73
+ onClose: t,
74
+ gap: o = 6,
75
+ margin: r = 8,
76
+ zIndex: s = 1e4
77
+ }) {
78
+ e.style.position = "fixed", e.style.zIndex = `${s}`, e.style.visibility = "hidden";
79
+ const c = () => {
80
+ if (!e.isConnected || !n.isConnected) {
81
+ t();
82
+ return;
83
+ }
84
+ const i = n.getBoundingClientRect();
85
+ if (i.width === 0 && i.height === 0) {
86
+ t();
87
+ return;
88
+ }
89
+ const a = e.getBoundingClientRect(), w = a.width || e.offsetWidth || 220, f = a.height || e.offsetHeight || 260, y = window.innerWidth, E = window.innerHeight;
90
+ let u = i.left, d = i.bottom + o;
91
+ if (u + w > y - r && (u = y - w - r), u = Math.max(r, u), d + f > E - r) {
92
+ const C = i.top - f - o;
93
+ C >= r ? d = C : d = Math.max(r, E - f - r);
94
+ }
95
+ d < r && (d = r), e.style.left = `${Math.round(u)}px`, e.style.top = `${Math.round(d)}px`, e.style.visibility = "visible";
96
+ }, l = () => {
97
+ c();
98
+ }, h = (i) => {
99
+ const a = i.target;
100
+ a && (e.contains(a) || n.contains(a) || t());
101
+ }, g = (i) => {
102
+ i.key === "Escape" && t();
103
+ };
104
+ window.addEventListener("resize", l), window.addEventListener("scroll", l, !0), document.addEventListener("keydown", g);
105
+ const R = window.requestAnimationFrame(() => {
106
+ document.addEventListener("mousedown", h, !0);
107
+ });
108
+ return c(), { reposition: c, destroy: () => {
109
+ window.cancelAnimationFrame(R), window.removeEventListener("resize", l), window.removeEventListener("scroll", l, !0), document.removeEventListener("keydown", g), document.removeEventListener("mousedown", h, !0);
110
+ } };
111
+ }
112
+ export {
113
+ M as a,
114
+ k as b
115
+ };
116
+ //# sourceMappingURL=anchoredPopover-DJFD2oAP.mjs.map
package/dist/core.css CHANGED
@@ -1 +1 @@
1
- .rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative;user-select:none}.rte-table td:focus,.rte-table th:focus,table td:focus,table th:focus{outline:2px solid #007acc;outline-offset:-2px}.rte-table th,table th{background-color:#f8f9fa;font-weight:600;text-align:left}.rte-table td p,table td p{margin:0;padding:0}.rte-table td p:empty:before,table td p:empty:before{content:"​";display:inline-block}.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before{content:"Type here...";color:#999;font-style:italic;pointer-events:none}.rte-table tr:hover,table tr:hover{background-color:#f8f9fa}.rte-table td.selected,table td.selected{background-color:#e3f2fd;border-color:#2196f3}.table-toolbar{background:#fff;border:1px solid #d0d0d0;border-radius:4px;box-shadow:0 2px 8px #0000001a;padding:4px;display:flex;align-items:center;gap:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;min-width:max-content}.toolbar-section{display:flex;align-items:center;gap:2px}.toolbar-divider{width:1px;height:20px;background:#e0e0e0;margin:0 4px}.toolbar-icon-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;color:#333;border-radius:3px;transition:all .2s ease;flex-shrink:0;font-size:14px;line-height:1}.toolbar-icon-btn svg{width:16px;height:16px}.toolbar-icon-btn:hover:not(:disabled){background:#f0f0f0;border-color:#d0d0d0;color:#06c}.toolbar-icon-btn:active:not(:disabled){background:#e8f0ff;border-color:#06c;transform:scale(.95)}.toolbar-icon-btn:disabled{opacity:.4;cursor:not-allowed;color:#ccc}.toolbar-icon-btn-danger{color:#d32f2f}.toolbar-icon-btn-danger:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-danger:active:not(:disabled){background:#ffebee}.toolbar-icon-btn-delete{color:#d32f2f}.toolbar-icon-btn-delete:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-delete:active:not(:disabled){background:#ffebee}.resize-handle{opacity:0;transition:all .15s ease}.resize-handle:hover{opacity:1}td:hover>.resize-handle,th:hover>.resize-handle{opacity:1}.table-resize-handle{position:absolute;bottom:-4px;right:-4px;width:12px;height:12px;background:transparent;cursor:nwse-resize;z-index:10;transition:background .15s ease}.table-resize-handle:after{content:"";position:absolute;bottom:0;right:0;width:8px;height:8px;background:#0066cc4d;border-bottom:2px solid #0066cc;border-right:2px solid #0066cc;border-radius:0 0 2px;opacity:0;transition:opacity .15s ease}.table-resize-handle:hover:after{opacity:1}.rte-table:hover .table-resize-handle:after,table:hover .table-resize-handle:after{opacity:1}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table,table){border-color:#607088;background:#24303c;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td,.rte-table th,table td,table th){border-color:#607088;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table th,table th){background:linear-gradient(180deg,#3b4553,#333d4a);color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table tr:hover,table tr:hover){background-color:#58a6ff1f}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td.selected,table td.selected){background-color:#58a6ff47;border-color:#79beff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before){color:#94a3b8}:is([data-theme=dark],.dark,.editora-theme-dark) .table-toolbar{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}.table-toolbar.rte-theme-dark{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-divider{background:#4d596b}.table-toolbar.rte-theme-dark .toolbar-divider{background:#4d596b}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn{color:#d7deea;border-color:transparent}.table-toolbar.rte-theme-dark .toolbar-icon-btn{color:#d7deea;border-color:transparent}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg{color:currentColor;fill:currentColor}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg{color:currentColor;fill:currentColor}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}.table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}.table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:disabled{color:#7f8ca1}.table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled{color:#7f8ca1}@media(max-width:768px){.rte-table,table{font-size:12px}.rte-table td,.rte-table th,table td,table th{padding:4px 6px;min-width:60px}.table-toolbar{padding:3px;gap:0;max-width:90vw;overflow-x:auto}.toolbar-icon-btn{width:26px;height:26px}.toolbar-divider{height:18px}}@media print{.rte-table,table{border:1px solid #000}.rte-table td,.rte-table th,table td,table th{border:1px solid #000;padding:4px}.table-toolbar{display:none}}
1
+ .rte-table-wrapper{position:relative}.rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative;user-select:none}.rte-table td:focus,.rte-table th:focus,table td:focus,table th:focus{outline:2px solid #007acc;outline-offset:-2px}.rte-table th,table th{background-color:#f8f9fa;font-weight:600;text-align:left}.rte-table td p,table td p{margin:0;padding:0}.rte-table td p:empty:before,table td p:empty:before{content:"​";display:inline-block}.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before{content:"Type here...";color:#999;font-style:italic;pointer-events:none}.rte-table tr:hover,table tr:hover{background-color:#f8f9fa}.rte-table td.selected,table td.selected{background-color:#e3f2fd;border-color:#2196f3}.table-toolbar{background:#fff;border:1px solid #d0d0d0;border-radius:4px;box-shadow:0 2px 8px #0000001a;padding:4px;display:flex;align-items:center;gap:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;min-width:max-content}.toolbar-section{display:flex;align-items:center;gap:2px}.toolbar-divider{width:1px;height:20px;background:#e0e0e0;margin:0 4px}.toolbar-icon-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;color:#333;border-radius:3px;transition:all .2s ease;flex-shrink:0;font-size:14px;line-height:1}.toolbar-icon-btn svg{width:16px;height:16px}.toolbar-icon-btn:hover:not(:disabled){background:#f0f0f0;border-color:#d0d0d0;color:#06c}.toolbar-icon-btn:active:not(:disabled){background:#e8f0ff;border-color:#06c;transform:scale(.95)}.toolbar-icon-btn:disabled{opacity:.4;cursor:not-allowed;color:#ccc}.toolbar-icon-btn-danger{color:#d32f2f}.toolbar-icon-btn-danger:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-danger:active:not(:disabled){background:#ffebee}.toolbar-icon-btn-delete{color:#d32f2f}.toolbar-icon-btn-delete:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-delete:active:not(:disabled){background:#ffebee}.resize-handle{opacity:0;transition:all .15s ease}.resize-handle:hover{opacity:1}td:hover>.resize-handle,th:hover>.resize-handle{opacity:1}.table-resize-handle{position:absolute;bottom:-4px;right:-4px;width:12px;height:12px;background:transparent;cursor:nwse-resize;z-index:10;transition:background .15s ease}.table-resize-handle:after{content:"";position:absolute;bottom:0;right:0;width:8px;height:8px;background:#0066cc4d;border-bottom:2px solid #0066cc;border-right:2px solid #0066cc;border-radius:0 0 2px;opacity:0;transition:opacity .15s ease}.table-resize-handle:hover:after{opacity:1}.rte-table:hover .table-resize-handle:after,table:hover .table-resize-handle:after{opacity:1}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table,table){border-color:#607088;background:#24303c;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td,.rte-table th,table td,table th){border-color:#607088;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table th,table th){background:linear-gradient(180deg,#3b4553,#333d4a);color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table tr:hover,table tr:hover){background-color:#58a6ff1f}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td.selected,table td.selected){background-color:#58a6ff47;border-color:#79beff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before){color:#94a3b8}:is([data-theme=dark],.dark,.editora-theme-dark) .table-toolbar{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}.table-toolbar.rte-theme-dark{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-divider{background:#4d596b}.table-toolbar.rte-theme-dark .toolbar-divider{background:#4d596b}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn{color:#d7deea;border-color:transparent}.table-toolbar.rte-theme-dark .toolbar-icon-btn{color:#d7deea;border-color:transparent}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg{color:currentColor}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg{color:currentColor}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}.table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}.table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:disabled{color:#7f8ca1}.table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled{color:#7f8ca1}@media(max-width:768px){.rte-table,table{font-size:12px}.rte-table td,.rte-table th,table td,table th{padding:4px 6px;min-width:60px}.table-toolbar{padding:3px;gap:0;max-width:90vw;overflow-x:auto}.toolbar-icon-btn{width:26px;height:26px}.toolbar-divider{height:18px}}@media print{.rte-table,table{border:1px solid #000}.rte-table td,.rte-table th,table td,table th{border:1px solid #000;padding:4px}.table-toolbar{display:none}}
@@ -0,0 +1,40 @@
1
+ function n(e) {
2
+ let i = !1;
3
+ e.addEventListener(
4
+ "pointerdown",
5
+ (t) => {
6
+ i = t.target !== e;
7
+ },
8
+ !0
9
+ ), e.addEventListener(
10
+ "click",
11
+ (t) => {
12
+ t.target === e && i && t.stopImmediatePropagation(), i = !1;
13
+ },
14
+ !0
15
+ );
16
+ }
17
+ const a = "rte-dialog-base-styles";
18
+ function o() {
19
+ if (typeof document == "undefined" || document.getElementById(a)) return;
20
+ const e = document.createElement("style");
21
+ e.id = a, e.textContent = `
22
+ [data-rte-dialog] {
23
+ font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
24
+ }
25
+
26
+ /* Form controls ignore inherited fonts (browsers default them to Arial /
27
+ system-ui). :where() keeps this at zero specificity so any control a plugin
28
+ styles explicitly - e.g. a monospace formula field - keeps its own font. */
29
+ :where([data-rte-dialog]) :where(button, input, select, textarea) {
30
+ font-family: inherit;
31
+ }
32
+ `, document.head.appendChild(e);
33
+ }
34
+ function s(e) {
35
+ e.setAttribute("data-rte-dialog", ""), o(), n(e);
36
+ }
37
+ export {
38
+ s as i
39
+ };
40
+ //# sourceMappingURL=dialogHelpers-DBf7WqYH.mjs.map