@editora/core 1.0.23 → 1.0.24
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/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
- package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
- package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
- package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
- package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
- package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
- package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
- package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
- package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
- package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
- package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
- package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
- package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
- package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
- package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
- package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
- package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
- package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
- package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
- package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
- package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
- package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
- package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
- package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
- package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
- package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
- package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
- package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
- package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
- package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
- package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
- package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
- package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
- package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
- package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
- package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
- package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
- package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
- package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
- package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
- package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
- package/dist/editora.min.js +21 -21
- package/dist/editora.umd.js +10 -10
- package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
- package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/katex-DLIObQUm.mjs +11683 -0
- package/dist/katex.min--Ws3c9be.mjs +6 -0
- package/dist/notify-DCQGpmq-.mjs +60 -0
- package/dist/plugin-loader.js +54 -54
- package/dist/webcomponent-core.js +305 -234
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +153 -80
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +631 -560
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1677 -1328
- package/package.json +1 -1
- package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
- package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
- package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
- package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs}
RENAMED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { i as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { e as T } from "./escapeHtml-CX8RelZ1.mjs";
|
|
2
|
+
import { i as ne } from "./dialogHelpers-Dzn8DHoF.mjs";
|
|
3
|
+
import { r as le } from "./historyHelpers-B0-4mq1E.mjs";
|
|
4
|
+
import { p as de, c as Q } from "./confirmDialog-BP8hZPpX.mjs";
|
|
5
|
+
let M = null, v = null, m = null;
|
|
6
|
+
const P = [];
|
|
7
|
+
let I = !1, B = null, Z = 0, K = 0, R = 0, z = 0, O = 1, N = null;
|
|
8
|
+
const ee = '[data-theme="dark"], .dark, .editora-theme-dark', j = (t, e) => {
|
|
9
|
+
const r = (a) => {
|
|
10
|
+
a.key !== "Escape" || !t.isConnected || (a.preventDefault(), a.stopPropagation(), e());
|
|
9
11
|
};
|
|
10
12
|
return document.addEventListener("keydown", r, !0), () => {
|
|
11
13
|
document.removeEventListener("keydown", r, !0);
|
|
12
14
|
};
|
|
13
|
-
},
|
|
15
|
+
}, se = () => {
|
|
14
16
|
if (typeof document == "undefined" || document.getElementById("rte-media-dialog-styles")) return;
|
|
15
17
|
const t = document.createElement("style");
|
|
16
18
|
t.id = "rte-media-dialog-styles", t.textContent = `
|
|
@@ -22,7 +24,7 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
22
24
|
--rte-media-border: #d6dbe4;
|
|
23
25
|
--rte-media-surface: #f7f9fc;
|
|
24
26
|
--rte-media-surface-hover: #eef2f7;
|
|
25
|
-
--rte-media-accent: #
|
|
27
|
+
--rte-media-accent: #1560e8;
|
|
26
28
|
--rte-media-accent-hover: #165fd6;
|
|
27
29
|
--rte-media-danger: #dc3545;
|
|
28
30
|
--rte-media-danger-hover: #b92735;
|
|
@@ -50,7 +52,7 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
50
52
|
--rte-media-border: #49566c;
|
|
51
53
|
--rte-media-surface: #2a3444;
|
|
52
54
|
--rte-media-surface-hover: #344256;
|
|
53
|
-
--rte-media-accent: #
|
|
55
|
+
--rte-media-accent: #1f6feb;
|
|
54
56
|
--rte-media-accent-hover: #4598f4;
|
|
55
57
|
--rte-media-danger: #ff7b72;
|
|
56
58
|
--rte-media-danger-hover: #ff645b;
|
|
@@ -391,7 +393,7 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
391
393
|
}
|
|
392
394
|
|
|
393
395
|
.media-floating-toolbar.rte-ui-theme-dark,
|
|
394
|
-
${
|
|
396
|
+
${ee} .media-floating-toolbar {
|
|
395
397
|
--rte-media-toolbar-bg: #24303f;
|
|
396
398
|
--rte-media-toolbar-border: #4a5a71;
|
|
397
399
|
--rte-media-toolbar-text: #d9e6fb;
|
|
@@ -440,56 +442,70 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
440
442
|
background: var(--rte-media-toolbar-separator);
|
|
441
443
|
}
|
|
442
444
|
`, document.head.appendChild(t);
|
|
443
|
-
},
|
|
445
|
+
}, ce = () => {
|
|
444
446
|
const t = window.getSelection();
|
|
445
447
|
if (!t || t.rangeCount === 0) return null;
|
|
446
448
|
const e = t.anchorNode, r = e instanceof HTMLElement ? e : e == null ? void 0 : e.parentElement;
|
|
447
449
|
return (r == null ? void 0 : r.closest(".rte-content, .editora-content")) || null;
|
|
448
|
-
},
|
|
450
|
+
}, te = (t) => {
|
|
449
451
|
if (t) return t;
|
|
450
|
-
const e =
|
|
452
|
+
const e = ce();
|
|
451
453
|
if (e) return e;
|
|
452
|
-
if (
|
|
454
|
+
if (N) return N;
|
|
453
455
|
const r = document.activeElement;
|
|
454
456
|
return r ? r.closest(".rte-content, .editora-content") || r : null;
|
|
455
|
-
},
|
|
456
|
-
const e =
|
|
457
|
-
return e ? !!e.closest(
|
|
458
|
-
},
|
|
459
|
-
|
|
457
|
+
}, re = (t) => {
|
|
458
|
+
const e = te(t);
|
|
459
|
+
return e ? !!e.closest(ee) : !1;
|
|
460
|
+
}, U = (t) => {
|
|
461
|
+
se();
|
|
460
462
|
const e = document.createElement("div");
|
|
461
|
-
return
|
|
462
|
-
},
|
|
463
|
+
return ne(e), e.className = "rte-media-overlay", re(t) && e.classList.add("rte-ui-theme-dark"), e;
|
|
464
|
+
}, V = (t, e) => {
|
|
465
|
+
var r;
|
|
466
|
+
(r = t.querySelector(e === "upload" ? ".tab-upload" : ".tab-url")) == null || r.focus();
|
|
467
|
+
}, ae = (t, e) => {
|
|
468
|
+
t == null || t.addEventListener("keydown", (r) => {
|
|
469
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), e == null || e.click());
|
|
470
|
+
});
|
|
471
|
+
}, W = (t = !1) => {
|
|
463
472
|
const e = document.createElement("div");
|
|
464
473
|
return e.className = t ? "rte-media-dialog rte-media-dialog-compact" : "rte-media-dialog", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e;
|
|
465
|
-
},
|
|
466
|
-
document.querySelectorAll(".rte-media-overlay").forEach((
|
|
474
|
+
}, J = (t, e) => {
|
|
475
|
+
document.querySelectorAll(".rte-media-overlay").forEach((n) => n.remove());
|
|
467
476
|
const r = window.getSelection();
|
|
468
|
-
r && r.rangeCount > 0 && (
|
|
469
|
-
const
|
|
470
|
-
let
|
|
471
|
-
const
|
|
472
|
-
|
|
477
|
+
r && r.rangeCount > 0 && (M = r.getRangeAt(0).cloneRange());
|
|
478
|
+
const a = U(e), i = W();
|
|
479
|
+
let o = "upload", d = "", p = "", b = "", h = "";
|
|
480
|
+
const E = () => `
|
|
481
|
+
<div class="rte-media-field rte-media-preview-field">
|
|
482
|
+
<span class="rte-media-label">Preview</span>
|
|
483
|
+
<div class="rte-media-preview">
|
|
484
|
+
${t === "image" ? `<img src="${T(d)}" alt="Preview">` : `<video src="${T(d)}" controls></video>`}
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
`, y = () => {
|
|
488
|
+
i.innerHTML = `
|
|
473
489
|
<div class="rte-media-header">
|
|
474
490
|
<h2 class="rte-media-title">Insert ${t === "image" ? "Image" : "Video"}</h2>
|
|
475
491
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
476
492
|
</div>
|
|
477
493
|
|
|
478
|
-
<div class="rte-media-tabs">
|
|
479
|
-
<button class="tab-upload rte-media-tab ${
|
|
480
|
-
<button class="tab-url rte-media-tab ${
|
|
494
|
+
<div class="rte-media-tabs" role="tablist" aria-label="Where to get the ${t === "image" ? "image" : "video"} from">
|
|
495
|
+
<button class="tab-upload rte-media-tab ${o === "upload" ? "active" : ""}" type="button" role="tab" aria-selected="${o === "upload"}">Upload</button>
|
|
496
|
+
<button class="tab-url rte-media-tab ${o === "url" ? "active" : ""}" type="button" role="tab" aria-selected="${o === "url"}">URL</button>
|
|
481
497
|
</div>
|
|
482
498
|
|
|
483
499
|
<div class="rte-media-body">
|
|
484
|
-
${
|
|
500
|
+
${o === "upload" ? `
|
|
485
501
|
<div id="upload-section">
|
|
486
|
-
<div class="dropzone rte-media-dropzone">
|
|
487
|
-
<div class="rte-media-dropzone-icon">📁</div>
|
|
502
|
+
<div class="dropzone rte-media-dropzone" role="button" tabindex="0" aria-label="Drag and drop your ${t} here or click to browse. Max file size: 50MB">
|
|
503
|
+
<div class="rte-media-dropzone-icon" aria-hidden="true">📁</div>
|
|
488
504
|
<p class="rte-media-dropzone-title">Drag and drop your ${t} here</p>
|
|
489
505
|
<p class="rte-media-muted">or click to browse</p>
|
|
490
506
|
<p class="rte-media-hint">Max file size: 50MB</p>
|
|
491
507
|
</div>
|
|
492
|
-
<input type="file" id="file-input" accept="${t === "image" ? "image/*" : "video/*"}" style="display: none;">
|
|
508
|
+
<input type="file" id="file-input" aria-label="${t === "image" ? "Choose an image file" : "Choose a video file"}" accept="${t === "image" ? "image/*" : "video/*"}" style="display: none;">
|
|
493
509
|
<div id="upload-progress" class="rte-media-progress" style="display: none;">
|
|
494
510
|
<div class="rte-media-progress-track">
|
|
495
511
|
<div id="progress-bar" class="rte-media-progress-bar"></div>
|
|
@@ -500,113 +516,134 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
500
516
|
` : `
|
|
501
517
|
<div id="url-section">
|
|
502
518
|
<div class="rte-media-field">
|
|
503
|
-
<label class="rte-media-label">URL</label>
|
|
504
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${d}">
|
|
519
|
+
<label class="rte-media-label" for="url-input">URL</label>
|
|
520
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t === "image" ? "jpg" : "mp4"}" value="${T(d)}">
|
|
505
521
|
</div>
|
|
506
522
|
${t === "image" ? `
|
|
507
523
|
<div class="rte-media-field">
|
|
508
|
-
<label class="rte-media-label">Alt Text (for accessibility)</label>
|
|
509
|
-
<input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${
|
|
524
|
+
<label class="rte-media-label" for="alt-input">Alt Text (for accessibility)</label>
|
|
525
|
+
<input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${T(h)}">
|
|
510
526
|
</div>
|
|
511
527
|
` : ""}
|
|
512
528
|
<div class="rte-media-grid">
|
|
513
529
|
<div class="rte-media-field">
|
|
514
|
-
<label class="rte-media-label">Width (px)</label>
|
|
515
|
-
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${p}">
|
|
530
|
+
<label class="rte-media-label" for="width-input">Width (px)</label>
|
|
531
|
+
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${T(p)}">
|
|
516
532
|
</div>
|
|
517
533
|
<div class="rte-media-field">
|
|
518
|
-
<label class="rte-media-label">Height (px)</label>
|
|
519
|
-
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${
|
|
534
|
+
<label class="rte-media-label" for="height-input">Height (px)</label>
|
|
535
|
+
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${T(b)}">
|
|
520
536
|
</div>
|
|
521
537
|
</div>
|
|
522
|
-
${d ?
|
|
523
|
-
<div class="rte-media-field">
|
|
524
|
-
<label class="rte-media-label">Preview</label>
|
|
525
|
-
<div class="rte-media-preview">
|
|
526
|
-
${t === "image" ? `<img src="${d}" alt="Preview">` : `<video src="${d}" controls></video>`}
|
|
527
|
-
</div>
|
|
528
|
-
</div>
|
|
529
|
-
` : ""}
|
|
538
|
+
${d ? E() : ""}
|
|
530
539
|
</div>
|
|
531
540
|
`}
|
|
532
541
|
</div>
|
|
533
542
|
|
|
534
543
|
<div class="rte-media-footer">
|
|
535
544
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
536
|
-
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d &&
|
|
545
|
+
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d && o === "url" ? "disabled" : ""}>Insert</button>
|
|
537
546
|
</div>
|
|
538
547
|
`;
|
|
539
548
|
};
|
|
540
|
-
|
|
541
|
-
let
|
|
549
|
+
y(), a.appendChild(i), document.body.appendChild(a);
|
|
550
|
+
let L = () => {
|
|
542
551
|
};
|
|
543
|
-
const
|
|
544
|
-
|
|
552
|
+
const g = () => {
|
|
553
|
+
L(), a.parentNode && a.parentNode.removeChild(a);
|
|
545
554
|
};
|
|
546
|
-
|
|
547
|
-
const
|
|
555
|
+
L = j(a, g);
|
|
556
|
+
const k = () => {
|
|
557
|
+
var x, q, u, f, S;
|
|
548
558
|
if (!d) return;
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
559
|
+
const n = t === "image" ? document.createElement("img") : document.createElement("video");
|
|
560
|
+
n.src = d, n.setAttribute("data-media-type", t), t === "image" && h && (n.alt = h), p && (n.style.width = `${p}px`, n.setAttribute("width", p)), b && (n.style.height = `${b}px`, n.setAttribute("height", b)), t === "video" && (n.controls = !0), !p && !b ? n.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : n.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${p ? `width: ${p}px;` : "max-width: 100%;"} ${b ? `height: ${b}px;` : "height: auto;"}`;
|
|
561
|
+
const s = (f = (u = M ? (x = M.commonAncestorContainer instanceof HTMLElement ? M.commonAncestorContainer : M.commonAncestorContainer.parentElement) == null ? void 0 : x.closest('[contenteditable="true"]') : null) != null ? u : (q = te(e)) == null ? void 0 : q.closest('[contenteditable="true"]')) != null ? f : null, w = (S = s == null ? void 0 : s.innerHTML) != null ? S : "";
|
|
562
|
+
if (M && (s != null && s.contains(M.commonAncestorContainer)) ? (M.deleteContents(), M.insertNode(n)) : s && s.appendChild(n), g(), s && n.isConnected) {
|
|
563
|
+
s.focus({ preventScroll: !0 });
|
|
564
|
+
const C = window.getSelection();
|
|
565
|
+
if (C) {
|
|
566
|
+
const $ = document.createRange();
|
|
567
|
+
$.setStartAfter(n), $.collapse(!0), C.removeAllRanges(), C.addRange($);
|
|
568
|
+
}
|
|
569
|
+
le(s, w), s.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
570
|
+
}
|
|
571
|
+
}, c = async (n) => {
|
|
572
|
+
const s = i.querySelector("#upload-progress"), w = i.querySelector("#progress-bar"), x = i.querySelector("#progress-text");
|
|
573
|
+
if (s && w && x) {
|
|
574
|
+
s.style.display = "block";
|
|
575
|
+
let q = 0;
|
|
556
576
|
const u = setInterval(() => {
|
|
557
|
-
|
|
577
|
+
q += Math.random() * 30, q > 90 && (q = 90), w.style.width = `${q}%`;
|
|
558
578
|
}, 200);
|
|
559
579
|
try {
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
clearInterval(u),
|
|
563
|
-
d =
|
|
580
|
+
const f = new FileReader();
|
|
581
|
+
f.onload = () => {
|
|
582
|
+
clearInterval(u), w.style.width = "100%", x.textContent = "Upload complete", setTimeout(() => {
|
|
583
|
+
d = f.result, o = "url", y(), l();
|
|
564
584
|
}, 500);
|
|
565
|
-
},
|
|
566
|
-
} catch (
|
|
567
|
-
clearInterval(u),
|
|
585
|
+
}, f.readAsDataURL(n);
|
|
586
|
+
} catch (f) {
|
|
587
|
+
clearInterval(u), x.textContent = "Upload failed";
|
|
568
588
|
}
|
|
569
589
|
}
|
|
570
590
|
}, l = () => {
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
573
|
-
|
|
574
|
-
}),
|
|
575
|
-
|
|
576
|
-
}),
|
|
577
|
-
const u =
|
|
578
|
-
u == null || u.addEventListener("click", () =>
|
|
591
|
+
const n = i.querySelector(".close-btn"), s = i.querySelector(".cancel-btn"), w = i.querySelector("#insert-btn"), x = i.querySelector(".tab-upload"), q = i.querySelector(".tab-url");
|
|
592
|
+
if (n == null || n.addEventListener("click", g), s == null || s.addEventListener("click", g), w == null || w.addEventListener("click", k), x == null || x.addEventListener("click", () => {
|
|
593
|
+
o = "upload", y(), l(), V(i, o);
|
|
594
|
+
}), q == null || q.addEventListener("click", () => {
|
|
595
|
+
o = "url", y(), l(), V(i, o);
|
|
596
|
+
}), o === "upload") {
|
|
597
|
+
const u = i.querySelector(".dropzone"), f = i.querySelector("#file-input");
|
|
598
|
+
u == null || u.addEventListener("click", () => f == null ? void 0 : f.click()), ae(u, f), u == null || u.addEventListener("dragover", (S) => {
|
|
579
599
|
S.preventDefault(), u.classList.add("is-dragover");
|
|
580
600
|
}), u == null || u.addEventListener("dragleave", () => {
|
|
581
601
|
u.classList.remove("is-dragover");
|
|
582
602
|
}), u == null || u.addEventListener("drop", (S) => {
|
|
583
|
-
var
|
|
603
|
+
var $;
|
|
584
604
|
S.preventDefault(), u.classList.remove("is-dragover");
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
}),
|
|
588
|
-
var
|
|
589
|
-
const
|
|
590
|
-
|
|
605
|
+
const C = ($ = S.dataTransfer) == null ? void 0 : $.files[0];
|
|
606
|
+
C && c(C);
|
|
607
|
+
}), f == null || f.addEventListener("change", (S) => {
|
|
608
|
+
var $;
|
|
609
|
+
const C = ($ = S.target.files) == null ? void 0 : $[0];
|
|
610
|
+
C && c(C);
|
|
591
611
|
});
|
|
592
612
|
}
|
|
593
|
-
if (
|
|
594
|
-
const u =
|
|
613
|
+
if (o === "url") {
|
|
614
|
+
const u = i.querySelector("#url-input"), f = i.querySelector("#alt-input"), S = i.querySelector("#width-input"), C = i.querySelector("#height-input");
|
|
615
|
+
let $;
|
|
595
616
|
u == null || u.addEventListener("input", () => {
|
|
596
|
-
d = u.value
|
|
597
|
-
|
|
598
|
-
|
|
617
|
+
d = u.value;
|
|
618
|
+
const X = i.querySelector("#insert-btn");
|
|
619
|
+
X && (X.disabled = !d), clearTimeout($), $ = setTimeout(() => {
|
|
620
|
+
const H = i.querySelector("#url-section"), _ = H == null ? void 0 : H.querySelector(".rte-media-preview-field");
|
|
621
|
+
if (!H) return;
|
|
622
|
+
if (!d) {
|
|
623
|
+
_ == null || _.remove();
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (_) {
|
|
627
|
+
const Y = _.querySelector("img, video");
|
|
628
|
+
Y && Y.setAttribute("src", d);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
const F = H.querySelector(".rte-media-grid");
|
|
632
|
+
F == null || F.insertAdjacentHTML("afterend", E());
|
|
633
|
+
}, 400);
|
|
634
|
+
}), f == null || f.addEventListener("input", () => {
|
|
635
|
+
h = f.value;
|
|
599
636
|
}), S == null || S.addEventListener("input", () => {
|
|
600
637
|
p = S.value;
|
|
601
|
-
}),
|
|
602
|
-
|
|
638
|
+
}), C == null || C.addEventListener("input", () => {
|
|
639
|
+
b = C.value;
|
|
603
640
|
});
|
|
604
641
|
}
|
|
605
642
|
};
|
|
606
|
-
l(),
|
|
607
|
-
|
|
643
|
+
l(), a.addEventListener("click", (n) => {
|
|
644
|
+
n.target === a && g();
|
|
608
645
|
});
|
|
609
|
-
},
|
|
646
|
+
}, me = () => {
|
|
610
647
|
["nw", "ne", "sw", "se"].forEach((e) => {
|
|
611
648
|
const r = document.createElement("div");
|
|
612
649
|
r.className = `media-resize-handle-${e}`, r.style.cssText = `
|
|
@@ -620,25 +657,25 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
620
657
|
z-index: 10001;
|
|
621
658
|
display: none;
|
|
622
659
|
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
623
|
-
`, r.setAttribute("data-position", e), document.body.appendChild(r),
|
|
660
|
+
`, r.setAttribute("data-position", e), document.body.appendChild(r), P.push(r);
|
|
624
661
|
});
|
|
625
|
-
},
|
|
626
|
-
if (!
|
|
627
|
-
|
|
662
|
+
}, D = () => {
|
|
663
|
+
if (!v) {
|
|
664
|
+
P.forEach((r) => r.style.display = "none");
|
|
628
665
|
return;
|
|
629
666
|
}
|
|
630
|
-
const t =
|
|
667
|
+
const t = v.getBoundingClientRect(), e = {
|
|
631
668
|
nw: { x: t.left - 5, y: t.top - 5 },
|
|
632
669
|
ne: { x: t.right - 5, y: t.top - 5 },
|
|
633
670
|
sw: { x: t.left - 5, y: t.bottom - 5 },
|
|
634
671
|
se: { x: t.right - 5, y: t.bottom - 5 }
|
|
635
672
|
};
|
|
636
|
-
|
|
637
|
-
const
|
|
638
|
-
r.style.left = `${
|
|
673
|
+
P.forEach((r) => {
|
|
674
|
+
const a = r.getAttribute("data-position"), i = e[a];
|
|
675
|
+
r.style.left = `${i.x}px`, r.style.top = `${i.y}px`, r.style.display = "block";
|
|
639
676
|
});
|
|
640
|
-
},
|
|
641
|
-
const e =
|
|
677
|
+
}, ue = (t) => {
|
|
678
|
+
const e = U(t), r = W(!0);
|
|
642
679
|
r.innerHTML = `
|
|
643
680
|
<div class="rte-media-header">
|
|
644
681
|
<h2 class="rte-media-title">Edit Alt Text</h2>
|
|
@@ -646,7 +683,7 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
646
683
|
</div>
|
|
647
684
|
<div class="rte-media-body">
|
|
648
685
|
<label class="rte-media-label">Alternative Text (for accessibility)</label>
|
|
649
|
-
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${
|
|
686
|
+
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${T(t.alt || "")}</textarea>
|
|
650
687
|
<p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
|
|
651
688
|
</div>
|
|
652
689
|
<div class="rte-media-footer">
|
|
@@ -654,19 +691,19 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
654
691
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
655
692
|
</div>
|
|
656
693
|
`, e.appendChild(r), document.body.appendChild(e);
|
|
657
|
-
const
|
|
694
|
+
const a = r.querySelector("#alt-text-input"), i = r.querySelector(".close-btn"), o = r.querySelector(".cancel-btn"), d = r.querySelector(".save-btn");
|
|
658
695
|
let p = () => {
|
|
659
696
|
};
|
|
660
|
-
const
|
|
697
|
+
const b = () => {
|
|
661
698
|
p(), e.parentNode && e.parentNode.removeChild(e);
|
|
662
699
|
};
|
|
663
|
-
p =
|
|
664
|
-
|
|
700
|
+
p = j(e, b), i.addEventListener("click", b), o.addEventListener("click", b), e.addEventListener("click", (h) => {
|
|
701
|
+
h.target === e && b();
|
|
665
702
|
}), d.addEventListener("click", () => {
|
|
666
|
-
t.alt =
|
|
667
|
-
}),
|
|
668
|
-
},
|
|
669
|
-
const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "",
|
|
703
|
+
t.alt = a.value, b();
|
|
704
|
+
}), a.focus(), a.select();
|
|
705
|
+
}, pe = (t) => {
|
|
706
|
+
const e = t.closest("a"), r = (e == null ? void 0 : e.getAttribute("href")) || "", a = (e == null ? void 0 : e.getAttribute("target")) || "_self", i = (e == null ? void 0 : e.getAttribute("title")) || "", o = U(t), d = W(!0);
|
|
670
707
|
d.innerHTML = `
|
|
671
708
|
<div class="rte-media-header">
|
|
672
709
|
<h2 class="rte-media-title">${e ? "Edit Link" : "Add Link"}</h2>
|
|
@@ -675,14 +712,14 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
675
712
|
<div class="rte-media-body">
|
|
676
713
|
<div class="rte-media-field">
|
|
677
714
|
<label class="rte-media-label">URL</label>
|
|
678
|
-
<input id="link-url" type="url" class="rte-media-input" value="${
|
|
715
|
+
<input id="link-url" type="url" class="rte-media-input" value="${T(r)}" placeholder="https://example.com" />
|
|
679
716
|
</div>
|
|
680
717
|
<div class="rte-media-field">
|
|
681
718
|
<label class="rte-media-label">Title (tooltip)</label>
|
|
682
|
-
<input id="link-title" type="text" class="rte-media-input" value="${
|
|
719
|
+
<input id="link-title" type="text" class="rte-media-input" value="${T(i)}" placeholder="Optional tooltip text" />
|
|
683
720
|
</div>
|
|
684
721
|
<label class="rte-media-checkbox-label">
|
|
685
|
-
<input id="link-target" type="checkbox" ${
|
|
722
|
+
<input id="link-target" type="checkbox" ${a === "_blank" ? "checked" : ""} />
|
|
686
723
|
Open in new window/tab
|
|
687
724
|
</label>
|
|
688
725
|
</div>
|
|
@@ -693,54 +730,59 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
693
730
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
694
731
|
</div>
|
|
695
732
|
</div>
|
|
696
|
-
`,
|
|
697
|
-
const p = d.querySelector("#link-url"),
|
|
698
|
-
let
|
|
733
|
+
`, o.appendChild(d), document.body.appendChild(o);
|
|
734
|
+
const p = d.querySelector("#link-url"), b = d.querySelector("#link-title"), h = d.querySelector("#link-target"), E = d.querySelector(".close-btn"), y = d.querySelector(".cancel-btn"), L = d.querySelector(".save-btn"), g = d.querySelector(".remove-link-btn");
|
|
735
|
+
let k = () => {
|
|
699
736
|
};
|
|
700
|
-
const
|
|
701
|
-
|
|
737
|
+
const c = () => {
|
|
738
|
+
k(), o.parentNode && o.parentNode.removeChild(o);
|
|
702
739
|
};
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}),
|
|
706
|
-
const
|
|
707
|
-
if (
|
|
708
|
-
const
|
|
740
|
+
k = j(o, c), E.addEventListener("click", c), y.addEventListener("click", c), o.addEventListener("click", (l) => {
|
|
741
|
+
l.target === o && c();
|
|
742
|
+
}), L.addEventListener("click", () => {
|
|
743
|
+
const l = p.value.trim();
|
|
744
|
+
if (l) {
|
|
745
|
+
const n = l.startsWith("http") ? l : `https://${l}`;
|
|
709
746
|
if (e)
|
|
710
|
-
e.setAttribute("href",
|
|
747
|
+
e.setAttribute("href", n), e.setAttribute("target", h.checked ? "_blank" : "_self"), h.checked ? e.setAttribute("rel", "noopener noreferrer") : e.removeAttribute("rel"), b.value.trim() ? e.setAttribute("title", b.value.trim()) : e.removeAttribute("title");
|
|
711
748
|
else {
|
|
712
|
-
const
|
|
713
|
-
|
|
749
|
+
const s = document.createElement("a");
|
|
750
|
+
s.href = n, s.target = h.checked ? "_blank" : "_self", h.checked && (s.rel = "noopener noreferrer"), b.value.trim() && (s.title = b.value.trim()), t.replaceWith(s), s.appendChild(t);
|
|
714
751
|
}
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
}),
|
|
718
|
-
e
|
|
752
|
+
c(), m && v && G(v);
|
|
753
|
+
}
|
|
754
|
+
}), g == null || g.addEventListener("click", async () => {
|
|
755
|
+
!e || !await Q("Remove link from this media?", {
|
|
756
|
+
title: "Remove link",
|
|
757
|
+
confirmText: "Remove link",
|
|
758
|
+
danger: !0,
|
|
759
|
+
context: t
|
|
760
|
+
}) || !e.isConnected || (e.replaceWith(t), c(), m && v && G(v));
|
|
719
761
|
}), p.focus();
|
|
720
|
-
},
|
|
721
|
-
const e =
|
|
722
|
-
let
|
|
723
|
-
const
|
|
762
|
+
}, be = (t) => {
|
|
763
|
+
const e = U(t), r = W();
|
|
764
|
+
let a = "url", i = t.src;
|
|
765
|
+
const o = () => {
|
|
724
766
|
r.innerHTML = `
|
|
725
767
|
<div class="rte-media-header">
|
|
726
768
|
<h2 class="rte-media-title">Replace Image</h2>
|
|
727
769
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
728
770
|
</div>
|
|
729
771
|
|
|
730
|
-
<div class="rte-media-tabs">
|
|
731
|
-
<button class="tab-upload rte-media-tab ${
|
|
732
|
-
<button class="tab-url rte-media-tab ${
|
|
772
|
+
<div class="rte-media-tabs" role="tablist" aria-label="Where to get the image from">
|
|
773
|
+
<button class="tab-upload rte-media-tab ${a === "upload" ? "active" : ""}" type="button" role="tab" aria-selected="${a === "upload"}">Upload</button>
|
|
774
|
+
<button class="tab-url rte-media-tab ${a === "url" ? "active" : ""}" type="button" role="tab" aria-selected="${a === "url"}">URL</button>
|
|
733
775
|
</div>
|
|
734
776
|
|
|
735
777
|
<div class="rte-media-body">
|
|
736
|
-
${
|
|
778
|
+
${a === "upload" ? `
|
|
737
779
|
<div id="upload-section">
|
|
738
|
-
<div class="dropzone rte-media-dropzone">
|
|
739
|
-
<div class="rte-media-dropzone-icon">📁</div>
|
|
780
|
+
<div class="dropzone rte-media-dropzone" role="button" tabindex="0" aria-label="Drag and drop your image here or click to browse">
|
|
781
|
+
<div class="rte-media-dropzone-icon" aria-hidden="true">📁</div>
|
|
740
782
|
<p class="rte-media-dropzone-title">Drag and drop your image here</p>
|
|
741
783
|
<p class="rte-media-muted">or click to browse</p>
|
|
742
784
|
</div>
|
|
743
|
-
<input type="file" id="file-input" accept="image/*" style="display: none;">
|
|
785
|
+
<input type="file" id="file-input" aria-label="Choose an image file" accept="image/*" style="display: none;">
|
|
744
786
|
<div id="upload-progress" class="rte-media-progress" style="display: none;">
|
|
745
787
|
<div class="rte-media-progress-track">
|
|
746
788
|
<div id="progress-bar" class="rte-media-progress-bar"></div>
|
|
@@ -751,14 +793,14 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
751
793
|
` : `
|
|
752
794
|
<div id="url-section">
|
|
753
795
|
<div class="rte-media-field">
|
|
754
|
-
<label class="rte-media-label">Image URL</label>
|
|
755
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${
|
|
796
|
+
<label class="rte-media-label" for="url-input">Image URL</label>
|
|
797
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${T(i)}">
|
|
756
798
|
</div>
|
|
757
|
-
${
|
|
799
|
+
${i ? `
|
|
758
800
|
<div class="rte-media-field">
|
|
759
|
-
<
|
|
801
|
+
<span class="rte-media-label">Preview</span>
|
|
760
802
|
<div class="rte-media-preview">
|
|
761
|
-
<img src="${
|
|
803
|
+
<img src="${T(i)}" alt="Preview" onerror="this.parentElement.innerHTML='<p class="rte-media-muted">Failed to load image</p>'">
|
|
762
804
|
</div>
|
|
763
805
|
</div>
|
|
764
806
|
` : ""}
|
|
@@ -768,88 +810,95 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
768
810
|
|
|
769
811
|
<div class="rte-media-footer">
|
|
770
812
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
771
|
-
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!
|
|
813
|
+
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!i && a === "url" ? "disabled" : ""}>Replace</button>
|
|
772
814
|
</div>
|
|
773
815
|
`;
|
|
774
816
|
};
|
|
775
|
-
|
|
817
|
+
o(), e.appendChild(r), document.body.appendChild(e);
|
|
776
818
|
let d = () => {
|
|
777
819
|
};
|
|
778
820
|
const p = () => {
|
|
779
821
|
d(), e.parentNode && e.parentNode.removeChild(e);
|
|
780
822
|
};
|
|
781
|
-
d =
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
},
|
|
785
|
-
const
|
|
786
|
-
if (
|
|
787
|
-
|
|
788
|
-
let
|
|
789
|
-
const
|
|
790
|
-
|
|
823
|
+
d = j(e, p);
|
|
824
|
+
const b = () => {
|
|
825
|
+
i && (t.src = i, p());
|
|
826
|
+
}, h = async (y) => {
|
|
827
|
+
const L = r.querySelector("#upload-progress"), g = r.querySelector("#progress-bar"), k = r.querySelector("#progress-text");
|
|
828
|
+
if (L && g && k) {
|
|
829
|
+
L.style.display = "block";
|
|
830
|
+
let c = 0;
|
|
831
|
+
const l = setInterval(() => {
|
|
832
|
+
c += Math.random() * 30, c > 90 && (c = 90), g.style.width = `${c}%`;
|
|
791
833
|
}, 200);
|
|
792
834
|
try {
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
clearInterval(
|
|
796
|
-
|
|
835
|
+
const n = new FileReader();
|
|
836
|
+
n.onload = () => {
|
|
837
|
+
clearInterval(l), g.style.width = "100%", k.textContent = "Upload complete", setTimeout(() => {
|
|
838
|
+
i = n.result, a = "url", o(), E();
|
|
797
839
|
}, 500);
|
|
798
|
-
},
|
|
799
|
-
} catch (
|
|
800
|
-
clearInterval(
|
|
840
|
+
}, n.readAsDataURL(y);
|
|
841
|
+
} catch (n) {
|
|
842
|
+
clearInterval(l), k.textContent = "Upload failed";
|
|
801
843
|
}
|
|
802
844
|
}
|
|
803
|
-
},
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
}),
|
|
808
|
-
|
|
809
|
-
}),
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}),
|
|
814
|
-
|
|
815
|
-
}),
|
|
816
|
-
var
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
}),
|
|
821
|
-
var
|
|
822
|
-
const
|
|
823
|
-
|
|
845
|
+
}, E = () => {
|
|
846
|
+
const y = r.querySelector(".close-btn"), L = r.querySelector(".cancel-btn"), g = r.querySelector("#replace-btn"), k = r.querySelector(".tab-upload"), c = r.querySelector(".tab-url");
|
|
847
|
+
if (y == null || y.addEventListener("click", p), L == null || L.addEventListener("click", p), g == null || g.addEventListener("click", b), k == null || k.addEventListener("click", () => {
|
|
848
|
+
a = "upload", o(), E(), V(r, a);
|
|
849
|
+
}), c == null || c.addEventListener("click", () => {
|
|
850
|
+
a = "url", o(), E(), V(r, a);
|
|
851
|
+
}), a === "upload") {
|
|
852
|
+
const l = r.querySelector(".dropzone"), n = r.querySelector("#file-input");
|
|
853
|
+
l == null || l.addEventListener("click", () => n == null ? void 0 : n.click()), ae(l, n), l == null || l.addEventListener("dragover", (s) => {
|
|
854
|
+
s.preventDefault(), l.classList.add("is-dragover");
|
|
855
|
+
}), l == null || l.addEventListener("dragleave", () => {
|
|
856
|
+
l.classList.remove("is-dragover");
|
|
857
|
+
}), l == null || l.addEventListener("drop", (s) => {
|
|
858
|
+
var x;
|
|
859
|
+
s.preventDefault(), l.classList.remove("is-dragover");
|
|
860
|
+
const w = (x = s.dataTransfer) == null ? void 0 : x.files[0];
|
|
861
|
+
w && h(w);
|
|
862
|
+
}), n == null || n.addEventListener("change", (s) => {
|
|
863
|
+
var x;
|
|
864
|
+
const w = (x = s.target.files) == null ? void 0 : x[0];
|
|
865
|
+
w && h(w);
|
|
824
866
|
});
|
|
825
867
|
}
|
|
826
|
-
if (
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
|
|
868
|
+
if (a === "url") {
|
|
869
|
+
const l = r.querySelector("#url-input");
|
|
870
|
+
l == null || l.addEventListener("input", () => {
|
|
871
|
+
i = l.value;
|
|
872
|
+
const n = r.querySelector("#replace-btn");
|
|
873
|
+
n && (n.disabled = !i);
|
|
830
874
|
});
|
|
831
875
|
}
|
|
832
876
|
};
|
|
833
|
-
|
|
834
|
-
|
|
877
|
+
E(), e.addEventListener("click", (y) => {
|
|
878
|
+
y.target === e && p();
|
|
835
879
|
});
|
|
836
|
-
},
|
|
837
|
-
if (!
|
|
838
|
-
const t =
|
|
839
|
-
|
|
840
|
-
|
|
880
|
+
}, A = () => {
|
|
881
|
+
if (!m || !v) return;
|
|
882
|
+
const t = m.offsetHeight || 40, e = m.offsetWidth || 120, r = m.parentElement || v, a = r.getBoundingClientRect(), i = v.getBoundingClientRect(), o = i.top - a.top - r.clientTop + r.scrollTop, d = i.left - a.left - r.clientLeft + r.scrollLeft, p = v.closest('[contenteditable="true"]'), h = (p ? i.top - p.getBoundingClientRect().top - t - 8 : 1) < 0 ? o + i.height + 8 : o - t - 8, E = d + i.width / 2 - e / 2;
|
|
883
|
+
m.style.top = `${h}px`, m.style.left = `${E}px`, setTimeout(() => {
|
|
884
|
+
m && (m.style.display = "flex");
|
|
841
885
|
}, 100);
|
|
842
|
-
},
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
886
|
+
}, ie = (t) => {
|
|
887
|
+
let e = t.parentElement;
|
|
888
|
+
for (; e && e.parentElement && getComputedStyle(e).display === "inline"; )
|
|
889
|
+
e = e.parentElement;
|
|
890
|
+
return e;
|
|
891
|
+
}, G = (t) => {
|
|
892
|
+
var p, b, h, E, y, L, g, k;
|
|
893
|
+
m && (m._cleanup && m._cleanup(), m.remove());
|
|
894
|
+
const e = ie(t);
|
|
846
895
|
if (e) {
|
|
847
|
-
const
|
|
848
|
-
(!
|
|
896
|
+
const c = e.style.position;
|
|
897
|
+
(!c || c === "static") && (e.style.position = "relative", e._originalPosition = c), m = document.createElement("div"), m.className = "media-floating-toolbar", re(t) && m.classList.add("rte-ui-theme-dark"), e.insertBefore(m, e.firstChild), A();
|
|
849
898
|
}
|
|
850
|
-
const r =
|
|
899
|
+
const r = m;
|
|
851
900
|
if (!r) return;
|
|
852
|
-
const
|
|
901
|
+
const a = t.tagName === "IMG", i = t.closest("a");
|
|
853
902
|
r.innerHTML = `
|
|
854
903
|
<button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
|
|
855
904
|
<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>
|
|
@@ -861,14 +910,14 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
861
910
|
<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>
|
|
862
911
|
</button>
|
|
863
912
|
<div class="media-floating-toolbar-separator" aria-hidden="true"></div>
|
|
864
|
-
${
|
|
913
|
+
${a ? `
|
|
865
914
|
<button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
|
|
866
915
|
<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>
|
|
867
916
|
</button>` : ""}
|
|
868
|
-
<button class="media-floating-toolbar-btn btn-link" title="${
|
|
917
|
+
<button class="media-floating-toolbar-btn btn-link" title="${i ? "Edit/Remove Link" : "Add Link"}" type="button">
|
|
869
918
|
<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>
|
|
870
919
|
</button>
|
|
871
|
-
${
|
|
920
|
+
${a ? `
|
|
872
921
|
<button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
|
|
873
922
|
<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>
|
|
874
923
|
</button>` : ""}
|
|
@@ -877,94 +926,104 @@ const O = '[data-theme="dark"], .dark, .editora-theme-dark', I = (t, e) => {
|
|
|
877
926
|
<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>
|
|
878
927
|
</button>
|
|
879
928
|
`, setTimeout(() => {
|
|
880
|
-
|
|
929
|
+
A();
|
|
881
930
|
}, 0);
|
|
882
|
-
const
|
|
931
|
+
const o = () => A();
|
|
883
932
|
let d = t.parentElement;
|
|
884
933
|
for (; d; )
|
|
885
|
-
d.addEventListener("scroll",
|
|
886
|
-
window.addEventListener("scroll",
|
|
887
|
-
let
|
|
888
|
-
for (;
|
|
889
|
-
|
|
890
|
-
window.removeEventListener("scroll",
|
|
934
|
+
d.addEventListener("scroll", o), d = d.parentElement;
|
|
935
|
+
window.addEventListener("scroll", o), window.addEventListener("resize", o), r._cleanup = () => {
|
|
936
|
+
let c = t.parentElement;
|
|
937
|
+
for (; c; )
|
|
938
|
+
c.removeEventListener("scroll", o), c = c.parentElement;
|
|
939
|
+
window.removeEventListener("scroll", o), window.removeEventListener("resize", o);
|
|
891
940
|
}, (p = r.querySelector(".btn-align-left")) == null || p.addEventListener("click", () => {
|
|
892
|
-
t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto",
|
|
893
|
-
}), (
|
|
894
|
-
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto",
|
|
895
|
-
}), (
|
|
896
|
-
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0",
|
|
897
|
-
}), (
|
|
898
|
-
t.tagName === "IMG" &&
|
|
899
|
-
}), (
|
|
900
|
-
|
|
901
|
-
}), (
|
|
902
|
-
t.tagName === "IMG" &&
|
|
903
|
-
}), (
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
t.
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
941
|
+
t.style.display = "block", t.style.marginLeft = "0", t.style.marginRight = "auto", A();
|
|
942
|
+
}), (b = r.querySelector(".btn-align-center")) == null || b.addEventListener("click", () => {
|
|
943
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "auto", A();
|
|
944
|
+
}), (h = r.querySelector(".btn-align-right")) == null || h.addEventListener("click", () => {
|
|
945
|
+
t.style.display = "block", t.style.marginLeft = "auto", t.style.marginRight = "0", A();
|
|
946
|
+
}), (E = r.querySelector(".btn-alt")) == null || E.addEventListener("click", () => {
|
|
947
|
+
t.tagName === "IMG" && ue(t);
|
|
948
|
+
}), (y = r.querySelector(".btn-link")) == null || y.addEventListener("click", () => {
|
|
949
|
+
pe(t);
|
|
950
|
+
}), (L = r.querySelector(".btn-replace")) == null || L.addEventListener("click", () => {
|
|
951
|
+
t.tagName === "IMG" && be(t);
|
|
952
|
+
}), (g = r.querySelector(".btn-resize")) == null || g.addEventListener("click", async () => {
|
|
953
|
+
const c = await de("Enter width in pixels:", {
|
|
954
|
+
title: "Resize",
|
|
955
|
+
label: "Width (px)",
|
|
956
|
+
initialValue: String(t.width || t.offsetWidth),
|
|
957
|
+
inputMode: "numeric",
|
|
958
|
+
confirmText: "Resize",
|
|
959
|
+
context: t,
|
|
960
|
+
validate: (n) => /^\s*\d+\s*$/.test(n) && parseInt(n, 10) > 0 ? null : "Enter a whole number of pixels, such as 480."
|
|
961
|
+
});
|
|
962
|
+
if (c === null) return;
|
|
963
|
+
const l = parseInt(c, 10);
|
|
964
|
+
t.style.width = `${l}px`, t.setAttribute("width", String(l)), D(), A();
|
|
965
|
+
}), (k = r.querySelector(".btn-remove")) == null || k.addEventListener("click", async () => {
|
|
966
|
+
await Q("Remove this media?", {
|
|
967
|
+
title: "Remove media",
|
|
968
|
+
confirmText: "Remove",
|
|
969
|
+
danger: !0,
|
|
970
|
+
context: t
|
|
971
|
+
}) && (t.remove(), m && (m._cleanup && m._cleanup(), m.remove(), m = null), v = null, D());
|
|
911
972
|
}), r._cleanup = () => {
|
|
912
|
-
window.removeEventListener("scroll",
|
|
973
|
+
window.removeEventListener("scroll", A), window.removeEventListener("resize", A);
|
|
913
974
|
};
|
|
914
|
-
},
|
|
915
|
-
|
|
975
|
+
}, oe = (t) => {
|
|
976
|
+
N = t || null, me(), document.addEventListener("click", (e) => {
|
|
916
977
|
const r = e.target;
|
|
917
978
|
if (r.tagName === "IMG" || r.tagName === "VIDEO") {
|
|
918
|
-
const
|
|
919
|
-
let
|
|
920
|
-
if (
|
|
921
|
-
e.preventDefault(), e.stopPropagation(),
|
|
979
|
+
const a = r;
|
|
980
|
+
let i = !1;
|
|
981
|
+
if (N ? i = N.contains(a) : i = !!a.closest('[contenteditable="true"]'), i) {
|
|
982
|
+
e.preventDefault(), e.stopPropagation(), v = a, v.style.display = "block", G(a), D();
|
|
922
983
|
return;
|
|
923
984
|
}
|
|
924
985
|
}
|
|
925
|
-
if (!r.closest(".btn-link, .btn-resize, .btn-remove") &&
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
m = null, z();
|
|
986
|
+
if (!r.closest(".btn-link, .btn-resize, .btn-remove") && m && !r.closest("button")) {
|
|
987
|
+
m._cleanup && m._cleanup(), m.remove(), m = null;
|
|
988
|
+
const a = v && ie(v);
|
|
989
|
+
a && a._originalPosition !== void 0 && (a.style.position = a._originalPosition, delete a._originalPosition), v = null, D();
|
|
931
990
|
}
|
|
932
|
-
}),
|
|
991
|
+
}), P.forEach((e) => {
|
|
933
992
|
e.addEventListener("mousedown", (r) => {
|
|
934
|
-
if (!
|
|
935
|
-
r.preventDefault(), r.stopPropagation(),
|
|
936
|
-
const
|
|
937
|
-
|
|
993
|
+
if (!v) return;
|
|
994
|
+
r.preventDefault(), r.stopPropagation(), I = !0, B = e.getAttribute("data-position"), Z = r.clientX, K = r.clientY;
|
|
995
|
+
const a = v.getBoundingClientRect();
|
|
996
|
+
R = a.width, z = a.height, O = R / z, document.body.style.userSelect = "none", document.body.style.cursor = `${B}-resize`;
|
|
938
997
|
});
|
|
939
998
|
}), document.addEventListener("mousemove", (e) => {
|
|
940
|
-
if (!
|
|
941
|
-
const r = e.clientX -
|
|
942
|
-
let
|
|
943
|
-
switch (
|
|
999
|
+
if (!I || !v || !B) return;
|
|
1000
|
+
const r = e.clientX - Z, a = e.clientY - K;
|
|
1001
|
+
let i = R, o = z;
|
|
1002
|
+
switch (B) {
|
|
944
1003
|
case "se":
|
|
945
|
-
|
|
1004
|
+
i = R + r, o = z + a;
|
|
946
1005
|
break;
|
|
947
1006
|
case "sw":
|
|
948
|
-
|
|
1007
|
+
i = R - r, o = z + a;
|
|
949
1008
|
break;
|
|
950
1009
|
case "ne":
|
|
951
|
-
|
|
1010
|
+
i = R + r, o = z - a;
|
|
952
1011
|
break;
|
|
953
1012
|
case "nw":
|
|
954
|
-
|
|
1013
|
+
i = R - r, o = z - a;
|
|
955
1014
|
break;
|
|
956
1015
|
}
|
|
957
|
-
Math.abs(r) > Math.abs(
|
|
1016
|
+
Math.abs(r) > Math.abs(a) ? o = i / O : i = o * O, i = Math.max(50, i), o = Math.max(50, o), v.style.width = `${i}px`, v.style.height = `${o}px`, v.setAttribute("width", String(Math.round(i))), v.setAttribute("height", String(Math.round(o))), D(), A();
|
|
958
1017
|
}), document.addEventListener("mouseup", () => {
|
|
959
|
-
|
|
960
|
-
}), window.addEventListener("scroll",
|
|
1018
|
+
I && (I = !1, B = null, document.body.style.userSelect = "", document.body.style.cursor = "");
|
|
1019
|
+
}), window.addEventListener("scroll", D), window.addEventListener("resize", D);
|
|
961
1020
|
};
|
|
962
|
-
typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0,
|
|
963
|
-
const
|
|
1021
|
+
typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, oe());
|
|
1022
|
+
const ye = () => ({
|
|
964
1023
|
name: "image",
|
|
965
1024
|
initialize: (t) => {
|
|
966
1025
|
const e = t == null ? void 0 : t.editorElement;
|
|
967
|
-
|
|
1026
|
+
oe(e);
|
|
968
1027
|
},
|
|
969
1028
|
toolbar: [
|
|
970
1029
|
{
|
|
@@ -981,11 +1040,11 @@ const oe = () => ({
|
|
|
981
1040
|
commands: {
|
|
982
1041
|
insertImage: (t, e) => {
|
|
983
1042
|
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
984
|
-
return
|
|
1043
|
+
return J("image", r), !0;
|
|
985
1044
|
},
|
|
986
1045
|
insertVideo: (t, e) => {
|
|
987
1046
|
const r = (e == null ? void 0 : e.contentElement) instanceof HTMLElement ? e.contentElement : void 0;
|
|
988
|
-
return
|
|
1047
|
+
return J("video", r), !0;
|
|
989
1048
|
}
|
|
990
1049
|
},
|
|
991
1050
|
keymap: {
|
|
@@ -993,6 +1052,6 @@ const oe = () => ({
|
|
|
993
1052
|
}
|
|
994
1053
|
});
|
|
995
1054
|
export {
|
|
996
|
-
|
|
1055
|
+
ye as MediaManagerPlugin
|
|
997
1056
|
};
|
|
998
|
-
//# sourceMappingURL=MediaManagerPlugin.native-
|
|
1057
|
+
//# sourceMappingURL=MediaManagerPlugin.native-CRi24Mrb.mjs.map
|