@editora/plugins 1.0.16 → 1.0.18
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/CodePlugin.native-Bwf25lLX.js +460 -0
- package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
- package/dist/a11y-checker.cjs.js +16 -16
- package/dist/a11y-checker.esm.js +79 -75
- package/dist/anchor.cjs.js +9 -9
- package/dist/anchor.esm.js +61 -60
- package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
- package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
- package/dist/approval-workflow.cjs.js +5 -5
- package/dist/approval-workflow.esm.js +105 -104
- package/dist/background-color.cjs.js +1 -1
- package/dist/background-color.esm.js +1 -1
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +226 -202
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +9 -4
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +154 -116
- package/dist/citations.cjs.js +43 -18
- package/dist/citations.esm.js +465 -446
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +21 -20
- package/dist/code-sample.cjs.js +85 -66
- package/dist/code-sample.esm.js +301 -190
- package/dist/code.cjs.js +1 -669
- package/dist/code.esm.js +2 -4560
- package/dist/collaboration.cjs.js +68 -0
- package/dist/collaboration.esm.js +7428 -0
- package/dist/comments.cjs.js +11 -11
- package/dist/comments.esm.js +284 -237
- package/dist/conditional-content.cjs.js +67 -60
- package/dist/conditional-content.esm.js +270 -220
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +28 -27
- package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
- package/dist/dialogHelpers-zU6zpMIA.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
- package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
- package/dist/embed-iframe.cjs.js +37 -17
- package/dist/embed-iframe.esm.js +188 -143
- package/dist/emojis.cjs.js +13 -10
- package/dist/emojis.esm.js +288 -76
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +9 -7
- package/dist/escapeHtml-D2Zh82pD.js +1 -0
- package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +48 -41
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +67 -60
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +2 -1
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +40 -36
- package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
- package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
- package/dist/index-Bm1eqYHh.mjs +194 -0
- package/dist/index-CoflqYuK.js +30 -0
- package/dist/index-CxhJLMPS.js +221 -0
- package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
- package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
- package/dist/index.esm.js +17 -15
- package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
- package/dist/link.cjs.js +17 -13
- package/dist/link.esm.js +138 -69
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +66 -33
- package/dist/math.cjs.js +22 -22
- package/dist/math.esm.js +221 -126
- package/dist/media-manager.cjs.js +12 -12
- package/dist/media-manager.esm.js +55 -50
- package/dist/mentions.cjs.js +2 -2
- package/dist/mentions.esm.js +17 -12
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +43 -42
- package/dist/plugins.css +1 -1
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +30 -27
- package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
- package/dist/slash-commands.cjs.js +13 -7
- package/dist/slash-commands.esm.js +90 -79
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +85 -81
- package/dist/special-characters.cjs.js +6 -3
- package/dist/special-characters.esm.js +72 -25
- package/dist/spell-check.cjs.js +8 -8
- package/dist/spell-check.esm.js +10189 -295
- package/dist/table.cjs.js +166 -13
- package/dist/table.esm.js +543 -266
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +290 -264
- package/dist/text-color.cjs.js +1 -1
- package/dist/text-color.esm.js +1 -1
- package/dist/translation-workflow.cjs.js +4 -4
- package/dist/translation-workflow.esm.js +33 -31
- package/dist/version-diff.cjs.js +6 -6
- package/dist/version-diff.esm.js +40 -40
- package/package.json +10 -4
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/index-BFsKNTTj.mjs +0 -145
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-tqLTHcO6.js +0 -1
package/dist/embed-iframe.esm.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as M } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
|
+
const j = [
|
|
2
3
|
{ label: "Inline Value", value: "inline" },
|
|
3
4
|
{ label: "Responsive - 21x9", value: "21x9" },
|
|
4
5
|
{ label: "Responsive - 16x9", value: "16x9" },
|
|
5
6
|
{ label: "Responsive - 4x3", value: "4x3" },
|
|
6
7
|
{ label: "Responsive - 1x1", value: "1x1" }
|
|
7
|
-
],
|
|
8
|
+
], h = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
8
9
|
let c = null;
|
|
9
|
-
const
|
|
10
|
+
const E = /* @__PURE__ */ new WeakMap(), s = (e) => (E.has(e) || E.set(e, {
|
|
10
11
|
dialogElement: null,
|
|
11
12
|
escapeHandler: null,
|
|
12
13
|
savedRange: null,
|
|
@@ -24,14 +25,14 @@ const v = /* @__PURE__ */ new WeakMap(), s = (e) => (v.has(e) || v.set(e, {
|
|
|
24
25
|
showBorder: !0,
|
|
25
26
|
enableScrollbar: !0
|
|
26
27
|
}
|
|
27
|
-
}),
|
|
28
|
-
function
|
|
29
|
-
return e?.matches(
|
|
28
|
+
}), E.get(e));
|
|
29
|
+
function U(e) {
|
|
30
|
+
return e?.matches(h) || e?.closest(h) || document.activeElement?.closest(h) ? !0 : document.body.matches(h) || document.documentElement.matches(h);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function L(e) {
|
|
32
33
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function P(e) {
|
|
35
36
|
const t = e?.editorElement;
|
|
36
37
|
if (t instanceof HTMLElement) return t;
|
|
37
38
|
const r = e?.contentElement;
|
|
@@ -41,31 +42,31 @@ function R(e) {
|
|
|
41
42
|
}
|
|
42
43
|
const o = window.__editoraCommandEditorRoot;
|
|
43
44
|
if (o instanceof HTMLElement) return o;
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const l =
|
|
45
|
+
const n = window.getSelection();
|
|
46
|
+
if (n && n.rangeCount > 0) {
|
|
47
|
+
const l = L(n.getRangeAt(0).startContainer)?.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
47
48
|
if (l instanceof HTMLElement) return l;
|
|
48
49
|
}
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
const i =
|
|
50
|
+
const a = document.activeElement;
|
|
51
|
+
if (a instanceof HTMLElement) {
|
|
52
|
+
const i = a.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
52
53
|
if (i instanceof HTMLElement) return i;
|
|
53
54
|
}
|
|
54
55
|
return document.querySelector("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function I(e) {
|
|
57
58
|
return e.getAttribute("contenteditable") === "true" ? e : e.querySelector('.rte-content, .editora-content, [contenteditable="true"]');
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
return
|
|
60
|
+
function v(e) {
|
|
61
|
+
return L(e)?.closest('.rte-content, .editora-content, [contenteditable="true"]');
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function O(e) {
|
|
63
64
|
const t = window.getSelection();
|
|
64
65
|
if (!t || t.rangeCount === 0) return null;
|
|
65
66
|
const r = t.getRangeAt(0);
|
|
66
67
|
return !e.contains(r.startContainer) || !e.contains(r.endContainer) ? null : r.cloneRange();
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function T(e, t, r) {
|
|
69
70
|
if (t !== r) {
|
|
70
71
|
if (typeof window.execEditorCommand == "function") {
|
|
71
72
|
window.execEditorCommand("recordDomTransaction", e, t, r);
|
|
@@ -78,67 +79,67 @@ function k(e, t, r) {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
+
function $(e, t) {
|
|
82
83
|
let r = t;
|
|
83
84
|
for (; r && r.parentNode && r.parentNode !== e; )
|
|
84
85
|
r = r.parentNode;
|
|
85
86
|
return r && r.parentNode === e ? r : null;
|
|
86
87
|
}
|
|
87
|
-
function
|
|
88
|
+
function C(e, t) {
|
|
88
89
|
return e.tagName !== "P" ? !1 : Array.from(e.childNodes).every((r) => r === t ? !0 : r.nodeType === Node.ELEMENT_NODE ? r.tagName === "BR" : r.nodeType === Node.TEXT_NODE && !r.textContent?.trim());
|
|
89
90
|
}
|
|
90
|
-
function
|
|
91
|
+
function B(e) {
|
|
91
92
|
if (!(e instanceof Element)) return null;
|
|
92
93
|
const t = e.closest("iframe");
|
|
93
94
|
if (t instanceof HTMLIFrameElement) {
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
95
|
+
const a = v(t);
|
|
96
|
+
if (!a) return null;
|
|
96
97
|
const i = t.parentElement;
|
|
97
|
-
return i && i.parentElement ===
|
|
98
|
+
return i && i.parentElement === a && C(i, t) ? i : t;
|
|
98
99
|
}
|
|
99
100
|
const r = e.closest("p");
|
|
100
101
|
if (!(r instanceof HTMLElement)) return null;
|
|
101
|
-
const o =
|
|
102
|
+
const o = v(r);
|
|
102
103
|
if (!o || r.parentElement !== o) return null;
|
|
103
|
-
const
|
|
104
|
-
(
|
|
104
|
+
const n = Array.from(r.children).find(
|
|
105
|
+
(a) => a instanceof HTMLIFrameElement
|
|
105
106
|
);
|
|
106
|
-
return
|
|
107
|
+
return n && C(r, n) ? r : null;
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
+
function m() {
|
|
109
110
|
c && (c.classList.remove("rte-selected-embed-object"), c.querySelector("iframe")?.removeAttribute("data-rte-selected-object"), c instanceof HTMLIFrameElement && c.removeAttribute("data-rte-selected-object"), c = null);
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function F(e) {
|
|
112
113
|
if (c === e) return;
|
|
113
|
-
|
|
114
|
+
m(), c = e, e.classList.add("rte-selected-embed-object"), (e instanceof HTMLIFrameElement ? e : e.querySelector("iframe"))?.setAttribute("data-rte-selected-object", "true");
|
|
114
115
|
const r = window.getSelection();
|
|
115
116
|
if (!r) return;
|
|
116
117
|
const o = document.createRange();
|
|
117
118
|
o.selectNode(e), r.removeAllRanges(), r.addRange(o);
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
+
function _(e, t) {
|
|
120
121
|
const r = window.getSelection();
|
|
121
122
|
if (!r) return;
|
|
122
123
|
const o = document.createRange();
|
|
123
124
|
t && t.parentNode === e ? o.setStartBefore(t) : (o.selectNodeContents(e), o.collapse(!1)), o.collapse(!0), r.removeAllRanges(), r.addRange(o);
|
|
124
125
|
}
|
|
125
|
-
function
|
|
126
|
+
function V(e) {
|
|
126
127
|
if (e.childNodes.length > 0) return;
|
|
127
128
|
const t = document.createElement("p");
|
|
128
129
|
t.appendChild(document.createElement("br")), e.appendChild(t);
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
+
function Z() {
|
|
131
132
|
if (!c || !c.isConnected)
|
|
132
|
-
return
|
|
133
|
-
const e = c, t =
|
|
133
|
+
return m(), !1;
|
|
134
|
+
const e = c, t = v(e);
|
|
134
135
|
if (!t)
|
|
135
|
-
return
|
|
136
|
+
return m(), !1;
|
|
136
137
|
const r = t.innerHTML, o = e.nextSibling;
|
|
137
|
-
e.remove(),
|
|
138
|
-
const
|
|
139
|
-
return
|
|
138
|
+
e.remove(), V(t), m(), _(t, o);
|
|
139
|
+
const n = t.innerHTML;
|
|
140
|
+
return T(t, r, n), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), r !== n;
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function A() {
|
|
142
143
|
if (document.getElementById("embed-iframe-object-selection-styles")) return;
|
|
143
144
|
const e = document.createElement("style");
|
|
144
145
|
e.id = "embed-iframe-object-selection-styles", e.textContent = `
|
|
@@ -160,25 +161,25 @@ function E() {
|
|
|
160
161
|
}
|
|
161
162
|
`, document.head.appendChild(e);
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
-
typeof window > "u" || window.__embedIframeObjectSelectionInitialized || (window.__embedIframeObjectSelectionInitialized = !0,
|
|
165
|
-
const t =
|
|
164
|
+
function W() {
|
|
165
|
+
typeof window > "u" || window.__embedIframeObjectSelectionInitialized || (window.__embedIframeObjectSelectionInitialized = !0, A(), document.addEventListener("pointerdown", (e) => {
|
|
166
|
+
const t = B(e.target);
|
|
166
167
|
if (!t) {
|
|
167
|
-
e.target?.closest?.(".rte-embed-iframe-overlay") ||
|
|
168
|
+
e.target?.closest?.(".rte-embed-iframe-overlay") || m();
|
|
168
169
|
return;
|
|
169
170
|
}
|
|
170
|
-
e.preventDefault(),
|
|
171
|
+
e.preventDefault(), v(t)?.focus(), F(t);
|
|
171
172
|
}, !0), document.addEventListener("keydown", (e) => {
|
|
172
173
|
if (c) {
|
|
173
174
|
if (e.key === "Escape") {
|
|
174
|
-
|
|
175
|
+
m();
|
|
175
176
|
return;
|
|
176
177
|
}
|
|
177
|
-
e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(),
|
|
178
|
+
e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), Z());
|
|
178
179
|
}
|
|
179
180
|
}, !0));
|
|
180
181
|
}
|
|
181
|
-
function
|
|
182
|
+
function G(e) {
|
|
182
183
|
try {
|
|
183
184
|
const t = new URL(e), r = t.hostname.replace(/^www\./, "");
|
|
184
185
|
if (r === "youtu.be") {
|
|
@@ -188,8 +189,8 @@ function z(e) {
|
|
|
188
189
|
if (r === "youtube.com" || r === "m.youtube.com") {
|
|
189
190
|
const o = t.searchParams.get("v");
|
|
190
191
|
if (o) return `https://www.youtube.com/embed/${encodeURIComponent(o)}`;
|
|
191
|
-
const
|
|
192
|
-
if (
|
|
192
|
+
const n = t.pathname.match(/^\/embed\/([^/]+)/);
|
|
193
|
+
if (n?.[1]) return `https://www.youtube.com/embed/${encodeURIComponent(n[1])}`;
|
|
193
194
|
}
|
|
194
195
|
if (r === "vimeo.com") {
|
|
195
196
|
const o = t.pathname.split("/").filter(Boolean)[0];
|
|
@@ -200,9 +201,18 @@ function z(e) {
|
|
|
200
201
|
return e;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
|
|
204
|
+
function R(e) {
|
|
205
|
+
if (/\s/.test(e)) return !1;
|
|
206
|
+
try {
|
|
207
|
+
const t = new URL(e);
|
|
208
|
+
return (t.protocol === "https:" || t.protocol === "http:") && t.hostname.length > 0;
|
|
209
|
+
} catch {
|
|
210
|
+
return !1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const ne = () => ({
|
|
204
214
|
name: "embedIframe",
|
|
205
|
-
init:
|
|
215
|
+
init: W,
|
|
206
216
|
toolbar: [
|
|
207
217
|
{
|
|
208
218
|
label: "Embed Content",
|
|
@@ -213,23 +223,23 @@ const W = () => ({
|
|
|
213
223
|
}
|
|
214
224
|
],
|
|
215
225
|
commands: {
|
|
216
|
-
openEmbedIframeDialog: (e, t) => (
|
|
226
|
+
openEmbedIframeDialog: (e, t) => (K(P(t) || void 0), !0)
|
|
217
227
|
},
|
|
218
228
|
keymap: {
|
|
219
229
|
"Mod-Shift-e": "openEmbedIframeDialog"
|
|
220
230
|
}
|
|
221
231
|
});
|
|
222
|
-
function
|
|
223
|
-
if (!e) {
|
|
224
|
-
const
|
|
225
|
-
|
|
232
|
+
function K(e) {
|
|
233
|
+
if (document.querySelectorAll(".rte-embed-iframe-overlay").forEach((a) => a.remove()), !e) {
|
|
234
|
+
const a = document.activeElement;
|
|
235
|
+
a && a.closest("[data-editora-editor]") && (e = a.closest("[data-editora-editor]"));
|
|
226
236
|
}
|
|
227
237
|
if (e || (e = document.querySelector("[data-editora-editor]")), !e) {
|
|
228
238
|
console.warn("Editor element not found");
|
|
229
239
|
return;
|
|
230
240
|
}
|
|
231
|
-
const t = s(e), r =
|
|
232
|
-
t.savedRange = r ?
|
|
241
|
+
const t = s(e), r = I(e);
|
|
242
|
+
t.savedRange = r ? O(r) : null, t.formData = {
|
|
233
243
|
src: "",
|
|
234
244
|
selectedSize: "inline",
|
|
235
245
|
width: "100%",
|
|
@@ -243,12 +253,12 @@ function j(e) {
|
|
|
243
253
|
enableScrollbar: !0
|
|
244
254
|
}, t.activeTab = "general";
|
|
245
255
|
const o = document.createElement("div");
|
|
246
|
-
o.className = "rte-dialog-overlay rte-embed-iframe-overlay",
|
|
247
|
-
const
|
|
248
|
-
|
|
256
|
+
M(o), o.className = "rte-dialog-overlay rte-embed-iframe-overlay", U(e) && o.classList.add("rte-theme-dark"), o.onclick = () => g(e);
|
|
257
|
+
const n = document.createElement("div");
|
|
258
|
+
n.className = "rte-dialog-content embed-iframe-dialog", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-labelledby", "embed-iframe-dialog-title"), n.onclick = (a) => a.stopPropagation(), n.innerHTML = `
|
|
249
259
|
<div class="rte-dialog-header">
|
|
250
|
-
<h3>Embed Iframe</h3>
|
|
251
|
-
<button class="rte-dialog-close">×</button>
|
|
260
|
+
<h3 id="embed-iframe-dialog-title">Embed Iframe</h3>
|
|
261
|
+
<button type="button" class="rte-dialog-close" aria-label="Close">×</button>
|
|
252
262
|
</div>
|
|
253
263
|
<div class="rte-dialog-body">
|
|
254
264
|
<div class="rte-vertical-tabs">
|
|
@@ -259,22 +269,23 @@ function j(e) {
|
|
|
259
269
|
<div class="rte-tab-content">
|
|
260
270
|
<div class="rte-tab-panel" data-panel="general" style="display: block;">
|
|
261
271
|
<div class="rte-form-group">
|
|
262
|
-
<label class="rte-form-label">Source</label>
|
|
263
|
-
<input type="url" class="rte-form-input" id="iframe-src" placeholder="https://example.com" required />
|
|
272
|
+
<label class="rte-form-label" for="iframe-src">Source</label>
|
|
273
|
+
<input type="url" class="rte-form-input" id="iframe-src" placeholder="https://example.com" required aria-describedby="iframe-src-error" />
|
|
274
|
+
<div class="rte-form-error" id="iframe-src-error" role="alert" hidden></div>
|
|
264
275
|
</div>
|
|
265
276
|
<div class="rte-form-group">
|
|
266
|
-
<label class="rte-form-label">Size</label>
|
|
277
|
+
<label class="rte-form-label" for="iframe-size">Size</label>
|
|
267
278
|
<select class="rte-form-select" id="iframe-size">
|
|
268
|
-
${
|
|
279
|
+
${j.map((a) => `<option value="${a.value}">${a.label}</option>`).join("")}
|
|
269
280
|
</select>
|
|
270
281
|
</div>
|
|
271
282
|
<div class="rte-form-row" id="dimensions-row">
|
|
272
283
|
<div class="rte-form-group">
|
|
273
|
-
<label class="rte-form-label">Width</label>
|
|
284
|
+
<label class="rte-form-label" for="iframe-width">Width</label>
|
|
274
285
|
<input type="text" class="rte-form-input" id="iframe-width" placeholder="100%" value="100%" />
|
|
275
286
|
</div>
|
|
276
287
|
<div class="rte-form-group">
|
|
277
|
-
<label class="rte-form-label">Height</label>
|
|
288
|
+
<label class="rte-form-label" for="iframe-height">Height</label>
|
|
278
289
|
<input type="text" class="rte-form-input" id="iframe-height" placeholder="400px" value="400px" />
|
|
279
290
|
</div>
|
|
280
291
|
<div class="rte-form-group constrain-group">
|
|
@@ -284,20 +295,21 @@ function j(e) {
|
|
|
284
295
|
</div>
|
|
285
296
|
<div class="rte-tab-panel" data-panel="advanced" style="display: none;">
|
|
286
297
|
<div class="rte-form-group">
|
|
287
|
-
<label class="rte-form-label">Name</label>
|
|
298
|
+
<label class="rte-form-label" for="iframe-name">Name</label>
|
|
288
299
|
<input type="text" class="rte-form-input" id="iframe-name" placeholder="Iframe name" />
|
|
289
300
|
</div>
|
|
290
301
|
<div class="rte-form-group">
|
|
291
|
-
<label class="rte-form-label">Title</label>
|
|
302
|
+
<label class="rte-form-label" for="iframe-title">Title</label>
|
|
292
303
|
<input type="text" class="rte-form-input" id="iframe-title" placeholder="Iframe title" />
|
|
293
304
|
</div>
|
|
294
305
|
<div class="rte-form-group">
|
|
295
|
-
<label class="rte-form-label">Long Description</label>
|
|
306
|
+
<label class="rte-form-label" for="iframe-longdesc">Long Description</label>
|
|
296
307
|
<textarea class="rte-form-textarea" id="iframe-longdesc" placeholder="Detailed description of the iframe content" rows="3"></textarea>
|
|
297
308
|
</div>
|
|
298
309
|
<div class="rte-form-group">
|
|
299
|
-
<label class="rte-form-label">Description URL</label>
|
|
300
|
-
<input type="url" class="rte-form-input" id="iframe-desc-url" placeholder="https://example.com/description" />
|
|
310
|
+
<label class="rte-form-label" for="iframe-desc-url">Description URL</label>
|
|
311
|
+
<input type="url" class="rte-form-input" id="iframe-desc-url" placeholder="https://example.com/description" aria-describedby="iframe-desc-url-error" />
|
|
312
|
+
<div class="rte-form-error" id="iframe-desc-url-error" role="alert" hidden></div>
|
|
301
313
|
</div>
|
|
302
314
|
<div class="rte-form-group">
|
|
303
315
|
<label class="rte-checkbox-label">
|
|
@@ -319,115 +331,130 @@ function j(e) {
|
|
|
319
331
|
<button type="button" class="rte-btn rte-btn-secondary" id="cancel-btn">Cancel</button>
|
|
320
332
|
<button type="submit" class="rte-btn rte-btn-primary" id="save-btn">Save</button>
|
|
321
333
|
</div>
|
|
322
|
-
`, o.appendChild(
|
|
323
|
-
|
|
324
|
-
}, document.addEventListener("keydown", t.escapeHandler, !0),
|
|
325
|
-
|
|
334
|
+
`, o.appendChild(n), document.body.appendChild(o), t.dialogElement = o, t.escapeHandler = (a) => {
|
|
335
|
+
a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), g(e));
|
|
336
|
+
}, document.addEventListener("keydown", t.escapeHandler, !0), X(n, e), oe(), setTimeout(() => {
|
|
337
|
+
n.querySelector("#iframe-src")?.focus();
|
|
326
338
|
}, 100);
|
|
327
339
|
}
|
|
328
|
-
function
|
|
329
|
-
|
|
330
|
-
|
|
340
|
+
function X(e, t) {
|
|
341
|
+
e.querySelector(".rte-dialog-close")?.addEventListener("click", () => g(t)), e.querySelectorAll(".rte-tab-button").forEach((a) => {
|
|
342
|
+
a.addEventListener("click", (i) => {
|
|
331
343
|
const l = i.target.getAttribute("data-tab");
|
|
332
|
-
l &&
|
|
344
|
+
l && q(e, l, t);
|
|
333
345
|
});
|
|
334
|
-
}), e.querySelector("#iframe-size")?.addEventListener("change", (
|
|
335
|
-
const o = e.querySelector("#iframe-width"),
|
|
336
|
-
o?.addEventListener("input", (
|
|
346
|
+
}), e.querySelector("#iframe-size")?.addEventListener("change", (a) => J(e, a.target.value, t));
|
|
347
|
+
const o = e.querySelector("#iframe-width"), n = e.querySelector("#iframe-height");
|
|
348
|
+
o?.addEventListener("input", (a) => Q(e, a.target.value, t)), n?.addEventListener("input", (a) => Y(e, a.target.value, t)), e.querySelector("#constrain-btn")?.addEventListener("click", () => ee(e, t)), e.querySelector("#cancel-btn")?.addEventListener("click", () => g(t)), e.querySelector("#save-btn")?.addEventListener("click", () => te(e, t));
|
|
337
349
|
}
|
|
338
|
-
function
|
|
350
|
+
function q(e, t, r) {
|
|
339
351
|
const o = s(r);
|
|
340
|
-
o.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((
|
|
341
|
-
|
|
342
|
-
}), e.querySelectorAll(".rte-tab-panel").forEach((
|
|
343
|
-
|
|
352
|
+
o.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((n) => {
|
|
353
|
+
n.classList.toggle("active", n.getAttribute("data-tab") === t);
|
|
354
|
+
}), e.querySelectorAll(".rte-tab-panel").forEach((n) => {
|
|
355
|
+
n.style.display = n.getAttribute("data-panel") === t ? "block" : "none";
|
|
344
356
|
});
|
|
345
357
|
}
|
|
346
|
-
function
|
|
358
|
+
function J(e, t, r) {
|
|
347
359
|
const o = s(r);
|
|
348
360
|
o.formData.selectedSize = t;
|
|
349
|
-
const
|
|
350
|
-
t === "inline" ? (
|
|
361
|
+
const n = e.querySelector("#dimensions-row"), a = e.querySelector("#iframe-width"), i = e.querySelector("#iframe-height");
|
|
362
|
+
t === "inline" ? (n.style.display = "flex", a.value = "100%", i.value = "400px", o.formData.width = "100%", o.formData.height = "400px") : (n.style.display = "none", o.formData.width = "100%", o.formData.height = "auto");
|
|
351
363
|
}
|
|
352
|
-
function
|
|
364
|
+
function Q(e, t, r) {
|
|
353
365
|
const o = s(r);
|
|
354
366
|
if (o.formData.width = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
|
|
355
|
-
const
|
|
356
|
-
if (!isNaN(
|
|
357
|
-
const
|
|
358
|
-
o.formData.height = `${
|
|
367
|
+
const n = parseFloat(t);
|
|
368
|
+
if (!isNaN(n)) {
|
|
369
|
+
const a = n * 9 / 16;
|
|
370
|
+
o.formData.height = `${a}px`;
|
|
359
371
|
const i = e.querySelector("#iframe-height");
|
|
360
372
|
i && (i.value = o.formData.height);
|
|
361
373
|
}
|
|
362
374
|
}
|
|
363
375
|
}
|
|
364
|
-
function
|
|
376
|
+
function Y(e, t, r) {
|
|
365
377
|
const o = s(r);
|
|
366
378
|
if (o.formData.height = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
|
|
367
|
-
const
|
|
368
|
-
if (!isNaN(
|
|
369
|
-
const
|
|
370
|
-
o.formData.width = `${
|
|
379
|
+
const n = parseFloat(t);
|
|
380
|
+
if (!isNaN(n)) {
|
|
381
|
+
const a = n * 16 / 9;
|
|
382
|
+
o.formData.width = `${a}px`;
|
|
371
383
|
const i = e.querySelector("#iframe-width");
|
|
372
384
|
i && (i.value = o.formData.width);
|
|
373
385
|
}
|
|
374
386
|
}
|
|
375
387
|
}
|
|
376
|
-
function
|
|
388
|
+
function ee(e, t) {
|
|
377
389
|
const r = s(t);
|
|
378
390
|
r.formData.constrainProportions = !r.formData.constrainProportions;
|
|
379
391
|
const o = e.querySelector("#constrain-btn");
|
|
380
392
|
o && (o.textContent = r.formData.constrainProportions ? "🔒" : "🔓", o.className = `rte-constrain-btn ${r.formData.constrainProportions ? "locked" : "unlocked"}`, o.title = r.formData.constrainProportions ? "Unlock proportions" : "Lock proportions");
|
|
381
393
|
}
|
|
382
|
-
function
|
|
383
|
-
const r = s(t), o = e.querySelector("#iframe-src")
|
|
384
|
-
|
|
385
|
-
|
|
394
|
+
function te(e, t) {
|
|
395
|
+
const r = s(t), o = e.querySelector("#iframe-src"), n = e.querySelector("#iframe-desc-url");
|
|
396
|
+
let a = o?.value.trim() || "";
|
|
397
|
+
a && !/^[a-z][a-z0-9+.-]*:/i.test(a) && /^[^\s/]+\.[^\s/]+/.test(a) && (a = `https://${a}`, o && (o.value = a));
|
|
398
|
+
const i = (b, w, p, z) => {
|
|
399
|
+
q(e, z, t);
|
|
400
|
+
const k = e.querySelector(`#${w}`);
|
|
401
|
+
k && (k.textContent = p, k.hidden = !1), b && (b.setAttribute("aria-invalid", "true"), b.focus());
|
|
402
|
+
}, l = (b, w) => {
|
|
403
|
+
const p = e.querySelector(`#${w}`);
|
|
404
|
+
p && (p.textContent = "", p.hidden = !0), b?.removeAttribute("aria-invalid");
|
|
405
|
+
};
|
|
406
|
+
if (l(o, "iframe-src-error"), l(n, "iframe-desc-url-error"), !a) {
|
|
407
|
+
i(o, "iframe-src-error", "Please enter a source URL.", "general");
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (!R(a)) {
|
|
411
|
+
i(o, "iframe-src-error", "Enter a valid URL starting with https:// or http://.", "general");
|
|
386
412
|
return;
|
|
387
413
|
}
|
|
388
|
-
|
|
389
|
-
|
|
414
|
+
const d = n?.value.trim() || "";
|
|
415
|
+
if (d && !R(d)) {
|
|
416
|
+
i(n, "iframe-desc-url-error", "Enter a valid URL starting with https:// or http://.", "advanced");
|
|
390
417
|
return;
|
|
391
418
|
}
|
|
392
|
-
const
|
|
393
|
-
let
|
|
394
|
-
r.formData.selectedSize !== "inline" && (
|
|
395
|
-
src:
|
|
396
|
-
width:
|
|
397
|
-
height:
|
|
419
|
+
const y = e.querySelector("#iframe-name")?.value.trim(), f = e.querySelector("#iframe-title")?.value.trim(), u = e.querySelector("#iframe-longdesc")?.value.trim(), x = d, H = e.querySelector("#iframe-border")?.checked ?? !0, N = e.querySelector("#iframe-scrollbar")?.checked ?? !0;
|
|
420
|
+
let S = r.formData.width, D = r.formData.height;
|
|
421
|
+
r.formData.selectedSize !== "inline" && (S = "100%", D = "auto"), re(t, {
|
|
422
|
+
src: a,
|
|
423
|
+
width: S,
|
|
424
|
+
height: D,
|
|
398
425
|
aspectRatio: r.formData.selectedSize,
|
|
399
|
-
name:
|
|
400
|
-
title:
|
|
401
|
-
longDescription:
|
|
402
|
-
descriptionUrl:
|
|
403
|
-
showBorder:
|
|
404
|
-
enableScrollbar:
|
|
405
|
-
}),
|
|
426
|
+
name: y || void 0,
|
|
427
|
+
title: f || void 0,
|
|
428
|
+
longDescription: u || void 0,
|
|
429
|
+
descriptionUrl: x || void 0,
|
|
430
|
+
showBorder: H,
|
|
431
|
+
enableScrollbar: N
|
|
432
|
+
}), g(t);
|
|
406
433
|
}
|
|
407
|
-
function
|
|
408
|
-
const r = s(e), o =
|
|
434
|
+
function re(e, t) {
|
|
435
|
+
const r = s(e), o = I(e);
|
|
409
436
|
if (!o) return;
|
|
410
|
-
const
|
|
411
|
-
|
|
437
|
+
const n = o.innerHTML, a = document.createElement("iframe");
|
|
438
|
+
a.src = G(t.src), a.width = t.width, a.height = t.height, a.allowFullscreen = !0, a.setAttribute("frameborder", t.showBorder ? "1" : "0"), a.setAttribute("scrolling", t.enableScrollbar ? "auto" : "no"), a.setAttribute("data-aspect-ratio", t.aspectRatio), a.setAttribute("data-editora-embed", "true"), t.aspectRatio !== "inline" && a.classList.add(`rte-iframe-${t.aspectRatio}`), t.name && (a.name = t.name), t.title && (a.title = t.title), t.longDescription && a.setAttribute("data-long-description", t.longDescription), t.descriptionUrl && a.setAttribute("longdesc", t.descriptionUrl);
|
|
412
439
|
const i = document.createElement("p");
|
|
413
|
-
i.appendChild(
|
|
440
|
+
i.appendChild(a), i.appendChild(document.createElement("br"));
|
|
414
441
|
const l = r.savedRange && o.contains(r.savedRange.commonAncestorContainer) ? r.savedRange : document.createRange();
|
|
415
442
|
(!r.savedRange || !o.contains(r.savedRange.commonAncestorContainer)) && (l.selectNodeContents(o), l.collapse(!1));
|
|
416
|
-
const
|
|
417
|
-
o.insertBefore(i,
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
|
|
443
|
+
const d = $(o, l.startContainer), y = d ? d.nextSibling : null;
|
|
444
|
+
o.insertBefore(i, y);
|
|
445
|
+
const f = document.createRange();
|
|
446
|
+
f.setStartAfter(i), f.collapse(!0);
|
|
447
|
+
const u = window.getSelection();
|
|
448
|
+
u && (u.removeAllRanges(), u.addRange(f)), r.savedRange = null;
|
|
449
|
+
const x = o.innerHTML;
|
|
450
|
+
T(o, n, x), o.dispatchEvent(new CustomEvent("input", { bubbles: !0, detail: { allowedTags: ["iframe"] } }));
|
|
424
451
|
}
|
|
425
|
-
function
|
|
452
|
+
function g(e) {
|
|
426
453
|
const t = s(e);
|
|
427
454
|
t.savedRange = null, t.escapeHandler && (document.removeEventListener("keydown", t.escapeHandler, !0), t.escapeHandler = null), t.dialogElement && (t.dialogElement.remove(), t.dialogElement = null);
|
|
428
455
|
}
|
|
429
|
-
function
|
|
430
|
-
if (
|
|
456
|
+
function oe() {
|
|
457
|
+
if (A(), document.getElementById("embed-iframe-dialog-styles")) return;
|
|
431
458
|
const e = document.createElement("style");
|
|
432
459
|
e.id = "embed-iframe-dialog-styles", e.textContent = `
|
|
433
460
|
/* Embed Iframe Dialog Styles */
|
|
@@ -496,6 +523,24 @@ function V() {
|
|
|
496
523
|
}
|
|
497
524
|
|
|
498
525
|
.rte-form-textarea,
|
|
526
|
+
.rte-form-error {
|
|
527
|
+
margin-top: 4px;
|
|
528
|
+
font-size: 12px;
|
|
529
|
+
color: #c62828;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.rte-form-error[hidden] {
|
|
533
|
+
display: none;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.rte-form-input[aria-invalid="true"] {
|
|
537
|
+
border-color: #c62828;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.rte-embed-iframe-overlay.rte-theme-dark .rte-form-error {
|
|
541
|
+
color: #ff8a80;
|
|
542
|
+
}
|
|
543
|
+
|
|
499
544
|
.rte-form-input,
|
|
500
545
|
.rte-form-select {
|
|
501
546
|
width: 100%;
|
|
@@ -718,5 +763,5 @@ function V() {
|
|
|
718
763
|
`, document.head.appendChild(e);
|
|
719
764
|
}
|
|
720
765
|
export {
|
|
721
|
-
|
|
766
|
+
ne as EmbedIframePlugin
|
|
722
767
|
};
|