@editora/core 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -1,13 +1,14 @@
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);
8
8
  };
9
9
  }, X = () => {
10
- if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
10
+ if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles"))
11
+ return;
11
12
  const t = document.createElement("style");
12
13
  t.id = "rte-media-dialog-styles", t.textContent = `
13
14
  .rte-media-overlay {
@@ -438,14 +439,18 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
438
439
  `, document.head.appendChild(t);
439
440
  }, Y = () => {
440
441
  const t = window.getSelection();
441
- if (!t || t.rangeCount === 0) return null;
442
+ if (!t || t.rangeCount === 0)
443
+ return null;
442
444
  const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
443
445
  return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
444
446
  }, Z = (t) => {
445
- if (t) return t;
447
+ if (t)
448
+ return t;
446
449
  const e = Y();
447
- if (e) return e;
448
- if (R) return R;
450
+ if (e)
451
+ return e;
452
+ if (R)
453
+ return R;
449
454
  const r = document.activeElement;
450
455
  return r ? r.closest(".rte-content, .editora-content") || r : null;
451
456
  }, G = (t) => {
@@ -461,10 +466,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
461
466
  }, W = (t, e) => {
462
467
  const r = window.getSelection();
463
468
  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 = `
469
+ const a = N(e), o = B();
470
+ let n = "upload", d = "", p = "", c = "", g = "";
471
+ const h = () => {
472
+ o.innerHTML = `
468
473
  <div class="rte-media-header">
469
474
  <h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
470
475
  <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
@@ -496,29 +501,29 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
496
501
  <div id="url-section">
497
502
  <div class="rte-media-field">
498
503
  <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}">
504
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${d}">
500
505
  </div>
501
506
  ${t === "image" ? `
502
507
  <div class="rte-media-field">
503
508
  <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}">
509
+ <input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${g}">
505
510
  </div>
506
511
  ` : ""}
507
512
  <div class="rte-media-grid">
508
513
  <div class="rte-media-field">
509
514
  <label class="rte-media-label">Width (px)</label>
510
- <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${b}">
515
+ <input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${p}">
511
516
  </div>
512
517
  <div class="rte-media-field">
513
518
  <label class="rte-media-label">Height (px)</label>
514
- <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${m}">
519
+ <input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
515
520
  </div>
516
521
  </div>
517
- ${s ? `
522
+ ${d ? `
518
523
  <div class="rte-media-field">
519
524
  <label class="rte-media-label">Preview</label>
520
525
  <div class="rte-media-preview">
521
- ${t === "image" ? `<img src="${s}" alt="Preview">` : `<video src="${s}" controls></video>`}
526
+ ${t === "image" ? `<img src="${d}" alt="Preview">` : `<video src="${d}" controls></video>`}
522
527
  </div>
523
528
  </div>
524
529
  ` : ""}
@@ -528,78 +533,79 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
528
533
 
529
534
  <div class="rte-media-footer">
530
535
  <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>
536
+ <button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d && n === "url" ? "disabled" : ""}>Insert</button>
532
537
  </div>
533
538
  `;
534
539
  };
535
- y(), i.appendChild(a), document.body.appendChild(i);
540
+ h(), a.appendChild(o), document.body.appendChild(a);
536
541
  let w = () => {
537
542
  };
