@editora/core 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +6 -1
  2. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
  3. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  4. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
  5. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  6. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  7. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  8. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
  9. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  10. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  11. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
  12. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
  13. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  14. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
  15. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
  16. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  17. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
  18. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  19. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  20. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
  21. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  22. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
  23. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
  24. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
  25. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
  26. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
  27. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  28. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
  29. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  30. package/dist/editora.min.js +1 -1
  31. package/dist/editora.umd.js +1 -1
  32. package/dist/index-CPMGUZfB.js +10 -0
  33. package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +2 -2
  36. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  37. package/dist/plugin-loader.js +37 -37
  38. package/dist/webcomponent-core.js +18 -16
  39. package/dist/webcomponent-core.min.css +1 -1
  40. package/dist/webcomponent-core.min.js +139 -62
  41. package/dist/webcomponent.cjs.js +1 -1
  42. package/dist/webcomponent.esm.js +1 -1
  43. package/dist/webcomponent.js +50 -48
  44. package/dist/webcomponent.min.css +1 -1
  45. package/dist/webcomponent.min.js +1174 -1071
  46. package/package.json +11 -5
  47. package/LICENSE +0 -21
  48. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
  49. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
  50. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
  51. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
  52. package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
  53. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
  54. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
  55. package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
  56. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
  57. package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
  58. package/dist/index-D1LOqg5C.js +0 -10
@@ -1,7 +1,7 @@
1
- let D = null, d = null, l = null, _ = [], H = !1, A = null, U = 0, j = 0, q = 0, z = 0, P = 1, R = null;
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
2
  const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
