@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.
- package/README.md +6 -1
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
- package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
- package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
- package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
- package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
- package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
- package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
- package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
- package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
- package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
- package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
- package/dist/editora.min.js +1 -1
- package/dist/editora.umd.js +1 -1
- package/dist/index-CPMGUZfB.js +10 -0
- package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
- package/dist/plugin-loader.js +37 -37
- package/dist/webcomponent-core.js +18 -16
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +139 -62
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +50 -48
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1174 -1071
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
- package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
- package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
- package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
- package/dist/index-D1LOqg5C.js +0 -10
package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
let D = 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 = (
|
|
4
|
-
|
|
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
|
|
465
|
-
let n = "upload",
|
|
466
|
-
const
|
|
467
|
-
|
|
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="${
|
|
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="${
|
|
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="${
|
|
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="${
|
|
514
|
+
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
|
|
515
515
|
</div>
|
|
516
516
|
</div>
|
|
517
|
-
${
|
|
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="${
|
|
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" ${!
|
|
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
|
-
|
|
535
|
+
h(), a.appendChild(o), document.body.appendChild(a);
|
|
536
536
|
let w = () => {
|
|
537
537
|
};
|
|
538
|
-
const
|
|
539
|
-
w(),
|
|
538
|
+
const f = () => {
|
|
539
|
+
w(), a.parentNode && a.parentNode.removeChild(a);
|
|
540
540
|
};
|
|
541
|
-
w = I(
|
|
542
|
-
const
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
},
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
|
|
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
|
|
552
|
-
E += Math.random() * 30, E > 90 && (E = 90),
|
|
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(
|
|
558
|
-
|
|
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(
|
|
560
|
+
}, k.readAsDataURL(i);
|
|
561
561
|
} catch (k) {
|
|
562
|
-
clearInterval(
|
|
562
|
+
clearInterval(b), L.textContent = "Upload failed";
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
},
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
568
|
-
n = "upload",
|
|
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",
|
|
570
|
+
n = "url", h(), l();
|
|
571
571
|
}), n === "upload") {
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
S.preventDefault(),
|
|
575
|
-
}),
|
|
576
|
-
|
|
577
|
-
}),
|
|
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(),
|
|
579
|
+
S.preventDefault(), b.classList.remove("is-dragover");
|
|
580
580
|
const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
|
|
581
|
-
$ &&
|
|
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
|
-
$ &&
|
|
585
|
+
$ && x($);
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
588
|
if (n === "url") {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
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
|
-
|
|
593
|
+
g = k.value;
|
|
594
594
|
}), S == null || S.addEventListener("input", () => {
|
|
595
|
-
|
|
595
|
+
p = S.value;
|
|
596
596
|
}), $ == null || $.addEventListener("input", () => {
|
|
597
|
-
|
|
597
|
+
c = $.value;
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
600
|
};
|
|
601
|
-
|
|
602
|
-
|
|
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
|
-
},
|
|
621
|
-
if (!
|
|
620
|
+
}, z = () => {
|
|
621
|
+
if (!m) {
|
|
622
622
|
_.forEach((r) => r.style.display = "none");
|
|
623
623
|
return;
|
|
624
624
|
}
|
|
625
|
-
const t =
|
|
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
|
|
633
|
-
r.style.left = `${
|
|
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
|
|
653
|
-
let
|
|
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
|
|
656
|
-
|
|
655
|
+
const c = () => {
|
|
656
|
+
p(), e.parentNode && e.parentNode.removeChild(e);
|
|
657
657
|
};
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}),
|
|
661
|
-
t.alt =
|
|
662
|
-
}),
|
|
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")) || "",
|
|
665
|
-
|
|
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="${
|
|
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" ${
|
|
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(
|
|
692
|
-
const
|
|
693
|
-
let
|
|
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
|
|
696
|
-
|
|
695
|
+
const l = () => {
|
|
696
|
+
x(), n.parentNode && n.parentNode.removeChild(n);
|
|
697
697
|
};
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}),
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
const
|
|
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",
|
|
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
|
|
708
|
-
|
|
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
|
-
|
|
710
|
+
l(), s && m && V(m);
|
|
711
711
|
}
|
|
712
|
-
}),
|
|
713
|
-
e && confirm("Remove link from this media?") && (e.replaceWith(t),
|
|
714
|
-
}),
|
|
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
|
|
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 ${
|
|
727
|
-
<button class="tab-url rte-media-tab ${
|
|
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
|
-
${
|
|
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="${
|
|
750
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
|
|
751
751
|
</div>
|
|
752
|
-
${
|
|
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="${
|
|
756
|
+
<img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class="rte-media-muted">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" ${!
|
|
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
|
|
771
|
+
let d = () => {
|
|
772
772
|
};
|
|
773
|
-
const
|
|
774
|
-
|
|
773
|
+
const p = () => {
|
|
774
|
+
d(), e.parentNode && e.parentNode.removeChild(e);
|
|
775
775
|
};
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
},
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
let
|
|
784
|
-
const
|
|
785
|
-
|
|
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
|
|
789
|
-
|
|
790
|
-
clearInterval(
|
|
791
|
-
|
|
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
|
-
},
|
|
794
|
-
} catch (
|
|
795
|
-
clearInterval(
|
|
793
|
+
}, u.readAsDataURL(w);
|
|
794
|
+
} catch (u) {
|
|
795
|
+
clearInterval(i), x.textContent = "Upload failed";
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
},
|
|
799
|
-
const w = r.querySelector(".close-btn"),
|
|
800
|
-
if (w == null || w.addEventListener("click",
|
|
801
|
-
|
|
802
|
-
}),
|
|
803
|
-
|
|
804
|
-
}),
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}),
|
|
809
|
-
|
|
810
|
-
}),
|
|
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
|
-
|
|
813
|
-
const L = (E =
|
|
814
|
-
L &&
|
|
815
|
-
}),
|
|
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 =
|
|
818
|
-
L &&
|
|
817
|
+
const L = (E = v.target.files) == null ? void 0 : E[0];
|
|
818
|
+
L && g(L);
|
|
819
819
|
});
|
|
820
820
|
}
|
|
821
|
-
if (
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
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
|
-
|
|
829
|
-
w.target === e &&
|
|
828
|
+
h(), e.addEventListener("click", (w) => {
|
|
829
|
+
w.target === e && p();
|
|
830
830
|
});
|
|
831
831
|
}, C = () => {
|
|
832
|
-
if (!
|
|
833
|
-
const t =
|
|
834
|
-
|
|
835
|
-
|
|
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
|
|
839
|
-
|
|
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
|
|
843
|
-
(!
|
|
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 =
|
|
846
|
-
|
|
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
|
-
${
|
|
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="${
|
|
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
|
-
${
|
|
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
|
|
876
|
-
let
|
|
877
|
-
for (;
|
|
878
|
-
|
|
879
|
-
window.addEventListener("scroll",
|
|
880
|
-
let
|
|
881
|
-
for (;
|
|
882
|
-
|
|
883
|
-
window.removeEventListener("scroll",
|
|
884
|
-
}, (
|
|
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
|
-
}), (
|
|
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
|
-
}), (
|
|
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
|
-
}), (
|
|
892
|
+
}), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
|
|
891
893
|
t.tagName === "IMG" && J(t);
|
|
892
|
-
}), (
|
|
894
|
+
}), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
|
|
893
895
|
Q(t);
|
|
894
|
-
}), (
|
|
896
|
+
}), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
|
|
895
897
|
t.tagName === "IMG" && ee(t);
|
|
896
|
-
}), (
|
|
897
|
-
const
|
|
898
|
-
if (
|
|
899
|
-
const
|
|
900
|
-
t.style.width = `${
|
|
901
|
-
}
|
|
902
|
-
}), (x =
|
|
903
|
-
confirm("Remove this media?") && (t.remove(),
|
|
904
|
-
}),
|
|
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
|
|
912
|
-
let
|
|
913
|
-
if (R ?
|
|
914
|
-
e.preventDefault(), e.stopPropagation(),
|
|
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") &&
|
|
919
|
-
if (
|
|
920
|
-
const
|
|
921
|
-
|
|
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
|
-
|
|
925
|
+
m = null, z();
|
|
924
926
|
}
|
|
925
927
|
}), _.forEach((e) => {
|
|
926
928
|
e.addEventListener("mousedown", (r) => {
|
|
927
|
-
if (!
|
|
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
|
|
930
|
-
q =
|
|
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 || !
|
|
934
|
-
const r = e.clientX - U,
|
|
935
|
-
let
|
|
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
|
-
|
|
940
|
+
o = q + r, n = M + a;
|
|
939
941
|
break;
|
|
940
942
|
case "sw":
|
|
941
|
-
|
|
943
|
+
o = q - r, n = M + a;
|
|
942
944
|
break;
|
|
943
945
|
case "ne":
|
|
944
|
-
|
|
946
|
+
o = q + r, n = M - a;
|
|
945
947
|
break;
|
|
946
948
|
case "nw":
|
|
947
|
-
|
|
949
|
+
o = q - r, n = M - a;
|
|
948
950
|
break;
|
|
949
951
|
}
|
|
950
|
-
Math.abs(r) > Math.abs(
|
|
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",
|
|
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-
|
|
993
|
+
//# sourceMappingURL=MediaManagerPlugin.native-eOsTJFpw.mjs.map
|