@editora/plugins 1.0.9 → 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 +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import "./shared-config.esm.js";
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
const r = (
|
|
5
|
-
|
|
2
|
+
let R = null, m = null, s = null, H = [], _ = !1, A = null, j = 0, F = 0, q = 0, M = 0, P = 1, D = null;
|
|
3
|
+
const G = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
4
|
+
const r = (a) => {
|
|
5
|
+
a.key !== "Escape" || !t.isConnected || (a.preventDefault(), a.stopPropagation(), e());
|
|
6
6
|
};
|
|
7
7
|
return document.addEventListener("keydown", r, !0), () => {
|
|
8
8
|
document.removeEventListener("keydown", r, !0);
|
|
9
9
|
};
|
|
10
|
-
},
|
|
11
|
-
if (typeof document > "u" || document.getElementById("rte-media-dialog-styles"))
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
}, Y = () => {
|
|
11
|
+
if (typeof document > "u" || document.getElementById("rte-media-dialog-styles"))
|
|
12
|
+
return;
|
|
13
|
+
const t = document.createElement("style");
|
|
14
|
+
t.id = "rte-media-dialog-styles", t.textContent = `
|
|
14
15
|
.rte-media-overlay {
|
|
15
16
|
--rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
16
17
|
--rte-media-bg: #ffffff;
|
|
@@ -388,7 +389,7 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
388
389
|
}
|
|
389
390
|
|
|
390
391
|
.media-floating-toolbar.rte-ui-theme-dark,
|
|
391
|
-
${
|
|
392
|
+
${G} .media-floating-toolbar {
|
|
392
393
|
--rte-media-toolbar-bg: #24303f;
|
|
393
394
|
--rte-media-toolbar-border: #4a5a71;
|
|
394
395
|
--rte-media-toolbar-text: #d9e6fb;
|
|
@@ -436,56 +437,60 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
436
437
|
margin: 0 2px;
|
|
437
438
|
background: var(--rte-media-toolbar-separator);
|
|
438
439
|
}
|
|
439
|
-
`, document.head.appendChild(
|
|
440
|
-
},
|
|
441
|
-
const
|
|
442
|
-
if (!
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
440
|
+
`, document.head.appendChild(t);
|
|
441
|
+
}, Z = () => {
|
|
442
|
+
const t = window.getSelection();
|
|
443
|
+
if (!t || t.rangeCount === 0)
|
|
444
|
+
return null;
|
|
445
|
+
const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
|
|
446
|
+
return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
|
|
447
|
+
}, K = (t) => {
|
|
448
|
+
if (t)
|
|
449
|
+
return t;
|
|
450
|
+
const e = Z();
|
|
451
|
+
if (e)
|
|
452
|
+
return e;
|
|
453
|
+
if (D)
|
|
454
|
+
return D;
|
|
450
455
|
const r = document.activeElement;
|
|
451
456
|
return r ? r.closest(".rte-content, .editora-content") || r : null;
|
|
452
|
-
},
|
|
453
|
-
const
|
|
454
|
-
return
|
|
455
|
-
},
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
return
|
|
459
|
-
},
|
|
460
|
-
const
|
|
461
|
-
return
|
|
462
|
-
},
|
|
457
|
+
}, O = (t) => {
|
|
458
|
+
const e = K(t);
|
|
459
|
+
return e ? !!e.closest(G) : !1;
|
|
460
|
+
}, N = (t) => {
|
|
461
|
+
Y();
|
|
462
|
+
const e = document.createElement("div");
|
|
463
|
+
return e.className = "rte-media-overlay", O(t) && e.classList.add("rte-ui-theme-dark"), e;
|
|
464
|
+
}, B = (t = !1) => {
|
|
465
|
+
const e = document.createElement("div");
|
|
466
|
+
return e.className = t ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e;
|
|
467
|
+
}, W = (t, e) => {
|
|
463
468
|
const r = window.getSelection();
|
|
464
|
-
r && r.rangeCount > 0 && (
|
|
465
|
-
const
|
|
466
|
-
let
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
+
r && r.rangeCount > 0 && (R = r.getRangeAt(0).cloneRange());
|
|
470
|
+
const a = N(e), o = B();
|
|
471
|
+
let n = "upload", d = "", p = "", c = "", g = "";
|
|
472
|
+
const h = () => {
|
|
473
|
+
o.innerHTML = `
|
|
469
474
|
<div class="rte-media-header">
|
|
470
|
-
<h2 class="rte-media-title">Insert ${
|
|
475
|
+
<h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
|
|
471
476
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
472
477
|
</div>
|
|
473
478
|
|
|
474
479
|
<div class="rte-media-tabs">
|
|
475
|
-
<button class="tab-upload rte-media-tab ${
|
|
476
|
-
<button class="tab-url rte-media-tab ${
|
|
480
|
+
<button class="tab-upload rte-media-tab ${n === "upload" ? "active" : ""}" type="button">Upload</button>
|
|
481
|
+
<button class="tab-url rte-media-tab ${n === "url" ? "active" : ""}" type="button">URL</button>
|
|
477
482
|
</div>
|
|
478
483
|
|
|
479
484
|
<div class="rte-media-body">
|
|
480
|
-
${
|
|
485
|
+
${n === "upload" ? `
|
|
481
486
|
<div id="upload-section">
|
|
482
487
|
<div class="dropzone rte-media-dropzone">
|
|
483
488
|
<div class="rte-media-dropzone-icon">📁</div>
|
|
484
|
-
<p class="rte-media-dropzone-title">Drag and drop your ${
|
|
489
|
+
<p class="rte-media-dropzone-title">Drag and drop your ${t} here</p>
|
|
485
490
|
<p class="rte-media-muted">or click to browse</p>
|
|
486
491
|
<p class="rte-media-hint">Max file size: 50MB</p>
|
|
487
492
|
</div>
|
|
488
|
-
<input type="file" id="file-input" accept="${
|
|
493
|
+
<input type="file" id="file-input" accept="${t === "image" ? "image/*" : "video/*"}" style="display: none;">
|
|
489
494
|
<div id="upload-progress" class="rte-media-progress" style="display: none;">
|
|
490
495
|
<div class="rte-media-progress-track">
|
|
491
496
|
<div id="progress-bar" class="rte-media-progress-bar"></div>
|
|
@@ -497,9 +502,9 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
497
502
|
<div id="url-section">
|
|
498
503
|
<div class="rte-media-field">
|
|
499
504
|
<label class="rte-media-label">URL</label>
|
|
500
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${
|
|
505
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${d}">
|
|
501
506
|
</div>
|
|
502
|
-
${
|
|
507
|
+
${t === "image" ? `
|
|
503
508
|
<div class="rte-media-field">
|
|
504
509
|
<label class="rte-media-label">Alt Text (for accessibility)</label>
|
|
505
510
|
<input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${g}">
|
|
@@ -508,18 +513,18 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
508
513
|
<div class="rte-media-grid">
|
|
509
514
|
<div class="rte-media-field">
|
|
510
515
|
<label class="rte-media-label">Width (px)</label>
|
|
511
|
-
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${
|
|
516
|
+
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${p}">
|
|
512
517
|
</div>
|
|
513
518
|
<div class="rte-media-field">
|
|
514
519
|
<label class="rte-media-label">Height (px)</label>
|
|
515
|
-
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${
|
|
520
|
+
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
|
|
516
521
|
</div>
|
|
517
522
|
</div>
|
|
518
523
|
${d ? `
|
|
519
524
|
<div class="rte-media-field">
|
|
520
525
|
<label class="rte-media-label">Preview</label>
|
|
521
526
|
<div class="rte-media-preview">
|
|
522
|
-
${
|
|
527
|
+
${t === "image" ? `<img src="${d}" alt="Preview">` : `<video src="${d}" controls></video>`}
|
|
523
528
|
</div>
|
|
524
529
|
</div>
|
|
525
530
|
` : ""}
|
|
@@ -529,110 +534,113 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
529
534
|
|
|
530
535
|
<div class="rte-media-footer">
|
|
531
536
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
532
|
-
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d &&
|
|
537
|
+
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d && n === "url" ? "disabled" : ""}>Insert</button>
|
|
533
538
|
</div>
|
|
534
539
|
`;
|
|
535
540
|
};
|
|
536
|
-
|
|
537
|
-
let
|
|
541
|
+
h(), a.appendChild(o), document.body.appendChild(a);
|
|
542
|
+
let w = () => {
|
|
538
543
|
};
|
|
539
|
-
const
|
|
540
|
-
|
|
544
|
+
const f = () => {
|
|
545
|
+
w(), a.parentNode && a.parentNode.removeChild(a);
|
|
541
546
|
};
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
if (!d)
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
547
|
+
w = I(a, f);
|
|
548
|
+
const y = () => {
|
|
549
|
+
if (!d)
|
|
550
|
+
return;
|
|
551
|
+
const i = t === "image" ? document.createElement("img") : document.createElement("video");
|
|
552
|
+
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;"}`, R && (R.deleteContents(), R.insertNode(i)), f();
|
|
553
|
+
}, x = async (i) => {
|
|
554
|
+
const u = o.querySelector("#upload-progress"), v = o.querySelector("#progress-bar"), L = o.querySelector("#progress-text");
|
|
555
|
+
if (u && v && L) {
|
|
556
|
+
u.style.display = "block";
|
|
557
|
+
let E = 0;
|
|
558
|
+
const b = setInterval(() => {
|
|
559
|
+
E += Math.random() * 30, E > 90 && (E = 90), v.style.width = `${E}%`;
|
|
554
560
|
}, 200);
|
|
555
561
|
try {
|
|
556
|
-
const
|
|
557
|
-
|
|
558
|
-
clearInterval(
|
|
559
|
-
d =
|
|
562
|
+
const k = new FileReader();
|
|
563
|
+
k.onload = () => {
|
|
564
|
+
clearInterval(b), v.style.width = "100%", L.textContent = "Upload complete", setTimeout(() => {
|
|
565
|
+
d = k.result, n = "url", h(), l();
|
|
560
566
|
}, 500);
|
|
561
|
-
},
|
|
567
|
+
}, k.readAsDataURL(i);
|
|
562
568
|
} catch {
|
|
563
|
-
clearInterval(
|
|
569
|
+
clearInterval(b), L.textContent = "Upload failed";
|
|
564
570
|
}
|
|
565
571
|
}
|
|
566
|
-
},
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
569
|
-
|
|
570
|
-
}),
|
|
571
|
-
|
|
572
|
-
}),
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
S.preventDefault(),
|
|
576
|
-
}),
|
|
577
|
-
|
|
578
|
-
}),
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
572
|
+
}, l = () => {
|
|
573
|
+
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");
|
|
574
|
+
if (i == null || i.addEventListener("click", f), u == null || u.addEventListener("click", f), v == null || v.addEventListener("click", y), L == null || L.addEventListener("click", () => {
|
|
575
|
+
n = "upload", h(), l();
|
|
576
|
+
}), E == null || E.addEventListener("click", () => {
|
|
577
|
+
n = "url", h(), l();
|
|
578
|
+
}), n === "upload") {
|
|
579
|
+
const b = o.querySelector(".dropzone"), k = o.querySelector("#file-input");
|
|
580
|
+
b == null || b.addEventListener("click", () => k == null ? void 0 : k.click()), b == null || b.addEventListener("dragover", (S) => {
|
|
581
|
+
S.preventDefault(), b.classList.add("is-dragover");
|
|
582
|
+
}), b == null || b.addEventListener("dragleave", () => {
|
|
583
|
+
b.classList.remove("is-dragover");
|
|
584
|
+
}), b == null || b.addEventListener("drop", (S) => {
|
|
585
|
+
var T;
|
|
586
|
+
S.preventDefault(), b.classList.remove("is-dragover");
|
|
587
|
+
const $ = (T = S.dataTransfer) == null ? void 0 : T.files[0];
|
|
588
|
+
$ && x($);
|
|
589
|
+
}), k == null || k.addEventListener("change", (S) => {
|
|
590
|
+
var T;
|
|
591
|
+
const $ = (T = S.target.files) == null ? void 0 : T[0];
|
|
592
|
+
$ && x($);
|
|
585
593
|
});
|
|
586
594
|
}
|
|
587
|
-
if (
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
d =
|
|
591
|
-
}),
|
|
592
|
-
g =
|
|
593
|
-
}), S
|
|
594
|
-
|
|
595
|
-
}),
|
|
596
|
-
|
|
595
|
+
if (n === "url") {
|
|
596
|
+
const b = o.querySelector("#url-input"), k = o.querySelector("#alt-input"), S = o.querySelector("#width-input"), $ = o.querySelector("#height-input");
|
|
597
|
+
b == null || b.addEventListener("input", () => {
|
|
598
|
+
d = b.value, h(), l();
|
|
599
|
+
}), k == null || k.addEventListener("input", () => {
|
|
600
|
+
g = k.value;
|
|
601
|
+
}), S == null || S.addEventListener("input", () => {
|
|
602
|
+
p = S.value;
|
|
603
|
+
}), $ == null || $.addEventListener("input", () => {
|
|
604
|
+
c = $.value;
|
|
597
605
|
});
|
|
598
606
|
}
|
|
599
607
|
};
|
|
600
|
-
|
|
601
|
-
|
|
608
|
+
l(), a.addEventListener("click", (i) => {
|
|
609
|
+
i.target === a && f();
|
|
602
610
|
});
|
|
603
|
-
},
|
|
604
|
-
["nw", "ne", "sw", "se"].forEach((
|
|
611
|
+
}, J = () => {
|
|
612
|
+
["nw", "ne", "sw", "se"].forEach((e) => {
|
|
605
613
|
const r = document.createElement("div");
|
|
606
|
-
r.className = `media-resize-handle-${
|
|
614
|
+
r.className = `media-resize-handle-${e}`, r.style.cssText = `
|
|
607
615
|
position: fixed;
|
|
608
616
|
width: 10px;
|
|
609
617
|
height: 10px;
|
|
610
618
|
background: #007bff;
|
|
611
619
|
border: 2px solid white;
|
|
612
620
|
border-radius: 50%;
|
|
613
|
-
cursor: ${
|
|
621
|
+
cursor: ${e}-resize;
|
|
614
622
|
z-index: 10001;
|
|
615
623
|
display: none;
|
|
616
624
|
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
617
|
-
`, r.setAttribute("data-position",
|
|
625
|
+
`, r.setAttribute("data-position", e), document.body.appendChild(r), H.push(r);
|
|
618
626
|
});
|
|
619
|
-
},
|
|
620
|
-
if (!
|
|
621
|
-
|
|
627
|
+
}, z = () => {
|
|
628
|
+
if (!m) {
|
|
629
|
+
H.forEach((r) => r.style.display = "none");
|
|
622
630
|
return;
|
|
623
631
|
}
|
|
624
|
-
const
|
|
625
|
-
nw: { x:
|
|
626
|
-
ne: { x:
|
|
627
|
-
sw: { x:
|
|
628
|
-
se: { x:
|
|
632
|
+
const t = m.getBoundingClientRect(), e = {
|
|
633
|
+
nw: { x: t.left - 5, y: t.top - 5 },
|
|
634
|
+
ne: { x: t.right - 5, y: t.top - 5 },
|
|
635
|
+
sw: { x: t.left - 5, y: t.bottom - 5 },
|
|
636
|
+
se: { x: t.right - 5, y: t.bottom - 5 }
|
|
629
637
|
};
|
|
630
|
-
|
|
631
|
-
const
|
|
632
|
-
r.style.left = `${
|
|
638
|
+
H.forEach((r) => {
|
|
639
|
+
const a = r.getAttribute("data-position"), o = e[a];
|
|
640
|
+
r.style.left = `${o.x}px`, r.style.top = `${o.y}px`, r.style.display = "block";
|
|
633
641
|
});
|
|
634
|
-
},
|
|
635
|
-
const
|
|
642
|
+
}, Q = (t) => {
|
|
643
|
+
const e = N(t), r = B(!0);
|
|
636
644
|
r.innerHTML = `
|
|
637
645
|
<div class="rte-media-header">
|
|
638
646
|
<h2 class="rte-media-title">Edit Alt Text</h2>
|
|
@@ -640,30 +648,30 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
640
648
|
</div>
|
|
641
649
|
<div class="rte-media-body">
|
|
642
650
|
<label class="rte-media-label">Alternative Text (for accessibility)</label>
|
|
643
|
-
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${
|
|
651
|
+
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${t.alt || ""}</textarea>
|
|
644
652
|
<p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
|
|
645
653
|
</div>
|
|
646
654
|
<div class="rte-media-footer">
|
|
647
655
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
648
656
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
649
657
|
</div>
|
|
650
|
-
`,
|
|
651
|
-
const
|
|
652
|
-
let
|
|
658
|
+
`, e.appendChild(r), document.body.appendChild(e);
|
|
659
|
+
const a = r.querySelector("#alt-text-input"), o = r.querySelector(".close-btn"), n = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
|
|
660
|
+
let p = () => {
|
|
653
661
|
};
|
|
654
|
-
const
|
|
655
|
-
|
|
662
|
+
const c = () => {
|
|
663
|
+
p(), e.parentNode && e.parentNode.removeChild(e);
|
|
656
664
|
};
|
|
657
|
-
|
|
658
|
-
g.target ===
|
|
665
|
+
p = I(e, c), o.addEventListener("click", c), n.addEventListener("click", c), e.addEventListener("click", (g) => {
|
|
666
|
+
g.target === e && c();
|
|
659
667
|
}), d.addEventListener("click", () => {
|
|
660
|
-
|
|
661
|
-
}),
|
|
662
|
-
},
|
|
663
|
-
const
|
|
668
|
+
t.alt = a.value, c();
|
|
669
|
+
}), a.focus(), a.select();
|
|
670
|
+
}, ee = (t) => {
|
|
671
|
+
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);
|
|
664
672
|
d.innerHTML = `
|
|
665
673
|
<div class="rte-media-header">
|
|
666
|
-
<h2 class="rte-media-title">${
|
|
674
|
+
<h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
|
|
667
675
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
668
676
|
</div>
|
|
669
677
|
<div class="rte-media-body">
|
|
@@ -673,48 +681,48 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
673
681
|
</div>
|
|
674
682
|
<div class="rte-media-field">
|
|
675
683
|
<label class="rte-media-label">Title (tooltip)</label>
|
|
676
|
-
<input id="link-title" type="text" class="rte-media-input" value="${
|
|
684
|
+
<input id="link-title" type="text" class="rte-media-input" value="${o}" placeholder="Optional tooltip text" />
|
|
677
685
|
</div>
|
|
678
686
|
<label class="rte-media-checkbox-label">
|
|
679
|
-
<input id="link-target" type="checkbox" ${
|
|
687
|
+
<input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
|
|
680
688
|
Open in new window/tab
|
|
681
689
|
</label>
|
|
682
690
|
</div>
|
|
683
691
|
<div class="rte-media-footer rte-media-footer-spread">
|
|
684
|
-
${
|
|
692
|
+
${e ? '<button class="remove-link-btn rte-media-btn rte-media-btn-danger" type="button">Remove Link</button>' : '<span class="rte-media-spacer"></span>'}
|
|
685
693
|
<div class="rte-media-actions">
|
|
686
694
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
687
695
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
688
696
|
</div>
|
|
689
697
|
</div>
|
|
690
|
-
`,
|
|
691
|
-
const
|
|
698
|
+
`, n.appendChild(d), document.body.appendChild(n);
|
|
699
|
+
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");
|
|
692
700
|
let x = () => {
|
|
693
701
|
};
|
|
694
|
-
const
|
|
695
|
-
x(),
|
|
702
|
+
const l = () => {
|
|
703
|
+
x(), n.parentNode && n.parentNode.removeChild(n);
|
|
696
704
|
};
|
|
697
|
-
x =
|
|
698
|
-
|
|
699
|
-
}),
|
|
700
|
-
const
|
|
701
|
-
if (
|
|
702
|
-
const
|
|
703
|
-
if (
|
|
704
|
-
|
|
705
|
+
x = I(n, l), h.addEventListener("click", l), w.addEventListener("click", l), n.addEventListener("click", (i) => {
|
|
706
|
+
i.target === n && l();
|
|
707
|
+
}), f.addEventListener("click", () => {
|
|
708
|
+
const i = p.value.trim();
|
|
709
|
+
if (i) {
|
|
710
|
+
const u = i.startsWith("http") ? i : `https://${i}`;
|
|
711
|
+
if (e)
|
|
712
|
+
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");
|
|
705
713
|
else {
|
|
706
|
-
const
|
|
707
|
-
|
|
714
|
+
const v = document.createElement("a");
|
|
715
|
+
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);
|
|
708
716
|
}
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
}),
|
|
712
|
-
|
|
713
|
-
}),
|
|
714
|
-
},
|
|
715
|
-
const
|
|
716
|
-
let
|
|
717
|
-
const
|
|
717
|
+
l(), s && m && V(m);
|
|
718
|
+
}
|
|
719
|
+
}), y == null || y.addEventListener("click", () => {
|
|
720
|
+
e && confirm("Remove link from this media?") && (e.replaceWith(t), l(), s && m && V(m));
|
|
721
|
+
}), p.focus();
|
|
722
|
+
}, te = (t) => {
|
|
723
|
+
const e = N(t), r = B();
|
|
724
|
+
let a = "url", o = t.src;
|
|
725
|
+
const n = () => {
|
|
718
726
|
r.innerHTML = `
|
|
719
727
|
<div class="rte-media-header">
|
|
720
728
|
<h2 class="rte-media-title">Replace Image</h2>
|
|
@@ -722,12 +730,12 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
722
730
|
</div>
|
|
723
731
|
|
|
724
732
|
<div class="rte-media-tabs">
|
|
725
|
-
<button class="tab-upload rte-media-tab ${
|
|
726
|
-
<button class="tab-url rte-media-tab ${
|
|
733
|
+
<button class="tab-upload rte-media-tab ${a === "upload" ? "active" : ""}" type="button">Upload</button>
|
|
734
|
+
<button class="tab-url rte-media-tab ${a === "url" ? "active" : ""}" type="button">URL</button>
|
|
727
735
|
</div>
|
|
728
736
|
|
|
729
737
|
<div class="rte-media-body">
|
|
730
|
-
${
|
|
738
|
+
${a === "upload" ? `
|
|
731
739
|
<div id="upload-section">
|
|
732
740
|
<div class="dropzone rte-media-dropzone">
|
|
733
741
|
<div class="rte-media-dropzone-icon">📁</div>
|
|
@@ -746,13 +754,13 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
746
754
|
<div id="url-section">
|
|
747
755
|
<div class="rte-media-field">
|
|
748
756
|
<label class="rte-media-label">Image URL</label>
|
|
749
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${
|
|
757
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
|
|
750
758
|
</div>
|
|
751
|
-
${
|
|
759
|
+
${o ? `
|
|
752
760
|
<div class="rte-media-field">
|
|
753
761
|
<label class="rte-media-label">Preview</label>
|
|
754
762
|
<div class="rte-media-preview">
|
|
755
|
-
<img src="${
|
|
763
|
+
<img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class="rte-media-muted">Failed to load image</p>'">
|
|
756
764
|
</div>
|
|
757
765
|
</div>
|
|
758
766
|
` : ""}
|
|
@@ -762,84 +770,91 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
762
770
|
|
|
763
771
|
<div class="rte-media-footer">
|
|
764
772
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
765
|
-
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!
|
|
773
|
+
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o && a === "url" ? "disabled" : ""}>Replace</button>
|
|
766
774
|
</div>
|
|
767
775
|
`;
|
|
768
776
|
};
|
|
769
|
-
|
|
777
|
+
n(), e.appendChild(r), document.body.appendChild(e);
|
|
770
778
|
let d = () => {
|
|
771
779
|
};
|
|
772
|
-
const c = () => {
|
|
773
|
-
d(), t.parentNode && t.parentNode.removeChild(t);
|
|
774
|
-
};
|
|
775
|
-
d = B(t, c);
|
|
776
780
|
const p = () => {
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
781
|
+
d(), e.parentNode && e.parentNode.removeChild(e);
|
|
782
|
+
};
|
|
783
|
+
d = I(e, p);
|
|
784
|
+
const c = () => {
|
|
785
|
+
o && (t.src = o, p());
|
|
786
|
+
}, g = async (w) => {
|
|
787
|
+
const f = r.querySelector("#upload-progress"), y = r.querySelector("#progress-bar"), x = r.querySelector("#progress-text");
|
|
788
|
+
if (f && y && x) {
|
|
789
|
+
f.style.display = "block";
|
|
790
|
+
let l = 0;
|
|
791
|
+
const i = setInterval(() => {
|
|
792
|
+
l += Math.random() * 30, l > 90 && (l = 90), y.style.width = `${l}%`;
|
|
785
793
|
}, 200);
|
|
786
794
|
try {
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
clearInterval(
|
|
790
|
-
|
|
795
|
+
const u = new FileReader();
|
|
796
|
+
u.onload = () => {
|
|
797
|
+
clearInterval(i), y.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
|
|
798
|
+
o = u.result, a = "url", n(), h();
|
|
791
799
|
}, 500);
|
|
792
|
-
},
|
|
800
|
+
}, u.readAsDataURL(w);
|
|
793
801
|
} catch {
|
|
794
|
-
clearInterval(
|
|
802
|
+
clearInterval(i), x.textContent = "Upload failed";
|
|
795
803
|
}
|
|
796
804
|
}
|
|
797
|
-
},
|
|
798
|
-
const
|
|
799
|
-
if (
|
|
800
|
-
|
|
801
|
-
}),
|
|
802
|
-
|
|
803
|
-
}),
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}),
|
|
808
|
-
|
|
809
|
-
}),
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
805
|
+
}, h = () => {
|
|
806
|
+
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");
|
|
807
|
+
if (w == null || w.addEventListener("click", p), f == null || f.addEventListener("click", p), y == null || y.addEventListener("click", c), x == null || x.addEventListener("click", () => {
|
|
808
|
+
a = "upload", n(), h();
|
|
809
|
+
}), l == null || l.addEventListener("click", () => {
|
|
810
|
+
a = "url", n(), h();
|
|
811
|
+
}), a === "upload") {
|
|
812
|
+
const i = r.querySelector(".dropzone"), u = r.querySelector("#file-input");
|
|
813
|
+
i == null || i.addEventListener("click", () => u == null ? void 0 : u.click()), i == null || i.addEventListener("dragover", (v) => {
|
|
814
|
+
v.preventDefault(), i.classList.add("is-dragover");
|
|
815
|
+
}), i == null || i.addEventListener("dragleave", () => {
|
|
816
|
+
i.classList.remove("is-dragover");
|
|
817
|
+
}), i == null || i.addEventListener("drop", (v) => {
|
|
818
|
+
var E;
|
|
819
|
+
v.preventDefault(), i.classList.remove("is-dragover");
|
|
820
|
+
const L = (E = v.dataTransfer) == null ? void 0 : E.files[0];
|
|
821
|
+
L && g(L);
|
|
822
|
+
}), u == null || u.addEventListener("change", (v) => {
|
|
823
|
+
var E;
|
|
824
|
+
const L = (E = v.target.files) == null ? void 0 : E[0];
|
|
825
|
+
L && g(L);
|
|
816
826
|
});
|
|
817
827
|
}
|
|
818
|
-
if (
|
|
819
|
-
const
|
|
820
|
-
|
|
821
|
-
|
|
828
|
+
if (a === "url") {
|
|
829
|
+
const i = r.querySelector("#url-input");
|
|
830
|
+
i == null || i.addEventListener("input", () => {
|
|
831
|
+
o = i.value, n(), h();
|
|
822
832
|
});
|
|
823
833
|
}
|
|
824
834
|
};
|
|
825
|
-
|
|
826
|
-
|
|
835
|
+
h(), e.addEventListener("click", (w) => {
|
|
836
|
+
w.target === e && p();
|
|
827
837
|
});
|
|
828
|
-
},
|
|
829
|
-
if (!
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
838
|
+
}, C = () => {
|
|
839
|
+
if (!s || !m)
|
|
840
|
+
return;
|
|
841
|
+
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;
|
|
842
|
+
s.style.top = `${o}px`, s.style.left = `${n}px`, setTimeout(() => {
|
|
843
|
+
s && (s.style.display = "flex");
|
|
833
844
|
}, 100);
|
|
834
|
-
},
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
845
|
+
}, V = (t) => {
|
|
846
|
+
var p, c, g, h, w, f, y, x;
|
|
847
|
+
s && (s._cleanup && s._cleanup(), s.remove());
|
|
848
|
+
const e = t.parentElement;
|
|
849
|
+
if (e) {
|
|
850
|
+
const l = e.style.position;
|
|
851
|
+
(!l || l === "static") && (e.style.position = "relative", e._originalPosition = l), s = document.createElement("div"), s.className = "media-floating-toolbar", O(t) && s.classList.add("rte-ui-theme-dark"), e.insertBefore(s, e.firstChild), C();
|
|
840
852
|
}
|
|
841
|
-
const r =
|
|
842
|
-
|
|
853
|
+
const r = s;
|
|
854
|
+
if (!r)
|
|
855
|
+
return;
|
|
856
|
+
const a = t.tagName === "IMG", o = t.closest("a");
|
|
857
|
+
r.innerHTML = `
|
|
843
858
|
<button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
|
|
844
859
|
<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>
|
|
845
860
|
</button>
|
|
@@ -850,14 +865,14 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
850
865
|
<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>
|
|
851
866
|
</button>
|
|
852
867
|
<div class="media-floating-toolbar-separator" aria-hidden="true"></div>
|
|
853
|
-
${
|
|
868
|
+
${a ? `
|
|
854
869
|
<button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
|
|
855
870
|
<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>
|
|
856
871
|
</button>` : ""}
|
|
857
|
-
<button class="media-floating-toolbar-btn btn-link" title="${
|
|
872
|
+
<button class="media-floating-toolbar-btn btn-link" title="${o ? "Edit/Remove Link" : "Add Link"}" type="button">
|
|
858
873
|
<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>
|
|
859
874
|
</button>
|
|
860
|
-
${
|
|
875
|
+
${a ? `
|
|
861
876
|
<button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
|
|
862
877
|
<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>
|
|
863
878
|
</button>` : ""}
|
|
@@ -866,94 +881,96 @@ const W = '[data-theme="dark"], .dark, .editora-theme-dark', B = (e, t) => {
|
|
|
866
881
|
<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>
|
|
867
882
|
</button>
|
|
868
883
|
`, setTimeout(() => {
|
|
869
|
-
|
|
884
|
+
C();
|
|
870
885
|
}, 0);
|
|
871
|
-
const
|
|
872
|
-
let
|
|
873
|
-
for (;
|
|
874
|
-
|
|
875
|
-
window.addEventListener("scroll",
|
|
876
|
-
let
|
|
877
|
-
for (;
|
|
878
|
-
|
|
879
|
-
window.removeEventListener("scroll",
|
|
880
|
-
},
|
|
881
|
-
|
|
882
|
-
}),
|
|
883
|
-
|
|
884
|
-
}),
|
|
885
|
-
|
|
886
|
-
}),
|
|
887
|
-
|
|
888
|
-
}),
|
|
889
|
-
|
|
890
|
-
}),
|
|
891
|
-
|
|
892
|
-
}),
|
|
893
|
-
const
|
|
894
|
-
if (
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
}
|
|
898
|
-
}),
|
|
899
|
-
confirm("Remove this media?") && (
|
|
900
|
-
}),
|
|
901
|
-
window.removeEventListener("scroll",
|
|
886
|
+
const n = () => C();
|
|
887
|
+
let d = t.parentElement;
|
|
888
|
+
for (; d; )
|
|
889
|
+
d.addEventListener("scroll", n), d = d.parentElement;
|
|
890
|
+
window.addEventListener("scroll", n), window.addEventListener("resize", n), r._cleanup = () => {
|
|
891
|
+
let l = t.parentElement;
|
|
892
|
+
for (; l; )
|
|
893
|
+
l.removeEventListener("scroll", n), l = l.parentElement;
|
|
894
|
+
window.removeEventListener("scroll", n), window.removeEventListener("resize", n);
|
|
895
|
+
}, (p = r.querySelector(".btn-align-left")) == null || p.addEventListener("click", () => {
|
|
896
|
+
t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", C();
|
|
897
|
+
}), (c = r.querySelector(".btn-align-center")) == null || c.addEventListener("click", () => {
|
|
898
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", C();
|
|
899
|
+
}), (g = r.querySelector(".btn-align-right")) == null || g.addEventListener("click", () => {
|
|
900
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", C();
|
|
901
|
+
}), (h = r.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
|
|
902
|
+
t.tagName === "IMG" && Q(t);
|
|
903
|
+
}), (w = r.querySelector(".btn-link")) == null || w.addEventListener("click", () => {
|
|
904
|
+
ee(t);
|
|
905
|
+
}), (f = r.querySelector(".btn-replace")) == null || f.addEventListener("click", () => {
|
|
906
|
+
t.tagName === "IMG" && te(t);
|
|
907
|
+
}), (y = r.querySelector(".btn-resize")) == null || y.addEventListener("click", () => {
|
|
908
|
+
const l = prompt("Enter width in pixels:", String(t.width || t.offsetWidth));
|
|
909
|
+
if (l && !isNaN(parseInt(l))) {
|
|
910
|
+
const i = parseInt(l);
|
|
911
|
+
t.style.width = `${i}px`, t.setAttribute("width", String(i)), z(), C();
|
|
912
|
+
}
|
|
913
|
+
}), (x = r.querySelector(".btn-remove")) == null || x.addEventListener("click", () => {
|
|
914
|
+
confirm("Remove this media?") && (t.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), m = null, z());
|
|
915
|
+
}), r._cleanup = () => {
|
|
916
|
+
window.removeEventListener("scroll", C), window.removeEventListener("resize", C);
|
|
902
917
|
};
|
|
903
|
-
},
|
|
904
|
-
|
|
905
|
-
const r =
|
|
918
|
+
}, X = (t) => {
|
|
919
|
+
D = t || null, J(), document.addEventListener("click", (e) => {
|
|
920
|
+
const r = e.target;
|
|
906
921
|
if (r.tagName === "IMG" || r.tagName === "VIDEO") {
|
|
907
|
-
const
|
|
908
|
-
let
|
|
909
|
-
if (
|
|
910
|
-
|
|
922
|
+
const a = r;
|
|
923
|
+
let o = !1;
|
|
924
|
+
if (D ? o = D.contains(a) : o = !!a.closest('[contenteditable="true"]'), o) {
|
|
925
|
+
e.preventDefault(), e.stopPropagation(), m = a, m.style.display = "block", V(a), z();
|
|
911
926
|
return;
|
|
912
927
|
}
|
|
913
928
|
}
|
|
914
|
-
if (!r.closest(".btn-link, .btn-resize, .btn-remove") &&
|
|
915
|
-
if (
|
|
916
|
-
const
|
|
917
|
-
|
|
929
|
+
if (!r.closest(".btn-link, .btn-resize, .btn-remove") && s && !r.closest("button")) {
|
|
930
|
+
if (s._cleanup && s._cleanup(), s.remove(), s = null, m && m.parentElement) {
|
|
931
|
+
const a = m.parentElement;
|
|
932
|
+
a._originalPosition !== void 0 && (a.style.position = a._originalPosition, delete a._originalPosition);
|
|
918
933
|
}
|
|
919
|
-
|
|
920
|
-
}
|
|
921
|
-
}),
|
|
922
|
-
|
|
923
|
-
if (!
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
934
|
+
m = null, z();
|
|
935
|
+
}
|
|
936
|
+
}), H.forEach((e) => {
|
|
937
|
+
e.addEventListener("mousedown", (r) => {
|
|
938
|
+
if (!m)
|
|
939
|
+
return;
|
|
940
|
+
r.preventDefault(), r.stopPropagation(), _ = !0, A = e.getAttribute("data-position"), j = r.clientX, F = r.clientY;
|
|
941
|
+
const a = m.getBoundingClientRect();
|
|
942
|
+
q = a.width, M = a.height, P = q / M, document.body.style.userSelect = "none", document.body.style.cursor = `${A}-resize`;
|
|
927
943
|
});
|
|
928
|
-
}), document.addEventListener("mousemove", (
|
|
929
|
-
if (!
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
944
|
+
}), document.addEventListener("mousemove", (e) => {
|
|
945
|
+
if (!_ || !m || !A)
|
|
946
|
+
return;
|
|
947
|
+
const r = e.clientX - j, a = e.clientY - F;
|
|
948
|
+
let o = q, n = M;
|
|
949
|
+
switch (A) {
|
|
933
950
|
case "se":
|
|
934
|
-
|
|
951
|
+
o = q + r, n = M + a;
|
|
935
952
|
break;
|
|
936
953
|
case "sw":
|
|
937
|
-
|
|
954
|
+
o = q - r, n = M + a;
|
|
938
955
|
break;
|
|
939
956
|
case "ne":
|
|
940
|
-
|
|
957
|
+
o = q + r, n = M - a;
|
|
941
958
|
break;
|
|
942
959
|
case "nw":
|
|
943
|
-
|
|
960
|
+
o = q - r, n = M - a;
|
|
944
961
|
break;
|
|
945
962
|
}
|
|
946
|
-
Math.abs(r) > Math.abs(
|
|
963
|
+
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();
|
|
947
964
|
}), document.addEventListener("mouseup", () => {
|
|
948
|
-
|
|
949
|
-
}), window.addEventListener("scroll",
|
|
965
|
+
_ && (_ = !1, A = null, document.body.style.userSelect = "", document.body.style.cursor = "");
|
|
966
|
+
}), window.addEventListener("scroll", z), window.addEventListener("resize", z);
|
|
950
967
|
};
|
|
951
|
-
typeof window < "u" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0,
|
|
952
|
-
const
|
|
968
|
+
typeof window < "u" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, X());
|
|
969
|
+
const ie = () => ({
|
|
953
970
|
name: "image",
|
|
954
|
-
initialize: (
|
|
955
|
-
const
|
|
956
|
-
|
|
971
|
+
initialize: (t) => {
|
|
972
|
+
const e = t == null ? void 0 : t.editorElement;
|
|
973
|
+
X(e);
|
|
957
974
|
},
|
|
958
975
|
toolbar: [
|
|
959
976
|
{
|
|
@@ -968,19 +985,19 @@ const ae = () => ({
|
|
|
968
985
|
}
|
|
969
986
|
],
|
|
970
987
|
commands: {
|
|
971
|
-
insertImage: (
|
|
972
|
-
const r =
|
|
973
|
-
return
|
|
988
|
+
insertImage: (t, e) => {
|
|
989
|
+
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
990
|
+
return W("image", r), !0;
|
|
974
991
|
},
|
|
975
|
-
insertVideo: (
|
|
976
|
-
const r =
|
|
977
|
-
return
|
|
992
|
+
insertVideo: (t, e) => {
|
|
993
|
+
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
994
|
+
return W("video", r), !0;
|
|
978
995
|
}
|
|
979
996
|
},
|
|
980
997
|
keymap: {
|
|
981
998
|
"Mod-Shift-i": "insertImage"
|
|
982
999
|
}
|
|
983
|
-
}),
|
|
1000
|
+
}), re = {
|
|
984
1001
|
apiEndpoints: {
|
|
985
1002
|
upload: "/media/upload",
|
|
986
1003
|
library: "/media/library",
|
|
@@ -1001,15 +1018,15 @@ const ae = () => ({
|
|
|
1001
1018
|
// 'X-API-Key': 'YOUR_API_KEY'
|
|
1002
1019
|
}
|
|
1003
1020
|
};
|
|
1004
|
-
let
|
|
1005
|
-
function
|
|
1006
|
-
|
|
1021
|
+
let U = { ...re };
|
|
1022
|
+
function oe(t) {
|
|
1023
|
+
U = { ...U, ...t };
|
|
1007
1024
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return { ...
|
|
1025
|
+
function ne() {
|
|
1026
|
+
return { ...U };
|
|
1010
1027
|
}
|
|
1011
1028
|
export {
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1029
|
+
ie as MediaManagerPlugin,
|
|
1030
|
+
ne as getMediaManagerConfig,
|
|
1031
|
+
oe as setMediaManagerConfig
|
|
1015
1032
|
};
|