@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.
Files changed (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-XsYC_KdJ.mjs +3923 -0
  48. package/dist/index-_eKRBZPq.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2055 -476
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2223 -643
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -1,12 +1,13 @@
1
- const q = [
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
- ], p = '[data-theme="dark"], .dark, .editora-theme-dark';
8
+ ], g = '[data-theme="dark"], .dark, .editora-theme-dark';
8
9
  let c = null;
9
- const y = /* @__PURE__ */ new WeakMap(), d = (e) => (y.has(e) || y.set(e, {
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
- }), y.get(e));
28
- function A(e) {
29
- if (e != null && e.matches(p) || e != null && e.closest(p))
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(p) ? !0 : document.body.matches(p) || document.documentElement.matches(p);
33
+ return t != null && t.closest(g) ? !0 : document.body.matches(g) || document.documentElement.matches(g);
33
34
  }
34
- function T(e) {
35
+ function z(e) {
35
36
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
36
37
  }
37
- function M(e) {
38
+ function Z(e) {
38
39
  const t = e == null ? void 0 : e.editorElement;
39
40
  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;
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 o = window.__editoraCommandEditorRoot;
46
- if (o instanceof HTMLElement) return o;
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 = T(n.getRangeAt(0).startContainer), l = i == null ? void 0 : i.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor");
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 I(e) {
60
+ function M(e) {
60
61
  return e.getAttribute("contenteditable") === "true" ? e : e.querySelector('.rte-content, .editora-content, [contenteditable="true"]');
61
62
  }
62
- function v(e) {
63
- const t = T(e);
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 j(e) {
67
+ function W(e) {
67
68
  const t = window.getSelection();
68
69
  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();
70
+ const o = t.getRangeAt(0);
71
+ return !e.contains(o.startContainer) || !e.contains(o.endContainer) ? null : o.cloneRange();
71
72
  }
72
- function H(e, t, r) {
73
- if (t !== r) {
73
+ function j(e, t, o) {
74
+ if (t !== o) {
74
75
  if (typeof window.execEditorCommand == "function") {
75
- window.execEditorCommand("recordDomTransaction", e, t, r);
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: r });
81
- } catch (o) {
81
+ window.executeEditorCommand("recordDomTransaction", { editor: e, beforeHTML: t, afterHTML: o });
82
+ } catch (r) {
82
83
  }
83
84
  }
84
85
  }
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;
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 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());
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 P(e) {
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 = v(t);
102
+ const a = y(t);
102
103
  if (!a) return null;
103
104
  const i = t.parentElement;
104
- return i && i.parentElement === a && L(i, t) ? i : t;
105
+ return i && i.parentElement === a && H(i, t) ? i : t;
105
106
  }
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(
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 && L(r, n) ? r : null;
114
+ return n && H(o, n) ? o : null;
114
115
  }
115
- function b() {
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 O(e) {
120
+ function X(e) {
120
121
  if (c === e) return;
121
- b(), c = e, e.classList.add("rte-selected-embed-object");
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 r = window.getSelection();
125
- if (!r) return;
126
- const o = document.createRange();
127
- o.selectNode(e), r.removeAllRanges(), r.addRange(o);
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 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);
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 U(e) {
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 b(), !1;
143
- const e = c, t = v(e);
143
+ return p(), !1;
144
+ const e = c, t = y(e);
144
145
  if (!t)
145
- return b(), !1;
146
- const r = t.innerHTML, o = e.nextSibling;
147
- e.remove(), U(t), b(), B(t, o);
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 H(t, r, n), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), r !== n;
150
+ return j(t, o, n), t.dispatchEvent(new window.Event("input", { bubbles: !0 })), o !== n;
150
151
  }
151
- function N() {
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, N(), document.addEventListener("pointerdown", (e) => {
175
- var r, o;
176
- const t = P(e.target);
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
- (r = n == null ? void 0 : n.closest) != null && r.call(n, ".rte-embed-iframe-overlay") || b();
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(), (o = v(t)) == null || o.focus(), O(t);
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
- b();
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 F(e) {
194
+ function te(e) {
194
195
  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)}`;
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 (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}`;
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
- const te = () => ({
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(M(t) || void 0), !0)
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 Z(e) {
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 = d(e), r = I(e);
244
- t.savedRange = r ? j(r) : null, t.formData = {
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 o = document.createElement("div");
258
- o.className = "rte-dialog-overlay rte-embed-iframe-overlay", A(e) && o.classList.add("rte-theme-dark"), o.onclick = () => h(e);
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
- ${q.map((a) => `<option value="${a.value}">${a.label}</option>`).join("")}
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
- `, 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(() => {
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 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);
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 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));
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 W(e, t, r) {
355
- const o = d(r);
356
- o.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((n) => {
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 G(e, t, r) {
363
- const o = d(r);
364
- o.formData.selectedSize = t;
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", o.formData.width = "100%", o.formData.height = "400px") : (n.style.display = "none", o.formData.width = "100%", o.formData.height = "auto");
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 K(e, t, r) {
369
- const o = d(r);
370
- if (o.formData.width = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
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
- o.formData.height = `${a}px`;
386
+ r.formData.height = `${a}px`;
375
387
  const i = e.querySelector("#iframe-height");
376
- i && (i.value = o.formData.height);
388
+ i && (i.value = r.formData.height);
377
389
  }
378
390
  }
379
391
  }
380
- function X(e, t, r) {
381
- const o = d(r);
382
- if (o.formData.height = t, o.formData.constrainProportions && o.formData.selectedSize === "inline") {
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
- o.formData.width = `${a}px`;
398
+ r.formData.width = `${a}px`;
387
399
  const i = e.querySelector("#iframe-width");
388
- i && (i.value = o.formData.width);
400
+ i && (i.value = r.formData.width);
389
401
  }
390
402
  }
391
403
  }
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");
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 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) {
402
- alert("Please enter a source URL");
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
- if (!o.startsWith("https://") && !o.startsWith("http://")) {
406
- alert("Please enter a valid URL starting with https:// or http://");
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 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,
414
- height: m,
415
- aspectRatio: r.formData.selectedSize,
416
- name: n || void 0,
417
- title: a || void 0,
418
- longDescription: i || void 0,
419
- descriptionUrl: l || void 0,
420
- showBorder: u,
421
- enableScrollbar: s
422
- }), h(t);
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 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);
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 = 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 }));
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 h(e) {
443
- const t = d(e);
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 ee() {
447
- if (N(), document.getElementById("embed-iframe-dialog-styles")) return;
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
- te as EmbedIframePlugin
783
+ fe as EmbedIframePlugin
739
784
  };
740
- //# sourceMappingURL=EmbedIframePlugin.native-BF_-LjTq.mjs.map
785
+ //# sourceMappingURL=EmbedIframePlugin.native-BfZ_HGlV.mjs.map