@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,12 +1,16 @@
1
- let D = null, m = null, s = null, _ = [], H = !1, A = null, U = 0, j = 0, q = 0, M = 0, P = 1, R = null;
2
- const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
3
- const r = (a) => {
4
- a.key !== "Escape" || !t.isConnected || (a.preventDefault(), a.stopPropagation(), e());
1
+ import { e as V } from "./escapeHtml-CX8RelZ1.mjs";
2
+ import { i as Y } from "./dialogHelpers-DBf7WqYH.mjs";
3
+ let R = null, m = null, s = null;
4
+ const _ = [];
5
+ let H = !1, T = null, j = 0, W = 0, q = 0, M = 0, P = 1, D = null;
6
+ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
7
+ const r = (i) => {
8
+ i.key !== "Escape" || !t.isConnected || (i.preventDefault(), i.stopPropagation(), e());
5
9
  };
6
10
  return document.addEventListener("keydown", r, !0), () => {
7
11
  document.removeEventListener("keydown", r, !0);
8
12
  };
9
- }, X = () => {
13
+ }, Z = () => {
10
14
  if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
11
15
  const t = document.createElement("style");
12
16
  t.id = "rte-media-dialog-styles", t.textContent = `
@@ -387,7 +391,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
387
391
  }
388
392
 
389
393
  .media-floating-toolbar.rte-ui-theme-dark,
390
- ${F} .media-floating-toolbar {
394
+ ${O} .media-floating-toolbar {
391
395
  --rte-media-toolbar-bg: #24303f;
392
396
  --rte-media-toolbar-border: #4a5a71;
393
397
  --rte-media-toolbar-text: #d9e6fb;
@@ -436,32 +440,33 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
436
440
  background: var(--rte-media-toolbar-separator);
437
441
  }
438
442
  `, document.head.appendChild(t);
439
- }, Y = () => {
443
+ }, K = () => {
440
444
  const t = window.getSelection();
441
445
  if (!t || t.rangeCount === 0) return null;
442
446
  const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
443
447
  return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
444
- }, Z = (t) => {
448
+ }, J = (t) => {
445
449
  if (t) return t;
446
- const e = Y();
450
+ const e = K();
447
451
  if (e) return e;
448
- if (R) return R;
452
+ if (D) return D;
449
453
  const r = document.activeElement;
450
454
  return r ? r.closest(".rte-content, .editora-content") || r : null;
451
455
  }, G = (t) => {
452
- const e = Z(t);
453
- return e ? !!e.closest(F) : !1;
456
+ const e = J(t);
457
+ return e ? !!e.closest(O) : !1;
454
458
  }, N = (t) => {
455
- X();
459
+ Z();
456
460
  const e = document.createElement("div");
457
- return e.className = "rte-media-overlay", G(t) && e.classList.add("rte-ui-theme-dark"), e;
461
+ return Y(e), e.className = "rte-media-overlay", G(t) && e.classList.add("rte-ui-theme-dark"), e;
458
462
  }, B = (t = !1) => {
459
463
  const e = document.createElement("div");
460
464
  return e.className = t ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e;
461
- }, W = (t, e) => {
465
+ }, F = (t, e) => {
466
+ document.querySelectorAll(".rte-media-overlay").forEach((a) => a.remove());
462
467
  const r = window.getSelection();
463
- r && r.rangeCount > 0 && (D = r.getRangeAt(0).cloneRange());
464
- const a = N(e), o = B();
468
+ r && r.rangeCount > 0 && (R = r.getRangeAt(0).cloneRange());
469
+ const i = N(e), o = B();
465
470
  let n = "upload", d = "", p = "", c = "", g = "";
466
471
  const h = () => {
467
472
  o.innerHTML = `
@@ -532,63 +537,63 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
532
537
  </div>
533
538
  `;
534
539
  };
535
- h(), a.appendChild(o), document.body.appendChild(a);
540
+ h(), i.appendChild(o), document.body.appendChild(i);
536
541
  let w = () => {
537
542
  };
538
543
  const f = () => {
539
- w(), a.parentNode && a.parentNode.removeChild(a);
544
+ w(), i.parentNode && i.parentNode.removeChild(i);
540
545
  };
541
- w = I(a, f);
546
+ w = I(i, f);
542
547
  const y = () => {
543
548
  if (!d) return;
544
- const i = t === "image" ? document.createElement("img") : document.createElement("video");
545
- i.src = d, i.setAttribute("data-media-type", t), t === "image" && g && (i.alt = g), p && (i.style.width = `${p}px`, i.setAttribute("width", p)), c && (i.style.height = `${c}px`, i.setAttribute("height", c)), t === "video" && (i.controls = !0), !p && !c ? i.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : i.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${p ? `width: ${p}px;` : "max-width: 100%;"} ${c ? `height: ${c}px;` : "height: auto;"}`, D && (D.deleteContents(), D.insertNode(i)), f();
546
- }, x = async (i) => {
547
- const u = o.querySelector("#upload-progress"), v = o.querySelector("#progress-bar"), L = o.querySelector("#progress-text");
548
- if (u && v && L) {
549
- u.style.display = "block";
549
+ const a = t === "image" ? document.createElement("img") : document.createElement("video");
550
+ a.src = d, a.setAttribute("data-media-type", t), t === "image" && g && (a.alt = g), p && (a.style.width = `${p}px`, a.setAttribute("width", p)), c && (a.style.height = `${c}px`, a.setAttribute("height", c)), t === "video" && (a.controls = !0), !p && !c ? a.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : a.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${p ? `width: ${p}px;` : "max-width: 100%;"} ${c ? `height: ${c}px;` : "height: auto;"}`, R && (R.deleteContents(), R.insertNode(a)), f();
551
+ }, x = async (a) => {
552
+ const b = o.querySelector("#upload-progress"), v = o.querySelector("#progress-bar"), L = o.querySelector("#progress-text");
553
+ if (b && v && L) {
554
+ b.style.display = "block";
550
555
  let E = 0;
551
- const b = setInterval(() => {
556
+ const u = setInterval(() => {
552
557
  E += Math.random() * 30, E > 90 && (E = 90), v.style.width = `${E}%`;
553
558
  }, 200);
554
559
  try {
555
560
  const k = new FileReader();
556
561
  k.onload = () => {
557
- clearInterval(b), v.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
562
+ clearInterval(u), v.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
558
563
  d = k.result, n = "url", h(), l();
559
564
  }, 500);
560
- }, k.readAsDataURL(i);
565
+ }, k.readAsDataURL(a);
561
566
  } catch (k) {
562
- clearInterval(b), L.textContent = "Upload failed";
567
+ clearInterval(u), L.textContent = "Upload failed";
563
568
  }
564
569
  }
565
570
  }, l = () => {
566
- const i = o.querySelector(".close-btn"), u = o.querySelector(".cancel-btn"), v = o.querySelector("#insert-btn"), L = o.querySelector(".tab-upload"), E = o.querySelector(".tab-url");
567
- if (i == null || i.addEventListener("click", f), u == null || u.addEventListener("click", f), v == null || v.addEventListener("click", y), L == null || L.addEventListener("click", () => {
571
+ const a = o.querySelector(".close-btn"), b = o.querySelector(".cancel-btn"), v = o.querySelector("#insert-btn"), L = o.querySelector(".tab-upload"), E = o.querySelector(".tab-url");
572
+ if (a == null || a.addEventListener("click", f), b == null || b.addEventListener("click", f), v == null || v.addEventListener("click", y), L == null || L.addEventListener("click", () => {
568
573
  n = "upload", h(), l();
569
574
  }), E == null || E.addEventListener("click", () => {
570
575
  n = "url", h(), l();
571
576
  }), n === "upload") {
572
- const b = o.querySelector(".dropzone"), k = o.querySelector("#file-input");
573
- b == null || b.addEventListener("click", () => k == null ? void 0 : k.click()), b == null || b.addEventListener("dragover", (S) => {
574
- S.preventDefault(), b.classList.add("is-dragover");
575
- }), b == null || b.addEventListener("dragleave", () => {
576
- b.classList.remove("is-dragover");
577
- }), b == null || b.addEventListener("drop", (S) => {
578
- var T;
579
- S.preventDefault(), b.classList.remove("is-dragover");
580
- const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
577
+ const u = o.querySelector(".dropzone"), k = o.querySelector("#file-input");
578
+ u == null || u.addEventListener("click", () => k == null ? void 0 : k.click()), u == null || u.addEventListener("dragover", (S) => {
579
+ S.preventDefault(), u.classList.add("is-dragover");
580
+ }), u == null || u.addEventListener("dragleave", () => {
581
+ u.classList.remove("is-dragover");
582
+ }), u == null || u.addEventListener("drop", (S) => {
583
+ var A;
584
+ S.preventDefault(), u.classList.remove("is-dragover");
585
+ const $ = (A = S.dataTransfer) == null ? void 0 : A.files[0];
581
586
  $ && x($);
582
587
  }), k == null || k.addEventListener("change", (S) => {
583
- var T;
584
- const $ = (T = S.target.files) == null ? void 0 : T[0];
588
+ var A;
589
+ const $ = (A = S.target.files) == null ? void 0 : A[0];
585
590
  $ && x($);
586
591
  });
587
592
  }
588
593
  if (n === "url") {
589
- const b = o.querySelector("#url-input"), k = o.querySelector("#alt-input"), S = o.querySelector("#width-input"), $ = o.querySelector("#height-input");
590
- b == null || b.addEventListener("input", () => {
591
- d = b.value, h(), l();
594
+ const u = o.querySelector("#url-input"), k = o.querySelector("#alt-input"), S = o.querySelector("#width-input"), $ = o.querySelector("#height-input");
595
+ u == null || u.addEventListener("input", () => {
596
+ d = u.value, h(), l();
592
597
  }), k == null || k.addEventListener("input", () => {
593
598
  g = k.value;
594
599
  }), S == null || S.addEventListener("input", () => {
@@ -598,10 +603,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
598
603
  });
599
604
  }
600
605
  };
601
- l(), a.addEventListener("click", (i) => {
602
- i.target === a && f();
606
+ l(), i.addEventListener("click", (a) => {
607
+ a.target === i && f();
603
608
  });
604
- }, K = () => {
609
+ }, Q = () => {
605
610
  ["nw", "ne", "sw", "se"].forEach((e) => {
606
611
  const r = document.createElement("div");
607
612
  r.className = `media-resize-handle-${e}`, r.style.cssText = `
@@ -629,10 +634,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
629
634
  se: { x: t.right - 5, y: t.bottom - 5 }
630
635
  };
631
636
  _.forEach((r) => {
632
- const a = r.getAttribute("data-position"), o = e[a];
637
+ const i = r.getAttribute("data-position"), o = e[i];
633
638
  r.style.left = `${o.x}px`, r.style.top = `${o.y}px`, r.style.display = "block";
634
639
  });
635
- }, J = (t) => {
640
+ }, ee = (t) => {
636
641
  const e = N(t), r = B(!0);
637
642
  r.innerHTML = `
638
643
  <div class="rte-media-header">
@@ -641,7 +646,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
641
646
  </div>
642
647
  <div class="rte-media-body">
643
648
  <label class="rte-media-label">Alternative Text (for accessibility)</label>
644
- <textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${t.alt || ""}</textarea>
649
+ <textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${V(t.alt || "")}</textarea>
645
650
  <p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
646
651
  </div>
647
652
  <div class="rte-media-footer">
@@ -649,7 +654,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
649
654
  <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
650
655
  </div>
651
656
  `, e.appendChild(r), document.body.appendChild(e);
652
- const a = r.querySelector("#alt-text-input"), o = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
657
+ const i = r.querySelector("#alt-text-input"), o = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
653
658
  let p = () => {
654
659
  };
655
660
  const c = () => {
@@ -658,10 +663,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
658
663
  p = I(e, c), o.addEventListener("click", c), n.addEventListener("click", c), e.addEventListener("click", (g) => {
659
664
  g.target === e && c();
660
665
  }), d.addEventListener("click", () => {
661
- t.alt = a.value, c();
662
- }), a.focus(), a.select();
663
- }, Q = (t) => {
664
- const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "", a = (e == null ? void 0 : e.getAttribute("target")) || "_self", o = (e == null ? void 0 : e.getAttribute("title")) || "", n = N(t), d = B(!0);
666
+ t.alt = i.value, c();
667
+ }), i.focus(), i.select();
668
+ }, te = (t) => {
669
+ const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "", i = (e == null ? void 0 : e.getAttribute("target")) || "_self", o = (e == null ? void 0 : e.getAttribute("title")) || "", n = N(t), d = B(!0);
665
670
  d.innerHTML = `
666
671
  <div class="rte-media-header">
667
672
  <h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
@@ -670,14 +675,14 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
670
675
  <div class="rte-media-body">
671
676
  <div class="rte-media-field">
672
677
  <label class="rte-media-label">URL</label>
673
- <input id="link-url" type="url" class="rte-media-input" value="${r}" placeholder="https://example.com" />
678
+ <input id="link-url" type="url" class="rte-media-input" value="${V(r)}" placeholder="https://example.com" />
674
679
  </div>
675
680
  <div class="rte-media-field">
676
681
  <label class="rte-media-label">Title (tooltip)</label>
677
- <input id="link-title" type="text" class="rte-media-input" value="${o}" placeholder="Optional tooltip text" />
682
+ <input id="link-title" type="text" class="rte-media-input" value="${V(o)}" placeholder="Optional tooltip text" />
678
683
  </div>
679
684
  <label class="rte-media-checkbox-label">
680
- <input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
685
+ <input id="link-target" type="checkbox" ${i === "_blank" ? "checked" : ""} />
681
686
  Open in new window/tab
682
687
  </label>
683
688
  </div>
@@ -695,26 +700,26 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
695
700
  const l = () => {
696
701
  x(), n.parentNode && n.parentNode.removeChild(n);
697
702
  };
698
- x = I(n, l), h.addEventListener("click", l), w.addEventListener("click", l), n.addEventListener("click", (i) => {
699
- i.target === n && l();
703
+ x = I(n, l), h.addEventListener("click", l), w.addEventListener("click", l), n.addEventListener("click", (a) => {
704
+ a.target === n && l();
700
705
  }), f.addEventListener("click", () => {
701
- const i = p.value.trim();
702
- if (i) {
703
- const u = i.startsWith("http") ? i : `https://${i}`;
706
+ const a = p.value.trim();
707
+ if (a) {
708
+ const b = a.startsWith("http") ? a : `https://${a}`;
704
709
  if (e)
705
- e.setAttribute("href", u), e.setAttribute("target", g.checked ? "_blank" : "_self"), g.checked ? e.setAttribute("rel", "noopener noreferrer") : e.removeAttribute("rel"), c.value.trim() ? e.setAttribute("title", c.value.trim()) : e.removeAttribute("title");
710
+ e.setAttribute("href", b), e.setAttribute("target", g.checked ? "_blank" : "_self"), g.checked ? e.setAttribute("rel", "noopener noreferrer") : e.removeAttribute("rel"), c.value.trim() ? e.setAttribute("title", c.value.trim()) : e.removeAttribute("title");
706
711
  else {
707
712
  const v = document.createElement("a");
708
- v.href = u, v.target = g.checked ? "_blank" : "_self", g.checked && (v.rel = "noopener noreferrer"), c.value.trim() && (v.title = c.value.trim()), t.replaceWith(v), v.appendChild(t);
713
+ v.href = b, v.target = g.checked ? "_blank" : "_self", g.checked && (v.rel = "noopener noreferrer"), c.value.trim() && (v.title = c.value.trim()), t.replaceWith(v), v.appendChild(t);
709
714
  }
710
- l(), s && m && V(m);
715
+ l(), s && m && U(m);
711
716
  }
712
717
  }), y == null || y.addEventListener("click", () => {
713
- e && confirm("Remove link from this media?") && (e.replaceWith(t), l(), s && m && V(m));
718
+ e && confirm("Remove link from this media?") && (e.replaceWith(t), l(), s && m && U(m));
714
719
  }), p.focus();
715
- }, ee = (t) => {
720
+ }, re = (t) => {
716
721
  const e = N(t), r = B();
717
- let a = "url", o = t.src;
722
+ let i = "url", o = t.src;
718
723
  const n = () => {
719
724
  r.innerHTML = `
720
725
  <div class="rte-media-header">
@@ -723,12 +728,12 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
723
728
  </div>
724
729
 
725
730
  <div class="rte-media-tabs">
726
- <button class="tab-upload rte-media-tab ${a === "upload" ? "active" : ""}" type="button">Upload</button>
727
- <button class="tab-url rte-media-tab ${a === "url" ? "active" : ""}" type="button">URL</button>
731
+ <button class="tab-upload rte-media-tab ${i === "upload" ? "active" : ""}" type="button">Upload</button>
732
+ <button class="tab-url rte-media-tab ${i === "url" ? "active" : ""}" type="button">URL</button>
728
733
  </div>
729
734
 
730
735
  <div class="rte-media-body">
731
- ${a === "upload" ? `
736
+ ${i === "upload" ? `
732
737
  <div id="upload-section">
733
738
  <div class="dropzone rte-media-dropzone">
734
739
  <div class="rte-media-dropzone-icon">📁</div>
@@ -763,7 +768,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
763
768
 
764
769
  <div class="rte-media-footer">
765
770
  <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
766
- <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o && a === "url" ? "disabled" : ""}>Replace</button>
771
+ <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o && i === "url" ? "disabled" : ""}>Replace</button>
767
772
  </div>
768
773
  `;
769
774
  };
@@ -781,47 +786,47 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
781
786
  if (f && y && x) {
782
787
  f.style.display = "block";
783
788
  let l = 0;
784
- const i = setInterval(() => {
789
+ const a = setInterval(() => {
785
790
  l += Math.random() * 30, l > 90 && (l = 90), y.style.width = `${l}%`;
786
791
  }, 200);
787
792
  try {
788
- const u = new FileReader();
789
- u.onload = () => {
790
- clearInterval(i), y.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
791
- o = u.result, a = "url", n(), h();
793
+ const b = new FileReader();
794
+ b.onload = () => {
795
+ clearInterval(a), y.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
796
+ o = b.result, i = "url", n(), h();
792
797
  }, 500);
793
- }, u.readAsDataURL(w);
794
- } catch (u) {
795
- clearInterval(i), x.textContent = "Upload failed";
798
+ }, b.readAsDataURL(w);
799
+ } catch (b) {
800
+ clearInterval(a), x.textContent = "Upload failed";
796
801
  }
797
802
  }
798
803
  }, h = () => {
799
804
  const w = r.querySelector(".close-btn"), f = r.querySelector(".cancel-btn"), y = r.querySelector("#replace-btn"), x = r.querySelector(".tab-upload"), l = r.querySelector(".tab-url");
800
805
  if (w == null || w.addEventListener("click", p), f == null || f.addEventListener("click", p), y == null || y.addEventListener("click", c), x == null || x.addEventListener("click", () => {
801
- a = "upload", n(), h();
806
+ i = "upload", n(), h();
802
807
  }), l == null || l.addEventListener("click", () => {
803
- a = "url", n(), h();
804
- }), a === "upload") {
805
- const i = r.querySelector(".dropzone"), u = r.querySelector("#file-input");
806
- i == null || i.addEventListener("click", () => u == null ? void 0 : u.click()), i == null || i.addEventListener("dragover", (v) => {
807
- v.preventDefault(), i.classList.add("is-dragover");
808
- }), i == null || i.addEventListener("dragleave", () => {
809
- i.classList.remove("is-dragover");
810
- }), i == null || i.addEventListener("drop", (v) => {
808
+ i = "url", n(), h();
809
+ }), i === "upload") {
810
+ const a = r.querySelector(".dropzone"), b = r.querySelector("#file-input");
811
+ a == null || a.addEventListener("click", () => b == null ? void 0 : b.click()), a == null || a.addEventListener("dragover", (v) => {
812
+ v.preventDefault(), a.classList.add("is-dragover");
813
+ }), a == null || a.addEventListener("dragleave", () => {
814
+ a.classList.remove("is-dragover");
815
+ }), a == null || a.addEventListener("drop", (v) => {
811
816
  var E;
812
- v.preventDefault(), i.classList.remove("is-dragover");
817
+ v.preventDefault(), a.classList.remove("is-dragover");
813
818
  const L = (E = v.dataTransfer) == null ? void 0 : E.files[0];
814
819
  L && g(L);
815
- }), u == null || u.addEventListener("change", (v) => {
820
+ }), b == null || b.addEventListener("change", (v) => {
816
821
  var E;
817
822
  const L = (E = v.target.files) == null ? void 0 : E[0];
818
823
  L && g(L);
819
824
  });
820
825
  }
821
- if (a === "url") {
822
- const i = r.querySelector("#url-input");
823
- i == null || i.addEventListener("input", () => {
824
- o = i.value, n(), h();
826
+ if (i === "url") {
827
+ const a = r.querySelector("#url-input");
828
+ a == null || a.addEventListener("input", () => {
829
+ o = a.value, n(), h();
825
830
  });
826
831
  }
827
832
  };
@@ -830,11 +835,11 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
830
835
  });
831
836
  }, C = () => {
832
837
  if (!s || !m) return;
833
- const t = s.offsetHeight || 40, e = m.offsetTop, r = m.offsetLeft, a = m.offsetWidth, o = e - t - 8, n = r + a / 2 - (s.offsetWidth || 120) / 2;
838
+ const t = s.offsetHeight || 40, e = m.offsetTop, r = m.offsetLeft, i = m.offsetWidth, o = e - t - 8, n = r + i / 2 - (s.offsetWidth || 120) / 2;
834
839
  s.style.top = `${o}px`, s.style.left = `${n}px`, setTimeout(() => {
835
840
  s && (s.style.display = "flex");
836
841
  }, 100);
837
- }, V = (t) => {
842
+ }, U = (t) => {
838
843
  var p, c, g, h, w, f, y, x;
839
844
  s && (s._cleanup && s._cleanup(), s.remove());
840
845
  const e = t.parentElement;
@@ -844,7 +849,7 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
844
849
  }
845
850
  const r = s;
846
851
  if (!r) return;
847
- const a = t.tagName === "IMG", o = t.closest("a");
852
+ const i = t.tagName === "IMG", o = t.closest("a");
848
853
  r.innerHTML = `
849
854
  <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
850
855
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line></svg>
@@ -856,14 +861,14 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
856
861
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line></svg>
857
862
  </button>
858
863
  <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
859
- ${a ? `
864
+ ${i ? `
860
865
  <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
861
866
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>
862
867
  </button>` : ""}
863
868
  <button class="media-floating-toolbar-btn btn-link" title="${o ? "Edit/Remove Link" : "Add Link"}" type="button">
864
869
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
865
870
  </button>
866
- ${a ? `
871
+ ${i ? `
867
872
  <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
868
873
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
869
874
  </button>` : ""}
@@ -890,76 +895,76 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
890
895
  }), (g = r.querySelector(".btn-align-right")) == null || g.addEventListener("click", () => {
891
896
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", C();
892
897
  }), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
893
- t.tagName === "IMG" && J(t);
898
+ t.tagName === "IMG" && ee(t);
894
899
  }), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
895
- Q(t);
900
+ te(t);
896
901
  }), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
897
- t.tagName === "IMG" && ee(t);
902
+ t.tagName === "IMG" && re(t);
898
903
  }), (y = r.querySelector(".btn-resize")) == null || y.addEventListener("click", () => {
899
904
  const l = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
900
905
  if (l && !isNaN(parseInt(l))) {
901
- const i = parseInt(l);
902
- t.style.width = `${i}px`, t.setAttribute("width", String(i)), z(), C();
906
+ const a = parseInt(l);
907
+ t.style.width = `${a}px`, t.setAttribute("width", String(a)), z(), C();
903
908
  }
904
909
  }), (x = r.querySelector(".btn-remove")) == null || x.addEventListener("click", () => {
905
910
  confirm("Remove this media?") && (t.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), m = null, z());
906
911
  }), r._cleanup = () => {
907
912
  window.removeEventListener("scroll", C), window.removeEventListener("resize", C);
908
913
  };
909
- }, O = (t) => {
910
- R = t || null, K(), document.addEventListener("click", (e) => {
914
+ }, X = (t) => {
915
+ D = t || null, Q(), document.addEventListener("click", (e) => {
911
916
  const r = e.target;
912
917
  if (r.tagName === "IMG" || r.tagName === "VIDEO") {
913
- const a = r;
918
+ const i = r;
914
919
  let o = !1;
915
- if (R ? o = R.contains(a) : o = !!a.closest('[contenteditable="true"]'), o) {
916
- e.preventDefault(), e.stopPropagation(), m = a, m.style.display = "block", V(a), z();
920
+ if (D ? o = D.contains(i) : o = !!i.closest('[contenteditable="true"]'), o) {
921
+ e.preventDefault(), e.stopPropagation(), m = i, m.style.display = "block", U(i), z();
917
922
  return;
918
923
  }
919
924
  }
920
925
  if (!r.closest(".btn-link, .btn-resize, .btn-remove") && s && !r.closest("button")) {
921
926
  if (s._cleanup && s._cleanup(), s.remove(), s = null, m && m.parentElement) {
922
- const a = m.parentElement;
923
- a._originalPosition !== void 0 && (a.style.position = a._originalPosition, delete a._originalPosition);
927
+ const i = m.parentElement;
928
+ i._originalPosition !== void 0 && (i.style.position = i._originalPosition, delete i._originalPosition);
924
929
  }
925
930
  m = null, z();
926
931
  }
927
932
  }), _.forEach((e) => {
928
933
  e.addEventListener("mousedown", (r) => {
929
934
  if (!m) return;
930
- r.preventDefault(), r.stopPropagation(), H = !0, A = e.getAttribute("data-position"), U = r.clientX, j = r.clientY;
931
- const a = m.getBoundingClientRect();
932
- q = a.width, M = a.height, P = q / M, document.body.style.userSelect = "none", document.body.style.cursor = `${A}-resize`;
935
+ r.preventDefault(), r.stopPropagation(), H = !0, T = e.getAttribute("data-position"), j = r.clientX, W = r.clientY;
936
+ const i = m.getBoundingClientRect();
937
+ q = i.width, M = i.height, P = q / M, document.body.style.userSelect = "none", document.body.style.cursor = `${T}-resize`;
933
938
  });
934
939
  }), document.addEventListener("mousemove", (e) => {
935
- if (!H || !m || !A) return;
936
- const r = e.clientX - U, a = e.clientY - j;
940
+ if (!H || !m || !T) return;
941
+ const r = e.clientX - j, i = e.clientY - W;
937
942
  let o = q, n = M;
938
- switch (A) {
943
+ switch (T) {
939
944
  case "se":
940
- o = q + r, n = M + a;
945
+ o = q + r, n = M + i;
941
946
  break;
942
947
  case "sw":
943
- o = q - r, n = M + a;
948
+ o = q - r, n = M + i;
944
949
  break;
945
950
  case "ne":
946
- o = q + r, n = M - a;
951
+ o = q + r, n = M - i;
947
952
  break;
948
953
  case "nw":
949
- o = q - r, n = M - a;
954
+ o = q - r, n = M - i;
950
955
  break;
951
956
  }
952
- Math.abs(r) > Math.abs(a) ? n = o / P : o = n * P, o = Math.max(50, o), n = Math.max(50, n), m.style.width = `${o}px`, m.style.height = `${n}px`, m.setAttribute("width", String(Math.round(o))), m.setAttribute("height", String(Math.round(n))), z(), C();
957
+ Math.abs(r) > Math.abs(i) ? n = o / P : o = n * P, o = Math.max(50, o), n = Math.max(50, n), m.style.width = `${o}px`, m.style.height = `${n}px`, m.setAttribute("width", String(Math.round(o))), m.setAttribute("height", String(Math.round(n))), z(), C();
953
958
  }), document.addEventListener("mouseup", () => {
954
- H && (H = !1, A = null, document.body.style.userSelect = "", document.body.style.cursor = "");
959
+ H && (H = !1, T = null, document.body.style.userSelect = "", document.body.style.cursor = "");
955
960
  }), window.addEventListener("scroll", z), window.addEventListener("resize", z);
956
961
  };
957
- typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, O());
958
- const te = () => ({
962
+ typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, X());
963
+ const oe = () => ({
959
964
  name: "image",
960
965
  initialize: (t) => {
961
966
  const e = t == null ? void 0 : t.editorElement;
962
- O(e);
967
+ X(e);
963
968
  },
964
969
  toolbar: [
965
970
  {
@@ -976,11 +981,11 @@ const te = () => ({
976
981
  commands: {
977
982
  insertImage: (t, e) => {
978
983
  const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
979
- return W("image", r), !0;
984
+ return F("image", r), !0;
980
985
  },
981
986
  insertVideo: (t, e) => {
982
987
  const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
983
- return W("video", r), !0;
988
+ return F("video", r), !0;
984
989
  }
985
990
  },
986
991
  keymap: {
@@ -988,6 +993,6 @@ const te = () => ({
988
993
  }
989
994
  });
990
995
  export {
991
- te as MediaManagerPlugin
996
+ oe as MediaManagerPlugin
992
997
  };
993
- //# sourceMappingURL=MediaManagerPlugin.native-eOsTJFpw.mjs.map
998
+ //# sourceMappingURL=MediaManagerPlugin.native-BT1NZIJS.mjs.map