@editora/core 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +6 -1
  2. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
  3. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  4. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
  5. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  6. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  7. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  8. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
  9. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  10. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  11. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
  12. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
  13. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  14. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
  15. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
  16. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  17. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
  18. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  19. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  20. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
  21. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  22. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
  23. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
  24. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
  25. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
  26. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
  27. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  28. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
  29. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  30. package/dist/editora.min.js +1 -1
  31. package/dist/editora.umd.js +1 -1
  32. package/dist/index-CPMGUZfB.js +10 -0
  33. package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +2 -2
  36. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  37. package/dist/plugin-loader.js +37 -37
  38. package/dist/webcomponent-core.js +18 -16
  39. package/dist/webcomponent-core.min.css +1 -1
  40. package/dist/webcomponent-core.min.js +139 -62
  41. package/dist/webcomponent.cjs.js +1 -1
  42. package/dist/webcomponent.esm.js +1 -1
  43. package/dist/webcomponent.js +50 -48
  44. package/dist/webcomponent.min.css +1 -1
  45. package/dist/webcomponent.min.js +1174 -1071
  46. package/package.json +11 -5
  47. package/LICENSE +0 -21
  48. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
  49. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
  50. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
  51. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
  52. package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
  53. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
  54. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
  55. package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
  56. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
  57. package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
  58. package/dist/index-D1LOqg5C.js +0 -10