538
- const h = () => {
539
- w(), i.parentNode && i.parentNode.removeChild(i);
543
+ const f = () => {
544
+ w(), a.parentNode && a.parentNode.removeChild(a);
540
545
  };
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";
546
+ w = I(a, f);
547
+ const y = () => {
548
+ if (!d)
549
+ return;
550
+ const i = t === "image" ? document.createElement("img") : document.createElement("video");
551
+ 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();
552
+ }, x = async (i) => {
553
+ const u = o.querySelector("#upload-progress"), v = o.querySelector("#progress-bar"), L = o.querySelector("#progress-text");
554
+ if (u && v && L) {
555
+ u.style.display = "block";
550
556
  let E = 0;
551
- const u = setInterval(() => {
552
- E += Math.random() * 30, E > 90 && (E = 90), g.style.width = `${E}%`;
557
+ const b = setInterval(() => {
558
+ E += Math.random() * 30, E > 90 && (E = 90), v.style.width = `${E}%`;
553
559
  }, 200);
554
560
  try {
555
561
  const k = new FileReader();
556
562
  k.onload = () => {
557
- clearInterval(u), g.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
558
- s = k.result, n = "url", y(), p();
563
+ clearInterval(b), v.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
564
+ d = k.result, n = "url", h(), l();
559
565
  }, 500);
560
- }, k.readAsDataURL(o);
566
+ }, k.readAsDataURL(i);
561
567
  } catch (k) {
562
- clearInterval(u), L.textContent = "Upload failed";
568
+ clearInterval(b), L.textContent = "Upload failed";
563
569
  }
564
570
  }
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();
571
+ }, l = () => {
572
+ 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");
573
+ if (i == null || i.addEventListener("click", f), u == null || u.addEventListener("click", f), v == null || v.addEventListener("click", y), L == null || L.addEventListener("click", () => {
574
+ n = "upload", h(), l();
569
575
  }), E == null || E.addEventListener("click", () => {
570
- n = "url", y(), p();
576
+ n = "url", h(), l();
571
577
  }), 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) => {
578
+ const b = o.querySelector(".dropzone"), k = o.querySelector("#file-input");
579
+ b == null || b.addEventListener("click", () => k == null ? void 0 : k.click()), b == null || b.addEventListener("dragover", (S) => {
580
+ S.preventDefault(), b.classList.add("is-dragover");
581
+ }), b == null || b.addEventListener("dragleave", () => {
582
+ b.classList.remove("is-dragover");
583
+ }), b == null || b.addEventListener("drop", (S) => {
578
584
  var T;
579
- S.preventDefault(), u.classList.remove("is-dragover");
585
+ S.preventDefault(), b.classList.remove("is-dragover");
580
586
  const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
581
- $ && c($);
587
+ $ && x($);
582
588
  }), k == null || k.addEventListener("change", (S) => {
583
589
  var T;
584
590
  const $ = (T = S.target.files) == null ? void 0 : T[0];
585
- $ && c($);
591
+ $ && x($);
586
592
  });
587
593
  }
588
594
  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();
595
+ const b = o.querySelector("#url-input"), k = o.querySelector("#alt-input"), S = o.querySelector("#width-input"), $ = o.querySelector("#height-input");
596
+ b == null || b.addEventListener("input", () => {
597
+ d = b.value, h(), l();
592
598
  }), k == null || k.addEventListener("input", () => {
593
- f = k.value;
599
+ g = k.value;
594
600
  }), S == null || S.addEventListener("input", () => {
595
- b = S.value;
601
+ p = S.value;
596
602
  }), $ == null || $.addEventListener("input", () => {
597
- m = $.value;
603
+ c = $.value;
598
604
  });
599
605
  }
600
606
  };
