@editora/plugins 1.0.19 → 1.0.20

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,4 @@
1
- "use strict";const I=require("./dialogHelpers-zU6zpMIA.js"),l=require("@editora/light-code-editor"),H='[data-theme="dark"], .dark, .editora-theme-dark',P=`/* Source Editor Dialog Styles */
1
+ "use strict";const I=require("./dialogHelpers-zU6zpMIA.js"),s=require("@editora/light-code-editor"),P=require("./sanitizeHtml-CDoBlNTk.js"),S='[data-theme="dark"], .dark, .editora-theme-dark',U=`/* Source Editor Dialog Styles */
2
2
  .rte-source-editor-overlay {
3
3
  position: fixed !important;
4
4
  top: 0 !important;
@@ -375,10 +375,10 @@
375
375
  flex: 1;
376
376
  text-align: center;
377
377
  }
378
- }`,U=()=>({name:"code",toolbar:[{label:"Source",command:"toggleSourceView",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"></path></g></svg>',shortcut:"Mod-Shift-S"}],commands:{toggleSourceView:()=>{const u=(()=>{const a=window.getSelection();if(a&&a.anchorNode){let e=a.anchorNode instanceof HTMLElement?a.anchorNode:a.anchorNode.parentElement;for(;e;){if(e.classList?.contains("rte-content"))return e;e=e.parentElement}}if(document.activeElement){let e=document.activeElement;if(e.classList?.contains("rte-content"))return e;for(;e&&e!==document.body;){if(e.classList?.contains("rte-content"))return e;const n=e.querySelector(".rte-content");if(n)return n;e=e.parentElement}}const o=document.querySelector("[data-editora-editor]");if(o){const e=o.querySelector(".rte-content");if(e)return e}return document.querySelector(".rte-content")})();if(!u)return console.error("[CodePlugin] Editor content area not found"),alert("Editor content area not found. Please click inside the editor first."),!1;const N=u.innerHTML,D=a=>{let o="",e=0;const n=2,h=a.split(/(<\/?[a-zA-Z][^>]*>)/);for(const r of h)r.trim()&&(r.match(/^<\/[a-zA-Z]/)?(e=Math.max(0,e-1),o+=`
378
+ }`,_=()=>({name:"code",toolbar:[{label:"Source",command:"toggleSourceView",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"></path></g></svg>',shortcut:"Mod-Shift-S"}],commands:{toggleSourceView:()=>{const l=(()=>{const c=window.getSelection();if(c&&c.anchorNode){let e=c.anchorNode instanceof HTMLElement?c.anchorNode:c.anchorNode.parentElement;for(;e;){if(e.classList?.contains("rte-content"))return e;e=e.parentElement}}if(document.activeElement){let e=document.activeElement;if(e.classList?.contains("rte-content"))return e;for(;e&&e!==document.body;){if(e.classList?.contains("rte-content"))return e;const n=e.querySelector(".rte-content");if(n)return n;e=e.parentElement}}const o=document.querySelector("[data-editora-editor]");if(o){const e=o.querySelector(".rte-content");if(e)return e}return document.querySelector(".rte-content")})();if(!l)return console.error("[CodePlugin] Editor content area not found"),alert("Editor content area not found. Please click inside the editor first."),!1;const N=l.innerHTML,D=c=>{let o="",e=0;const n=2,u=c.split(/(<\/?[a-zA-Z][^>]*>)/);for(const r of u)r.trim()&&(r.match(/^<\/[a-zA-Z]/)?(e=Math.max(0,e-1),o+=`
379
379
  `+" ".repeat(e*n)+r):r.match(/^<[a-zA-Z]/)&&!r.match(/\/>$/)?(o+=`
380
380
  `+" ".repeat(e*n)+r,e++):r.match(/^<[a-zA-Z].*\/>$/)?o+=`