3
- const r = (i) => {
4
- i.key !== "Escape" || !t.isConnected || (i.preventDefault(), i.stopPropagation(), e());
3
+ const r = (a) => {
4
+ a.key !== "Escape" || !t.isConnected || (a.preventDefault(), a.stopPropagation(), e());
5
5
  };
6
6
  return document.addEventListener("keydown", r, !0), () => {
7
7
  document.removeEventListener("keydown", r, !0);
@@ -461,10 +461,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
461
461
  }, W = (t, e) => {
462
462
  const r = window.getSelection();
463
463
  r && r.rangeCount > 0 && (D = r.getRangeAt(0).cloneRange());
464
- const i = N(e), a = B();
465
- let n = "upload", s = "", b = "", m = "", f = "";
466
- const y = () => {
467
- a.innerHTML = `
464
+ const a = N(e), o = B();
465
+ let n = "upload", d = "", p = "", c = "", g = "";
466
+ const h = () => {
467
+ o.innerHTML = `
468
468
  <div class="rte-media-header">
469
469
  <h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
470
470
  <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
@@ -496,29 +496,29 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
496
496
  <div id="url-section">
497
497
  <div class="rte-media-field">
498
498
  <label class="rte-media-label">URL</label>
499
- <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${s}">
499
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${d}">
500
500
  </div>
501
501
  ${t === "image" ? `
502
502
  <div class="rte-media-field">
503
503
  <label class="rte-media-label">Alt Text (for accessibility)</label>
504
- <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${f}">
504
+ <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${g}">
505
505
  </div>
506
506
  ` : ""}
507
507
  <div class="rte-media-grid">
508
508
  <div class="rte-media-field">
509
509
  <label class="rte-media-label">Width (px)</label>
510
- <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${b}">
510
+ <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${p}">
511
511
  </div>
512
512
  <div class="rte-media-field">
513
513
  <label class="rte-media-label">Height (px)</label>
514
- <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${m}">
514
+ <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
515
515
  </div>
516
516
  </div>
517
- ${s ? `
517
+ ${d ? `
518
518
  <div class="rte-media-field">
519
519
  <label class="rte-media-label">Preview</label>
520
520
  <div class="rte-media-preview">
521
- ${t === "image" ? `<img src="${s}" alt="Preview">` : `<video src="${s}" controls></video>`}
521
+ ${t === "image" ? `<img src="${d}" alt="Preview">` : `<video src="${d}" controls></video>`}
522
522
  </div>
523
523
  </div>
524
524
  ` : ""}
@@ -528,78 +528,78 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
528
528
 
529
529
  <div class="rte-media-footer">
530
530
  <button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
531
- <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!s && n === "url" ? "disabled" : ""}>Insert</button>
531
+ <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d && n === "url" ? "disabled" : ""}>Insert</button>
532
532
  </div>
533
533
  `;
534
534
  };
535
- y(), i.appendChild(a), document.body.appendChild(i);
535
+ h(), a.appendChild(o), document.body.appendChild(a);
536
536
  let w = () => {
537
537
  };
538
- const h = () => {
539
- w(), i.parentNode && i.parentNode.removeChild(i);
538
+ const f = () => {
539
+ w(), a.parentNode && a.parentNode.removeChild(a);
540
540
  };
541
- w = I(i, h);
542
- const x = () => {
543
- if (!s) return;
544
- const o = t === "image" ? document.createElement("img") : document.createElement("video");
545
- o.src = s, o.setAttribute("data-media-type", t), t === "image" && f && (o.alt = f), b && (o.style.width = `${b}px`, o.setAttribute("width", b)), m && (o.style.height = `${m}px`, o.setAttribute("height", m)), t === "video" && (o.controls = !0), !b && !m ? o.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : o.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${b ? `width: ${b}px;` : "max-width: 100%;"} ${m ? `height: ${m}px;` : "height: auto;"}`, D && (D.deleteContents(), D.insertNode(o)), h();
546
- }, c = async (o) => {
547
- const v = a.querySelector("#upload-progress"), g = a.querySelector("#progress-bar"), L = a.querySelector("#progress-text");
548
- if (v && g && L) {
549
- v.style.display = "block";
541
+ w = I(a, f);
542
+ const y = () => {
543
+ 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";
550
550
  let E = 0;
551
- const u = setInterval(() => {
552
- E += Math.random() * 30, E > 90 && (E = 90), g.style.width = `${E}%`;
551
+ const b = setInterval(() => {
552
+ E += Math.random() * 30, E > 90 && (E = 90), v.style.width = `${E}%`;
553
553
  }, 200);
554
554
  try {
555
555
  const k = new FileReader();
556
556
  k.onload = () => {
557
- clearInterval(u), g.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
558
- s = k.result, n = "url", y(), p();
557
+ clearInterval(b), v.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
558
+ d = k.result, n = "url", h(), l();
559
559
  }, 500);
560
- }, k.readAsDataURL(o);
560
+ }, k.readAsDataURL(i);
561
561
  } catch (k) {
562
- clearInterval(u), L.textContent = "Upload failed";
562
+ clearInterval(b), L.textContent = "Upload failed";
563
563
  }
564
564
  }
565
- }, p = () => {
566
- const o = a.querySelector(".close-btn"), v = a.querySelector(".cancel-btn"), g = a.querySelector("#insert-btn"), L = a.querySelector(".tab-upload"), E = a.querySelector(".tab-url");
567
- if (o == null || o.addEventListener("click", h), v == null || v.addEventListener("click", h), g == null || g.addEventListener("click", x), L == null || L.addEventListener("click", () => {
568
- n = "upload", y(), p();
565
+ }, 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", () => {
568
+ n = "upload", h(), l();
569
569
  }), E == null || E.addEventListener("click", () => {
570
- n = "url", y(), p();
570
+ n = "url", h(), l();
571
571
  }), n === "upload") {
572
- const u = a.querySelector(".dropzone"), k = a.querySelector("#file-input");
573
- u == null || u.addEventListener("click", () => k == null ? void 0 : k.click()), u == null || u.addEventListener("dragover", (S) => {
574
- S.preventDefault(), u.classList.add("is-dragover");
575
- }), u == null || u.addEventListener("dragleave", () => {
576
- u.classList.remove("is-dragover");
577
- }), u == null || u.addEventListener("drop", (S) => {
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
578
  var T;
579
- S.preventDefault(), u.classList.remove("is-dragover");
579
+ S.preventDefault(), b.classList.remove("is-dragover");
580
580
  const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
581
- $ && c($);
581
+ $ && x($);
582
582
  }), k == null || k.addEventListener("change", (S) => {
583
583
  var T;
584
584
  const $ = (T = S.target.files) == null ? void 0 : T[0];
585
- $ && c($);
585
+ $ && x($);
586
586
  });
587
587
  }
588
588
  if (n === "url") {
589
- const u = a.querySelector("#url-input"), k = a.querySelector("#alt-input"), S = a.querySelector("#width-input"), $ = a.querySelector("#height-input");
590
- u == null || u.addEventListener("input", () => {
591
- s = u.value, y(), p();
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();
592
592
  }), k == null || k.addEventListener("input", () => {
593
- f = k.value;
593
+ g = k.value;
594
594
  }), S == null || S.addEventListener("input", () => {
595
- b = S.value;
595
+ p = S.value;
596
596
  }), $ == null || $.addEventListener("input", () => {
597
- m = $.value;
597
+ c = $.value;
598
598
  });
599
599
  }
600
600
  };
601
- p(), i.addEventListener("click", (o) => {
602
- o.target === i && h();
601
+ l(), a.addEventListener("click", (i) => {
602
+ i.target === a && f();
603
603
  });
604
604
  }, K = () => {
605
605
  ["nw", "ne", "sw", "se"].forEach((e) => {
@@ -617,20 +617,20 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
617
617
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
618
618
  `, r.setAttribute("data-position", e), document.body.appendChild(r), _.push(r);
619
619
  });
620
- }, M = () => {
621
- if (!d) {
620
+ }, z = () => {
621
+ if (!m) {
622
622
  _.forEach((r) => r.style.display = "none");
623
623
  return;
624
624
  }
625
- const t = d.getBoundingClientRect(), e = {
625
+ const t = m.getBoundingClientRect(), e = {
626
626
  nw: { x: t.left - 5, y: t.top - 5 },
627
627
  ne: { x: t.right - 5, y: t.top - 5 },
628
628
  sw: { x: t.left - 5, y: t.bottom - 5 },
629
629
  se: { x: t.right - 5, y: t.bottom - 5 }
630
630
  };
631
631
  _.forEach((r) => {
632
- const i = r.getAttribute("data-position"), a = e[i];
633
- r.style.left = `${a.x}px`, r.style.top = `${a.y}px`, r.style.display = "block";
632
+ const a = r.getAttribute("data-position"), o = e[a];
633
+ r.style.left = `${o.x}px`, r.style.top = `${o.y}px`, r.style.display = "block";
634
634
  });
635
635
  }, J = (t) => {
636
636
  const e = N(t), r = B(!0);
@@ -649,20 +649,20 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
649
649
  <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
650
650
  </div>
651
651
  `, e.appendChild(r), document.body.appendChild(e);
652
- const i = r.querySelector("#alt-text-input"), a = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), s = r.querySelector(".save-btn");
653
- let b = () => {
652
+ const a = r.querySelector("#alt-text-input"), o = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
653
+ let p = () => {
654
654
  };
655
- const m = () => {
656
- b(), e.parentNode && e.parentNode.removeChild(e);
655
+ const c = () => {
656
+ p(), e.parentNode && e.parentNode.removeChild(e);
657
657
  };
658
- b = I(e, m), a.addEventListener("click", m), n.addEventListener("click", m), e.addEventListener("click", (f) => {
659
- f.target === e && m();
660
- }), s.addEventListener("click", () => {
661
- t.alt = i.value, m();
662
- }), i.focus(), i.select();
658
+ p = I(e, c), o.addEventListener("click", c), n.addEventListener("click", c), e.addEventListener("click", (g) => {
659
+ g.target === e && c();
660
+ }), d.addEventListener("click", () => {
661
+ t.alt = a.value, c();
662
+ }), a.focus(), a.select();
663
663
  }, Q = (t) => {
664
- const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "", i = (e == null ? void 0 : e.getAttribute("target")) || "_self", a = (e == null ? void 0 : e.getAttribute("title")) || "", n = N(t), s = B(!0);
665
- s.innerHTML = `
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);
665
+ d.innerHTML = `
666
666
  <div class="rte-media-header">
667
667
  <h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
668
668
  <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
@@ -674,10 +674,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
674
674
  </div>
675
675
  <div class="rte-media-field">
676
676
  <label class="rte-media-label">Title (tooltip)</label>
677
- <input id="link-title" type="text" class="rte-media-input" value="${a}" placeholder="Optional tooltip text" />
677
+ <input id="link-title" type="text" class="rte-media-input" value="${o}" placeholder="Optional tooltip text" />
678
678
  </div>
679
679
  <label class="rte-media-checkbox-label">
680
- <input id="link-target" type="checkbox" ${i === "_blank" ? "checked" : ""} />
680
+ <input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
681
681
  Open in new window/tab
682
682
  </label>
683
683
  </div>
@@ -688,33 +688,33 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
688
688
  <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
689
689
  </div>
690
690
  </div>
691
- `, n.appendChild(s), document.body.appendChild(n);
692
- const b = s.querySelector("#link-url"), m = s.querySelector("#link-title"), f = s.querySelector("#link-target"), y = s.querySelector(".close-btn"), w = s.querySelector(".cancel-btn"), h = s.querySelector(".save-btn"), x = s.querySelector(".remove-link-btn");
693
- let c = () => {
691
+ `, n.appendChild(d), document.body.appendChild(n);
692
+ const p = d.querySelector("#link-url"), c = d.querySelector("#link-title"), g = d.querySelector("#link-target"), h = d.querySelector(".close-btn"), w = d.querySelector(".cancel-btn"), f = d.querySelector(".save-btn"), y = d.querySelector(".remove-link-btn");
693
+ let x = () => {
694
694
  };
695
- const p = () => {
696
- c(), n.parentNode && n.parentNode.removeChild(n);
695
+ const l = () => {
696
+ x(), n.parentNode && n.parentNode.removeChild(n);
697
697
  };
698
- c = I(n, p), y.addEventListener("click", p), w.addEventListener("click", p), n.addEventListener("click", (o) => {
699
- o.target === n && p();
700
- }), h.addEventListener("click", () => {
701
- const o = b.value.trim();
702
- if (o) {
703
- const v = o.startsWith("http") ? o : `https://${o}`;
698
+ x = I(n, l), h.addEventListener("click", l), w.addEventListener("click", l), n.addEventListener("click", (i) => {
699
+ i.target === n && l();
700
+ }), f.addEventListener("click", () => {
701
+ const i = p.value.trim();
702
+ if (i) {
703
+ const u = i.startsWith("http") ? i : `https://${i}`;
704
704
  if (e)
705
- e.setAttribute("href", v), e.setAttribute("target", f.checked ? "_blank" : "_self"), f.checked ? e.setAttribute("rel", "noopener noreferrer") : e.removeAttribute("rel"), m.value.trim() ? e.setAttribute("title", m.value.trim()) : e.removeAttribute("title");
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");
706
706
  else {
707
- const g = document.createElement("a");
708
- g.href = v, g.target = f.checked ? "_blank" : "_self", f.checked && (g.rel = "noopener noreferrer"), m.value.trim() && (g.title = m.value.trim()), t.replaceWith(g), g.appendChild(t);
707
+ 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);
709
709
  }
710
- p(), l && d && V(d);
710
+ l(), s && m && V(m);
711
711
  }
712
- }), x == null || x.addEventListener("click", () => {
713
- e && confirm("Remove link from this media?") && (e.replaceWith(t), p(), l && d && V(d));
714
- }), b.focus();
712
+ }), y == null || y.addEventListener("click", () => {
713
+ e && confirm("Remove link from this media?") && (e.replaceWith(t), l(), s && m && V(m));
714
+ }), p.focus();
715
715
  }, ee = (t) => {
716
716
  const e = N(t), r = B();
717
- let i = "url", a = t.src;
717
+ let a = "url", o = t.src;
718
718
  const n = () => {
719
719
  r.innerHTML = `
720
720
  <div class="rte-media-header">
@@ -723,12 +723,12 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
723
723
  </div>
724
724
 
725
725
  <div class="rte-media-tabs">
726
- <button class="tab-upload rte-media-tab ${i === "upload" ? "active" : ""}" type="button">Upload</button>
727
- <button class="tab-url rte-media-tab ${i === "url" ? "active" : ""}" type="button">URL</button>
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>
728
728
  </div>
729
729
 
730
730
  <div class="rte-media-body">
731
- ${i === "upload" ? `
731
+ ${a === "upload" ? `
732
732
  <div id="upload-section">
733
733
  <div class="dropzone rte-media-dropzone">
734
734
  <div class="rte-media-dropzone-icon">📁</div>
@@ -747,13 +747,13 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
747
747
  <div id="url-section">
748
748
  <div class="rte-media-field">
749
749
  <label class="rte-media-label">Image URL</label>
750
- <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${a}">
750
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
751
751
  </div>
752
- ${a ? `
752
+ ${o ? `
753
753
  <div class="rte-media-field">
754
754
  <label class="rte-media-label">Preview</label>
755
755
  <div class="rte-media-preview">
756
- <img src="${a}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
756
+ <img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
757
757
  </div>
758
758
  </div>
759
759
  ` : ""}
@@ -763,87 +763,89 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
763
763
 
764
764
  <div class="rte-media-footer">
765
765
  <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" ${!a && i === "url" ? "disabled" : ""}>Replace</button>
766
+ <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o && a === "url" ? "disabled" : ""}>Replace</button>
767
767
  </div>
768
768
  `;
769
769
  };
770
770
  n(), e.appendChild(r), document.body.appendChild(e);
771
- let s = () => {
771
+ let d = () => {
772
772
  };
773
- const b = () => {
774
- s(), e.parentNode && e.parentNode.removeChild(e);
773
+ const p = () => {
774
+ d(), e.parentNode && e.parentNode.removeChild(e);
775
775
  };
776
- s = I(e, b);
777
- const m = () => {
778
- a && (t.src = a, b());
779
- }, f = async (w) => {
780
- const h = r.querySelector("#upload-progress"), x = r.querySelector("#progress-bar"), c = r.querySelector("#progress-text");
781
- if (h && x && c) {
782
- h.style.display = "block";
783
- let p = 0;
784
- const o = setInterval(() => {
785
- p += Math.random() * 30, p > 90 && (p = 90), x.style.width = `${p}%`;
776
+ d = I(e, p);
777
+ const c = () => {
778
+ o && (t.src = o, p());
779
+ }, g = async (w) => {
780
+ const f = r.querySelector("#upload-progress"), y = r.querySelector("#progress-bar"), x = r.querySelector("#progress-text");
781
+ if (f && y && x) {
782
+ f.style.display = "block";
783
+ let l = 0;
784
+ const i = setInterval(() => {
785
+ l += Math.random() * 30, l > 90 && (l = 90), y.style.width = `${l}%`;
786
786
  }, 200);
787
787
  try {
788
- const v = new FileReader();
789
- v.onload = () => {
790
- clearInterval(o), x.style.width = "100%", c.textContent = "Upload complete", setTimeout(() => {
791
- a = v.result, i = "url", n(), y();
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();
792
792
  }, 500);
793
- }, v.readAsDataURL(w);
794
- } catch (v) {
795
- clearInterval(o), c.textContent = "Upload failed";
793
+ }, u.readAsDataURL(w);
794
+ } catch (u) {
795
+ clearInterval(i), x.textContent = "Upload failed";
796
796
  }
797
797
  }
798
- }, y = () => {
799
- const w = r.querySelector(".close-btn"), h = r.querySelector(".cancel-btn"), x = r.querySelector("#replace-btn"), c = r.querySelector(".tab-upload"), p = r.querySelector(".tab-url");
800
- if (w == null || w.addEventListener("click", b), h == null || h.addEventListener("click", b), x == null || x.addEventListener("click", m), c == null || c.addEventListener("click", () => {
801
- i = "upload", n(), y();
802
- }), p == null || p.addEventListener("click", () => {
803
- i = "url", n(), y();
804
- }), i === "upload") {
805
- const o = r.querySelector(".dropzone"), v = r.querySelector("#file-input");
806
- o == null || o.addEventListener("click", () => v == null ? void 0 : v.click()), o == null || o.addEventListener("dragover", (g) => {
807
- g.preventDefault(), o.classList.add("is-dragover");
808
- }), o == null || o.addEventListener("dragleave", () => {
809
- o.classList.remove("is-dragover");
810
- }), o == null || o.addEventListener("drop", (g) => {
798
+ }, h = () => {
799
+ 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
+ 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();
802
+ }), 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) => {
811
811
  var E;
812
- g.preventDefault(), o.classList.remove("is-dragover");
813
- const L = (E = g.dataTransfer) == null ? void 0 : E.files[0];
814
- L && f(L);
815
- }), v == null || v.addEventListener("change", (g) => {
812
+ v.preventDefault(), i.classList.remove("is-dragover");
813
+ const L = (E = v.dataTransfer) == null ? void 0 : E.files[0];
814
+ L && g(L);
815
+ }), u == null || u.addEventListener("change", (v) => {
816
816
  var E;
817
- const L = (E = g.target.files) == null ? void 0 : E[0];
818
- L && f(L);
817
+ const L = (E = v.target.files) == null ? void 0 : E[0];
818
+ L && g(L);
819
819
  });
820
820
  }
821
- if (i === "url") {
822
- const o = r.querySelector("#url-input");
823
- o == null || o.addEventListener("input", () => {
824
- a = o.value, n(), y();
821
+ if (a === "url") {
822
+ const i = r.querySelector("#url-input");
823
+ i == null || i.addEventListener("input", () => {
824
+ o = i.value, n(), h();
825
825
  });
826
826
  }
827
827
  };
828
- y(), e.addEventListener("click", (w) => {
829
- w.target === e && b();
828
+ h(), e.addEventListener("click", (w) => {
829
+ w.target === e && p();
830
830
  });
831
831
  }, C = () => {
832
- if (!l || !d) return;
833
- const t = l.offsetHeight || 40, e = d.offsetTop, r = d.offsetLeft, i = d.offsetWidth, a = e - t - 8, n = r + i / 2 - (l.offsetWidth || 120) / 2;
834
- l.style.top = `${a}px`, l.style.left = `${n}px`, setTimeout(() => {
835
- l && (l.style.display = "flex");
832
+ 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;
834
+ s.style.top = `${o}px`, s.style.left = `${n}px`, setTimeout(() => {
835
+ s && (s.style.display = "flex");
836
836
  }, 100);
837
837
  }, V = (t) => {
838
- var s, b, m, f, y, w, h, x;
839
- l && (l._cleanup && l._cleanup(), l.remove());
838
+ var p, c, g, h, w, f, y, x;
839
+ s && (s._cleanup && s._cleanup(), s.remove());
840
840
  const e = t.parentElement;
841
841
  if (e) {
842
- const c = e.style.position;
843
- (!c || c === "static") && (e.style.position = "relative", e._originalPosition = c), l = document.createElement("div"), l.className = "media-floating-toolbar", G(t) && l.classList.add("rte-ui-theme-dark"), e.insertBefore(l, e.firstChild), C();
842
+ const l = e.style.position;
843
+ (!l || l === "static") && (e.style.position = "relative", e._originalPosition = l), s = document.createElement("div"), s.className = "media-floating-toolbar", G(t) && s.classList.add("rte-ui-theme-dark"), e.insertBefore(s, e.firstChild), C();
844
844
  }
845
- const r = t.tagName === "IMG", i = t.closest("a");
846
- l.innerHTML = `
845
+ const r = s;
846
+ if (!r) return;
847
+ const a = t.tagName === "IMG", o = t.closest("a");
848
+ r.innerHTML = `
847
849
  <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
848
850
  <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>
849
851
  </button>
@@ -854,14 +856,14 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
854
856
  <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>
855
857
  </button>
856
858
  <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
857
- ${r ? `
859
+ ${a ? `
858
860
  <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
859
861
  <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>
860
862
  </button>` : ""}
861
- <button class="media-floating-toolbar-btn btn-link" title="${i ? "Edit/Remove Link" : "Add Link"}" type="button">
863
+ <button class="media-floating-toolbar-btn btn-link" title="${o ? "Edit/Remove Link" : "Add Link"}" type="button">
862
864
  <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>
863
865
  </button>
864
- ${r ? `
866
+ ${a ? `
865
867
  <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
866
868
  <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>
867
869
  </button>` : ""}
@@ -872,85 +874,85 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
872
874
  `, setTimeout(() => {
873
875
  C();
874
876
  }, 0);
875
- const a = () => C();
876
- let n = d.parentElement;
877
- for (; n; )
878
- n.addEventListener("scroll", a), n = n.parentElement;
879
- window.addEventListener("scroll", a), window.addEventListener("resize", a), l._cleanup = () => {
880
- let c = d == null ? void 0 : d.parentElement;
881
- for (; c; )
882
- c.removeEventListener("scroll", a), c = c.parentElement;
883
- window.removeEventListener("scroll", a), window.removeEventListener("resize", a);
884
- }, (s = l.querySelector(".btn-align-left")) == null || s.addEventListener("click", () => {
877
+ const n = () => C();
878
+ let d = t.parentElement;
879
+ for (; d; )
880
+ d.addEventListener("scroll", n), d = d.parentElement;
881
+ window.addEventListener("scroll", n), window.addEventListener("resize", n), r._cleanup = () => {
882
+ let l = t.parentElement;
883
+ for (; l; )
884
+ l.removeEventListener("scroll", n), l = l.parentElement;
885
+ window.removeEventListener("scroll", n), window.removeEventListener("resize", n);
886
+ }, (p = r.querySelector(".btn-align-left")) == null || p.addEventListener("click", () => {
885
887
  t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", C();
886
- }), (b = l.querySelector(".btn-align-center")) == null || b.addEventListener("click", () => {
888
+ }), (c = r.querySelector(".btn-align-center")) == null || c.addEventListener("click", () => {
887
889
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", C();
888
- }), (m = l.querySelector(".btn-align-right")) == null || m.addEventListener("click", () => {
890
+ }), (g = r.querySelector(".btn-align-right")) == null || g.addEventListener("click", () => {
889
891
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", C();
890
- }), (f = l.querySelector(".btn-alt")) == null || f.addEventListener("click", () => {
892
+ }), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
891
893
  t.tagName === "IMG" && J(t);
892
- }), (y = l.querySelector(".btn-link")) == null || y.addEventListener("click", () => {
894
+ }), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
893
895
  Q(t);
894
- }), (w = l.querySelector(".btn-replace")) == null || w.addEventListener("click", () => {
896
+ }), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
895
897
  t.tagName === "IMG" && ee(t);
896
- }), (h = l.querySelector(".btn-resize")) == null || h.addEventListener("click", () => {
897
- const c = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
898
- if (c && !isNaN(parseInt(c))) {
899
- const p = parseInt(c);
900
- t.style.width = `${p}px`, t.setAttribute("width", String(p)), M(), C();
901
- }
902
- }), (x = l.querySelector(".btn-remove")) == null || x.addEventListener("click", () => {
903
- confirm("Remove this media?") && (t.remove(), l && (l._cleanup && l._cleanup(), l.remove(), l = null), d = null, M());
904
- }), l._cleanup = () => {
898
+ }), (y = r.querySelector(".btn-resize")) == null || y.addEventListener("click", () => {
899
+ const l = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
900
+ if (l && !isNaN(parseInt(l))) {
901
+ const i = parseInt(l);
902
+ t.style.width = `${i}px`, t.setAttribute("width", String(i)), z(), C();
903
+ }
904
+ }), (x = r.querySelector(".btn-remove")) == null || x.addEventListener("click", () => {
905
+ confirm("Remove this media?") && (t.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), m = null, z());
906
+ }), r._cleanup = () => {
905
907
  window.removeEventListener("scroll", C), window.removeEventListener("resize", C);
906
908
  };
