@editora/core 1.0.15 → 1.0.17
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-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
- package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
- package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
- package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
- package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
- package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
- package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
- package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
- package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
- package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
- package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
- package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
- package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
- package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
- package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
- package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
- package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
- package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
- package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
- package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
- package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
- package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
- package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
- package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
- package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
- package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
- package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
- package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
- package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
- package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
- package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
- package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
- package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
- package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
- package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
- package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
- package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
- package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
- package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
- package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
- package/dist/core.css +1 -1
- package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
- package/dist/editora.min.js +26 -24
- package/dist/editora.umd.js +26 -24
- package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
- package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
- package/dist/index-XsYC_KdJ.mjs +3923 -0
- package/dist/index-_eKRBZPq.js +12 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.esm.js +17 -14
- package/dist/plugin-loader.js +53 -52
- package/dist/webcomponent-core.js +2055 -476
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +96 -66
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +2223 -643
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +1564 -1198
- package/index.d.ts +32 -0
- package/package.json +10 -3
- package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
- package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
- package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
- package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
- package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
- package/dist/index-BLm1MtzH.js +0 -10
- package/dist/index-Cd9jEuZP.mjs +0 -2341
package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { i as F } from "./dialogHelpers-DBf7WqYH.mjs";
|
|
2
|
+
const _ = [
|
|
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
|
+
], g = '[data-theme="dark"], .dark, .editora-theme-dark';
|
|
8
9
|
let c = null;
|
|
9
|
-
const
|
|
10
|
+
const E = /* @__PURE__ */ new WeakMap(), m = (e) => (E.has(e) || E.set(e, {
|
|
10
11
|
dialogElement: null,
|
|
11
12
|
escapeHandler: null,
|
|
12
13
|
savedRange: null,
|
|
@@ -24,29 +25,29 @@ const y = /* @__PURE__ */ new WeakMap(), d = (e) => (y.has(e) || y.set(e, {
|
|
|
24
25
|
showBorder: !0,
|
|
25
26
|
enableScrollbar: !0
|
|
26
27
|
}
|
|
27
|
-
}),
|
|
28
|
-
function
|
|
29
|
-
if (e != null && e.matches(
|
|
28
|
+
}), E.get(e));
|
|
29
|
+
function V(e) {
|
|
30
|
+
if (e != null && e.matches(g) || e != null && e.closest(g))
|
|
30
31
|
return !0;
|
|
31
32
|
const t = document.activeElement;
|
|
32
|
-
return t != null && t.closest(
|
|
33
|
+
return t != null && t.closest(g) ? !0 : document.body.matches(g) || document.documentElement.matches(g);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function z(e) {
|
|
35
36
|
return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
+
function Z(e) {
|
|
38
39
|
const t = e == null ? void 0 : e.editorElement;
|
|
39
40
|
if (t instanceof HTMLElement) return t;
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
const i =
|
|
43
|
-
return i instanceof HTMLElement ? i :
|
|
41
|
+
const o = e == null ? void 0 : e.contentElement;
|
|
42
|
+
if (o instanceof HTMLElement) {
|
|
43
|
+
const i = o.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
44
|
+
return i instanceof HTMLElement ? i : o;
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
46
|
+
const r = window.__editoraCommandEditorRoot;
|
|
47
|
+
if (r instanceof HTMLElement) return r;
|
|
47
48
|
const n = window.getSelection();
|
|
48
49
|
if (n && n.rangeCount > 0) {
|
|
49
|
-
const i =
|
|
50
|
+
const i = z(n.getRangeAt(0).startContainer), l = i == null ? void 0 : i.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
50
51
|
if (l instanceof HTMLElement) return l;
|
|
51
52
|
}
|
|
52
53
|
const a = document.activeElement;
|
|
@@ -56,99 +57,99 @@ function M(e) {
|
|
|
56
57
|
}
|
|
57
58
|
return document.querySelector("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function M(e) {
|
|
60
61
|
return e.getAttribute("contenteditable") === "true" ? e : e.querySelector('.rte-content, .editora-content, [contenteditable="true"]');
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
const t =
|
|
63
|
+
function y(e) {
|
|
64
|
+
const t = z(e);
|
|
64
65
|
return t == null ? void 0 : t.closest('.rte-content, .editora-content, [contenteditable="true"]');
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function W(e) {
|
|
67
68
|
const t = window.getSelection();
|
|
68
69
|
if (!t || t.rangeCount === 0) return null;
|
|
69
|
-
const
|
|
70
|
-
return !e.contains(
|
|
70
|
+
const o = t.getRangeAt(0);
|
|
71
|
+
return !e.contains(o.startContainer) || !e.contains(o.endContainer) ? null : o.cloneRange();
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
if (t !==
|
|
73
|
+
function j(e, t, o) {
|
|
74
|
+
if (t !== o) {
|
|
74
75
|
if (typeof window.execEditorCommand == "function") {
|
|
75
|
-
window.execEditorCommand("recordDomTransaction", e, t,
|
|
76
|
+
window.execEditorCommand("recordDomTransaction", e, t, o);
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
if (typeof window.executeEditorCommand == "function")
|
|
79
80
|
try {
|
|
80
|
-
window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML:
|
|
81
|
-
} catch (
|
|
81
|
+
window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: o });
|
|
82
|
+
} catch (r) {
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
for (;
|
|
88
|
-
|
|
89
|
-
return
|
|
86
|
+
function G(e, t) {
|
|
87
|
+
let o = t;
|
|
88
|
+
for (; o && o.parentNode && o.parentNode !== e; )
|
|
89
|
+
o = o.parentNode;
|
|
90
|
+
return o && o.parentNode === e ? o : null;
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
return e.tagName !== "P" ? !1 : Array.from(e.childNodes).every((
|
|
93
|
-
var
|
|
94
|
-
return
|
|
92
|
+
function H(e, t) {
|
|
93
|
+
return e.tagName !== "P" ? !1 : Array.from(e.childNodes).every((o) => {
|
|
94
|
+
var r;
|
|
95
|
+
return o === t ? !0 : o.nodeType === Node.ELEMENT_NODE ? o.tagName === "BR" : o.nodeType === Node.TEXT_NODE && !((r = o.textContent) != null && r.trim());
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function K(e) {
|
|
98
99
|
if (!(e instanceof Element)) return null;
|
|
99
100
|
const t = e.closest("iframe");
|
|
100
101
|
if (t instanceof HTMLIFrameElement) {
|
|
101
|
-
const a =
|
|
102
|
+
const a = y(t);
|
|
102
103
|
if (!a) return null;
|
|
103
104
|
const i = t.parentElement;
|
|
104
|
-
return i && i.parentElement === a &&
|
|
105
|
+
return i && i.parentElement === a && H(i, t) ? i : t;
|
|
105
106
|
}
|
|
106
|
-
const
|
|
107
|
-
if (!(
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
const n = Array.from(
|
|
107
|
+
const o = e.closest("p");
|
|
108
|
+
if (!(o instanceof HTMLElement)) return null;
|
|
109
|
+
const r = y(o);
|
|
110
|
+
if (!r || o.parentElement !== r) return null;
|
|
111
|
+
const n = Array.from(o.children).find(
|
|
111
112
|
(a) => a instanceof HTMLIFrameElement
|
|
112
113
|
);
|
|
113
|
-
return n &&
|
|
114
|
+
return n && H(o, n) ? o : null;
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function p() {
|
|
116
117
|
var e;
|
|
117
118
|
c && (c.classList.remove("rte-selected-embed-object"), (e = c.querySelector("iframe")) == null || e.removeAttribute("data-rte-selected-object"), c instanceof HTMLIFrameElement && c.removeAttribute("data-rte-selected-object"), c = null);
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
+
function X(e) {
|
|
120
121
|
if (c === e) return;
|
|
121
|
-
|
|
122
|
+
p(), c = e, e.classList.add("rte-selected-embed-object");
|
|
122
123
|
const t = e instanceof HTMLIFrameElement ? e : e.querySelector("iframe");
|
|
123
124
|
t == null || t.setAttribute("data-rte-selected-object", "true");
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
126
|
-
const
|
|
127
|
-
|
|
125
|
+
const o = window.getSelection();
|
|
126
|
+
if (!o) return;
|
|
127
|
+
const r = document.createRange();
|
|
128
|
+
r.selectNode(e), o.removeAllRanges(), o.addRange(r);
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
if (!
|
|
132
|
-
const
|
|
133
|
-
t && t.parentNode === e ?
|
|
130
|
+
function J(e, t) {
|
|
131
|
+
const o = window.getSelection();
|
|
132
|
+
if (!o) return;
|
|
133
|
+
const r = document.createRange();
|
|
134
|
+
t && t.parentNode === e ? r.setStartBefore(t) : (r.selectNodeContents(e), r.collapse(!1)), r.collapse(!0), o.removeAllRanges(), o.addRange(r);
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function Q(e) {
|
|
136
137
|
if (e.childNodes.length > 0) return;
|
|
137
138
|
const t = document.createElement("p");
|
|
138
139
|
t.appendChild(document.createElement("br")), e.appendChild(t);
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function Y() {
|
|
141
142
|
if (!c || !c.isConnected)
|
|
142
|
-
return
|
|
143
|
-
const e = c, t =
|
|
143
|
+
return p(), !1;
|
|
144
|
+
const e = c, t = y(e);
|
|
144
145
|
if (!t)
|
|
145
|
-
return
|
|
146
|
-
const
|
|
147
|
-
e.remove(),
|
|
146
|
+
return p(), !1;
|
|
147
|
+
const o = t.innerHTML, r = e.nextSibling;
|
|
148
|
+
e.remove(), Q(t), p(), J(t, r);
|
|
148
149
|
const n = t.innerHTML;
|
|
149
|
-
return
|
|
150
|
+
return j(t, o, n), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), o !== n;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function P() {
|
|
152
153
|
if (document.getElementById("embed-iframe-object-selection-styles")) return;
|
|
153
154
|
const e = document.createElement("style");
|
|
154
155
|
e.id = "embed-iframe-object-selection-styles", e.textContent = `
|
|
@@ -170,51 +171,60 @@ function N() {
|
|
|
170
171
|
}
|
|
171
172
|
`, document.head.appendChild(e);
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
-
typeof window == "undefined" || window.__embedIframeObjectSelectionInitialized || (window.__embedIframeObjectSelectionInitialized = !0,
|
|
175
|
-
var
|
|
176
|
-
const t =
|
|
174
|
+
function ee() {
|
|
175
|
+
typeof window == "undefined" || window.__embedIframeObjectSelectionInitialized || (window.__embedIframeObjectSelectionInitialized = !0, P(), document.addEventListener("pointerdown", (e) => {
|
|
176
|
+
var o, r;
|
|
177
|
+
const t = K(e.target);
|
|
177
178
|
if (!t) {
|
|
178
179
|
const n = e.target;
|
|
179
|
-
(
|
|
180
|
+
(o = n == null ? void 0 : n.closest) != null && o.call(n, ".rte-embed-iframe-overlay") || p();
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
|
-
e.preventDefault(), (
|
|
183
|
+
e.preventDefault(), (r = y(t)) == null || r.focus(), X(t);
|
|
183
184
|
}, !0), document.addEventListener("keydown", (e) => {
|
|
184
185
|
if (c) {
|
|
185
186
|
if (e.key === "Escape") {
|
|
186
|
-
|
|
187
|
+
p();
|
|
187
188
|
return;
|
|
188
189
|
}
|
|
189
|
-
e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(),
|
|
190
|
+
e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), Y());
|
|
190
191
|
}
|
|
191
192
|
}, !0));
|
|
192
193
|
}
|
|
193
|
-
function
|
|
194
|
+
function te(e) {
|
|
194
195
|
try {
|
|
195
|
-
const t = new URL(e),
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
199
|
-
}
|
|
200
|
-
if (
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
196
|
+
const t = new URL(e), o = t.hostname.replace(/^www\./, "");
|
|
197
|
+
if (o === "youtu.be") {
|
|
198
|
+
const r = t.pathname.split("/").filter(Boolean)[0];
|
|
199
|
+
if (r) return `https://www.youtube.com/embed/${encodeURIComponent(r)}`;
|
|
200
|
+
}
|
|
201
|
+
if (o === "youtube.com" || o === "m.youtube.com") {
|
|
202
|
+
const r = t.searchParams.get("v");
|
|
203
|
+
if (r) return `https://www.youtube.com/embed/${encodeURIComponent(r)}`;
|
|
203
204
|
const n = t.pathname.match(/^\/embed\/([^/]+)/);
|
|
204
205
|
if (n != null && n[1]) return `https://www.youtube.com/embed/${encodeURIComponent(n[1])}`;
|
|
205
206
|
}
|
|
206
|
-
if (
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
207
|
+
if (o === "vimeo.com") {
|
|
208
|
+
const r = t.pathname.split("/").filter(Boolean)[0];
|
|
209
|
+
if (r && /^\d+$/.test(r)) return `https://player.vimeo.com/video/${r}`;
|
|
209
210
|
}
|
|
210
211
|
return e;
|
|
211
212
|
} catch (t) {
|
|
212
213
|
return e;
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
|
-
|
|
216
|
+
function N(e) {
|
|
217
|
+
if (/\s/.test(e)) return !1;
|
|
218
|
+
try {
|
|
219
|
+
const t = new URL(e);
|
|
220
|
+
return (t.protocol === "https:" || t.protocol === "http:") && t.hostname.length > 0;
|
|
221
|
+
} catch (t) {
|
|
222
|
+
return !1;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const fe = () => ({
|
|
216
226
|
name: "embedIframe",
|
|
217
|
-
init:
|
|
227
|
+
init: ee,
|
|
218
228
|
toolbar: [
|
|
219
229
|
{
|
|
220
230
|
label: "Embed Content",
|
|
@@ -225,14 +235,14 @@ const te = () => ({
|
|
|
225
235
|
}
|
|
226
236
|
],
|
|
227
237
|
commands: {
|
|
228
|
-
openEmbedIframeDialog: (e, t) => (Z(
|
|
238
|
+
openEmbedIframeDialog: (e, t) => (re(Z(t) || void 0), !0)
|
|
229
239
|
},
|
|
230
240
|
keymap: {
|
|
231
241
|
"Mod-Shift-e": "openEmbedIframeDialog"
|
|
232
242
|
}
|
|
233
243
|
});
|
|
234
|
-
function
|
|
235
|
-
if (!e) {
|
|
244
|
+
function re(e) {
|
|
245
|
+
if (document.querySelectorAll(".rte-embed-iframe-overlay").forEach((a) => a.remove()), !e) {
|
|
236
246
|
const a = document.activeElement;
|
|
237
247
|
a && a.closest("[data-editora-editor]") && (e = a.closest("[data-editora-editor]"));
|
|
238
248
|
}
|
|
@@ -240,8 +250,8 @@ function Z(e) {
|
|
|
240
250
|
console.warn("Editor element not found");
|
|
241
251
|
return;
|
|
242
252
|
}
|
|
243
|
-
const t =
|
|
244
|
-
t.savedRange =
|
|
253
|
+
const t = m(e), o = M(e);
|
|
254
|
+
t.savedRange = o ? W(o) : null, t.formData = {
|
|
245
255
|
src: "",
|
|
246
256
|
selectedSize: "inline",
|
|
247
257
|
width: "100%",
|
|
@@ -254,13 +264,13 @@ function Z(e) {
|
|
|
254
264
|
showBorder: !0,
|
|
255
265
|
enableScrollbar: !0
|
|
256
266
|
}, t.activeTab = "general";
|
|
257
|
-
const
|
|
258
|
-
|
|
267
|
+
const r = document.createElement("div");
|
|
268
|
+
F(r), r.className = "rte-dialog-overlay rte-embed-iframe-overlay", V(e) && r.classList.add("rte-theme-dark"), r.onclick = () => v(e);
|
|
259
269
|
const n = document.createElement("div");
|
|
260
|
-
n.className = "rte-dialog-content embed-iframe-dialog", n.onclick = (a) => a.stopPropagation(), n.innerHTML = `
|
|
270
|
+
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 = `
|
|
261
271
|
<div class="rte-dialog-header">
|
|
262
|
-
<h3>Embed Iframe</h3>
|
|
263
|
-
<button class="rte-dialog-close">×</button>
|
|
272
|
+
<h3 id="embed-iframe-dialog-title">Embed Iframe</h3>
|
|
273
|
+
<button type="button" class="rte-dialog-close" aria-label="Close">×</button>
|
|
264
274
|
</div>
|
|
265
275
|
<div class="rte-dialog-body">
|
|
266
276
|
<div class="rte-vertical-tabs">
|
|
@@ -271,22 +281,23 @@ function Z(e) {
|
|
|
271
281
|
<div class="rte-tab-content">
|
|
272
282
|
<div class="rte-tab-panel" data-panel="general" style="display: block;">
|
|
273
283
|
<div class="rte-form-group">
|
|
274
|
-
<label class="rte-form-label">Source</label>
|
|
275
|
-
<input type="url" class="rte-form-input" id="iframe-src" placeholder="https://example.com" required />
|
|
284
|
+
<label class="rte-form-label" for="iframe-src">Source</label>
|
|
285
|
+
<input type="url" class="rte-form-input" id="iframe-src" placeholder="https://example.com" required aria-describedby="iframe-src-error" />
|
|
286
|
+
<div class="rte-form-error" id="iframe-src-error" role="alert" hidden></div>
|
|
276
287
|
</div>
|
|
277
288
|
<div class="rte-form-group">
|
|
278
|
-
<label class="rte-form-label">Size</label>
|
|
289
|
+
<label class="rte-form-label" for="iframe-size">Size</label>
|
|
279
290
|
<select class="rte-form-select" id="iframe-size">
|
|
280
|
-
${
|
|
291
|
+
${_.map((a) => `<option value="${a.value}">${a.label}</option>`).join("")}
|
|
281
292
|
</select>
|
|
282
293
|
</div>
|
|
283
294
|
<div class="rte-form-row" id="dimensions-row">
|
|
284
295
|
<div class="rte-form-group">
|
|
285
|
-
<label class="rte-form-label">Width</label>
|
|
296
|
+
<label class="rte-form-label" for="iframe-width">Width</label>
|
|
286
297
|
<input type="text" class="rte-form-input" id="iframe-width" placeholder="100%" value="100%" />
|
|
287
298
|
</div>
|
|
288
299
|
<div class="rte-form-group">
|
|
289
|
-
<label class="rte-form-label">Height</label>
|
|
300
|
+
<label class="rte-form-label" for="iframe-height">Height</label>
|
|
290
301
|
<input type="text" class="rte-form-input" id="iframe-height" placeholder="400px" value="400px" />
|
|
291
302
|
</div>
|
|
292
303
|
<div class="rte-form-group constrain-group">
|
|
@@ -296,20 +307,21 @@ function Z(e) {
|
|
|
296
307
|
</div>
|
|
297
308
|
<div class="rte-tab-panel" data-panel="advanced" style="display: none;">
|
|
298
309
|
<div class="rte-form-group">
|
|
299
|
-
<label class="rte-form-label">Name</label>
|
|
310
|
+
<label class="rte-form-label" for="iframe-name">Name</label>
|
|
300
311
|
<input type="text" class="rte-form-input" id="iframe-name" placeholder="Iframe name" />
|
|
301
312
|
</div>
|
|
302
313
|
<div class="rte-form-group">
|
|
303
|
-
<label class="rte-form-label">Title</label>
|
|
314
|
+
<label class="rte-form-label" for="iframe-title">Title</label>
|
|
304
315
|
<input type="text" class="rte-form-input" id="iframe-title" placeholder="Iframe title" />
|
|
305
316
|
</div>
|
|
306
317
|
<div class="rte-form-group">
|
|
307
|
-
<label class="rte-form-label">Long Description</label>
|
|
318
|
+
<label class="rte-form-label" for="iframe-longdesc">Long Description</label>
|
|
308
319
|
<textarea class="rte-form-textarea" id="iframe-longdesc" placeholder="Detailed description of the iframe content" rows="3"></textarea>
|
|
309
320
|
</div>
|
|
310
321
|
<div class="rte-form-group">
|
|
311
|
-
<label class="rte-form-label">Description URL</label>
|
|
312
|
-
<input type="url" class="rte-form-input" id="iframe-desc-url" placeholder="https://example.com/description" />
|
|
322
|
+
<label class="rte-form-label" for="iframe-desc-url">Description URL</label>
|
|
323
|
+
<input type="url" class="rte-form-input" id="iframe-desc-url" placeholder="https://example.com/description" aria-describedby="iframe-desc-url-error" />
|
|
324
|
+
<div class="rte-form-error" id="iframe-desc-url-error" role="alert" hidden></div>
|
|
313
325
|
</div>
|
|
314
326
|
<div class="rte-form-group">
|
|
315
327
|
<label class="rte-checkbox-label">
|
|
@@ -331,120 +343,135 @@ function Z(e) {
|
|
|
331
343
|
<button type="button" class="rte-btn rte-btn-secondary" id="cancel-btn">Cancel</button>
|
|
332
344
|
<button type="submit" class="rte-btn rte-btn-primary" id="save-btn">Save</button>
|
|
333
345
|
</div>
|
|
334
|
-
`,
|
|
335
|
-
a.key === "Escape" && (a.preventDefault(), a.stopPropagation(),
|
|
336
|
-
}, document.addEventListener("keydown", t.escapeHandler, !0),
|
|
346
|
+
`, r.appendChild(n), document.body.appendChild(r), t.dialogElement = r, t.escapeHandler = (a) => {
|
|
347
|
+
a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), v(e));
|
|
348
|
+
}, document.addEventListener("keydown", t.escapeHandler, !0), oe(n, e), de(), setTimeout(() => {
|
|
337
349
|
var a;
|
|
338
350
|
(a = n.querySelector("#iframe-src")) == null || a.focus();
|
|
339
351
|
}, 100);
|
|
340
352
|
}
|
|
341
|
-
function
|
|
342
|
-
var a, i, l,
|
|
343
|
-
|
|
344
|
-
s.addEventListener("click", (
|
|
345
|
-
const
|
|
346
|
-
|
|
353
|
+
function oe(e, t) {
|
|
354
|
+
var a, i, l, d;
|
|
355
|
+
(a = e.querySelector(".rte-dialog-close")) == null || a.addEventListener("click", () => v(t)), e.querySelectorAll(".rte-tab-button").forEach((s) => {
|
|
356
|
+
s.addEventListener("click", (u) => {
|
|
357
|
+
const f = u.target.getAttribute("data-tab");
|
|
358
|
+
f && O(e, f, t);
|
|
347
359
|
});
|
|
348
360
|
});
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
|
|
361
|
+
const o = e.querySelector("#iframe-size");
|
|
362
|
+
o == null || o.addEventListener("change", (s) => ae(e, s.target.value, t));
|
|
363
|
+
const r = e.querySelector("#iframe-width"), n = e.querySelector("#iframe-height");
|
|
364
|
+
r == null || r.addEventListener("input", (s) => ne(e, s.target.value, t)), n == null || n.addEventListener("input", (s) => ie(e, s.target.value, t)), (i = e.querySelector("#constrain-btn")) == null || i.addEventListener("click", () => le(e, t)), (l = e.querySelector("#cancel-btn")) == null || l.addEventListener("click", () => v(t)), (d = e.querySelector("#save-btn")) == null || d.addEventListener("click", () => ce(e, t));
|
|
353
365
|
}
|
|
354
|
-
function
|
|
355
|
-
const
|
|
356
|
-
|
|
366
|
+
function O(e, t, o) {
|
|
367
|
+
const r = m(o);
|
|
368
|
+
r.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((n) => {
|
|
357
369
|
n.classList.toggle("active", n.getAttribute("data-tab") === t);
|
|
358
370
|
}), e.querySelectorAll(".rte-tab-panel").forEach((n) => {
|
|
359
371
|
n.style.display = n.getAttribute("data-panel") === t ? "block" : "none";
|
|
360
372
|
});
|
|
361
373
|
}
|
|
362
|
-
function
|
|
363
|
-
const
|
|
364
|
-
|
|
374
|
+
function ae(e, t, o) {
|
|
375
|
+
const r = m(o);
|
|
376
|
+
r.formData.selectedSize = t;
|
|
365
377
|
const n = e.querySelector("#dimensions-row"), a = e.querySelector("#iframe-width"), i = e.querySelector("#iframe-height");
|
|
366
|
-
t === "inline" ? (n.style.display = "flex", a.value = "100%", i.value = "400px",
|
|
378
|
+
t === "inline" ? (n.style.display = "flex", a.value = "100%", i.value = "400px", r.formData.width = "100%", r.formData.height = "400px") : (n.style.display = "none", r.formData.width = "100%", r.formData.height = "auto");
|
|
367
379
|
}
|
|
368
|
-
function
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
380
|
+
function ne(e, t, o) {
|
|
381
|
+
const r = m(o);
|
|
382
|
+
if (r.formData.width = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
|
|
371
383
|
const n = parseFloat(t);
|
|
372
384
|
if (!isNaN(n)) {
|
|
373
385
|
const a = n * 9 / 16;
|
|
374
|
-
|
|
386
|
+
r.formData.height = `${a}px`;
|
|
375
387
|
const i = e.querySelector("#iframe-height");
|
|
376
|
-
i && (i.value =
|
|
388
|
+
i && (i.value = r.formData.height);
|
|
377
389
|
}
|
|
378
390
|
}
|
|
379
391
|
}
|
|
380
|
-
function
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
392
|
+
function ie(e, t, o) {
|
|
393
|
+
const r = m(o);
|
|
394
|
+
if (r.formData.height = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
|
|
383
395
|
const n = parseFloat(t);
|
|
384
396
|
if (!isNaN(n)) {
|
|
385
397
|
const a = n * 16 / 9;
|
|
386
|
-
|
|
398
|
+
r.formData.width = `${a}px`;
|
|
387
399
|
const i = e.querySelector("#iframe-width");
|
|
388
|
-
i && (i.value =
|
|
400
|
+
i && (i.value = r.formData.width);
|
|
389
401
|
}
|
|
390
402
|
}
|
|
391
403
|
}
|
|
392
|
-
function
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
const
|
|
396
|
-
|
|
404
|
+
function le(e, t) {
|
|
405
|
+
const o = m(t);
|
|
406
|
+
o.formData.constrainProportions = !o.formData.constrainProportions;
|
|
407
|
+
const r = e.querySelector("#constrain-btn");
|
|
408
|
+
r && (r.textContent = o.formData.constrainProportions ? "🔒" : "🔓", r.className = `rte-constrain-btn ${o.formData.constrainProportions ? "locked" : "unlocked"}`, r.title = o.formData.constrainProportions ? "Unlock proportions" : "Lock proportions");
|
|
397
409
|
}
|
|
398
|
-
function
|
|
399
|
-
var
|
|
400
|
-
const
|
|
401
|
-
|
|
402
|
-
|
|
410
|
+
function ce(e, t) {
|
|
411
|
+
var C, R, L, T, A, I, q;
|
|
412
|
+
const o = m(t), r = e.querySelector("#iframe-src"), n = e.querySelector("#iframe-desc-url");
|
|
413
|
+
let a = (r == null ? void 0 : r.value.trim()) || "";
|
|
414
|
+
a && !/^[a-z][a-z0-9+.-]*:/i.test(a) && /^[^\s/]+\.[^\s/]+/.test(a) && (a = `https://${a}`, r && (r.value = a));
|
|
415
|
+
const i = (b, w, h, B) => {
|
|
416
|
+
O(e, B, t);
|
|
417
|
+
const k = e.querySelector(`#${w}`);
|
|
418
|
+
k && (k.textContent = h, k.hidden = !1), b && (b.setAttribute("aria-invalid", "true"), b.focus());
|
|
419
|
+
}, l = (b, w) => {
|
|
420
|
+
const h = e.querySelector(`#${w}`);
|
|
421
|
+
h && (h.textContent = "", h.hidden = !0), b == null || b.removeAttribute("aria-invalid");
|
|
422
|
+
};
|
|
423
|
+
if (l(r, "iframe-src-error"), l(n, "iframe-desc-url-error"), !a) {
|
|
424
|
+
i(r, "iframe-src-error", "Please enter a source URL.", "general");
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (!N(a)) {
|
|
428
|
+
i(r, "iframe-src-error", "Enter a valid URL starting with https:// or http://.", "general");
|
|
403
429
|
return;
|
|
404
430
|
}
|
|
405
|
-
|
|
406
|
-
|
|
431
|
+
const d = (n == null ? void 0 : n.value.trim()) || "";
|
|
432
|
+
if (d && !N(d)) {
|
|
433
|
+
i(n, "iframe-desc-url-error", "Enter a valid URL starting with https:// or http://.", "advanced");
|
|
407
434
|
return;
|
|
408
435
|
}
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
|
|
412
|
-
src:
|
|
413
|
-
width:
|
|
414
|
-
height:
|
|
415
|
-
aspectRatio:
|
|
416
|
-
name:
|
|
417
|
-
title:
|
|
418
|
-
longDescription:
|
|
419
|
-
descriptionUrl:
|
|
420
|
-
showBorder:
|
|
421
|
-
enableScrollbar:
|
|
422
|
-
}),
|
|
436
|
+
const s = (C = e.querySelector("#iframe-name")) == null ? void 0 : C.value.trim(), u = (R = e.querySelector("#iframe-title")) == null ? void 0 : R.value.trim(), f = (L = e.querySelector("#iframe-longdesc")) == null ? void 0 : L.value.trim(), x = d, U = (A = (T = e.querySelector("#iframe-border")) == null ? void 0 : T.checked) != null ? A : !0, $ = (q = (I = e.querySelector("#iframe-scrollbar")) == null ? void 0 : I.checked) != null ? q : !0;
|
|
437
|
+
let S = o.formData.width, D = o.formData.height;
|
|
438
|
+
o.formData.selectedSize !== "inline" && (S = "100%", D = "auto"), se(t, {
|
|
439
|
+
src: a,
|
|
440
|
+
width: S,
|
|
441
|
+
height: D,
|
|
442
|
+
aspectRatio: o.formData.selectedSize,
|
|
443
|
+
name: s || void 0,
|
|
444
|
+
title: u || void 0,
|
|
445
|
+
longDescription: f || void 0,
|
|
446
|
+
descriptionUrl: x || void 0,
|
|
447
|
+
showBorder: U,
|
|
448
|
+
enableScrollbar: $
|
|
449
|
+
}), v(t);
|
|
423
450
|
}
|
|
424
|
-
function
|
|
425
|
-
const
|
|
426
|
-
if (!
|
|
427
|
-
const n =
|
|
428
|
-
a.src =
|
|
451
|
+
function se(e, t) {
|
|
452
|
+
const o = m(e), r = M(e);
|
|
453
|
+
if (!r) return;
|
|
454
|
+
const n = r.innerHTML, a = document.createElement("iframe");
|
|
455
|
+
a.src = te(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);
|
|
429
456
|
const i = document.createElement("p");
|
|
430
457
|
i.appendChild(a), i.appendChild(document.createElement("br"));
|
|
431
|
-
const l =
|
|
432
|
-
(!
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
const
|
|
440
|
-
|
|
458
|
+
const l = o.savedRange && r.contains(o.savedRange.commonAncestorContainer) ? o.savedRange : document.createRange();
|
|
459
|
+
(!o.savedRange || !r.contains(o.savedRange.commonAncestorContainer)) && (l.selectNodeContents(r), l.collapse(!1));
|
|
460
|
+
const d = G(r, l.startContainer), s = d ? d.nextSibling : null;
|
|
461
|
+
r.insertBefore(i, s);
|
|
462
|
+
const u = document.createRange();
|
|
463
|
+
u.setStartAfter(i), u.collapse(!0);
|
|
464
|
+
const f = window.getSelection();
|
|
465
|
+
f && (f.removeAllRanges(), f.addRange(u)), o.savedRange = null;
|
|
466
|
+
const x = r.innerHTML;
|
|
467
|
+
j(r, n, x), r.dispatchEvent(new CustomEvent("input", { bubbles: !0, detail: { allowedTags: ["iframe"] } }));
|
|
441
468
|
}
|
|
442
|
-
function
|
|
443
|
-
const t =
|
|
469
|
+
function v(e) {
|
|
470
|
+
const t = m(e);
|
|
444
471
|
t.savedRange = null, t.escapeHandler && (document.removeEventListener("keydown", t.escapeHandler, !0), t.escapeHandler = null), t.dialogElement && (t.dialogElement.remove(), t.dialogElement = null);
|
|
445
472
|
}
|
|
446
|
-
function
|
|
447
|
-
if (
|
|
473
|
+
function de() {
|
|
474
|
+
if (P(), document.getElementById("embed-iframe-dialog-styles")) return;
|
|
448
475
|
const e = document.createElement("style");
|
|
449
476
|
e.id = "embed-iframe-dialog-styles", e.textContent = `
|
|
450
477
|
/* Embed Iframe Dialog Styles */
|
|
@@ -513,6 +540,24 @@ function ee() {
|
|
|
513
540
|
}
|
|
514
541
|
|
|
515
542
|
.rte-form-textarea,
|
|
543
|
+
.rte-form-error {
|
|
544
|
+
margin-top: 4px;
|
|
545
|
+
font-size: 12px;
|
|
546
|
+
color: #c62828;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.rte-form-error[hidden] {
|
|
550
|
+
display: none;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.rte-form-input[aria-invalid="true"] {
|
|
554
|
+
border-color: #c62828;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.rte-embed-iframe-overlay.rte-theme-dark .rte-form-error {
|
|
558
|
+
color: #ff8a80;
|
|
559
|
+
}
|
|
560
|
+
|
|
516
561
|
.rte-form-input,
|
|
517
562
|
.rte-form-select {
|
|
518
563
|
width: 100%;
|
|
@@ -735,6 +780,6 @@ function ee() {
|
|
|
735
780
|
`, document.head.appendChild(e);
|
|
736
781
|
}
|
|
737
782
|
export {
|
|
738
|
-
|
|
783
|
+
fe as EmbedIframePlugin
|
|
739
784
|
};
|
|
740
|
-
//# sourceMappingURL=EmbedIframePlugin.native-
|
|
785
|
+
//# sourceMappingURL=EmbedIframePlugin.native-BfZ_HGlV.mjs.map
|