@editora/core 1.0.3 → 1.0.5
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 +34 -0
- package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
- package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
- package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
- package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-B263UI8O.mjs} +624 -473
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +384 -0
- package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
- package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
- package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
- package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
- package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
- package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
- package/dist/HistoryPlugin.native-TDnVMsEO.mjs +257 -0
- package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
- package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
- package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
- package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
- package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
- package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +419 -0
- package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
- package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
- package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
- package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
- package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
- package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
- package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
- package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
- package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
- package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
- package/dist/core.css +1 -1
- package/dist/editora.min.js +31 -29
- package/dist/editora.umd.js +31 -29
- package/dist/index-CqWQFb3D.js +10 -0
- package/dist/index-OwnkG39N.mjs +2227 -0
- package/dist/index.cjs.js +14 -18
- package/dist/index.esm.js +204 -521
- package/dist/plugin-loader.js +26 -26
- package/dist/webcomponent-core.js +1286 -295
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +111 -78
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +1252 -261
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3552 -2037
- package/index.d.ts +355 -0
- package/package.json +21 -18
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
- package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
- package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
- package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
- package/dist/documentManager-irzj9n3V.mjs.map +0 -1
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
- package/dist/editora.min.js.map +0 -1
- package/dist/editora.umd.js.map +0 -1
- package/dist/index-BF5RBhL9.js +0 -4
- package/dist/index-BF5RBhL9.js.map +0 -1
- package/dist/index-BPsf460l.mjs +0 -1243
- package/dist/index-BPsf460l.mjs.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es-CuicffkQ.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin-loader.js.map +0 -1
- package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
- package/dist/webcomponent-core.js.map +0 -1
- package/dist/webcomponent-core.min.js.map +0 -1
- package/dist/webcomponent.cjs.js.map +0 -1
- package/dist/webcomponent.esm.js.map +0 -1
- package/dist/webcomponent.js.map +0 -1
- package/dist/webcomponent.min.js.map +0 -1
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
let A = null, p = null, s = null, R = [], M = !1, T = null, I = 0, j = 0, $ = 0, S = 0, D = 1, _ = null;
|
|
2
|
-
const V = (i) => {
|
|
3
|
-
const t = window.getSelection();
|
|
4
|
-
t && t.rangeCount > 0 && (A = t.getRangeAt(0).cloneRange());
|
|
5
|
-
const e = document.createElement("div");
|
|
6
|
-
e.style.cssText = "position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 99999;";
|
|
7
|
-
const o = document.createElement("div");
|
|
8
|
-
o.style.cssText = "background: white; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);";
|
|
9
|
-
let r = "upload", l = "", c = "", b = "", y = "";
|
|
10
|
-
const f = () => {
|
|
11
|
-
o.innerHTML = `
|
|
12
|
-
<div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
13
|
-
<h2 style="margin: 0; font-size: 18px; font-weight: 600;">Insert ${i === "image" ? "Image" : "Video"}</h2>
|
|
14
|
-
<button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: #6c757d; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div class="tabs" style="display: flex; border-bottom: 1px solid #e1e5e9;">
|
|
18
|
-
<button class="tab-upload" style="flex: 1; padding: 12px; border: none; background: ${r === "upload" ? "#007bff" : "#f8f9fa"}; color: ${r === "upload" ? "white" : "#495057"}; cursor: pointer; font-weight: 500;">📤 Upload</button>
|
|
19
|
-
<button class="tab-url" style="flex: 1; padding: 12px; border: none; background: ${r === "url" ? "#007bff" : "#f8f9fa"}; color: ${r === "url" ? "white" : "#495057"}; cursor: pointer; font-weight: 500;">🔗 URL</button>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div style="padding: 20px; overflow-y: auto; flex: 1;">
|
|
23
|
-
${r === "upload" ? `
|
|
24
|
-
<div id="upload-section">
|
|
25
|
-
<div class="dropzone" style="border: 2px dashed #ced4da; border-radius: 8px; padding: 40px; text-align: center; cursor: pointer; transition: all 0.3s;">
|
|
26
|
-
<div style="font-size: 48px; margin-bottom: 10px;">📁</div>
|
|
27
|
-
<p style="margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">Drag and drop your ${i} here</p>
|
|
28
|
-
<p style="margin: 0 0 8px 0; color: #6c757d; font-size: 14px;">or click to browse</p>
|
|
29
|
-
<p style="margin: 0; color: #6c757d; font-size: 12px;">Max file size: 50MB</p>
|
|
30
|
-
</div>
|
|
31
|
-
<input type="file" id="file-input" accept="${i === "image" ? "image/*" : "video/*"}" style="display: none;">
|
|
32
|
-
<div id="upload-progress" style="display: none; margin-top: 20px;">
|
|
33
|
-
<div style="background: #e9ecef; border-radius: 4px; height: 8px; overflow: hidden;">
|
|
34
|
-
<div id="progress-bar" style="background: #007bff; height: 100%; width: 0%; transition: width 0.3s;"></div>
|
|
35
|
-
</div>
|
|
36
|
-
<p id="progress-text" style="margin-top: 8px; text-align: center; color: #6c757d; font-size: 14px;">Uploading...</p>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
` : `
|
|
40
|
-
<div id="url-section">
|
|
41
|
-
<div style="margin-bottom: 20px;">
|
|
42
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">URL:</label>
|
|
43
|
-
<input type="text" id="url-input" placeholder="https://example.com/${i}.${i === "image" ? "jpg" : "mp4"}" value="${l}" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;">
|
|
44
|
-
</div>
|
|
45
|
-
${i === "image" ? `
|
|
46
|
-
<div style="margin-bottom: 20px;">
|
|
47
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Alt Text (for accessibility):</label>
|
|
48
|
-
<input type="text" id="alt-input" placeholder="Describe the image" value="${y}" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;">
|
|
49
|
-
</div>
|
|
50
|
-
` : ""}
|
|
51
|
-
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px;">
|
|
52
|
-
<div>
|
|
53
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Width (px):</label>
|
|
54
|
-
<input type="number" id="width-input" placeholder="Auto" value="${c}" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;">
|
|
55
|
-
</div>
|
|
56
|
-
<div>
|
|
57
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Height (px):</label>
|
|
58
|
-
<input type="number" id="height-input" placeholder="Auto" value="${b}" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;">
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
${l ? `
|
|
62
|
-
<div style="margin-bottom: 20px;">
|
|
63
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Preview:</label>
|
|
64
|
-
<div style="border: 1px solid #dee2e6; border-radius: 4px; padding: 10px; background: #f8f9fa; text-align: center;">
|
|
65
|
-
${i === "image" ? `<img src="${l}" alt="Preview" style="max-width: 100%; max-height: 200px;">` : `<video src="${l}" controls style="max-width: 100%; max-height: 200px;"></video>`}
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
` : ""}
|
|
69
|
-
</div>
|
|
70
|
-
`}
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
74
|
-
<button class="cancel-btn" style="padding: 10px 20px; background: #fff; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
|
|
75
|
-
<button id="insert-btn" style="padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;" ${!l && r === "url" ? "disabled" : ""}>Insert</button>
|
|
76
|
-
</div>
|
|
77
|
-
`;
|
|
78
|
-
};
|
|
79
|
-
f(), e.appendChild(o), document.body.appendChild(e);
|
|
80
|
-
const h = () => document.body.removeChild(e), k = () => {
|
|
81
|
-
if (!l) return;
|
|
82
|
-
const d = i === "image" ? document.createElement("img") : document.createElement("video");
|
|
83
|
-
d.src = l, d.setAttribute("data-media-type", i), i === "image" && y && (d.alt = y), c && (d.style.width = `${c}px`, d.setAttribute("width", c)), b && (d.style.height = `${b}px`, d.setAttribute("height", b)), i === "video" && (d.controls = !0), !c && !b ? d.style.cssText = "max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;" : d.style.cssText = `display: block; margin: 1em 0; cursor: pointer; ${c ? `width: ${c}px;` : "max-width: 100%;"} ${b ? `height: ${b}px;` : "height: auto;"}`, A && (A.deleteContents(), A.insertNode(d)), h();
|
|
84
|
-
}, m = async (d) => {
|
|
85
|
-
const n = o.querySelector("#upload-progress"), u = o.querySelector("#progress-bar"), g = o.querySelector("#progress-text");
|
|
86
|
-
if (n && u && g) {
|
|
87
|
-
n.style.display = "block";
|
|
88
|
-
let w = 0;
|
|
89
|
-
const a = setInterval(() => {
|
|
90
|
-
w += Math.random() * 30, w > 90 && (w = 90), u.style.width = `${w}%`;
|
|
91
|
-
}, 200);
|
|
92
|
-
try {
|
|
93
|
-
const v = new FileReader();
|
|
94
|
-
v.onload = () => {
|
|
95
|
-
clearInterval(a), u.style.width = "100%", g.textContent = "✅ Upload complete", setTimeout(() => {
|
|
96
|
-
l = v.result, r = "url", f(), x();
|
|
97
|
-
}, 500);
|
|
98
|
-
}, v.readAsDataURL(d);
|
|
99
|
-
} catch (v) {
|
|
100
|
-
clearInterval(a), g.textContent = "❌ Upload failed";
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}, x = () => {
|
|
104
|
-
const d = o.querySelector(".close-btn"), n = o.querySelector(".cancel-btn"), u = o.querySelector("#insert-btn"), g = o.querySelector(".tab-upload"), w = o.querySelector(".tab-url");
|
|
105
|
-
if (d == null || d.addEventListener("click", h), n == null || n.addEventListener("click", h), u == null || u.addEventListener("click", k), g == null || g.addEventListener("click", () => {
|
|
106
|
-
r = "upload", f(), x();
|
|
107
|
-
}), w == null || w.addEventListener("click", () => {
|
|
108
|
-
r = "url", f(), x();
|
|
109
|
-
}), r === "upload") {
|
|
110
|
-
const a = o.querySelector(".dropzone"), v = o.querySelector("#file-input");
|
|
111
|
-
a == null || a.addEventListener("click", () => v == null ? void 0 : v.click()), a == null || a.addEventListener("dragover", (E) => {
|
|
112
|
-
E.preventDefault(), a.style.borderColor = "#007bff", a.style.background = "#f0f8ff";
|
|
113
|
-
}), a == null || a.addEventListener("dragleave", () => {
|
|
114
|
-
a.style.borderColor = "#ced4da", a.style.background = "transparent";
|
|
115
|
-
}), a == null || a.addEventListener("drop", (E) => {
|
|
116
|
-
var C;
|
|
117
|
-
E.preventDefault(), a.style.borderColor = "#ced4da", a.style.background = "transparent";
|
|
118
|
-
const L = (C = E.dataTransfer) == null ? void 0 : C.files[0];
|
|
119
|
-
L && m(L);
|
|
120
|
-
}), v == null || v.addEventListener("change", (E) => {
|
|
121
|
-
var C;
|
|
122
|
-
const L = (C = E.target.files) == null ? void 0 : C[0];
|
|
123
|
-
L && m(L);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (r === "url") {
|
|
127
|
-
const a = o.querySelector("#url-input"), v = o.querySelector("#alt-input"), E = o.querySelector("#width-input"), L = o.querySelector("#height-input");
|
|
128
|
-
a == null || a.addEventListener("input", () => {
|
|
129
|
-
l = a.value, f(), x();
|
|
130
|
-
}), v == null || v.addEventListener("input", () => {
|
|
131
|
-
y = v.value;
|
|
132
|
-
}), E == null || E.addEventListener("input", () => {
|
|
133
|
-
c = E.value;
|
|
134
|
-
}), L == null || L.addEventListener("input", () => {
|
|
135
|
-
b = L.value;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
x(), e.addEventListener("click", (d) => {
|
|
140
|
-
d.target === e && h();
|
|
141
|
-
});
|
|
142
|
-
}, B = () => {
|
|
143
|
-
["nw", "ne", "sw", "se"].forEach((t) => {
|
|
144
|
-
const e = document.createElement("div");
|
|
145
|
-
e.className = `media-resize-handle-${t}`, e.style.cssText = `
|
|
146
|
-
position: fixed;
|
|
147
|
-
width: 10px;
|
|
148
|
-
height: 10px;
|
|
149
|
-
background: #007bff;
|
|
150
|
-
border: 2px solid white;
|
|
151
|
-
border-radius: 50%;
|
|
152
|
-
cursor: ${t}-resize;
|
|
153
|
-
z-index: 10001;
|
|
154
|
-
display: none;
|
|
155
|
-
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
156
|
-
`, e.setAttribute("data-position", t), document.body.appendChild(e), R.push(e);
|
|
157
|
-
});
|
|
158
|
-
}, q = () => {
|
|
159
|
-
if (!p) {
|
|
160
|
-
R.forEach((e) => e.style.display = "none");
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const i = p.getBoundingClientRect(), t = {
|
|
164
|
-
nw: { x: i.left - 5, y: i.top - 5 },
|
|
165
|
-
ne: { x: i.right - 5, y: i.top - 5 },
|
|
166
|
-
sw: { x: i.left - 5, y: i.bottom - 5 },
|
|
167
|
-
se: { x: i.right - 5, y: i.bottom - 5 }
|
|
168
|
-
};
|
|
169
|
-
R.forEach((e) => {
|
|
170
|
-
const o = e.getAttribute("data-position"), r = t[o];
|
|
171
|
-
e.style.left = `${r.x}px`, e.style.top = `${r.y}px`, e.style.display = "block";
|
|
172
|
-
});
|
|
173
|
-
}, U = (i) => {
|
|
174
|
-
const t = document.createElement("div");
|
|
175
|
-
t.style.cssText = "position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 10001;";
|
|
176
|
-
const e = document.createElement("div");
|
|
177
|
-
e.style.cssText = "background: white; border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);", e.innerHTML = `
|
|
178
|
-
<div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
179
|
-
<h2 style="margin: 0; font-size: 18px; font-weight: 600;">Edit Alt Text</h2>
|
|
180
|
-
<button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: #6c757d; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
|
|
181
|
-
</div>
|
|
182
|
-
<div style="padding: 20px;">
|
|
183
|
-
<label style="display: block; margin-bottom: 8px; font-weight: 500;">Alternative Text (for accessibility):</label>
|
|
184
|
-
<textarea id="alt-text-input" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px; min-height: 80px; font-family: inherit; resize: vertical;" placeholder="Describe the image for screen readers...">${i.alt || ""}</textarea>
|
|
185
|
-
<p style="margin-top: 8px; margin-bottom: 0; font-size: 12px; color: #6c757d;">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
|
|
186
|
-
</div>
|
|
187
|
-
<div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
188
|
-
<button class="cancel-btn" style="padding: 10px 20px; background: #fff; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
|
|
189
|
-
<button class="save-btn" style="padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;">Save</button>
|
|
190
|
-
</div>
|
|
191
|
-
`, t.appendChild(e), document.body.appendChild(t);
|
|
192
|
-
const o = e.querySelector("#alt-text-input"), r = e.querySelector(".close-btn"), l = e.querySelector(".cancel-btn"), c = e.querySelector(".save-btn"), b = () => document.body.removeChild(t);
|
|
193
|
-
r.addEventListener("click", b), l.addEventListener("click", b), t.addEventListener("click", (y) => {
|
|
194
|
-
y.target === t && b();
|
|
195
|
-
}), c.addEventListener("click", () => {
|
|
196
|
-
i.alt = o.value, b();
|
|
197
|
-
}), o.focus(), o.select();
|
|
198
|
-
}, N = (i) => {
|
|
199
|
-
const t = i.closest("a"), e = (t == null ? void 0 : t.getAttribute("href")) || "", o = (t == null ? void 0 : t.getAttribute("target")) || "_self", r = (t == null ? void 0 : t.getAttribute("title")) || "", l = document.createElement("div");
|
|
200
|
-
l.style.cssText = "position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 10001;";
|
|
201
|
-
const c = document.createElement("div");
|
|
202
|
-
c.style.cssText = "background: white; border-radius: 8px; width: 90%; max-width: 500px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);", c.innerHTML = `
|
|
203
|
-
<div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
204
|
-
<h2 style="margin: 0; font-size: 18px; font-weight: 600;">${t ? "Edit Link" : "Add Link"}</h2>
|
|
205
|
-
<button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: #6c757d; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
|
|
206
|
-
</div>
|
|
207
|
-
<div style="padding: 20px;">
|
|
208
|
-
<div style="margin-bottom: 16px;">
|
|
209
|
-
<label style="display: block; margin-bottom: 6px; font-weight: 500;">URL:</label>
|
|
210
|
-
<input id="link-url" type="url" value="${e}" placeholder="https://example.com" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;" />
|
|
211
|
-
</div>
|
|
212
|
-
<div style="margin-bottom: 16px;">
|
|
213
|
-
<label style="display: block; margin-bottom: 6px; font-weight: 500;">Title (tooltip):</label>
|
|
214
|
-
<input id="link-title" type="text" value="${r}" placeholder="Optional tooltip text" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;" />
|
|
215
|
-
</div>
|
|
216
|
-
<div>
|
|
217
|
-
<label style="display: flex; align-items: center; cursor: pointer;">
|
|
218
|
-
<input id="link-target" type="checkbox" ${o === "_blank" ? "checked" : ""} style="margin-right: 8px;" />
|
|
219
|
-
Open in new window/tab
|
|
220
|
-
</label>
|
|
221
|
-
</div>
|
|
222
|
-
</div>
|
|
223
|
-
<div style="display: flex; justify-content: space-between; padding: 16px 20px; border-top: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
224
|
-
${t ? '<button class="remove-link-btn" style="padding: 10px 20px; background: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;">Remove Link</button>' : "<span></span>"}
|
|
225
|
-
<div style="display: flex; gap: 10px;">
|
|
226
|
-
<button class="cancel-btn" style="padding: 10px 20px; background: #fff; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
|
|
227
|
-
<button class="save-btn" style="padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;">Save</button>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
`, l.appendChild(c), document.body.appendChild(l);
|
|
231
|
-
const b = c.querySelector("#link-url"), y = c.querySelector("#link-title"), f = c.querySelector("#link-target"), h = c.querySelector(".close-btn"), k = c.querySelector(".cancel-btn"), m = c.querySelector(".save-btn"), x = c.querySelector(".remove-link-btn"), d = () => document.body.removeChild(l);
|
|
232
|
-
h.addEventListener("click", d), k.addEventListener("click", d), l.addEventListener("click", (n) => {
|
|
233
|
-
n.target === l && d();
|
|
234
|
-
}), m.addEventListener("click", () => {
|
|
235
|
-
const n = b.value.trim();
|
|
236
|
-
if (n) {
|
|
237
|
-
const u = n.startsWith("http") ? n : `https://${n}`;
|
|
238
|
-
if (t)
|
|
239
|
-
t.setAttribute("href", u), t.setAttribute("target", f.checked ? "_blank" : "_self"), f.checked ? t.setAttribute("rel", "noopener noreferrer") : t.removeAttribute("rel"), y.value.trim() ? t.setAttribute("title", y.value.trim()) : t.removeAttribute("title");
|
|
240
|
-
else {
|
|
241
|
-
const g = document.createElement("a");
|
|
242
|
-
g.href = u, g.target = f.checked ? "_blank" : "_self", f.checked && (g.rel = "noopener noreferrer"), y.value.trim() && (g.title = y.value.trim()), i.replaceWith(g), g.appendChild(i);
|
|
243
|
-
}
|
|
244
|
-
d(), s && p && H(p);
|
|
245
|
-
}
|
|
246
|
-
}), x == null || x.addEventListener("click", () => {
|
|
247
|
-
t && confirm("Remove link from this media?") && (t.replaceWith(i), d(), s && p && H(p));
|
|
248
|
-
}), b.focus();
|
|
249
|
-
}, W = (i) => {
|
|
250
|
-
const t = document.createElement("div");
|
|
251
|
-
t.style.cssText = "position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 10001;";
|
|
252
|
-
const e = document.createElement("div");
|
|
253
|
-
e.style.cssText = "background: white; border-radius: 8px; width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);";
|
|
254
|
-
let o = "url", r = i.src;
|
|
255
|
-
const l = () => {
|
|
256
|
-
e.innerHTML = `
|
|
257
|
-
<div style="display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
258
|
-
<h2 style="margin: 0; font-size: 18px; font-weight: 600;">Replace Image</h2>
|
|
259
|
-
<button class="close-btn" style="background: none; border: none; font-size: 28px; cursor: pointer; color: #6c757d; padding: 0; width: 30px; height: 30px; line-height: 1;">×</button>
|
|
260
|
-
</div>
|
|
261
|
-
|
|
262
|
-
<div class="tabs" style="display: flex; border-bottom: 1px solid #e1e5e9;">
|
|
263
|
-
<button class="tab-upload" style="flex: 1; padding: 12px; border: none; background: ${o === "upload" ? "#007bff" : "#f8f9fa"}; color: ${o === "upload" ? "white" : "#495057"}; cursor: pointer; font-weight: 500;">📤 Upload</button>
|
|
264
|
-
<button class="tab-url" style="flex: 1; padding: 12px; border: none; background: ${o === "url" ? "#007bff" : "#f8f9fa"}; color: ${o === "url" ? "white" : "#495057"}; cursor: pointer; font-weight: 500;">🔗 URL</button>
|
|
265
|
-
</div>
|
|
266
|
-
|
|
267
|
-
<div style="padding: 20px; overflow-y: auto; flex: 1;">
|
|
268
|
-
${o === "upload" ? `
|
|
269
|
-
<div id="upload-section">
|
|
270
|
-
<div class="dropzone" style="border: 2px dashed #ced4da; border-radius: 8px; padding: 40px; text-align: center; cursor: pointer; transition: all 0.3s;">
|
|
271
|
-
<div style="font-size: 48px; margin-bottom: 10px;">📁</div>
|
|
272
|
-
<p style="margin: 0 0 8px 0; font-weight: 600; font-size: 16px;">Drag and drop your image here</p>
|
|
273
|
-
<p style="margin: 0 0 8px 0; color: #6c757d; font-size: 14px;">or click to browse</p>
|
|
274
|
-
</div>
|
|
275
|
-
<input type="file" id="file-input" accept="image/*" style="display: none;">
|
|
276
|
-
<div id="upload-progress" style="display: none; margin-top: 20px;">
|
|
277
|
-
<div style="background: #e9ecef; border-radius: 4px; height: 8px; overflow: hidden;">
|
|
278
|
-
<div id="progress-bar" style="background: #007bff; height: 100%; width: 0%; transition: width 0.3s;"></div>
|
|
279
|
-
</div>
|
|
280
|
-
<p id="progress-text" style="margin-top: 8px; text-align: center; color: #6c757d; font-size: 14px;">Uploading...</p>
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
` : `
|
|
284
|
-
<div id="url-section">
|
|
285
|
-
<div style="margin-bottom: 20px;">
|
|
286
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Image URL:</label>
|
|
287
|
-
<input type="text" id="url-input" placeholder="https://example.com/image.jpg" value="${r}" style="width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid #ced4da; border-radius: 4px; font-size: 14px;">
|
|
288
|
-
</div>
|
|
289
|
-
${r ? `
|
|
290
|
-
<div style="margin-bottom: 20px;">
|
|
291
|
-
<label style="display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px;">Preview:</label>
|
|
292
|
-
<div style="border: 1px solid #dee2e6; border-radius: 4px; padding: 10px; background: #f8f9fa; text-align: center;">
|
|
293
|
-
<img src="${r}" alt="Preview" style="max-width: 100%; max-height: 300px;" onerror="this.parentElement.innerHTML='<p style="color: #dc3545;">Failed to load image</p>'">
|
|
294
|
-
</div>
|
|
295
|
-
</div>
|
|
296
|
-
` : ""}
|
|
297
|
-
</div>
|
|
298
|
-
`}
|
|
299
|
-
</div>
|
|
300
|
-
|
|
301
|
-
<div style="display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid #e1e5e9; background: #f8f9fa;">
|
|
302
|
-
<button class="cancel-btn" style="padding: 10px 20px; background: #fff; border: 1px solid #ced4da; border-radius: 4px; cursor: pointer; font-size: 14px;">Cancel</button>
|
|
303
|
-
<button id="replace-btn" style="padding: 10px 20px; background: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px;" ${!r && o === "url" ? "disabled" : ""}>Replace</button>
|
|
304
|
-
</div>
|
|
305
|
-
`;
|
|
306
|
-
};
|
|
307
|
-
l(), t.appendChild(e), document.body.appendChild(t);
|
|
308
|
-
const c = () => document.body.removeChild(t), b = () => {
|
|
309
|
-
r && (i.src = r, c());
|
|
310
|
-
}, y = async (h) => {
|
|
311
|
-
const k = e.querySelector("#upload-progress"), m = e.querySelector("#progress-bar"), x = e.querySelector("#progress-text");
|
|
312
|
-
if (k && m && x) {
|
|
313
|
-
k.style.display = "block";
|
|
314
|
-
let d = 0;
|
|
315
|
-
const n = setInterval(() => {
|
|
316
|
-
d += Math.random() * 30, d > 90 && (d = 90), m.style.width = `${d}%`;
|
|
317
|
-
}, 200);
|
|
318
|
-
try {
|
|
319
|
-
const u = new FileReader();
|
|
320
|
-
u.onload = () => {
|
|
321
|
-
clearInterval(n), m.style.width = "100%", x.textContent = "✅ Upload complete", setTimeout(() => {
|
|
322
|
-
r = u.result, o = "url", l(), f();
|
|
323
|
-
}, 500);
|
|
324
|
-
}, u.readAsDataURL(h);
|
|
325
|
-
} catch (u) {
|
|
326
|
-
clearInterval(n), x.textContent = "❌ Upload failed";
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}, f = () => {
|
|
330
|
-
const h = e.querySelector(".close-btn"), k = e.querySelector(".cancel-btn"), m = e.querySelector("#replace-btn"), x = e.querySelector(".tab-upload"), d = e.querySelector(".tab-url");
|
|
331
|
-
if (h == null || h.addEventListener("click", c), k == null || k.addEventListener("click", c), m == null || m.addEventListener("click", b), x == null || x.addEventListener("click", () => {
|
|
332
|
-
o = "upload", l(), f();
|
|
333
|
-
}), d == null || d.addEventListener("click", () => {
|
|
334
|
-
o = "url", l(), f();
|
|
335
|
-
}), o === "upload") {
|
|
336
|
-
const n = e.querySelector(".dropzone"), u = e.querySelector("#file-input");
|
|
337
|
-
n == null || n.addEventListener("click", () => u == null ? void 0 : u.click()), n == null || n.addEventListener("dragover", (g) => {
|
|
338
|
-
g.preventDefault(), n.style.borderColor = "#007bff", n.style.background = "#f0f8ff";
|
|
339
|
-
}), n == null || n.addEventListener("dragleave", () => {
|
|
340
|
-
n.style.borderColor = "#ced4da", n.style.background = "transparent";
|
|
341
|
-
}), n == null || n.addEventListener("drop", (g) => {
|
|
342
|
-
var a;
|
|
343
|
-
g.preventDefault(), n.style.borderColor = "#ced4da", n.style.background = "transparent";
|
|
344
|
-
const w = (a = g.dataTransfer) == null ? void 0 : a.files[0];
|
|
345
|
-
w && y(w);
|
|
346
|
-
}), u == null || u.addEventListener("change", (g) => {
|
|
347
|
-
var a;
|
|
348
|
-
const w = (a = g.target.files) == null ? void 0 : a[0];
|
|
349
|
-
w && y(w);
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
if (o === "url") {
|
|
353
|
-
const n = e.querySelector("#url-input");
|
|
354
|
-
n == null || n.addEventListener("input", () => {
|
|
355
|
-
r = n.value, l(), f();
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
f(), t.addEventListener("click", (h) => {
|
|
360
|
-
h.target === t && c();
|
|
361
|
-
});
|
|
362
|
-
}, z = () => {
|
|
363
|
-
if (!s || !p) return;
|
|
364
|
-
const i = s.offsetHeight || 40, t = p.offsetTop, e = p.offsetLeft, o = p.offsetWidth, r = t - i - 8, l = e + o / 2 - (s.offsetWidth || 120) / 2;
|
|
365
|
-
s.style.top = `${r}px`, s.style.left = `${l}px`, setTimeout(() => {
|
|
366
|
-
s && (s.style.display = "flex");
|
|
367
|
-
}, 100);
|
|
368
|
-
}, H = (i) => {
|
|
369
|
-
var b, y, f, h, k, m, x, d;
|
|
370
|
-
s && (s._cleanup && s._cleanup(), s.remove());
|
|
371
|
-
const t = i.parentElement;
|
|
372
|
-
if (t) {
|
|
373
|
-
const n = t.style.position;
|
|
374
|
-
(!n || n === "static") && (t.style.position = "relative", t._originalPosition = n), s = document.createElement("div"), s.className = "media-floating-toolbar", s.style.cssText = `
|
|
375
|
-
position: absolute;
|
|
376
|
-
background: white;
|
|
377
|
-
border: 1px solid #ced4da;
|
|
378
|
-
border-radius: 6px;
|
|
379
|
-
box-shadow: 0 2px 12px rgba(0,0,0,0.15);
|
|
380
|
-
gap: 2px;
|
|
381
|
-
padding: 4px;
|
|
382
|
-
z-index: 10000;
|
|
383
|
-
pointer-events: auto;
|
|
384
|
-
display: none;
|
|
385
|
-
`, t.insertBefore(s, t.firstChild), z();
|
|
386
|
-
}
|
|
387
|
-
const e = "padding: 6px 8px; border: none; background: white; cursor: pointer; border-radius: 4px; transition: background 0.2s; display: flex; align-items: center; justify-content: center;", o = i.tagName === "IMG", r = i.closest("a");
|
|
388
|
-
s.innerHTML = `
|
|
389
|
-
<button class="btn-align-left" title="Align Left" style="${e}">
|
|
390
|
-
<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>
|
|
391
|
-
</button>
|
|
392
|
-
<button class="btn-align-center" title="Align Center" style="${e}">
|
|
393
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="10" x2="6" 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="18" y1="18" x2="6" y2="18"></line></svg>
|
|
394
|
-
</button>
|
|
395
|
-
<button class="btn-align-right" title="Align Right" style="${e}">
|
|
396
|
-
<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>
|
|
397
|
-
</button>
|
|
398
|
-
<div style="width: 1px; height: 20px; background: #dee2e6; margin: 0 2px;"></div>
|
|
399
|
-
${o ? `
|
|
400
|
-
<button class="btn-alt" title="Edit Alt Text" style="${e}">
|
|
401
|
-
<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>
|
|
402
|
-
</button>` : ""}
|
|
403
|
-
<button class="btn-link" title="${r ? "Edit/Remove Link" : "Add Link"}" style="${e}">
|
|
404
|
-
<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>
|
|
405
|
-
</button>
|
|
406
|
-
${o ? `
|
|
407
|
-
<button class="btn-replace" title="Replace Image" style="${e}">
|
|
408
|
-
<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>
|
|
409
|
-
</button>` : ""}
|
|
410
|
-
<div style="width: 1px; height: 20px; background: #dee2e6; margin: 0 2px;"></div>
|
|
411
|
-
<button class="btn-remove" title="Remove" style="${e}">
|
|
412
|
-
<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>
|
|
413
|
-
</button>
|
|
414
|
-
`, setTimeout(() => {
|
|
415
|
-
z();
|
|
416
|
-
}, 0);
|
|
417
|
-
const l = () => z();
|
|
418
|
-
let c = p.parentElement;
|
|
419
|
-
for (; c; )
|
|
420
|
-
c.addEventListener("scroll", l), c = c.parentElement;
|
|
421
|
-
window.addEventListener("scroll", l), window.addEventListener("resize", l), s._cleanup = () => {
|
|
422
|
-
let n = p == null ? void 0 : p.parentElement;
|
|
423
|
-
for (; n; )
|
|
424
|
-
n.removeEventListener("scroll", l), n = n.parentElement;
|
|
425
|
-
window.removeEventListener("scroll", l), window.removeEventListener("resize", l);
|
|
426
|
-
}, s.querySelectorAll("button").forEach((n) => {
|
|
427
|
-
n.addEventListener("mouseenter", () => {
|
|
428
|
-
n.style.background = "#f8f9fa";
|
|
429
|
-
}), n.addEventListener("mouseleave", () => {
|
|
430
|
-
n.style.background = "white";
|
|
431
|
-
});
|
|
432
|
-
}), (b = s.querySelector(".btn-align-left")) == null || b.addEventListener("click", () => {
|
|
433
|
-
i.style.display = "block", i.style.marginLeft = "0", i.style.marginRight = "auto", z();
|
|
434
|
-
}), (y = s.querySelector(".btn-align-center")) == null || y.addEventListener("click", () => {
|
|
435
|
-
i.style.display = "block", i.style.marginLeft = "auto", i.style.marginRight = "auto", z();
|
|
436
|
-
}), (f = s.querySelector(".btn-align-right")) == null || f.addEventListener("click", () => {
|
|
437
|
-
i.style.display = "block", i.style.marginLeft = "auto", i.style.marginRight = "0", z();
|
|
438
|
-
}), (h = s.querySelector(".btn-alt")) == null || h.addEventListener("click", () => {
|
|
439
|
-
i.tagName === "IMG" && U(i);
|
|
440
|
-
}), (k = s.querySelector(".btn-link")) == null || k.addEventListener("click", () => {
|
|
441
|
-
N(i);
|
|
442
|
-
}), (m = s.querySelector(".btn-replace")) == null || m.addEventListener("click", () => {
|
|
443
|
-
i.tagName === "IMG" && W(i);
|
|
444
|
-
}), (x = s.querySelector(".btn-resize")) == null || x.addEventListener("click", () => {
|
|
445
|
-
const n = prompt("Enter width in pixels:", String(i.width || i.offsetWidth));
|
|
446
|
-
if (n && !isNaN(parseInt(n))) {
|
|
447
|
-
const u = parseInt(n);
|
|
448
|
-
i.style.width = `${u}px`, i.setAttribute("width", String(u)), q(), z();
|
|
449
|
-
}
|
|
450
|
-
}), (d = s.querySelector(".btn-remove")) == null || d.addEventListener("click", () => {
|
|
451
|
-
confirm("Remove this media?") && (i.remove(), s && (s._cleanup && s._cleanup(), s.remove(), s = null), p = null, q());
|
|
452
|
-
}), s._cleanup = () => {
|
|
453
|
-
window.removeEventListener("scroll", z), window.removeEventListener("resize", z);
|
|
454
|
-
};
|
|
455
|
-
}, P = (i) => {
|
|
456
|
-
_ = i || null, B(), document.addEventListener("click", (t) => {
|
|
457
|
-
const e = t.target;
|
|
458
|
-
if (e.tagName === "IMG" || e.tagName === "VIDEO") {
|
|
459
|
-
const o = e;
|
|
460
|
-
let r = !1;
|
|
461
|
-
if (_ ? r = _.contains(o) : r = !!o.closest('[contenteditable="true"]'), r) {
|
|
462
|
-
t.preventDefault(), t.stopPropagation(), p = o, p.style.display = "block", H(o), q();
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
if (!e.closest(".btn-link, .btn-resize, .btn-remove") && s && !e.closest("button")) {
|
|
467
|
-
if (s._cleanup && s._cleanup(), s.remove(), s = null, p && p.parentElement) {
|
|
468
|
-
const o = p.parentElement;
|
|
469
|
-
o._originalPosition !== void 0 && (o.style.position = o._originalPosition, delete o._originalPosition);
|
|
470
|
-
}
|
|
471
|
-
p = null, q();
|
|
472
|
-
}
|
|
473
|
-
}), R.forEach((t) => {
|
|
474
|
-
t.addEventListener("mousedown", (e) => {
|
|
475
|
-
if (!p) return;
|
|
476
|
-
e.preventDefault(), e.stopPropagation(), M = !0, T = t.getAttribute("data-position"), I = e.clientX, j = e.clientY;
|
|
477
|
-
const o = p.getBoundingClientRect();
|
|
478
|
-
$ = o.width, S = o.height, D = $ / S, document.body.style.userSelect = "none", document.body.style.cursor = `${T}-resize`;
|
|
479
|
-
});
|
|
480
|
-
}), document.addEventListener("mousemove", (t) => {
|
|
481
|
-
if (!M || !p || !T) return;
|
|
482
|
-
const e = t.clientX - I, o = t.clientY - j;
|
|
483
|
-
let r = $, l = S;
|
|
484
|
-
switch (T) {
|
|
485
|
-
case "se":
|
|
486
|
-
r = $ + e, l = S + o;
|
|
487
|
-
break;
|
|
488
|
-
case "sw":
|
|
489
|
-
r = $ - e, l = S + o;
|
|
490
|
-
break;
|
|
491
|
-
case "ne":
|
|
492
|
-
r = $ + e, l = S - o;
|
|
493
|
-
break;
|
|
494
|
-
case "nw":
|
|
495
|
-
r = $ - e, l = S - o;
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
Math.abs(e) > Math.abs(o) ? l = r / D : r = l * D, r = Math.max(50, r), l = Math.max(50, l), p.style.width = `${r}px`, p.style.height = `${l}px`, p.setAttribute("width", String(Math.round(r))), p.setAttribute("height", String(Math.round(l))), q(), z();
|
|
499
|
-
}), document.addEventListener("mouseup", () => {
|
|
500
|
-
M && (M = !1, T = null, document.body.style.userSelect = "", document.body.style.cursor = "");
|
|
501
|
-
}), window.addEventListener("scroll", q), window.addEventListener("resize", q);
|
|
502
|
-
};
|
|
503
|
-
typeof window != "undefined" && !window.__mediaManagerInitialized && (window.__mediaManagerInitialized = !0, P());
|
|
504
|
-
const F = () => ({
|
|
505
|
-
name: "image",
|
|
506
|
-
initialize: (i) => {
|
|
507
|
-
const t = i == null ? void 0 : i.editorElement;
|
|
508
|
-
P(t);
|
|
509
|
-
},
|
|
510
|
-
toolbar: [
|
|
511
|
-
{
|
|
512
|
-
label: "Image",
|
|
513
|
-
command: "insertImage",
|
|
514
|
-
icon: '<svg width="24px" height="24px" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><g><rect fill="none" height="22" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="30" x="1" y="5"></rect><polygon fill="none" points="31,27 21,17 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><polygon fill="none" points="18,20 9,11 1,19 1,27 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><circle cx="19" cy="11" fill="none" r="2" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></circle></g></svg>'
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
label: "Video",
|
|
518
|
-
command: "insertVideo",
|
|
519
|
-
icon: '<svg width="24" height="24" focusable="false"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"></path></svg>'
|
|
520
|
-
}
|
|
521
|
-
],
|
|
522
|
-
commands: {
|
|
523
|
-
insertImage: () => (V("image"), !0),
|
|
524
|
-
insertVideo: () => (V("video"), !0)
|
|
525
|
-
},
|
|
526
|
-
keymap: {
|
|
527
|
-
"Mod-Shift-i": "insertImage"
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
export {
|
|
531
|
-
F as MediaManagerPlugin
|
|
532
|
-
};
|
|
533
|
-
//# sourceMappingURL=MediaManagerPlugin.native-DaYFDzNM.mjs.map
|