907
909
  }, O = (t) => {
908
910
  R = t || null, K(), document.addEventListener("click", (e) => {
909
911
  const r = e.target;
910
912
  if (r.tagName === "IMG" || r.tagName === "VIDEO") {
911
- const i = r;
912
- let a = !1;
913
- if (R ? a = R.contains(i) : a = !!i.closest('[contenteditable="true"]'), a) {
914
- e.preventDefault(), e.stopPropagation(), d = i, d.style.display = "block", V(i), M();
913
+ const a = r;
914
+ 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();
915
917
  return;
916
918
  }
917
919
  }
918
- if (!r.closest(".btn-link, .btn-resize, .btn-remove") && l && !r.closest("button")) {
919
- if (l._cleanup && l._cleanup(), l.remove(), l = null, d && d.parentElement) {
920
- const i = d.parentElement;
921
- i._originalPosition !== void 0 && (i.style.position = i._originalPosition, delete i._originalPosition);
920
+ if (!r.closest(".btn-link, .btn-resize, .btn-remove") && s && !r.closest("button")) {
921
+ 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);
922
924
  }
923
- d = null, M();
925
+ m = null, z();
924
926
  }
925
927
  }), _.forEach((e) => {
926
928
  e.addEventListener("mousedown", (r) => {
927
- if (!d) return;
929
+ if (!m) return;
928
930
  r.preventDefault(), r.stopPropagation(), H = !0, A = e.getAttribute("data-position"), U = r.clientX, j = r.clientY;
929
- const i = d.getBoundingClientRect();
930
- q = i.width, z = i.height, P = q / z, document.body.style.userSelect = "none", document.body.style.cursor = `${A}-resize`;
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`;
931
933
  });
932
934
  }), document.addEventListener("mousemove", (e) => {
933
- if (!H || !d || !A) return;
934
- const r = e.clientX - U, i = e.clientY - j;
935
- let a = q, n = z;
935
+ if (!H || !m || !A) return;
936
+ const r = e.clientX - U, a = e.clientY - j;
937
+ let o = q, n = M;
936
938
  switch (A) {
937
939
  case "se":
938
- a = q + r, n = z + i;
940
+ o = q + r, n = M + a;
939
941
  break;
940
942
  case "sw":
941
- a = q - r, n = z + i;
943
+ o = q - r, n = M + a;
942
944
  break;
943
945
  case "ne":
944
- a = q + r, n = z - i;
946
+ o = q + r, n = M - a;
945
947
  break;
946
948
  case "nw":
947
- a = q - r, n = z - i;
949
+ o = q - r, n = M - a;
948
950
  break;
949
951
  }
950
- Math.abs(r) > Math.abs(i) ? n = a / P : a = n * P, a = Math.max(50, a), n = Math.max(50, n), d.style.width = `${a}px`, d.style.height = `${n}px`, d.setAttribute("width", String(Math.round(a))), d.setAttribute("height", String(Math.round(n))), M(), C();
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();
951
953
  }), document.addEventListener("mouseup", () => {
952
954
  H && (H = !1, A = null, document.body.style.userSelect = "", document.body.style.cursor = "");
953
- }), window.addEventListener("scroll", M), window.addEventListener("resize", M);
955
+ }), window.addEventListener("scroll", z), window.addEventListener("resize", z);
954
956
  };
955
957
  typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, O());
956
958
  const te = () => ({
@@ -988,4 +990,4 @@ const te = () => ({
988
990
  export {
989
991
  te as MediaManagerPlugin
990
992
  };
991
- //# sourceMappingURL=MediaManagerPlugin.native-BiXiK8FC.mjs.map
993
+ //# sourceMappingURL=MediaManagerPlugin.native-eOsTJFpw.mjs.map