@editora/plugins 1.0.18 → 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.
- package/dist/{CodePlugin.native-Bwf25lLX.js → CodePlugin.native-CKJo7IFG.js} +8 -8
- package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
- package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
- package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +47 -50
- package/dist/purify.es-B6PsRpEV.js +3 -0
- package/dist/purify.es-DmCsrgBd.mjs +1480 -0
- package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
- package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +158 -150
- package/dist/template.cjs.js +20 -21
- package/dist/template.esm.js +175 -723
- package/package.json +5 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const I=require("./dialogHelpers-zU6zpMIA.js"),
|
|
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
|
-
}`,
|
|
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",
|
|
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
|
|
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
|
-
`,
|
|
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
|
-
`)},
|
|
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
|
-
`)},
|
|
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
|
-
`)},
|
|
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
|
|
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
|
-
|
|
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
|
-
}`,
|
|
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
|
|
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 (!
|
|
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 =
|
|
437
|
+
const A = s.innerHTML, N = (a) => {
|
|
437
438
|
let o = "", e = 0;
|
|
438
|
-
const n = 2,
|
|
439
|
-
for (const r of
|
|
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",
|
|
450
|
-
const D = !!
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
|
|
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
|
|
493
|
-
|
|
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
|
|
497
|
-
|
|
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
|
-
|
|
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
|
-
`,
|
|
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 =
|
|
512
|
+
t.id = "rte-source-editor-styles", t.textContent = Q, document.head.appendChild(t);
|
|
512
513
|
}
|
|
513
|
-
const x =
|
|
514
|
+
const x = u.querySelector(
|
|
514
515
|
".theme-toggle-btn"
|
|
515
|
-
),
|
|
516
|
+
), b = u.querySelector(
|
|
516
517
|
".readonly-toggle-btn"
|
|
517
|
-
), y =
|
|
518
|
+
), y = u.querySelector(
|
|
518
519
|
".rte-source-editor-fullscreen-btn"
|
|
519
|
-
),
|
|
520
|
+
), S = u.querySelector(
|
|
520
521
|
".rte-source-editor-close-btn"
|
|
521
|
-
),
|
|
522
|
+
), L = h.querySelector(
|
|
522
523
|
".rte-source-editor-btn-cancel"
|
|
523
|
-
),
|
|
524
|
+
), H = h.querySelector(
|
|
524
525
|
".rte-source-editor-btn-save"
|
|
525
|
-
),
|
|
526
|
+
), T = h.querySelector(
|
|
526
527
|
".unsaved-changes"
|
|
527
|
-
),
|
|
528
|
-
t.addEventListener(
|
|
529
|
-
() => t.removeEventListener(
|
|
528
|
+
), C = [], d = (t, m, B, q) => {
|
|
529
|
+
t.addEventListener(m, B, q), C.push(
|
|
530
|
+
() => t.removeEventListener(m, B, q)
|
|
530
531
|
);
|
|
531
|
-
},
|
|
532
|
-
p !== t && (p = t,
|
|
532
|
+
}, z = (t) => {
|
|
533
|
+
p !== t && (p = t, T && (T.style.display = p ? "inline" : "none"));
|
|
533
534
|
}, g = () => {
|
|
534
|
-
if (!
|
|
535
|
-
for (
|
|
536
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
571
|
-
r = !r, i.classList.toggle("fullscreen", 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() || ""
|
|
585
|
-
|
|
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
|
-
|
|
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
|
-
|
|
596
|
+
s.dispatchEvent(
|
|
598
597
|
new Event("input", { bubbles: !0 })
|
|
599
598
|
);
|
|
600
599
|
}
|
|
601
|
-
|
|
600
|
+
s.dispatchEvent(
|
|
602
601
|
new Event("change", { bubbles: !0 })
|
|
603
|
-
),
|
|
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 &&
|
|
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
|
-
}),
|
|
611
|
-
const
|
|
612
|
-
|
|
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 (!(
|
|
613
|
+
if (!(k || !i.isConnected))
|
|
615
614
|
try {
|
|
616
|
-
e = I(
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
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;
|