381
- `+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=D(N);let e=null,n="dark",h=!1,r=!1,v=!1,E=!1;const O=!!u.closest(H)||document.body.matches(H)||document.documentElement.matches(H),i=document.createElement("div");I.initDialogOverlay(i),i.className="rte-source-editor-overlay",O&&i.classList.add("rte-theme-dark");const d=document.createElement("div");d.className="rte-source-editor-modal",d.setAttribute("role","dialog"),d.setAttribute("aria-modal","true"),d.setAttribute("aria-labelledby","source-editor-title");const f=document.createElement("div");f.className="rte-source-editor-header",f.innerHTML=`
381
+ `+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=D(N);let e=null,n="dark",u=!1,r=!1,v=!1,w=!1;const O=!!l.closest(S)||document.body.matches(S)||document.documentElement.matches(S),i=document.createElement("div");I.initDialogOverlay(i),i.className="rte-source-editor-overlay",O&&i.classList.add("rte-theme-dark");const a=document.createElement("div");a.className="rte-source-editor-modal",a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby","source-editor-title");const h=document.createElement("div");h.className="rte-source-editor-header",h.innerHTML=`
382
382
  <h2 id="source-editor-title">Source Editor</h2>
383
383
  <div class="rte-source-editor-header-toolbar">
384
384
  <button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
@@ -414,7 +414,7 @@
414
414
  </svg>
415
415
  </button>
416
416
  </div>
417
- `;const C=document.createElement("div");C.className="rte-source-editor-body";const x=document.createElement("div");x.className="rte-source-editor-content";const M=document.createElement("div");M.className="rte-source-editor-warning",M.textContent="⚠️ Advanced users only. Invalid HTML may break the editor.";const g=document.createElement("div");g.className="rte-source-editor-light-editor",g.style.height="400px",x.appendChild(M),x.appendChild(g),C.appendChild(x);const b=document.createElement("div");if(b.className="rte-source-editor-footer",b.innerHTML=`
417
+ `;const E=document.createElement("div");E.className="rte-source-editor-body";const x=document.createElement("div");x.className="rte-source-editor-content";const C=document.createElement("div");C.className="rte-source-editor-warning",C.textContent="⚠️ Advanced users only. Invalid HTML may break the editor.";const b=document.createElement("div");b.className="rte-source-editor-light-editor",b.style.height="400px",x.appendChild(C),x.appendChild(b),E.appendChild(x);const f=document.createElement("div");if(f.className="rte-source-editor-footer",f.innerHTML=`
418
418
  <div class="rte-source-editor-footer-info">
419
419
  <span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
420
420
  </div>
@@ -422,7 +422,7 @@
422
422
  <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
423
423
  <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
424
424
  </div>
425
- `,d.appendChild(f),d.appendChild(C),d.appendChild(b),i.appendChild(d),!document.getElementById("rte-source-editor-styles")){const t=document.createElement("style");t.id="rte-source-editor-styles",t.textContent=P,document.head.appendChild(t)}const y=f.querySelector(".theme-toggle-btn"),m=f.querySelector(".readonly-toggle-btn"),k=f.querySelector(".rte-source-editor-fullscreen-btn"),T=f.querySelector(".rte-source-editor-close-btn"),z=b.querySelector(".rte-source-editor-btn-cancel"),B=b.querySelector(".rte-source-editor-btn-save"),q=b.querySelector(".unsaved-changes"),S=[],s=(t,c,L,w)=>{t.addEventListener(c,L,w),S.push(()=>t.removeEventListener(c,L,w))},A=t=>{v!==t&&(v=t,q&&(q.style.display=v?"inline":"none"))},p=()=>{if(!E){for(E=!0;S.length;)S.pop()?.();e&&(e.destroy(),e=null),i.isConnected&&i.remove()}},R=()=>{n=n==="dark"?"light":"dark",e?.setTheme(n),y&&(y.innerHTML=n==="light"?`
425
+ `,a.appendChild(h),a.appendChild(E),a.appendChild(f),i.appendChild(a),!document.getElementById("rte-source-editor-styles")){const t=document.createElement("style");t.id="rte-source-editor-styles",t.textContent=U,document.head.appendChild(t)}const y=h.querySelector(".theme-toggle-btn"),g=h.querySelector(".readonly-toggle-btn"),k=h.querySelector(".rte-source-editor-fullscreen-btn"),L=h.querySelector(".rte-source-editor-close-btn"),H=f.querySelector(".rte-source-editor-btn-cancel"),T=f.querySelector(".rte-source-editor-btn-save"),z=f.querySelector(".unsaved-changes"),M=[],d=(t,m,q,A)=>{t.addEventListener(m,q,A),M.push(()=>t.removeEventListener(m,q,A))},B=t=>{v!==t&&(v=t,z&&(z.style.display=v?"inline":"none"))},p=()=>{if(!w){for(w=!0;M.length;)M.pop()?.();e&&(e.destroy(),e=null),i.isConnected&&i.remove()}},R=()=>{n=n==="dark"?"light":"dark",e?.setTheme(n),y&&(y.innerHTML=n==="light"?`
426
426
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
427
427
  <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