@@ -1,12 +1,15 @@
1
- const D = [
1
+ const q = [
2
2
  { label: "Inline Value", value: "inline" },
3
3
  { label: "Responsive - 21x9", value: "21x9" },
4
4
  { label: "Responsive - 16x9", value: "16x9" },
5
5
  { label: "Responsive - 4x3", value: "4x3" },
6
6
  { label: "Responsive - 1x1", value: "1x1" }
7
- ], u = '[data-theme="dark"], .dark, .editora-theme-dark', h = /* @__PURE__ */ new WeakMap(), s = (e) => (h.has(e) || h.set(e, {
7
+ ], p = '[data-theme="dark"], .dark, .editora-theme-dark';
8
+ let c = null;
9
+ const y = /* @__PURE__ */ new WeakMap(), d = (e) => (y.has(e) || y.set(e, {
8
10
  dialogElement: null,
9
11
  escapeHandler: null,
12
+ savedRange: null,
10
13
  activeTab: "general",
11
14
  formData: {
12
15
  src: "",
@@ -21,15 +24,197 @@ const D = [
21
24
  showBorder: !0,
22
25
  enableScrollbar: !0
23
26
  }
24
- }), h.get(e));
25
- function q(e) {
26
- if (e != null && e.matches(u) || e != null && e.closest(u))
27
+ }), y.get(e));
28
+ function A(e) {
29
+ if (e != null && e.matches(p) || e != null && e.closest(p))
27
30
  return !0;
28
31
  const t = document.activeElement;
29
- return t != null && t.closest(u) ? !0 : document.body.matches(u) || document.documentElement.matches(u);
32
+ return t != null && t.closest(p) ? !0 : document.body.matches(p) || document.documentElement.matches(p);
30
33
  }
31
- const A = () => ({
34
+ function T(e) {
35
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
36
+ }
37
+ function M(e) {
38
+ const t = e == null ? void 0 : e.editorElement;
39
+ if (t instanceof HTMLElement) return t;
40
+ const r = e == null ? void 0 : e.contentElement;
41
+ if (r instanceof HTMLElement) {
42
+ const i = r.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
43
+ return i instanceof HTMLElement ? i : r;
44
+ }
45
+ const o = window.__editoraCommandEditorRoot;
46
+ if (o instanceof HTMLElement) return o;
47
+ const n = window.getSelection();
48
+ if (n && n.rangeCount > 0) {
49
+ const i = T(n.getRangeAt(0).startContainer), l = i == null ? void 0 : i.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
50
+ if (l instanceof HTMLElement) return l;
51
+ }
52
+ const a = document.activeElement;
53
+ if (a instanceof HTMLElement) {
54
+ const i = a.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
55
+ if (i instanceof HTMLElement) return i;
56
+ }
57
+ return document.querySelector("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
58
+ }
59
+ function I(e) {
60
+ return e.getAttribute("contenteditable") === "true" ? e : e.querySelector('.rte-content, .editora-content, [contenteditable="true"]');
61
+ }
62
+ function v(e) {
63
+ const t = T(e);
64
+ return t == null ? void 0 : t.closest('.rte-content, .editora-content, [contenteditable="true"]');
65
+ }
66
+ function j(e) {
67
+ const t = window.getSelection();
68
+ if (!t || t.rangeCount === 0) return null;
69
+ const r = t.getRangeAt(0);
70
+ return !e.contains(r.startContainer) || !e.contains(r.endContainer) ? null : r.cloneRange();
71
+ }
72
+ function H(e, t, r) {
73
+ if (t !== r) {
74
+ if (typeof window.execEditorCommand == "function") {
75
+ window.execEditorCommand("recordDomTransaction", e, t, r);
76
+ return;
77
+ }
78
+ if (typeof window.executeEditorCommand == "function")
79
+ try {
80
+ window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: r });
81
+ } catch (o) {
82
+ }
83
+ }
84
+ }
85
+ function z(e, t) {
86
+ let r = t;
87
+ for (; r && r.parentNode && r.parentNode !== e; )
88
+ r = r.parentNode;
89
+ return r && r.parentNode === e ? r : null;
90
+ }
91
+ function L(e, t) {
92
+ return e.tagName !== "P" ? !1 : Array.from(e.childNodes).every((r) => {
93
+ var o;
94
+ return r === t ? !0 : r.nodeType === Node.ELEMENT_NODE ? r.tagName === "BR" : r.nodeType === Node.TEXT_NODE && !((o = r.textContent) != null && o.trim());
95
+ });
96
+ }
97
+ function P(e) {
98
+ if (!(e instanceof Element)) return null;
99
+ const t = e.closest("iframe");
100
+ if (t instanceof HTMLIFrameElement) {
101
+ const a = v(t);
102
+ if (!a) return null;
103
+ const i = t.parentElement;
104
+ return i && i.parentElement === a && L(i, t) ? i : t;
105
+ }
106
+ const r = e.closest("p");
107
+ if (!(r instanceof HTMLElement)) return null;
108
+ const o = v(r);
109
+ if (!o || r.parentElement !== o) return null;
110
+ const n = Array.from(r.children).find(
111
+ (a) => a instanceof HTMLIFrameElement
112
+ );
113
+ return n && L(r, n) ? r : null;
114
+ }
115
+ function b() {
116
+ var e;
117
+ 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
+ function O(e) {
120
+ if (c === e) return;
121
+ b(), c = e, e.classList.add("rte-selected-embed-object");
122
+ const t = e instanceof HTMLIFrameElement ? e : e.querySelector("iframe");
123
+ t == null || t.setAttribute("data-rte-selected-object", "true");
124
+ const r = window.getSelection();
125
+ if (!r) return;
126
+ const o = document.createRange();
127
+ o.selectNode(e), r.removeAllRanges(), r.addRange(o);
128
+ }
129
+ function B(e, t) {
130
+ const r = window.getSelection();
131
+ if (!r) return;
132
+ const o = document.createRange();
133
+ t && t.parentNode === e ? o.setStartBefore(t) : (o.selectNodeContents(e), o.collapse(!1)), o.collapse(!0), r.removeAllRanges(), r.addRange(o);
134
+ }
135
+ function U(e) {
136
+ if (e.childNodes.length > 0) return;
137
+ const t = document.createElement("p");
138
+ t.appendChild(document.createElement("br")), e.appendChild(t);
139
+ }
140
+ function _() {
141
+ if (!c || !c.isConnected)
142
+ return b(), !1;
143
+ const e = c, t = v(e);
144
+ if (!t)
145
+ return b(), !1;
146
+ const r = t.innerHTML, o = e.nextSibling;
147
+ e.remove(), U(t), b(), B(t, o);
148
+ const n = t.innerHTML;
149
+ return H(t, r, n), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), r !== n;
150
+ }
151
+ function N() {
152
+ if (document.getElementById("embed-iframe-object-selection-styles")) return;
153
+ const e = document.createElement("style");
154
+ e.id = "embed-iframe-object-selection-styles", e.textContent = `
155
+ .rte-selected-embed-object {
156
+ outline: 2px solid #2563eb;
157
+ outline-offset: 3px;
158
+ border-radius: 4px;
159
+ }
160
+
161
+ .rte-content iframe,
162
+ .editora-content iframe,
163
+ [contenteditable="true"] iframe {
164
+ pointer-events: none;
165
+ }
166
+
167
+ .rte-selected-embed-object iframe,
168
+ iframe.rte-selected-embed-object {
169
+ box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
170
+ }
171
+ `, document.head.appendChild(e);
172
+ }
173
+ function $() {
174
+ typeof window == "undefined" || window.__embedIframeObjectSelectionInitialized || (window.__embedIframeObjectSelectionInitialized = !0, N(), document.addEventListener("pointerdown", (e) => {
175
+ var r, o;
176
+ const t = P(e.target);
177
+ if (!t) {
178
+ const n = e.target;
179
+ (r = n == null ? void 0 : n.closest) != null && r.call(n, ".rte-embed-iframe-overlay") || b();
180
+ return;
181
+ }
182
+ e.preventDefault(), (o = v(t)) == null || o.focus(), O(t);
183
+ }, !0), document.addEventListener("keydown", (e) => {
184
+ if (c) {
185
+ if (e.key === "Escape") {
186
+ b();
187
+ return;
188
+ }
189
+ e.key !== "Backspace" && e.key !== "Delete" || (e.preventDefault(), e.stopPropagation(), _());
190
+ }
191
+ }, !0));
192
+ }
193
+ function F(e) {
194
+ try {
195
+ const t = new URL(e), r = t.hostname.replace(/^www\./, "");
196
+ if (r === "youtu.be") {
197
+ const o = t.pathname.split("/").filter(Boolean)[0];
198
+ if (o) return `https://www.youtube.com/embed/${encodeURIComponent(o)}`;
199
+ }
200
+ if (r === "youtube.com" || r === "m.youtube.com") {
201
+ const o = t.searchParams.get("v");
202
+ if (o) return `https://www.youtube.com/embed/${encodeURIComponent(o)}`;
203
+ const n = t.pathname.match(/^\/embed\/([^/]+)/);
204
+ if (n != null && n[1]) return `https://www.youtube.com/embed/${encodeURIComponent(n[1])}`;
205
+ }
206
+ if (r === "vimeo.com") {
207
+ const o = t.pathname.split("/").filter(Boolean)[0];
208
+ if (o && /^\d+$/.test(o)) return `https://player.vimeo.com/video/${o}`;
209
+ }
210
+ return e;
211
+ } catch (t) {
212
+ return e;
213
+ }
214
+ }
215
+ const te = () => ({
32
216
  name: "embedIframe",
217
+ init: $,
33
218
  toolbar: [
34
219
  {
35
220
  label: "Embed Content",
@@ -40,13 +225,13 @@ const A = () => ({
40
225
  }
41
226
  ],
42
227
  commands: {
43
- openEmbedIframeDialog: (e) => (L(e), !0)
228
+ openEmbedIframeDialog: (e, t) => (Z(M(t) || void 0), !0)
44
229
  },
45
230
  keymap: {
46
231
  "Mod-Shift-e": "openEmbedIframeDialog"
47
232
  }
48
233
  });
49
- function L(e) {
234
+ function Z(e) {
50
235
  if (!e) {
51
236
  const a = document.activeElement;
52
237
  a && a.closest("[data-editora-editor]") && (e = a.closest("[data-editora-editor]"));
@@ -55,8 +240,8 @@ function L(e) {
55
240
  console.warn("Editor element not found");
56
241
  return;
57
242
  }
58
- const t = s(e);
59
- t.formData = {
243
+ const t = d(e), r = I(e);
244
+ t.savedRange = r ? j(r) : null, t.formData = {
60
245
  src: "",
61
246
  selectedSize: "inline",
62
247
  width: "100%",
@@ -70,9 +255,9 @@ function L(e) {
70
255
  enableScrollbar: !0
71
256
  }, t.activeTab = "general";
72
257
  const o = document.createElement("div");
73
- o.className = "rte-dialog-overlay rte-embed-iframe-overlay", q(e) && o.classList.add("rte-theme-dark"), o.onclick = () => p(e);
74
- const r = document.createElement("div");
75
- r.className = "rte-dialog-content embed-iframe-dialog", r.onclick = (a) => a.stopPropagation(), r.innerHTML = `
258
+ o.className = "rte-dialog-overlay rte-embed-iframe-overlay", A(e) && o.classList.add("rte-theme-dark"), o.onclick = () => h(e);
259
+ const n = document.createElement("div");
260
+ n.className = "rte-dialog-content embed-iframe-dialog", n.onclick = (a) => a.stopPropagation(), n.innerHTML = `
76
261
  <div class="rte-dialog-header">
77
262
  <h3>Embed Iframe</h3>
78
263
  <button class="rte-dialog-close">×</button>
@@ -92,7 +277,7 @@ function L(e) {
92
277
  <div class="rte-form-group">
93
278
  <label class="rte-form-label">Size</label>
94
279
  <select class="rte-form-select" id="iframe-size">
95
- ${D.map((a) => `<option value="${a.value}">${a.label}</option>`).join("")}
280
+ ${q.map((a) => `<option value="${a.value}">${a.label}</option>`).join("")}
96
281
  </select>
97
282
  </div>
98
283
  <div class="rte-form-row" id="dimensions-row">
@@ -146,133 +331,120 @@ function L(e) {
146
331
  <button type="button" class="rte-btn rte-btn-secondary" id="cancel-btn">Cancel</button>
147
332
  <button type="submit" class="rte-btn rte-btn-primary" id="save-btn">Save</button>
148
333
  </div>
149
- `, o.appendChild(r), document.body.appendChild(o), t.dialogElement = o, t.escapeHandler = (a) => {
150
- a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), p(e));
151
- }, document.addEventListener("keydown", t.escapeHandler, !0), $(r, e), T(), setTimeout(() => {
334
+ `, o.appendChild(n), document.body.appendChild(o), t.dialogElement = o, t.escapeHandler = (a) => {
335
+ a.key === "Escape" && (a.preventDefault(), a.stopPropagation(), h(e));
336
+ }, document.addEventListener("keydown", t.escapeHandler, !0), V(n, e), ee(), setTimeout(() => {
152
337
  var a;
153
- (a = r.querySelector("#iframe-src")) == null || a.focus();
338
+ (a = n.querySelector("#iframe-src")) == null || a.focus();
154
339
  }, 100);
155
340
  }
156
- function $(e, t) {
157
- var l, i, d, f;
158
- s(t), (l = e.querySelector(".rte-dialog-close")) == null || l.addEventListener("click", () => p(t)), e.querySelectorAll(".rte-tab-button").forEach((n) => {
159
- n.addEventListener("click", (m) => {
160
- const c = m.target.getAttribute("data-tab");
161
- c && C(e, c, t);
341
+ function V(e, t) {
342
+ var a, i, l, u;
343
+ d(t), (a = e.querySelector(".rte-dialog-close")) == null || a.addEventListener("click", () => h(t)), e.querySelectorAll(".rte-tab-button").forEach((s) => {
344
+ s.addEventListener("click", (f) => {
345
+ const m = f.target.getAttribute("data-tab");
346
+ m && W(e, m, t);
162
347
  });
163
348
  });
164
- const o = e.querySelector("#iframe-size");
165
- o == null || o.addEventListener("change", (n) => H(e, n.target.value, t));
166
- const r = e.querySelector("#iframe-width"), a = e.querySelector("#iframe-height");
167
- r == null || r.addEventListener("input", (n) => z(e, n.target.value, t)), a == null || a.addEventListener("input", (n) => E(e, n.target.value, t)), (i = e.querySelector("#constrain-btn")) == null || i.addEventListener("click", () => I(e, t)), (d = e.querySelector("#cancel-btn")) == null || d.addEventListener("click", () => p(t)), (f = e.querySelector("#save-btn")) == null || f.addEventListener("click", () => P(e, t));
349
+ const r = e.querySelector("#iframe-size");
350
+ r == null || r.addEventListener("change", (s) => G(e, s.target.value, t));
351
+ const o = e.querySelector("#iframe-width"), n = e.querySelector("#iframe-height");
352
+ o == null || o.addEventListener("input", (s) => K(e, s.target.value, t)), n == null || n.addEventListener("input", (s) => X(e, s.target.value, t)), (i = e.querySelector("#constrain-btn")) == null || i.addEventListener("click", () => J(e, t)), (l = e.querySelector("#cancel-btn")) == null || l.addEventListener("click", () => h(t)), (u = e.querySelector("#save-btn")) == null || u.addEventListener("click", () => Q(e, t));
168
353
  }
169
- function C(e, t, o) {
170
- const r = s(o);
171
- r.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((a) => {
172
- a.classList.toggle("active", a.getAttribute("data-tab") === t);
173
- }), e.querySelectorAll(".rte-tab-panel").forEach((a) => {
174
- a.style.display = a.getAttribute("data-panel") === t ? "block" : "none";
354
+ function W(e, t, r) {
355
+ const o = d(r);
356
+ o.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((n) => {
357
+ n.classList.toggle("active", n.getAttribute("data-tab") === t);
358
+ }), e.querySelectorAll(".rte-tab-panel").forEach((n) => {
359
+ n.style.display = n.getAttribute("data-panel") === t ? "block" : "none";
175
360
  });
176
361
  }
177
- function H(e, t, o) {
178
- const r = s(o);
179
- r.formData.selectedSize = t;
180
- const a = e.querySelector("#dimensions-row"), l = e.querySelector("#iframe-width"), i = e.querySelector("#iframe-height");
181
- t === "inline" ? (a.style.display = "flex", l.value = "100%", i.value = "400px", r.formData.width = "100%", r.formData.height = "400px") : (a.style.display = "none", r.formData.width = "100%", r.formData.height = "auto");
362
+ function G(e, t, r) {
363
+ const o = d(r);
364
+ o.formData.selectedSize = t;
365
+ 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", o.formData.width = "100%", o.formData.height = "400px") : (n.style.display = "none", o.formData.width = "100%", o.formData.height = "auto");
182
367
  }
183
- function z(e, t, o) {
184
- const r = s(o);
185
- if (r.formData.width = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
186
- const a = parseFloat(t);
187
- if (!isNaN(a)) {
188
- const l = a * 9 / 16;
189
- r.formData.height = `${l}px`;
368
+ function K(e, t, r) {
369
+ const o = d(r);
370
+ if (o.formData.width = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
371
+ const n = parseFloat(t);
372
+ if (!isNaN(n)) {
373
+ const a = n * 9 / 16;
374
+ o.formData.height = `${a}px`;
190
375
  const i = e.querySelector("#iframe-height");
191
- i && (i.value = r.formData.height);
376
+ i && (i.value = o.formData.height);
192
377
  }
193
378
  }
194
379
  }
195
- function E(e, t, o) {
196
- const r = s(o);
197
- if (r.formData.height = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
198
- const a = parseFloat(t);
199
- if (!isNaN(a)) {
200
- const l = a * 16 / 9;
201
- r.formData.width = `${l}px`;
380
+ function X(e, t, r) {
381
+ const o = d(r);
382
+ if (o.formData.height = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
383
+ const n = parseFloat(t);
384
+ if (!isNaN(n)) {
385
+ const a = n * 16 / 9;
386
+ o.formData.width = `${a}px`;
202
387
  const i = e.querySelector("#iframe-width");
203
- i && (i.value = r.formData.width);
388
+ i && (i.value = o.formData.width);
204
389
  }
205
390
  }
206
391
  }
207
- function I(e, t) {
208
- const o = s(t);
209
- o.formData.constrainProportions = !o.formData.constrainProportions;
210
- const r = e.querySelector("#constrain-btn");
211
- 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");
392
+ function J(e, t) {
393
+ const r = d(t);
394
+ r.formData.constrainProportions = !r.formData.constrainProportions;
395
+ const o = e.querySelector("#constrain-btn");
396
+ 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");
212
397
  }
213
- function P(e, t) {
214
- var c, b, g, v, x, y, k, w, S;
215
- const o = s(t), r = (c = e.querySelector("#iframe-src")) == null ? void 0 : c.value.trim();
216
- if (!r) {
398
+ function Q(e, t) {
399
+ var g, x, w, k, S, E, D, C, R;
400
+ const r = d(t), o = (g = e.querySelector("#iframe-src")) == null ? void 0 : g.value.trim();
401
+ if (!o) {
217
402
  alert("Please enter a source URL");
218
403
  return;
219
404
  }
220
- if (!r.startsWith("https://") && !r.startsWith("http://")) {
405
+ if (!o.startsWith("https://") && !o.startsWith("http://")) {
221
406
  alert("Please enter a valid URL starting with https:// or http://");
222
407
  return;
223
408
  }
224
- const a = (b = e.querySelector("#iframe-name")) == null ? void 0 : b.value.trim(), l = (g = e.querySelector("#iframe-title")) == null ? void 0 : g.value.trim(), i = (v = e.querySelector("#iframe-longdesc")) == null ? void 0 : v.value.trim();
225
- (x = e.querySelector("#iframe-desc-url")) == null || x.value.trim();
226
- const d = (k = (y = e.querySelector("#iframe-border")) == null ? void 0 : y.checked) != null ? k : !0, f = (S = (w = e.querySelector("#iframe-scrollbar")) == null ? void 0 : w.checked) != null ? S : !0;
227
- let n = o.formData.width, m = o.formData.height;
228
- o.formData.selectedSize !== "inline" && (n = "100%", m = "auto"), R(t, {
229
- src: r,
230
- width: n,
409
+ const n = (x = e.querySelector("#iframe-name")) == null ? void 0 : x.value.trim(), a = (w = e.querySelector("#iframe-title")) == null ? void 0 : w.value.trim(), i = (k = e.querySelector("#iframe-longdesc")) == null ? void 0 : k.value.trim(), l = (S = e.querySelector("#iframe-desc-url")) == null ? void 0 : S.value.trim(), u = (D = (E = e.querySelector("#iframe-border")) == null ? void 0 : E.checked) != null ? D : !0, s = (R = (C = e.querySelector("#iframe-scrollbar")) == null ? void 0 : C.checked) != null ? R : !0;
410
+ let f = r.formData.width, m = r.formData.height;
411
+ r.formData.selectedSize !== "inline" && (f = "100%", m = "auto"), Y(t, {
412
+ src: o,
413
+ width: f,
231
414
  height: m,
232
- aspectRatio: o.formData.selectedSize,
233
- name: a || void 0,
234
- title: l || void 0,
415
+ aspectRatio: r.formData.selectedSize,
416
+ name: n || void 0,
417
+ title: a || void 0,
235
418
  longDescription: i || void 0,
236
- showBorder: d,
237
- enableScrollbar: f
238
- }), p(t);
419
+ descriptionUrl: l || void 0,
420
+ showBorder: u,
421
+ enableScrollbar: s
422
+ }), h(t);
239
423
  }
240
- function R(e, t) {
241
- const o = e.querySelector('[contenteditable="true"]');
242
- o && (o.focus(), setTimeout(() => {
243
- const r = [
244
- `src="${t.src}"`,
245
- `width="${t.width}"`,
246
- `height="${t.height}"`,
247
- "allowfullscreen",
248
- `frameborder="${t.showBorder ? "1" : "0"}"`,
249
- `scrolling="${t.enableScrollbar ? "auto" : "no"}"`
250
- ];
251
- t.name && r.push(`name="${t.name}"`), t.title && r.push(`title="${t.title}"`), t.longDescription && r.push(`longdesc="${t.longDescription}"`);
252
- const a = [];
253
- t.aspectRatio !== "inline" && a.push(`rte-iframe-${t.aspectRatio}`);
254
- const l = a.length > 0 ? `class="${a.join(" ")}"` : "", i = `data-aspect-ratio="${t.aspectRatio}"`, d = `<iframe ${r.join(" ")} ${l} ${i}></iframe>`;
255
- if (!document.execCommand("insertHTML", !1, d)) {
256
- const n = window.getSelection();
257
- if (n && n.rangeCount > 0) {
258
- const m = n.getRangeAt(0);
259
- m.deleteContents();
260
- const c = document.createElement("div");
261
- c.innerHTML = d;
262
- const b = document.createDocumentFragment();
263
- for (; c.firstChild; )
264
- b.appendChild(c.firstChild);
265
- m.insertNode(b);
266
- }
267
- }
268
- }, 10));
424
+ function Y(e, t) {
425
+ const r = d(e), o = I(e);
426
+ if (!o) return;
427
+ const n = o.innerHTML, a = document.createElement("iframe");
428
+ a.src = F(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), 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
+ const i = document.createElement("p");
430
+ i.appendChild(a), i.appendChild(document.createElement("br"));
431
+ const l = r.savedRange && o.contains(r.savedRange.commonAncestorContainer) ? r.savedRange : document.createRange();
432
+ (!r.savedRange || !o.contains(r.savedRange.commonAncestorContainer)) && (l.selectNodeContents(o), l.collapse(!1));
433
+ const u = z(o, l.startContainer), s = u ? u.nextSibling : null;
434
+ o.insertBefore(i, s);
435
+ const f = document.createRange();
436
+ f.setStartAfter(i), f.collapse(!0);
437
+ const m = window.getSelection();
438
+ m && (m.removeAllRanges(), m.addRange(f)), r.savedRange = null;
439
+ const g = o.innerHTML;
440
+ H(o, n, g), o.dispatchEvent(new window.Event("input", { bubbles: !0 }));
269
441
  }
270
- function p(e) {
271
- const t = s(e);
272
- t.escapeHandler && (document.removeEventListener("keydown", t.escapeHandler, !0), t.escapeHandler = null), t.dialogElement && (t.dialogElement.remove(), t.dialogElement = null);
442
+ function h(e) {
443
+ const t = d(e);
444
+ t.savedRange = null, t.escapeHandler && (document.removeEventListener("keydown", t.escapeHandler, !0), t.escapeHandler = null), t.dialogElement && (t.dialogElement.remove(), t.dialogElement = null);
273
445
  }
274
- function T() {
275
- if (document.getElementById("embed-iframe-dialog-styles")) return;
446
+ function ee() {
447
+ if (N(), document.getElementById("embed-iframe-dialog-styles")) return;
276
448
  const e = document.createElement("style");
277
449
  e.id = "embed-iframe-dialog-styles", e.textContent = `
278
450
  /* Embed Iframe Dialog Styles */
@@ -563,6 +735,6 @@ function T() {
563
735
  `, document.head.appendChild(e);
564
736
  }
565
737
  export {
566
- A as EmbedIframePlugin
738
+ te as EmbedIframePlugin
567
739
  };
568
- //# sourceMappingURL=EmbedIframePlugin.native-DKJx2OS7.mjs.map
740
+ //# sourceMappingURL=EmbedIframePlugin.native-BF_-LjTq.mjs.map