601
- p(), i.addEventListener("click", (o) => {
602
- o.target === i && h();
607
+ l(), a.addEventListener("click", (i) => {
608
+ i.target === a && f();
603
609
  });
604
610
  }, K = () => {
605
611
  ["nw", "ne", "sw", "se"].forEach((e) => {
@@ -617,20 +623,20 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
617
623
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
618
624
  `, r.setAttribute("data-position", e), document.body.appendChild(r), _.push(r);
619
625
  });
620
- }, M = () => {
621
- if (!d) {
626
+ }, z = () => {
627
+ if (!m) {
622
628
  _.forEach((r) => r.style.display = "none");
623
629
  return;
624
630
  }
625
- const t = d.getBoundingClientRect(), e = {
631
+ const t = m.getBoundingClientRect(), e = {
626
632
  nw: { x: t.left - 5, y: t.top - 5 },
627
633
  ne: { x: t.right - 5, y: t.top - 5 },
628
634
  sw: { x: t.left - 5, y: t.bottom - 5 },
629
635
  se: { x: t.right - 5, y: t.bottom - 5 }
630
636
  };
631
637
  _.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";
638
+ const a = r.getAttribute("data-position"), o = e[a];
639
+ r.style.left = `${o.x}px`, r.style.top = `${o.y}px`, r.style.display = "block";
634
640
  });
635
641
  }, J = (t) => {
636
642
  const e = N(t), r = B(!0);
@@ -649,20 +655,20 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
649
655
  <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
650
656
  </div>
651
657
  `, 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 = () => {
658
+ const a = r.querySelector("#alt-text-input"), o = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
659
+ let p = () => {
654
660
  };
655
- const m = () => {
656
- b(), e.parentNode && e.parentNode.removeChild(e);
661
+ const c = () => {
662
+ p(), e.parentNode && e.parentNode.removeChild(e);
657
663
  };
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();
664
+ p = I(e, c), o.addEventListener("click", c), n.addEventListener("click", c), e.addEventListener("click", (g) => {
665
+ g.target === e && c();
666
+ }), d.addEventListener("click", () => {
667
+ t.alt = a.value, c();
668
+ }), a.focus(), a.select();
663
669
  }, 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 = `
670
+ 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);
671
+ d.innerHTML = `
666
672
  <div class="rte-media-header">
667
673
  <h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
668
674
  <button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
@@ -674,10 +680,10 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
674
680
  </div>
675
681
  <div class="rte-media-field">
676
682
  <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" />
683
+ <input id="link-title" type="text" class="rte-media-input" value="${o}" placeholder="Optional tooltip text" />
678
684
  </div>
679
685
  <label class="rte-media-checkbox-label">
680
- <input id="link-target" type="checkbox" ${i === "_blank" ? "checked" : ""} />
686
+ <input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
681
687
  Open in new window/tab
682
688
  </label>
683
689
  </div>
@@ -688,33 +694,33 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
688
694
  <button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
689
695
  </div>
690
696
  </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 = () => {
697
+ `, n.appendChild(d), document.body.appendChild(n);
698
+ 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");
699
+ let x = () => {
694
700
  };
695
- const p = () => {
696
- c(), n.parentNode && n.parentNode.removeChild(n);
701
+ const l = () => {
702
+ x(), n.parentNode && n.parentNode.removeChild(n);
697
703
  };
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}`;
704
+ x = I(n, l), h.addEventListener("click", l), w.addEventListener("click", l), n.addEventListener("click", (i) => {
705
+ i.target === n && l();
706
+ }), f.addEventListener("click", () => {
707
+ const i = p.value.trim();
708
+ if (i) {
709
+ const u = i.startsWith("http") ? i : `https://${i}`;
704
710
  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");
711
+ 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
712
  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);
713
+ const v = document.createElement("a");
714
+ 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
715
  }
710
- p(), l && d && V(d);
716
+ l(), s && m && V(m);
711
717
  }
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();
718
+ }), y == null || y.addEventListener("click", () => {
719
+ e && confirm("Remove link from this media?") && (e.replaceWith(t), l(), s && m && V(m));
720
+ }), p.focus();
715
721
  }, ee = (t) => {
716
722
  const e = N(t), r = B();
717
- let i = "url", a = t.src;
723
+ let a = "url", o = t.src;
718
724
  const n = () => {
719
725
  r.innerHTML = `
720
726
  <div class="rte-media-header">
@@ -723,12 +729,12 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
723
729
  </div>
724
730
 
725
731
  <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>
732
+ <button class="tab-upload rte-media-tab ${a === "upload" ? "active" : ""}" type="button">Upload</button>
733
+ <button class="tab-url rte-media-tab ${a === "url" ? "active" : ""}" type="button">URL</button>
728
734
  </div>
729
735
 
730
736
  <div class="rte-media-body">
731
- ${i === "upload" ? `
737
+ ${a === "upload" ? `
732
738
  <div id="upload-section">
733
739
  <div class="dropzone rte-media-dropzone">
734
740
  <div class="rte-media-dropzone-icon">📁</div>
@@ -747,13 +753,13 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
747
753
  <div id="url-section">
748
754
  <div class="rte-media-field">
749
755
  <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}">
756
+ <input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
751
757
  </div>
752
- ${a ? `
758
+ ${o ? `
753
759
  <div class="rte-media-field">
754
760
  <label class="rte-media-label">Preview</label>
755
761
  <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>'">
762
+ <img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class=&quot;rte-media-muted&quot;>Failed to load image</p>'">
757
763
  </div>
758
764
  </div>
759
765
  ` : ""}
@@ -763,87 +769,91 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
763
769
 
764
770
  <div class="rte-media-footer">
765
771
  <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>
772
+ <button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o && a === "url" ? "disabled" : ""}>Replace</button>
767
773
  </div>
768
774
  `;
769
775
  };
770
776
  n(), e.appendChild(r), document.body.appendChild(e);
771
- let s = () => {
777
+ let d = () => {
772
778
  };
773
- const b = () => {
774
- s(), e.parentNode && e.parentNode.removeChild(e);
779
+ const p = () => {
780
+ d(), e.parentNode && e.parentNode.removeChild(e);
775
781
  };
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}%`;
782
+ d = I(e, p);
783
+ const c = () => {
784
+ o && (t.src = o, p());
785
+ }, g = async (w) => {
786
+ const f = r.querySelector("#upload-progress"), y = r.querySelector("#progress-bar"), x = r.querySelector("#progress-text");
787
+ if (f && y && x) {
788
+ f.style.display = "block";
789
+ let l = 0;
790
+ const i = setInterval(() => {
791
+ l += Math.random() * 30, l > 90 && (l = 90), y.style.width = `${l}%`;
786
792
  }, 200);
787
793
  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();
794
+ const u = new FileReader();
795
+ u.onload = () => {
796
+ clearInterval(i), y.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
797
+ o = u.result, a = "url", n(), h();
792
798
  }, 500);
793
- }, v.readAsDataURL(w);
794
- } catch (v) {
795
- clearInterval(o), c.textContent = "Upload failed";
799
+ }, u.readAsDataURL(w);
800
+ } catch (u) {
801
+ clearInterval(i), x.textContent = "Upload failed";
796
802
  }
797
803
  }
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) => {
804
+ }, h = () => {
805
+ 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");
806
+ if (w == null || w.addEventListener("click", p), f == null || f.addEventListener("click", p), y == null || y.addEventListener("click", c), x == null || x.addEventListener("click", () => {
807
+ a = "upload", n(), h();
808
+ }), l == null || l.addEventListener("click", () => {
809
+ a = "url", n(), h();
810
+ }), a === "upload") {
811
+ const i = r.querySelector(".dropzone"), u = r.querySelector("#file-input");
812
+ i == null || i.addEventListener("click", () => u == null ? void 0 : u.click()), i == null || i.addEventListener("dragover", (v) => {
813
+ v.preventDefault(), i.classList.add("is-dragover");
814
+ }), i == null || i.addEventListener("dragleave", () => {
815
+ i.classList.remove("is-dragover");
816
+ }), i == null || i.addEventListener("drop", (v) => {
811
817
  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) => {
818
+ v.preventDefault(), i.classList.remove("is-dragover");
819
+ const L = (E = v.dataTransfer) == null ? void 0 : E.files[0];
820
+ L && g(L);
821
+ }), u == null || u.addEventListener("change", (v) => {
816
822
  var E;
817
- const L = (E = g.target.files) == null ? void 0 : E[0];
818
- L && f(L);
823
+ const L = (E = v.target.files) == null ? void 0 : E[0];
824
+ L && g(L);
819
825
  });
820
826
  }
821
- if (i === "url") {
822
- const o = r.querySelector("#url-input");
823
- o == null || o.addEventListener("input", () => {
824
- a = o.value, n(), y();
827
+ if (a === "url") {
828
+ const i = r.querySelector("#url-input");
829
+ i == null || i.addEventListener("input", () => {
830
+ o = i.value, n(), h();
825
831
  });
826
832
  }
827
833
  };
828
- y(), e.addEventListener("click", (w) => {
829
- w.target === e && b();
834
+ h(), e.addEventListener("click", (w) => {
835
+ w.target === e && p();
830
836
  });
831
837
  }, 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");
838
+ if (!s || !m)
839
+ return;
840
+ 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;
841
+ s.style.top = `${o}px`, s.style.left = `${n}px`, setTimeout(() => {
842
+ s && (s.style.display = "flex");
836
843
  }, 100);
837
844
  }, V = (t) => {
838
- var s, b, m, f, y, w, h, x;
839
- l && (l._cleanup && l._cleanup(), l.remove());
845
+ var p, c, g, h, w, f, y, x;
846
+ s && (s._cleanup && s._cleanup(), s.remove());
840
847
  const e = t.parentElement;
841
848
  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();
849
+ const l = e.style.position;
850
+ (!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
851
  }
845
- const r = t.tagName === "IMG", i = t.closest("a");
846
- l.innerHTML = `
852
+ const r = s;
853
+ if (!r)
854
+ return;
855
+ const a = t.tagName === "IMG", o = t.closest("a");
856
+ r.innerHTML = `
847
857
  <button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
848
858
  <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
859
  </button>
@@ -854,14 +864,14 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
854
864
  <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
865
  </button>
856
866
  <div class="media-floating-toolbar-separator" aria-hidden="true"></div>
857
- ${r ? `
867
+ ${a ? `
858
868
  <button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
859
869
  <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
870
  </button>` : ""}
861
- <button class="media-floating-toolbar-btn btn-link" title="${i ? "Edit/Remove Link" : "Add Link"}" type="button">
871
+ <button class="media-floating-toolbar-btn btn-link" title="${o ? "Edit/Remove Link" : "Add Link"}" type="button">
862
872
  <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
873
  </button>
864
- ${r ? `
874
+ ${a ? `
865
875
  <button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
866
876
  <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
877
  </button>` : ""}
@@ -872,85 +882,87 @@ const F = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
872
882
  `, setTimeout(() => {
873
883
  C();
874
884
  }, 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", () => {
885
+ const n = () => C();
886
+ let d = t.parentElement;
887
+ for (; d; )
888
+ d.addEventListener("scroll", n), d = d.parentElement;
889
+ window.addEventListener("scroll", n), window.addEventListener("resize", n), r._cleanup = () => {
890
+ let l = t.parentElement;
891
+ for (; l; )
892
+ l.removeEventListener("scroll", n), l = l.parentElement;
893
+ window.removeEventListener("scroll", n), window.removeEventListener("resize", n);
894
+ }, (p = r.querySelector(".btn-align-left")) == null || p.addEventListener("click", () => {
885
895
  t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", C();
886
- }), (b = l.querySelector(".btn-align-center")) == null || b.addEventListener("click", () => {
896
+ }), (c = r.querySelector(".btn-align-center")) == null || c.addEventListener("click", () => {
887
897
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", C();
888
- }), (m = l.querySelector(".btn-align-right")) == null || m.addEventListener("click", () => {
898
+ }), (g = r.querySelector(".btn-align-right")) == null || g.addEventListener("click", () => {
889
899
  t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", C();
890
- }), (f = l.querySelector(".btn-alt")) == null || f.addEventListener("click", () => {
900
+ }), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
891
901
  t.tagName === "IMG" && J(t);
892
- }), (y = l.querySelector(".btn-link")) == null || y.addEventListener("click", () => {
902
+ }), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
893
903
  Q(t);
894
- }), (w = l.querySelector(".btn-replace")) == null || w.addEventListener("click", () => {
904
+ }), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
895
905
  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 = () => {
906
+ }), (y = r.querySelector(".btn-resize")) == null || y.addEventListener("click", () => {
907
+ const l = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
908
+ if (l && !isNaN(parseInt(l))) {
909
+ const i = parseInt(l);
910
+ t.style.width = `${i}px`, t.setAttribute("width", String(i)), z(), C();
911
+ }
912
+ }), (x = r.querySelector(".btn-remove")) == null || x.addEventListener("click", () => {
913
+ confirm("Remove this media?") && (t.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), m = null, z());
914
+ }), r._cleanup = () => {
905
915
  window.removeEventListener("scroll", C), window.removeEventListener("resize", C);
906
916
  };
907
917
  }, O = (t) => {
908
918
  R = t || null, K(), document.addEventListener("click", (e) => {
909
919
  const r = e.target;
910
920
  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();
921
+ const a = r;
922
+ let o = !1;
923
+ if (R ? o = R.contains(a) : o = !!a.closest('[contenteditable="true"]'), o) {
924
+ e.preventDefault(), e.stopPropagation(), m = a, m.style.display = "block", V(a), z();
915
925
  return;
916
926
  }
917
927
  }
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);
928
+ if (!r.closest(".btn-link, .btn-resize, .btn-remove") && s && !r.closest("button")) {
929
+ if (s._cleanup && s._cleanup(), s.remove(), s = null, m && m.parentElement) {
930
+ const a = m.parentElement;
931
+ a._originalPosition !== void 0 && (a.style.position = a._originalPosition, delete a._originalPosition);
922
932
  }
923
- d = null, M();
933
+ m = null, z();
924
934
  }
925
935
  }), _.forEach((e) => {
926
936
  e.addEventListener("mousedown", (r) => {
927
- if (!d) return;
937
+ if (!m)
938
+ return;
928
939
  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`;
940
+ const a = m.getBoundingClientRect();
941
+ q = a.width, M = a.height, P = q / M, document.body.style.userSelect = "none", document.body.style.cursor = `${A}-resize`;
931
942
  });
932
943
  }), 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;
944
+ if (!H || !m || !A)
945
+ return;
946
+ const r = e.clientX - U, a = e.clientY - j;
947
+ let o = q, n = M;
936
948
  switch (A) {
937
949
  case "se":
938
- a = q + r, n = z + i;
950
+ o = q + r, n = M + a;
939
951
  break;
940
952
  case "sw":
941
- a = q - r, n = z + i;
953
+ o = q - r, n = M + a;
942
954
  break;
943
955
  case "ne":
944
- a = q + r, n = z - i;
956
+ o = q + r, n = M - a;
945
957
  break;
946
958
  case "nw":
947
- a = q - r, n = z - i;
959
+ o = q - r, n = M - a;
948
960
  break;
949
961
  }
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();
962
+ 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
963
  }), document.addEventListener("mouseup", () => {
952
964
  H && (H = !1, A = null, document.body.style.userSelect = "", document.body.style.cursor = "");
953
- }), window.addEventListener("scroll", M), window.addEventListener("resize", M);
965
+ }), window.addEventListener("scroll", z), window.addEventListener("resize", z);
954
966
  };
955
967
  typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, O());
956
968
  const te = () => ({
@@ -988,4 +1000,4 @@ const te = () => ({
988
1000
  export {
989
1001
  te as MediaManagerPlugin
990
1002
  };
991
- //# sourceMappingURL=MediaManagerPlugin.native-BiXiK8FC.mjs.map
1003
+ //# sourceMappingURL=MediaManagerPlugin.native-3cf48a00.mjs.map