428
428
  </svg>
@@ -438,7 +438,7 @@
438
438
  <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
439
439
  <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
440
440
  </svg>
441
- `)},j=()=>{h=!h,e?.setReadOnly(h),m&&(m.classList.toggle("active",h),m.innerHTML=h?`
441
+ `)},F=()=>{u=!u,e?.setReadOnly(u),g&&(g.classList.toggle("active",u),g.innerHTML=u?`
442
442
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
443
443
  <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
444
444
  <circle cx="12" cy="16" r="1"/>
@@ -449,7 +449,7 @@
449
449
  <path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
450
450
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
451
451
  </svg>
452
- `)},F=()=>{r=!r,i.classList.toggle("fullscreen",r),g.style.height=r?"calc(100vh - 200px)":"400px",k&&(k.innerHTML=r?`
452
+ `)},V=()=>{r=!r,i.classList.toggle("fullscreen",r),b.style.height=r?"calc(100vh - 200px)":"400px",k&&(k.innerHTML=r?`
453
453
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
454
454
  <path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
455
455
  </svg>
@@ -457,4 +457,4 @@
457
457
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
458
458
  <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
459
459
  </svg>
460
- `)},V=()=>{v&&!confirm("You have unsaved changes. Are you sure you want to cancel?")||p()},Z=()=>{try{const t=e?.getValue()||"",c=document.createElement("div");c.innerHTML=t,c.querySelectorAll('script, iframe[src^="javascript:"], object, embed').forEach(w=>w.remove()),u.innerHTML=c.innerHTML;try{u.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!1,inputType:"insertReplacementText"}))}catch{u.dispatchEvent(new Event("input",{bubbles:!0}))}u.dispatchEvent(new Event("change",{bubbles:!0})),A(!1),p()}catch(t){alert("Failed to update HTML. Please check your syntax."),console.error("HTML update error:",t)}};y&&s(y,"click",R),m&&s(m,"click",j),k&&s(k,"click",F),T&&s(T,"click",p),z&&s(z,"click",V),B&&s(B,"click",Z),s(i,"click",t=>{t.target===i&&p()}),s(document,"keydown",t=>{const c=t;c.key==="Escape"&&(c.preventDefault(),p())}),document.body.appendChild(i),requestAnimationFrame(()=>{if(!(E||!i.isConnected))try{e=l.createEditor(g,{value:o,theme:"dark",readOnly:!1,extensions:[new l.LineNumbersExtension,new l.ThemeExtension,new l.ReadOnlyExtension,new l.BracketMatchingExtension,new l.SearchExtension,new l.CodeFoldingExtension,new l.SyntaxHighlightingExtension]}),e.on("change",()=>{const t=e?.getValue()||"";A(t!==o)}),requestAnimationFrame(()=>e?.focus())}catch(t){console.error("Failed to initialize code editor:",t)}})})(),!0}},keymap:{"Mod-Shift-s":"toggleSourceView","Mod-Shift-S":"toggleSourceView"}});exports.CodePlugin=U;
460
+ `)},Z=()=>{v&&!confirm("You have unsaved changes. Are you sure you want to cancel?")||p()},j=()=>{try{const t=e?.getValue()||"";l.innerHTML=P.sanitizeHtml(t);try{l.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!1,inputType:"insertReplacementText"}))}catch{l.dispatchEvent(new Event("input",{bubbles:!0}))}l.dispatchEvent(new Event("change",{bubbles:!0})),B(!1),p()}catch(t){alert("Failed to update HTML. Please check your syntax."),console.error("HTML update error:",t)}};y&&d(y,"click",R),g&&d(g,"click",F),k&&d(k,"click",V),L&&d(L,"click",p),H&&d(H,"click",Z),T&&d(T,"click",j),d(i,"click",t=>{t.target===i&&p()}),d(document,"keydown",t=>{const m=t;m.key==="Escape"&&(m.preventDefault(),p())}),document.body.appendChild(i),requestAnimationFrame(()=>{if(!(w||!i.isConnected))try{e=s.createEditor(b,{value:o,theme:"dark",readOnly:!1,extensions:[new s.LineNumbersExtension,new s.ThemeExtension,new s.ReadOnlyExtension,new s.BracketMatchingExtension,new s.SearchExtension,new s.CodeFoldingExtension,new s.SyntaxHighlightingExtension]}),e.on("change",()=>{const t=e?.getValue()||"";B(t!==o)}),requestAnimationFrame(()=>e?.focus())}catch(t){console.error("Failed to initialize code editor:",t)}})})(),!0}},keymap:{"Mod-Shift-s":"toggleSourceView","Mod-Shift-S":"toggleSourceView"}});exports.CodePlugin=_;
@@ -1,6 +1,7 @@
1
- import { i as Z } from "./dialogHelpers-5d5BuOCW.mjs";
1
+ import { i as j } from "./dialogHelpers-5d5BuOCW.mjs";
2
2
  import { createEditor as I, LineNumbersExtension as U, ThemeExtension as P, ReadOnlyExtension as _, BracketMatchingExtension as $, SearchExtension as K, CodeFoldingExtension as Y, SyntaxHighlightingExtension as G } from "@editora/light-code-editor";
