@editora/core 1.0.17 → 1.0.19

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.
@@ -1,4 +1,5 @@
1
- const d = "rte-document-manager-styles", u = `
1
+ import { s as u } from "./sanitizeHtml-DA0ajC6k.mjs";
2
+ const d = "rte-document-manager-styles", s = `
2
3
  .rte-toolbar-button[data-busy="true"],
3
4
  .rte-docmgr-toolbar-button[data-busy="true"] {
4
5
  position: relative;
@@ -28,13 +29,13 @@ const d = "rte-document-manager-styles", u = `
28
29
  to { transform: rotate(360deg); }
29
30
  }
30
31
  `;
31
- function s() {
32
+ function p() {
32
33
  if (typeof document == "undefined" || document.getElementById(d)) return;
33
34
  const a = document.createElement("style");
34
- a.id = d, a.textContent = u, document.head.appendChild(a);
35
+ a.id = d, a.textContent = s, document.head.appendChild(a);
35
36
  }
36
37
  async function l(a) {
37
- s();
38
+ p();
38
39
  const t = typeof window != "undefined" ? window.__editoraLastCommandButton : null;
39
40
  t && (t.disabled = !0, t.setAttribute("data-busy", "true"), t.setAttribute("aria-busy", "true"));
40
41
  try {
@@ -43,7 +44,7 @@ async function l(a) {
43
44
  t && (t.disabled = !1, t.removeAttribute("data-busy"), t.removeAttribute("aria-busy"));
44
45
  }
45
46
  }
46
- const p = () => ({
47
+ const m = () => ({
47
48
  name: "document-manager",
48
49
  toolbar: [
49
50
  {
@@ -93,8 +94,8 @@ const p = () => ({
93
94
  try {
94
95
  const n = a();
95
96
  if (n) {
96
- const { importFromWord: i } = await import("./documentManager-BcBIv5P-.mjs"), c = await i(r);
97
- n.innerHTML = c, n.dispatchEvent(new Event("input", { bubbles: !0 }));
97
+ const { importFromWord: i } = await import("./documentManager-BWK_-KJp.mjs"), c = await i(r);
98
+ n.innerHTML = u(c), n.dispatchEvent(new Event("input", { bubbles: !0 }));
98
99
  }
99
100
  } catch (n) {
100
101
  console.error("Import failed:", n), alert("Failed to import Word document. Please check the console for details.");
@@ -119,7 +120,7 @@ const p = () => ({
119
120
  try {
120
121
  const t = a();
121
122
  if (t) {
122
- const e = t.innerHTML, { exportToWord: r } = await import("./documentManager-BcBIv5P-.mjs");
123
+ const e = t.innerHTML, { exportToWord: r } = await import("./documentManager-BWK_-KJp.mjs");
123
124
  await r(e, "document.docx");
124
125
  }
125
126
  return !0;
@@ -146,7 +147,7 @@ const p = () => ({
146
147
  try {
147
148
  const t = a();
148
149
  if (t) {
149
- const e = t.innerHTML, { exportToPdf: r } = await import("./documentManager-BcBIv5P-.mjs");
150
+ const e = t.innerHTML, { exportToPdf: r } = await import("./documentManager-BWK_-KJp.mjs");
150
151
  await r(e, "document.pdf", t);
151
152
  } else
152
153
  console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
@@ -160,6 +161,6 @@ const p = () => ({
160
161
  keymap: {}
161
162
  });
162
163
  export {
163
- p as DocumentManagerPlugin
164
+ m as DocumentManagerPlugin
164
165
  };
165
- //# sourceMappingURL=DocumentManagerPlugin.native-iFip6s4Q.mjs.map
166
+ //# sourceMappingURL=DocumentManagerPlugin.native-B8K-Oqom.mjs.map
@@ -1,11 +1,12 @@
1
- import { i as v } from "./dialogHelpers-DBf7WqYH.mjs";
2
- let p = !1, a = null;
3
- const h = () => {
1
+ import { i as h } from "./dialogHelpers-DBf7WqYH.mjs";
2
+ import { s as v } from "./sanitizeHtml-DA0ajC6k.mjs";
3
+ let l = !1, d = null;
4
+ const w = () => {
4
5
  if (typeof document == "undefined") return;
5
- const i = "rte-preview-plugin-styles";
6
- if (document.getElementById(i)) return;
6
+ const r = "rte-preview-plugin-styles";
7
+ if (document.getElementById(r)) return;
7
8
  const t = document.createElement("style");
8
- t.id = i, t.textContent = `
9
+ t.id = r, t.textContent = `
9
10
  /* Preview Editor Dialog Styles */
10
11
  .rte-preview-editor-overlay {
11
12
  position: fixed !important;
@@ -225,15 +226,15 @@ const h = () => {
225
226
  }
226
227
  }
227
228
  `, document.head.appendChild(t);
228
- }, w = () => {
229
- const i = window.getSelection();
230
- if (i && i.rangeCount > 0) {
231
- let e = i.getRangeAt(0).startContainer;
229
+ }, u = () => {
230
+ const r = window.getSelection();
231
+ if (r && r.rangeCount > 0) {
232
+ let e = r.getRangeAt(0).startContainer;
232
233
  for (; e && e !== document.body; ) {
233
234
  if (e.nodeType === Node.ELEMENT_NODE) {
234
- const n = e;
235
- if (n.getAttribute("contenteditable") === "true")
236
- return n;
235
+ const i = e;
236
+ if (i.getAttribute("contenteditable") === "true")
237
+ return i;
237
238
  }
238
239
  e = e.parentNode;
239
240
  }
@@ -246,37 +247,33 @@ const h = () => {
246
247
  if (e) return e;
247
248
  }
248
249
  return document.querySelector('[contenteditable="true"]');
249
- }, u = () => {
250
- const i = w();
251
- if (!i) return "";
252
- const t = i.cloneNode(!0);
250
+ }, f = () => {
251
+ const r = u();
252
+ if (!r) return "";
253
+ const t = r.cloneNode(!0);
253
254
  return [
254
255
  ".rte-floating-toolbar",
255
256
  ".rte-selection-marker",
256
257
  ".rte-toolbar",
257
258
  ".rte-resize-handle",
258
259
  "[data-rte-internal]"
259
- ].forEach((n) => {
260
- t.querySelectorAll(n).forEach((r) => r.remove());
260
+ ].forEach((i) => {
261
+ t.querySelectorAll(i).forEach((n) => n.remove());
261
262
  }), t.innerHTML;
262
- }, f = (i) => {
263
- const t = document.createElement("div");
264
- return t.innerHTML = i, t.querySelectorAll(
265
- 'script, iframe[src^="javascript:"], object, embed, form[action^="javascript:"]'
266
- ).forEach((r) => r.remove()), t.querySelectorAll("*").forEach((r) => {
267
- Array.from(r.attributes).forEach((o) => {
268
- o.name.startsWith("on") && r.removeAttribute(o.name), (o.name === "href" || o.name === "src") && o.value.startsWith("javascript:") && r.removeAttribute(o.name), o.name.toLowerCase() === "contenteditable" && r.removeAttribute(o.name);
269
- }), r.setAttribute("contenteditable", "false");
263
+ }, x = (r) => {
264
+ const t = document.createElement("template");
265
+ return t.innerHTML = v(r), t.content.querySelectorAll("*").forEach((e) => {
266
+ e.setAttribute("contenteditable", "false");
270
267
  }), t.innerHTML;
271
268
  }, b = () => {
272
- if (typeof window == "undefined" || p) return;
273
- p = !0, h();
274
- const i = u(), t = f(i), e = document.createElement("div");
275
- v(e), e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
269
+ if (typeof window == "undefined" || l) return;
270
+ l = !0, w();
271
+ const r = f(), t = x(r), e = document.createElement("div");
272
+ h(e), e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
273
+ const i = document.createElement("div");
274
+ i.className = "rte-preview-editor-modal";
276
275
  const n = document.createElement("div");
277
- n.className = "rte-preview-editor-modal";
278
- const r = document.createElement("div");
279
- r.className = "rte-preview-editor-header", r.innerHTML = `
276
+ n.className = "rte-preview-editor-header", n.innerHTML = `
280
277
  <h2 id="preview-editor-title">Preview Editor</h2>
281
278
  <div class="rte-preview-editor-header-actions">
282
279
  <button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
@@ -287,25 +284,25 @@ const h = () => {
287
284
  </button>
288
285
  </div>
289
286
  `;
290
- const o = document.createElement("div");
291
- o.className = "rte-preview-editor-body";
287
+ const p = document.createElement("div");
288
+ p.className = "rte-preview-editor-body";
292
289
  const c = document.createElement("div");
293
290
  c.className = "rte-preview-editor-content";
294
291
  const s = document.createElement("div");
295
- s.className = "rte-preview-editor-light-editor", s.innerHTML = t, c.appendChild(s), o.appendChild(c), n.appendChild(r), n.appendChild(o), e.appendChild(n);
296
- const l = () => {
297
- e.parentNode && e.parentNode.removeChild(e), p = !1, a = null, document.removeEventListener("keydown", m);
292
+ s.className = "rte-preview-editor-light-editor", s.innerHTML = t, c.appendChild(s), p.appendChild(c), i.appendChild(n), i.appendChild(p), e.appendChild(i);
293
+ const a = () => {
294
+ e.parentNode && e.parentNode.removeChild(e), l = !1, d = null, document.removeEventListener("keydown", m);
298
295
  };
299
- a = l;
300
- const m = (d) => {
301
- d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), l());
302
- }, g = r.querySelector(".rte-preview-editor-close-btn");
303
- g && g.addEventListener("click", (d) => {
304
- d.preventDefault(), d.stopPropagation(), l();
305
- }), e.addEventListener("click", (d) => {
306
- d.target === e && l();
296
+ d = a;
297
+ const m = (o) => {
298
+ o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), a());
299
+ }, g = n.querySelector(".rte-preview-editor-close-btn");
300
+ g && g.addEventListener("click", (o) => {
301
+ o.preventDefault(), o.stopPropagation(), a();
302
+ }), e.addEventListener("click", (o) => {
303
+ o.target === e && a();
307
304
  }), document.addEventListener("keydown", m), document.body.appendChild(e);
308
- }, y = () => ({
305
+ }, E = () => ({
309
306
  name: "preview",
310
307
  toolbar: [
311
308
  {
@@ -315,11 +312,11 @@ const h = () => {
315
312
  }
316
313
  ],
317
314
  commands: {
318
- togglePreview: () => (p ? a == null || a() : b(), !0)
315
+ togglePreview: () => (l ? d == null || d() : b(), !0)
319
316
  },
320
317
  keymap: {}
321
318
  });
322
319
  export {
323
- y as PreviewPlugin
320
+ E as PreviewPlugin
324
321
  };
325
- //# sourceMappingURL=PreviewPlugin.native-CiR51jql.mjs.map
322
+ //# sourceMappingURL=PreviewPlugin.native-Dyht8mGi.mjs.map