@editora/core 1.0.5 → 1.0.7
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/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-CXdX5fAv.mjs} +77 -68
- package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +10 -10
- package/dist/editora.umd.js +10 -10
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/{index-CqWQFb3D.js → index-BpE6GFbz.js} +4 -4
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/{index-OwnkG39N.mjs → index-yzU4NdPT.mjs} +200 -183
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +15 -15
- package/dist/webcomponent-core.js +241 -224
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +86 -106
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +205 -188
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +477 -402
- package/package.json +16 -10
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs}
RENAMED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
let
|
|
2
|
-
const
|
|
1
|
+
let D = null, d = null, l = null, _ = [], H = !1, A = null, U = 0, j = 0, q = 0, z = 0, P = 1, R = null;
|
|
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());
|
|
5
|
+
};
|
|
6
|
+
return document.addEventListener("keydown", r, !0), () => {
|
|
7
|
+
document.removeEventListener("keydown", r, !0);
|
|
8
|
+
};
|
|
9
|
+
}, X = () => {
|
|
3
10
|
if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
|
|
4
11
|
const t = document.createElement("style");
|
|
5
12
|
t.id = "rte-media-dialog-styles", t.textContent = `
|
|
@@ -380,7 +387,7 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
380
387
|
}
|
|
381
388
|
|
|
382
389
|
.media-floating-toolbar.rte-ui-theme-dark,
|
|
383
|
-
${
|
|
390
|
+
${F} .media-floating-toolbar {
|
|
384
391
|
--rte-media-toolbar-bg: #24303f;
|
|
385
392
|
--rte-media-toolbar-border: #4a5a71;
|
|
386
393
|
--rte-media-toolbar-text: #d9e6fb;
|
|
@@ -429,34 +436,34 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
429
436
|
background: var(--rte-media-toolbar-separator);
|
|
430
437
|
}
|
|
431
438
|
`, document.head.appendChild(t);
|
|
432
|
-
},
|
|
439
|
+
}, Y = () => {
|
|
433
440
|
const t = window.getSelection();
|
|
434
441
|
if (!t || t.rangeCount === 0) return null;
|
|
435
442
|
const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
|
|
436
443
|
return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
|
|
437
|
-
},
|
|
444
|
+
}, Z = (t) => {
|
|
438
445
|
if (t) return t;
|
|
439
|
-
const e =
|
|
446
|
+
const e = Y();
|
|
440
447
|
if (e) return e;
|
|
441
|
-
if (
|
|
448
|
+
if (R) return R;
|
|
442
449
|
const r = document.activeElement;
|
|
443
450
|
return r ? r.closest(".rte-content, .editora-content") || r : null;
|
|
444
|
-
},
|
|
445
|
-
const e =
|
|
446
|
-
return e ? !!e.closest(
|
|
447
|
-
},
|
|
448
|
-
|
|
451
|
+
}, G = (t) => {
|
|
452
|
+
const e = Z(t);
|
|
453
|
+
return e ? !!e.closest(F) : !1;
|
|
454
|
+
}, N = (t) => {
|
|
455
|
+
X();
|
|
449
456
|
const e = document.createElement("div");
|
|
450
|
-
return e.className = "rte-media-overlay",
|
|
451
|
-
},
|
|
457
|
+
return e.className = "rte-media-overlay", G(t) && e.classList.add("rte-ui-theme-dark"), e;
|
|
458
|
+
}, B = (t = !1) => {
|
|
452
459
|
const e = document.createElement("div");
|
|
453
460
|
return e.className = t ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e;
|
|
454
|
-
},
|
|
461
|
+
}, W = (t, e) => {
|
|
455
462
|
const r = window.getSelection();
|
|
456
|
-
r && r.rangeCount > 0 && (
|
|
457
|
-
const
|
|
458
|
-
let n = "upload", s = "", b = "",
|
|
459
|
-
const
|
|
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 = () => {
|
|
460
467
|
a.innerHTML = `
|
|
461
468
|
<div class="rte-media-header">
|
|
462
469
|
<h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
|
|
@@ -494,7 +501,7 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
494
501
|
${t === "image" ? `
|
|
495
502
|
<div class="rte-media-field">
|
|
496
503
|
<label class="rte-media-label">Alt Text (for accessibility)</label>
|
|
497
|
-
<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="${f}">
|
|
498
505
|
</div>
|
|
499
506
|
` : ""}
|
|
500
507
|
<div class="rte-media-grid">
|
|
@@ -504,7 +511,7 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
504
511
|
</div>
|
|
505
512
|
<div class="rte-media-field">
|
|
506
513
|
<label class="rte-media-label">Height (px)</label>
|
|
507
|
-
<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="${m}">
|
|
508
515
|
</div>
|
|
509
516
|
</div>
|
|
510
517
|
${s ? `
|
|
@@ -525,72 +532,76 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
525
532
|
</div>
|
|
526
533
|
`;
|
|
527
534
|
};
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
535
|
+
y(), i.appendChild(a), document.body.appendChild(i);
|
|
536
|
+
let w = () => {
|
|
537
|
+
};
|
|
538
|
+
const h = () => {
|
|
539
|
+
w(), i.parentNode && i.parentNode.removeChild(i);
|
|
540
|
+
};
|
|
541
|
+
w = I(i, h);
|
|
542
|
+
const x = () => {
|
|
532
543
|
if (!s) return;
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
},
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
538
|
-
|
|
539
|
-
let
|
|
540
|
-
const
|
|
541
|
-
|
|
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";
|
|
550
|
+
let E = 0;
|
|
551
|
+
const u = setInterval(() => {
|
|
552
|
+
E += Math.random() * 30, E > 90 && (E = 90), g.style.width = `${E}%`;
|
|
542
553
|
}, 200);
|
|
543
554
|
try {
|
|
544
|
-
const
|
|
545
|
-
|
|
546
|
-
clearInterval(
|
|
547
|
-
s =
|
|
555
|
+
const k = new FileReader();
|
|
556
|
+
k.onload = () => {
|
|
557
|
+
clearInterval(u), g.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
|
|
558
|
+
s = k.result, n = "url", y(), p();
|
|
548
559
|
}, 500);
|
|
549
|
-
},
|
|
550
|
-
} catch (
|
|
551
|
-
clearInterval(
|
|
560
|
+
}, k.readAsDataURL(o);
|
|
561
|
+
} catch (k) {
|
|
562
|
+
clearInterval(u), L.textContent = "Upload failed";
|
|
552
563
|
}
|
|
553
564
|
}
|
|
554
|
-
},
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
n = "upload",
|
|
558
|
-
}),
|
|
559
|
-
n = "url",
|
|
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();
|
|
569
|
+
}), E == null || E.addEventListener("click", () => {
|
|
570
|
+
n = "url", y(), p();
|
|
560
571
|
}), n === "upload") {
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}),
|
|
565
|
-
|
|
566
|
-
}),
|
|
567
|
-
var
|
|
568
|
-
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
}),
|
|
572
|
-
var
|
|
573
|
-
const
|
|
574
|
-
|
|
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
|
+
var T;
|
|
579
|
+
S.preventDefault(), u.classList.remove("is-dragover");
|
|
580
|
+
const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
|
|
581
|
+
$ && c($);
|
|
582
|
+
}), k == null || k.addEventListener("change", (S) => {
|
|
583
|
+
var T;
|
|
584
|
+
const $ = (T = S.target.files) == null ? void 0 : T[0];
|
|
585
|
+
$ && c($);
|
|
575
586
|
});
|
|
576
587
|
}
|
|
577
588
|
if (n === "url") {
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
s =
|
|
581
|
-
}),
|
|
582
|
-
|
|
583
|
-
}), L == null || L.addEventListener("input", () => {
|
|
584
|
-
b = L.value;
|
|
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();
|
|
592
|
+
}), k == null || k.addEventListener("input", () => {
|
|
593
|
+
f = k.value;
|
|
585
594
|
}), S == null || S.addEventListener("input", () => {
|
|
586
|
-
|
|
595
|
+
b = S.value;
|
|
596
|
+
}), $ == null || $.addEventListener("input", () => {
|
|
597
|
+
m = $.value;
|
|
587
598
|
});
|
|
588
599
|
}
|
|
589
600
|
};
|
|
590
|
-
|
|
591
|
-
|
|
601
|
+
p(), i.addEventListener("click", (o) => {
|
|
602
|
+
o.target === i && h();
|
|
592
603
|
});
|
|
593
|
-
},
|
|
604
|
+
}, K = () => {
|
|
594
605
|
["nw", "ne", "sw", "se"].forEach((e) => {
|
|
595
606
|
const r = document.createElement("div");
|
|
596
607
|
r.className = `media-resize-handle-${e}`, r.style.cssText = `
|
|
@@ -606,23 +617,23 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
606
617
|
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
607
618
|
`, r.setAttribute("data-position", e), document.body.appendChild(r), _.push(r);
|
|
608
619
|
});
|
|
609
|
-
},
|
|
610
|
-
if (!
|
|
620
|
+
}, M = () => {
|
|
621
|
+
if (!d) {
|
|
611
622
|
_.forEach((r) => r.style.display = "none");
|
|
612
623
|
return;
|
|
613
624
|
}
|
|
614
|
-
const t =
|
|
625
|
+
const t = d.getBoundingClientRect(), e = {
|
|
615
626
|
nw: { x: t.left - 5, y: t.top - 5 },
|
|
616
627
|
ne: { x: t.right - 5, y: t.top - 5 },
|
|
617
628
|
sw: { x: t.left - 5, y: t.bottom - 5 },
|
|
618
629
|
se: { x: t.right - 5, y: t.bottom - 5 }
|
|
619
630
|
};
|
|
620
631
|
_.forEach((r) => {
|
|
621
|
-
const
|
|
632
|
+
const i = r.getAttribute("data-position"), a = e[i];
|
|
622
633
|
r.style.left = `${a.x}px`, r.style.top = `${a.y}px`, r.style.display = "block";
|
|
623
634
|
});
|
|
624
|
-
},
|
|
625
|
-
const e =
|
|
635
|
+
}, J = (t) => {
|
|
636
|
+
const e = N(t), r = B(!0);
|
|
626
637
|
r.innerHTML = `
|
|
627
638
|
<div class="rte-media-header">
|
|
628
639
|
<h2 class="rte-media-title">Edit Alt Text</h2>
|
|
@@ -638,16 +649,19 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
638
649
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
639
650
|
</div>
|
|
640
651
|
`, e.appendChild(r), document.body.appendChild(e);
|
|
641
|
-
const
|
|
642
|
-
|
|
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 = () => {
|
|
654
|
+
};
|
|
655
|
+
const m = () => {
|
|
656
|
+
b(), e.parentNode && e.parentNode.removeChild(e);
|
|
643
657
|
};
|
|
644
|
-
a.addEventListener("click",
|
|
645
|
-
|
|
658
|
+
b = I(e, m), a.addEventListener("click", m), n.addEventListener("click", m), e.addEventListener("click", (f) => {
|
|
659
|
+
f.target === e && m();
|
|
646
660
|
}), s.addEventListener("click", () => {
|
|
647
|
-
t.alt =
|
|
648
|
-
}),
|
|
649
|
-
},
|
|
650
|
-
const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "",
|
|
661
|
+
t.alt = i.value, m();
|
|
662
|
+
}), i.focus(), i.select();
|
|
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);
|
|
651
665
|
s.innerHTML = `
|
|
652
666
|
<div class="rte-media-header">
|
|
653
667
|
<h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
|
|
@@ -663,7 +677,7 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
663
677
|
<input id="link-title" type="text" class="rte-media-input" value="${a}" placeholder="Optional tooltip text" />
|
|
664
678
|
</div>
|
|
665
679
|
<label class="rte-media-checkbox-label">
|
|
666
|
-
<input id="link-target" type="checkbox" ${
|
|
680
|
+
<input id="link-target" type="checkbox" ${i === "_blank" ? "checked" : ""} />
|
|
667
681
|
Open in new window/tab
|
|
668
682
|
</label>
|
|
669
683
|
</div>
|
|
@@ -675,29 +689,32 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
675
689
|
</div>
|
|
676
690
|
</div>
|
|
677
691
|
`, n.appendChild(s), document.body.appendChild(n);
|
|
678
|
-
const b = s.querySelector("#link-url"),
|
|
679
|
-
|
|
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 = () => {
|
|
680
694
|
};
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
695
|
+
const p = () => {
|
|
696
|
+
c(), n.parentNode && n.parentNode.removeChild(n);
|
|
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}`;
|
|
687
704
|
if (e)
|
|
688
|
-
e.setAttribute("href",
|
|
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");
|
|
689
706
|
else {
|
|
690
|
-
const
|
|
691
|
-
|
|
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);
|
|
692
709
|
}
|
|
693
|
-
|
|
710
|
+
p(), l && d && V(d);
|
|
694
711
|
}
|
|
695
|
-
}),
|
|
696
|
-
e && confirm("Remove link from this media?") && (e.replaceWith(t),
|
|
712
|
+
}), x == null || x.addEventListener("click", () => {
|
|
713
|
+
e && confirm("Remove link from this media?") && (e.replaceWith(t), p(), l && d && V(d));
|
|
697
714
|
}), b.focus();
|
|
698
|
-
},
|
|
699
|
-
const e =
|
|
700
|
-
let
|
|
715
|
+
}, ee = (t) => {
|
|
716
|
+
const e = N(t), r = B();
|
|
717
|
+
let i = "url", a = t.src;
|
|
701
718
|
const n = () => {
|
|
702
719
|
r.innerHTML = `
|
|
703
720
|
<div class="rte-media-header">
|
|
@@ -706,12 +723,12 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
706
723
|
</div>
|
|
707
724
|
|
|
708
725
|
<div class="rte-media-tabs">
|
|
709
|
-
<button class="tab-upload rte-media-tab ${
|
|
710
|
-
<button class="tab-url rte-media-tab ${
|
|
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>
|
|
711
728
|
</div>
|
|
712
729
|
|
|
713
730
|
<div class="rte-media-body">
|
|
714
|
-
${
|
|
731
|
+
${i === "upload" ? `
|
|
715
732
|
<div id="upload-section">
|
|
716
733
|
<div class="dropzone rte-media-dropzone">
|
|
717
734
|
<div class="rte-media-dropzone-icon">📁</div>
|
|
@@ -746,82 +763,86 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
746
763
|
|
|
747
764
|
<div class="rte-media-footer">
|
|
748
765
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
749
|
-
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!a &&
|
|
766
|
+
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!a && i === "url" ? "disabled" : ""}>Replace</button>
|
|
750
767
|
</div>
|
|
751
768
|
`;
|
|
752
769
|
};
|
|
753
770
|
n(), e.appendChild(r), document.body.appendChild(e);
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
771
|
+
let s = () => {
|
|
772
|
+
};
|
|
773
|
+
const b = () => {
|
|
774
|
+
s(), e.parentNode && e.parentNode.removeChild(e);
|
|
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}%`;
|
|
765
786
|
}, 200);
|
|
766
787
|
try {
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
clearInterval(
|
|
770
|
-
a =
|
|
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();
|
|
771
792
|
}, 500);
|
|
772
|
-
},
|
|
773
|
-
} catch (
|
|
774
|
-
clearInterval(
|
|
793
|
+
}, v.readAsDataURL(w);
|
|
794
|
+
} catch (v) {
|
|
795
|
+
clearInterval(o), c.textContent = "Upload failed";
|
|
775
796
|
}
|
|
776
797
|
}
|
|
777
|
-
},
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
}),
|
|
782
|
-
|
|
783
|
-
}),
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}),
|
|
788
|
-
|
|
789
|
-
}),
|
|
790
|
-
var
|
|
791
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
}),
|
|
795
|
-
var
|
|
796
|
-
const
|
|
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) => {
|
|
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) => {
|
|
816
|
+
var E;
|
|
817
|
+
const L = (E = g.target.files) == null ? void 0 : E[0];
|
|
818
|
+
L && f(L);
|
|
798
819
|
});
|
|
799
820
|
}
|
|
800
|
-
if (
|
|
801
|
-
const
|
|
802
|
-
|
|
803
|
-
a =
|
|
821
|
+
if (i === "url") {
|
|
822
|
+
const o = r.querySelector("#url-input");
|
|
823
|
+
o == null || o.addEventListener("input", () => {
|
|
824
|
+
a = o.value, n(), y();
|
|
804
825
|
});
|
|
805
826
|
}
|
|
806
827
|
};
|
|
807
|
-
|
|
808
|
-
|
|
828
|
+
y(), e.addEventListener("click", (w) => {
|
|
829
|
+
w.target === e && b();
|
|
809
830
|
});
|
|
810
|
-
},
|
|
811
|
-
if (!l || !
|
|
812
|
-
const t = l.offsetHeight || 40, e =
|
|
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;
|
|
813
834
|
l.style.top = `${a}px`, l.style.left = `${n}px`, setTimeout(() => {
|
|
814
835
|
l && (l.style.display = "flex");
|
|
815
836
|
}, 100);
|
|
816
|
-
},
|
|
817
|
-
var s, b,
|
|
837
|
+
}, V = (t) => {
|
|
838
|
+
var s, b, m, f, y, w, h, x;
|
|
818
839
|
l && (l._cleanup && l._cleanup(), l.remove());
|
|
819
840
|
const e = t.parentElement;
|
|
820
841
|
if (e) {
|
|
821
|
-
const
|
|
822
|
-
(!
|
|
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();
|
|
823
844
|
}
|
|
824
|
-
const r = t.tagName === "IMG",
|
|
845
|
+
const r = t.tagName === "IMG", i = t.closest("a");
|
|
825
846
|
l.innerHTML = `
|
|
826
847
|
<button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
|
|
827
848
|
<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>
|
|
@@ -837,7 +858,7 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
837
858
|
<button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
|
|
838
859
|
<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>
|
|
839
860
|
</button>` : ""}
|
|
840
|
-
<button class="media-floating-toolbar-btn btn-link" title="${
|
|
861
|
+
<button class="media-floating-toolbar-btn btn-link" title="${i ? "Edit/Remove Link" : "Add Link"}" type="button">
|
|
841
862
|
<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>
|
|
842
863
|
</button>
|
|
843
864
|
${r ? `
|
|
@@ -849,94 +870,94 @@ const j = '[data-theme="dark"], .dark, .editora-theme-dark', G = () => {
|
|
|
849
870
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>
|
|
850
871
|
</button>
|
|
851
872
|
`, setTimeout(() => {
|
|
852
|
-
|
|
873
|
+
C();
|
|
853
874
|
}, 0);
|
|
854
|
-
const a = () =>
|
|
855
|
-
let n =
|
|
875
|
+
const a = () => C();
|
|
876
|
+
let n = d.parentElement;
|
|
856
877
|
for (; n; )
|
|
857
878
|
n.addEventListener("scroll", a), n = n.parentElement;
|
|
858
879
|
window.addEventListener("scroll", a), window.addEventListener("resize", a), l._cleanup = () => {
|
|
859
|
-
let
|
|
860
|
-
for (;
|
|
861
|
-
|
|
880
|
+
let c = d == null ? void 0 : d.parentElement;
|
|
881
|
+
for (; c; )
|
|
882
|
+
c.removeEventListener("scroll", a), c = c.parentElement;
|
|
862
883
|
window.removeEventListener("scroll", a), window.removeEventListener("resize", a);
|
|
863
884
|
}, (s = l.querySelector(".btn-align-left")) == null || s.addEventListener("click", () => {
|
|
864
|
-
t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto",
|
|
885
|
+
t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", C();
|
|
865
886
|
}), (b = l.querySelector(".btn-align-center")) == null || b.addEventListener("click", () => {
|
|
866
|
-
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto",
|
|
867
|
-
}), (
|
|
868
|
-
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0",
|
|
869
|
-
}), (
|
|
870
|
-
t.tagName === "IMG" && Z(t);
|
|
871
|
-
}), (f = l.querySelector(".btn-link")) == null || f.addEventListener("click", () => {
|
|
872
|
-
K(t);
|
|
873
|
-
}), (y = l.querySelector(".btn-replace")) == null || y.addEventListener("click", () => {
|
|
887
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", C();
|
|
888
|
+
}), (m = l.querySelector(".btn-align-right")) == null || m.addEventListener("click", () => {
|
|
889
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", C();
|
|
890
|
+
}), (f = l.querySelector(".btn-alt")) == null || f.addEventListener("click", () => {
|
|
874
891
|
t.tagName === "IMG" && J(t);
|
|
875
|
-
}), (
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
892
|
+
}), (y = l.querySelector(".btn-link")) == null || y.addEventListener("click", () => {
|
|
893
|
+
Q(t);
|
|
894
|
+
}), (w = l.querySelector(".btn-replace")) == null || w.addEventListener("click", () => {
|
|
895
|
+
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());
|
|
883
904
|
}), l._cleanup = () => {
|
|
884
|
-
window.removeEventListener("scroll",
|
|
905
|
+
window.removeEventListener("scroll", C), window.removeEventListener("resize", C);
|
|
885
906
|
};
|
|
886
|
-
},
|
|
887
|
-
|
|
907
|
+
}, O = (t) => {
|
|
908
|
+
R = t || null, K(), document.addEventListener("click", (e) => {
|
|
888
909
|
const r = e.target;
|
|
889
910
|
if (r.tagName === "IMG" || r.tagName === "VIDEO") {
|
|
890
|
-
const
|
|
911
|
+
const i = r;
|
|
891
912
|
let a = !1;
|
|
892
|
-
if (
|
|
893
|
-
e.preventDefault(), e.stopPropagation(),
|
|
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();
|
|
894
915
|
return;
|
|
895
916
|
}
|
|
896
917
|
}
|
|
897
918
|
if (!r.closest(".btn-link, .btn-resize, .btn-remove") && l && !r.closest("button")) {
|
|
898
|
-
if (l._cleanup && l._cleanup(), l.remove(), l = null,
|
|
899
|
-
const
|
|
900
|
-
|
|
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);
|
|
901
922
|
}
|
|
902
|
-
|
|
923
|
+
d = null, M();
|
|
903
924
|
}
|
|
904
925
|
}), _.forEach((e) => {
|
|
905
926
|
e.addEventListener("mousedown", (r) => {
|
|
906
|
-
if (!
|
|
907
|
-
r.preventDefault(), r.stopPropagation(),
|
|
908
|
-
const
|
|
909
|
-
q =
|
|
927
|
+
if (!d) return;
|
|
928
|
+
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`;
|
|
910
931
|
});
|
|
911
932
|
}), document.addEventListener("mousemove", (e) => {
|
|
912
|
-
if (!
|
|
913
|
-
const r = e.clientX -
|
|
914
|
-
let a = q, n =
|
|
915
|
-
switch (
|
|
933
|
+
if (!H || !d || !A) return;
|
|
934
|
+
const r = e.clientX - U, i = e.clientY - j;
|
|
935
|
+
let a = q, n = z;
|
|
936
|
+
switch (A) {
|
|
916
937
|
case "se":
|
|
917
|
-
a = q + r, n =
|
|
938
|
+
a = q + r, n = z + i;
|
|
918
939
|
break;
|
|
919
940
|
case "sw":
|
|
920
|
-
a = q - r, n =
|
|
941
|
+
a = q - r, n = z + i;
|
|
921
942
|
break;
|
|
922
943
|
case "ne":
|
|
923
|
-
a = q + r, n =
|
|
944
|
+
a = q + r, n = z - i;
|
|
924
945
|
break;
|
|
925
946
|
case "nw":
|
|
926
|
-
a = q - r, n =
|
|
947
|
+
a = q - r, n = z - i;
|
|
927
948
|
break;
|
|
928
949
|
}
|
|
929
|
-
Math.abs(r) > Math.abs(
|
|
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();
|
|
930
951
|
}), document.addEventListener("mouseup", () => {
|
|
931
|
-
|
|
932
|
-
}), window.addEventListener("scroll",
|
|
952
|
+
H && (H = !1, A = null, document.body.style.userSelect = "", document.body.style.cursor = "");
|
|
953
|
+
}), window.addEventListener("scroll", M), window.addEventListener("resize", M);
|
|
933
954
|
};
|
|
934
|
-
typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0,
|
|
935
|
-
const
|
|
955
|
+
typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, O());
|
|
956
|
+
const te = () => ({
|
|
936
957
|
name: "image",
|
|
937
958
|
initialize: (t) => {
|
|
938
959
|
const e = t == null ? void 0 : t.editorElement;
|
|
939
|
-
|
|
960
|
+
O(e);
|
|
940
961
|
},
|
|
941
962
|
toolbar: [
|
|
942
963
|
{
|
|
@@ -953,11 +974,11 @@ const Q = () => ({
|
|
|
953
974
|
commands: {
|
|
954
975
|
insertImage: (t, e) => {
|
|
955
976
|
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
956
|
-
return
|
|
977
|
+
return W("image", r), !0;
|
|
957
978
|
},
|
|
958
979
|
insertVideo: (t, e) => {
|
|
959
980
|
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
960
|
-
return
|
|
981
|
+
return W("video", r), !0;
|
|
961
982
|
}
|
|
962
983
|
},
|
|
963
984
|
keymap: {
|
|
@@ -965,6 +986,6 @@ const Q = () => ({
|
|
|
965
986
|
}
|
|
966
987
|
});
|
|
967
988
|
export {
|
|
968
|
-
|
|
989
|
+
te as MediaManagerPlugin
|
|
969
990
|
};
|
|
970
|
-
//# sourceMappingURL=MediaManagerPlugin.native-
|
|
991
|
+
//# sourceMappingURL=MediaManagerPlugin.native-BiXiK8FC.mjs.map
|