3
- const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Editor Dialog Styles */
3
+ import { s as J } from "./sanitizeHtml-CtLy8um-.mjs";
4
+ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Editor Dialog Styles */
4
5
  .rte-source-editor-overlay {
5
6
  position: fixed !important;
6
7
  top: 0 !important;
@@ -377,7 +378,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
377
378
  flex: 1;
378
379
  text-align: center;
379
380
  }
380
- }`, te = () => ({
381
+ }`, oe = () => ({
381
382
  name: "code",
382
383
  // Toolbar button configuration
383
384
  toolbar: [
@@ -396,7 +397,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
396
397
  * Opens a dialog to edit raw HTML
397
398
  */
398
399
  toggleSourceView: () => {
399
- const l = (() => {
400
+ const s = (() => {
400
401
  const a = window.getSelection();
401
402
  if (a && a.anchorNode) {
402
403
  let e = a.anchorNode instanceof HTMLElement ? a.anchorNode : a.anchorNode.parentElement;
@@ -429,14 +430,14 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
429
430
  }
430
431
  return document.querySelector(".rte-content");
431
432
  })();
432
- if (!l)
433
+ if (!s)
433
434
  return console.error("[CodePlugin] Editor content area not found"), alert(
434
435
  "Editor content area not found. Please click inside the editor first."
435
436
  ), !1;
436
- const A = l.innerHTML, N = (a) => {
437
+ const A = s.innerHTML, N = (a) => {
437
438
  let o = "", e = 0;
438
- const n = 2, u = a.split(/(<\/?[a-zA-Z][^>]*>)/);
439
- for (const r of u)
439
+ const n = 2, l = a.split(/(<\/?[a-zA-Z][^>]*>)/);
440
+ for (const r of l)
440
441
  r.trim() && (r.match(/^<\/[a-zA-Z]/) ? (e = Math.max(0, e - 1), o += `
441
442
  ` + " ".repeat(e * n) + r) : r.match(/^<[a-zA-Z]/) && !r.match(/\/>$/) ? (o += `
442
443
  ` + " ".repeat(e * n) + r, e++) : r.match(/^<[a-zA-Z].*\/>$/) ? o += `
@@ -446,13 +447,13 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
446
447
  return (() => {
447
448
  document.querySelectorAll(".rte-source-editor-overlay").forEach((t) => t.remove());
448
449
  const o = N(A);
449
- let e = null, n = "dark", u = !1, r = !1, p = !1, w = !1;
450
- const D = !!l.closest(L) || document.body.matches(L) || document.documentElement.matches(L), i = document.createElement("div");
451
- Z(i), i.className = "rte-source-editor-overlay", D && i.classList.add("rte-theme-dark");
452
- const d = document.createElement("div");
453
- d.className = "rte-source-editor-modal", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "source-editor-title");
454
- const h = document.createElement("div");
455
- h.className = "rte-source-editor-header", h.innerHTML = `
450
+ let e = null, n = "dark", l = !1, r = !1, p = !1, k = !1;
451
+ const D = !!s.closest(M) || document.body.matches(M) || document.documentElement.matches(M), i = document.createElement("div");
452
+ j(i), i.className = "rte-source-editor-overlay", D && i.classList.add("rte-theme-dark");
453
+ const c = document.createElement("div");
454
+ c.className = "rte-source-editor-modal", c.setAttribute("role", "dialog"), c.setAttribute("aria-modal", "true"), c.setAttribute("aria-labelledby", "source-editor-title");
455
+ const u = document.createElement("div");
456
+ u.className = "rte-source-editor-header", u.innerHTML = `
456
457
  <h2 id="source-editor-title">Source Editor</h2>
457
458
  <div class="rte-source-editor-header-toolbar">
458
459
  <button class="rte-source-editor-toolbar-btn theme-toggle-btn" title="Switch theme">
@@ -489,16 +490,16 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
489
490
  </button>
490
491
  </div>
491
492
  `;
492
- const E = document.createElement("div");
493
- E.className = "rte-source-editor-body";
493
+ const w = document.createElement("div");
494
+ w.className = "rte-source-editor-body";
494
495
  const v = document.createElement("div");
495
496
  v.className = "rte-source-editor-content";
496
- const C = document.createElement("div");
497
- C.className = "rte-source-editor-warning", C.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
498
- const b = document.createElement("div");
499
- b.className = "rte-source-editor-light-editor", b.style.height = "400px", v.appendChild(C), v.appendChild(b), E.appendChild(v);
497
+ const E = document.createElement("div");
498
+ E.className = "rte-source-editor-warning", E.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
500
499
  const f = document.createElement("div");
501
- if (f.className = "rte-source-editor-footer", f.innerHTML = `
500
+ f.className = "rte-source-editor-light-editor", f.style.height = "400px", v.appendChild(E), v.appendChild(f), w.appendChild(v);
501
+ const h = document.createElement("div");
502
+ if (h.className = "rte-source-editor-footer", h.innerHTML = `
502
503
  <div class="rte-source-editor-footer-info">
503
504
  <span class="unsaved-changes" style="display: none;">• Unsaved changes</span>
504
505
  </div>
@@ -506,34 +507,34 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
506
507
  <button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
507
508
  <button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
508
509
  </div>
509
- `, d.appendChild(h), d.appendChild(E), d.appendChild(f), i.appendChild(d), !document.getElementById("rte-source-editor-styles")) {
510
+ `, c.appendChild(u), c.appendChild(w), c.appendChild(h), i.appendChild(c), !document.getElementById("rte-source-editor-styles")) {
510
511
  const t = document.createElement("style");
511
- t.id = "rte-source-editor-styles", t.textContent = J, document.head.appendChild(t);
512
+ t.id = "rte-source-editor-styles", t.textContent = Q, document.head.appendChild(t);
512
513
  }
513
- const x = h.querySelector(
514
+ const x = u.querySelector(
514
515
  ".theme-toggle-btn"
515
- ), m = h.querySelector(
516
+ ), b = u.querySelector(
516
517
  ".readonly-toggle-btn"
517
- ), y = h.querySelector(
518
+ ), y = u.querySelector(
518
519
  ".rte-source-editor-fullscreen-btn"
519
- ), T = h.querySelector(
520
+ ), S = u.querySelector(
520
521
  ".rte-source-editor-close-btn"
521
- ), H = f.querySelector(
522
+ ), L = h.querySelector(
522
523
  ".rte-source-editor-btn-cancel"
523
- ), z = f.querySelector(
524
+ ), H = h.querySelector(
524
525
  ".rte-source-editor-btn-save"
525
- ), B = f.querySelector(
526
+ ), T = h.querySelector(
526
527
  ".unsaved-changes"
527
- ), M = [], s = (t, c, S, k) => {
528
- t.addEventListener(c, S, k), M.push(
529
- () => t.removeEventListener(c, S, k)
528
+ ), C = [], d = (t, m, B, q) => {
529
+ t.addEventListener(m, B, q), C.push(
530
+ () => t.removeEventListener(m, B, q)
530
531
  );
531
- }, q = (t) => {
532
- p !== t && (p = t, B && (B.style.display = p ? "inline" : "none"));
532
+ }, z = (t) => {
533
+ p !== t && (p = t, T && (T.style.display = p ? "inline" : "none"));
533
534
  }, g = () => {
534
- if (!w) {
535
- for (w = !0; M.length; )
536
- M.pop()?.();
535
+ if (!k) {
536
+ for (k = !0; C.length; )
537
+ C.pop()?.();
537
538
  e && (e.destroy(), e = null), i.isConnected && i.remove();
538
539
  }
539
540
  }, O = () => {
@@ -555,7 +556,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
555
556
  </svg>
556
557
  `);
557
558
  }, R = () => {
558
- u = !u, e?.setReadOnly(u), m && (m.classList.toggle("active", u), m.innerHTML = u ? `
559
+ l = !l, e?.setReadOnly(l), b && (b.classList.toggle("active", l), b.innerHTML = l ? `
559
560
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
560
561
  <rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
561
562
  <circle cx="12" cy="16" r="1"/>
@@ -567,8 +568,8 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
567
568
  <path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
568
569
  </svg>
569
570
  `);
570
- }, j = () => {
571
- r = !r, i.classList.toggle("fullscreen", r), b.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
571
+ }, F = () => {
572
+ r = !r, i.classList.toggle("fullscreen", r), f.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
572
573
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
573
574
  <path d="M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 0 2-2h3M3 16h3a2 2 0 0 0 2 2v3"/>
574
575
  </svg>
@@ -577,16 +578,14 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
577
578
  <path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
578
579
  </svg>
579
580
  `);
580
- }, F = () => {
581
- p && !confirm("You have unsaved changes. Are you sure you want to cancel?") || g();
582
581
  }, V = () => {
582
+ p && !confirm("You have unsaved changes. Are you sure you want to cancel?") || g();
583
+ }, Z = () => {
583
584
  try {
584
- const t = e?.getValue() || "", c = document.createElement("div");
585
- c.innerHTML = t, c.querySelectorAll(
586
- 'script, iframe[src^="javascript:"], object, embed'
587
- ).forEach((k) => k.remove()), l.innerHTML = c.innerHTML;
585
+ const t = e?.getValue() || "";
586
+ s.innerHTML = J(t);
588
587
  try {
589
- l.dispatchEvent(
588
+ s.dispatchEvent(
590
589
  new InputEvent("input", {
591
590
  bubbles: !0,
592
591
  cancelable: !1,
@@ -594,26 +593,26 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
594
593
  })
595
594
  );
596
595
  } catch {
597
- l.dispatchEvent(
596
+ s.dispatchEvent(
598
597
  new Event("input", { bubbles: !0 })
599
598
  );
600
599
  }
601
- l.dispatchEvent(
600
+ s.dispatchEvent(
602
601
  new Event("change", { bubbles: !0 })
603
- ), q(!1), g();
602
+ ), z(!1), g();
604
603
  } catch (t) {
605
604
  alert("Failed to update HTML. Please check your syntax."), console.error("HTML update error:", t);
606
605
  }
607
606
  };
608
- x && s(x, "click", O), m && s(m, "click", R), y && s(y, "click", j), T && s(T, "click", g), H && s(H, "click", F), z && s(z, "click", V), s(i, "click", (t) => {
607
+ x && d(x, "click", O), b && d(b, "click", R), y && d(y, "click", F), S && d(S, "click", g), L && d(L, "click", V), H && d(H, "click", Z), d(i, "click", (t) => {
609
608
  t.target === i && g();
610
- }), s(document, "keydown", (t) => {
611
- const c = t;
612
- c.key === "Escape" && (c.preventDefault(), g());
609
+ }), d(document, "keydown", (t) => {
610
+ const m = t;
611
+ m.key === "Escape" && (m.preventDefault(), g());
613
612
  }), document.body.appendChild(i), requestAnimationFrame(() => {
614
- if (!(w || !i.isConnected))
613
+ if (!(k || !i.isConnected))
615
614
  try {
616
- e = I(b, {
615
+ e = I(f, {
617
616
  value: o,
618
617
  theme: "dark",
619
618
  readOnly: !1,
@@ -628,7 +627,7 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
628
627
  ]
629
628
  }), e.on("change", () => {
630
629
  const t = e?.getValue() || "";
631
- q(t !== o);
630
+ z(t !== o);
632
631
  }), requestAnimationFrame(() => e?.focus());
633
632
  } catch (t) {
634
633
  console.error("Failed to initialize code editor:", t);
@@ -644,5 +643,5 @@ const L = '[data-theme="dark"], .dark, .editora-theme-dark', J = `/* Source Edit
644
643
  }
645
644
  });
646
645
  export {
647
- te as C
646
+ oe as C
648
647
  };
package/dist/code.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./CodePlugin.native-Bwf25lLX.js");exports.CodePlugin=e.CodePlugin;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./CodePlugin.native-CKJo7IFG.js");exports.CodePlugin=e.CodePlugin;
package/dist/code.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as r } from "./CodePlugin.native-Cpp4u3Jl.mjs";
1
+ import { C as r } from "./CodePlugin.native-D8gGxB8i.mjs";
2
2
  export {
3
3
  r as CodePlugin
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-CoflqYuK.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-D5xugkYA.js");exports.DocumentManagerPlugin=e.DocumentManagerPlugin;exports.getDocumentManagerConfig=e.getDocumentManagerConfig;exports.setDocumentManagerConfig=e.setDocumentManagerConfig;
@@ -1,4 +1,4 @@
1
- import { D as n, g, s as o } from "./index-Bm1eqYHh.mjs";
1
+ import { D as n, g, s as o } from "./index-B-VitI3v.mjs";
2
2
  export {
3
3
  n as DocumentManagerPlugin,
4
4
  g as getDocumentManagerConfig,