@editora/core 1.0.8 → 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.
- package/README.md +5 -0
- package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
- package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-449ce66c.mjs} +79 -40
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
- package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
- package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-1cc51e63.mjs} +119 -60
- package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
- package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
- package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
- package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-169fb1e8.mjs} +137 -69
- package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
- package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
- package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-4983143a.mjs} +108 -51
- package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-63ed405b.mjs} +100 -50
- package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-427e9d75.mjs} +79 -40
- package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
- package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-8e41eda0.mjs} +115 -58
- package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
- package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
- package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
- package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
- package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
- package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
- package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
- package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
- package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
- package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
- package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
- package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-3b1e8c05.mjs} +89 -45
- package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
- package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-7ab10b9f.mjs} +107 -54
- package/dist/{PageBreakPlugin.native-DijGuHJZ.mjs → PageBreakPlugin.native-1794c5fb.mjs} +31 -16
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-f7b67cc0.mjs} +11 -6
- package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
- package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-8d45e511.mjs} +72 -37
- package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-a6c5efec.mjs} +99 -50
- package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
- package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
- package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
- package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
- package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
- package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
- package/dist/{TrackChangesPlugin.native-Bghu2q4a.mjs → TrackChangesPlugin.native-e96da509.mjs} +115 -58
- package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-4e711b1e.mjs} +160 -91
- package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-5bbeff85.mjs} +51 -26
- package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
- package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
- package/dist/documentManager-8327fb6e.mjs +9166 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
- package/dist/editora.min.js +14 -13
- package/dist/editora.umd.js +14 -13
- package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
- package/dist/index-072ef022.js +11 -0
- package/dist/index-49d31221.mjs +16860 -0
- package/dist/{index-DqC57IEH.mjs → index-7da30697.mjs} +163 -124
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-b47a189f.mjs +5782 -0
- package/dist/index.esm.js +12 -7
- package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
- package/dist/plugin-loader.js +67 -67
- package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
- package/dist/style.css +1 -0
- package/dist/webcomponent-core.js +164 -125
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +18 -17
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +226 -187
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1324 -1117
- package/package.json +11 -5
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
- package/dist/core.css +0 -1
- package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
- package/dist/index-BslAFzmv.mjs +0 -16544
- package/dist/index-D1LOqg5C.js +0 -10
- package/dist/index.es-BYD2KEo6.mjs +0 -6666
package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs}
RENAMED
|
@@ -1,13 +1,14 @@
|
|
|
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);
|
|
8
8
|
};
|
|
9
9
|
}, X = () => {
|
|
10
|
-
if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles"))
|
|
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)
|
|
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)
|
|
447
|
+
if (t)
|
|
448
|
+
return t;
|
|
446
449
|
const e = Y();
|
|
447
|
-
if (e)
|
|
448
|
-
|
|
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
|
|
465
|
-
let n = "upload",
|
|
466
|
-
const
|
|
467
|
-
|
|
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="${
|
|
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="${
|
|
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="${
|
|
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="${
|
|
519
|
+
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
|
|
515
520
|
</div>
|
|
516
521
|
</div>
|
|
517
|
-
${
|
|
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="${
|
|
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" ${!
|
|
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
|
-
|
|
540
|
+
h(), a.appendChild(o), document.body.appendChild(a);
|
|
536
541
|
let w = () => {
|
|
537
542
|
};
|
|
538
|
-
const
|
|
539
|
-
w(),
|
|
543
|
+
const f = () => {
|
|
544
|
+
w(), a.parentNode && a.parentNode.removeChild(a);
|
|
540
545
|
};
|
|
541
|
-
w = I(
|
|
542
|
-
const
|
|
543
|
-
if (!
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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
|
|
552
|
-
E += Math.random() * 30, E > 90 && (E = 90),
|
|
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(
|
|
558
|
-
|
|
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(
|
|
566
|
+
}, k.readAsDataURL(i);
|
|
561
567
|
} catch (k) {
|
|
562
|
-
clearInterval(
|
|
568
|
+
clearInterval(b), L.textContent = "Upload failed";
|
|
563
569
|
}
|
|
564
570
|
}
|
|
565
|
-
},
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
568
|
-
n = "upload",
|
|
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",
|
|
576
|
+
n = "url", h(), l();
|
|
571
577
|
}), n === "upload") {
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
S.preventDefault(),
|
|
575
|
-
}),
|
|
576
|
-
|
|
577
|
-
}),
|
|
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(),
|
|
585
|
+
S.preventDefault(), b.classList.remove("is-dragover");
|
|
580
586
|
const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
|
|
581
|
-
$ &&
|
|
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
|
-
$ &&
|
|
591
|
+
$ && x($);
|
|
586
592
|
});
|
|
587
593
|
}
|
|
588
594
|
if (n === "url") {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
|
|
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
|
-
|
|
599
|
+
g = k.value;
|
|
594
600
|
}), S == null || S.addEventListener("input", () => {
|
|
595
|
-
|
|
601
|
+
p = S.value;
|
|
596
602
|
}), $ == null || $.addEventListener("input", () => {
|
|
597
|
-
|
|
603
|
+
c = $.value;
|
|
598
604
|
});
|
|
599
605
|
}
|
|
600
606
|
};
|
|
601
|
-
|
|
602
|
-
|
|
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
|
-
},
|
|
621
|
-
if (!
|
|
626
|
+
}, z = () => {
|
|
627
|
+
if (!m) {
|
|
622
628
|
_.forEach((r) => r.style.display = "none");
|
|
623
629
|
return;
|
|
624
630
|
}
|
|
625
|
-
const t =
|
|
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
|
|
633
|
-
r.style.left = `${
|
|
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
|
|
653
|
-
let
|
|
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
|
|
656
|
-
|
|
661
|
+
const c = () => {
|
|
662
|
+
p(), e.parentNode && e.parentNode.removeChild(e);
|
|
657
663
|
};
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}),
|
|
661
|
-
t.alt =
|
|
662
|
-
}),
|
|
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")) || "",
|
|
665
|
-
|
|
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="${
|
|
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" ${
|
|
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(
|
|
692
|
-
const
|
|
693
|
-
let
|
|
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
|
|
696
|
-
|
|
701
|
+
const l = () => {
|
|
702
|
+
x(), n.parentNode && n.parentNode.removeChild(n);
|
|
697
703
|
};
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
}),
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
const
|
|
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",
|
|
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
|
|
708
|
-
|
|
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
|
-
|
|
716
|
+
l(), s && m && V(m);
|
|
711
717
|
}
|
|
712
|
-
}),
|
|
713
|
-
e && confirm("Remove link from this media?") && (e.replaceWith(t),
|
|
714
|
-
}),
|
|
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
|
|
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 ${
|
|
727
|
-
<button class="tab-url rte-media-tab ${
|
|
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
|
-
${
|
|
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="${
|
|
756
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
|
|
751
757
|
</div>
|
|
752
|
-
${
|
|
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="${
|
|
762
|
+
<img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class="rte-media-muted">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" ${!
|
|
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
|
|
777
|
+
let d = () => {
|
|
772
778
|
};
|
|
773
|
-
const
|
|
774
|
-
|
|
779
|
+
const p = () => {
|
|
780
|
+
d(), e.parentNode && e.parentNode.removeChild(e);
|
|
775
781
|
};
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
|
|
779
|
-
},
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
let
|
|
784
|
-
const
|
|
785
|
-
|
|
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
|
|
789
|
-
|
|
790
|
-
clearInterval(
|
|
791
|
-
|
|
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
|
-
},
|
|
794
|
-
} catch (
|
|
795
|
-
clearInterval(
|
|
799
|
+
}, u.readAsDataURL(w);
|
|
800
|
+
} catch (u) {
|
|
801
|
+
clearInterval(i), x.textContent = "Upload failed";
|
|
796
802
|
}
|
|
797
803
|
}
|
|
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
|
-
}),
|
|
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
|
-
|
|
813
|
-
const L = (E =
|
|
814
|
-
L &&
|
|
815
|
-
}),
|
|
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 =
|
|
818
|
-
L &&
|
|
823
|
+
const L = (E = v.target.files) == null ? void 0 : E[0];
|
|
824
|
+
L && g(L);
|
|
819
825
|
});
|
|
820
826
|
}
|
|
821
|
-
if (
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
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
|
-
|
|
829
|
-
w.target === e &&
|
|
834
|
+
h(), e.addEventListener("click", (w) => {
|
|
835
|
+
w.target === e && p();
|
|
830
836
|
});
|
|
831
837
|
}, C = () => {
|
|
832
|
-
if (!
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
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
|
|
839
|
-
|
|
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
|
|
843
|
-
(!
|
|
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 =
|
|
846
|
-
|
|
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
|
-
${
|
|
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="${
|
|
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
|
-
${
|
|
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
|
|
876
|
-
let
|
|
877
|
-
for (;
|
|
878
|
-
|
|
879
|
-
window.addEventListener("scroll",
|
|
880
|
-
let
|
|
881
|
-
for (;
|
|
882
|
-
|
|
883
|
-
window.removeEventListener("scroll",
|
|
884
|
-
}, (
|
|
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
|
-
}), (
|
|
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
|
-
}), (
|
|
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
|
-
}), (
|
|
900
|
+
}), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
|
|
891
901
|
t.tagName === "IMG" && J(t);
|
|
892
|
-
}), (
|
|
902
|
+
}), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
|
|
893
903
|
Q(t);
|
|
894
|
-
}), (
|
|
904
|
+
}), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
|
|
895
905
|
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
|
-
}),
|
|
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
|
|
912
|
-
let
|
|
913
|
-
if (R ?
|
|
914
|
-
e.preventDefault(), e.stopPropagation(),
|
|
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") &&
|
|
919
|
-
if (
|
|
920
|
-
const
|
|
921
|
-
|
|
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
|
-
|
|
933
|
+
m = null, z();
|
|
924
934
|
}
|
|
925
935
|
}), _.forEach((e) => {
|
|
926
936
|
e.addEventListener("mousedown", (r) => {
|
|
927
|
-
if (!
|
|
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
|
|
930
|
-
q =
|
|
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 || !
|
|
934
|
-
|
|
935
|
-
|
|
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
|
-
|
|
950
|
+
o = q + r, n = M + a;
|
|
939
951
|
break;
|
|
940
952
|
case "sw":
|
|
941
|
-
|
|
953
|
+
o = q - r, n = M + a;
|
|
942
954
|
break;
|
|
943
955
|
case "ne":
|
|
944
|
-
|
|
956
|
+
o = q + r, n = M - a;
|
|
945
957
|
break;
|
|
946
958
|
case "nw":
|
|
947
|
-
|
|
959
|
+
o = q - r, n = M - a;
|
|
948
960
|
break;
|
|
949
961
|
}
|
|
950
|
-
Math.abs(r) > Math.abs(
|
|
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",
|
|
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-
|
|
1003
|
+
//# sourceMappingURL=MediaManagerPlugin.native-3cf48a00.mjs.map
|