@editora/plugins 1.0.22 → 1.1.0
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/README.md +1 -1
- package/dist/{CodePlugin.native-CKJo7IFG.js → CodePlugin.native-BwhZsI5v.js} +11 -11
- package/dist/{CodePlugin.native-D8gGxB8i.mjs → CodePlugin.native-CojLCp6C.mjs} +61 -53
- package/dist/MediaManagerPlugin.native-CycfjOi4.js +1841 -0
- package/dist/MediaManagerPlugin.native-DZrmcmnm.mjs +4688 -0
- package/dist/a11y-checker.cjs.js +3 -3
- package/dist/a11y-checker.esm.js +6 -4
- package/dist/anchor.cjs.js +4 -4
- package/dist/anchor.esm.js +19 -18
- package/dist/anchoredPopover-BNJ8e7j-.mjs +128 -0
- package/dist/anchoredPopover-Cygmit_o.js +1 -0
- package/dist/approval-workflow.cjs.js +7 -7
- package/dist/approval-workflow.esm.js +55 -54
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +72 -67
- package/dist/blocks-library.cjs.js +18 -19
- package/dist/blocks-library.esm.js +41 -42
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +50 -50
- package/dist/code-sample.cjs.js +10 -10
- package/dist/code-sample.esm.js +4 -4
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/comments.cjs.js +23 -11
- package/dist/comments.esm.js +167 -149
- package/dist/conditional-content.cjs.js +2 -2
- package/dist/conditional-content.esm.js +2 -2
- package/dist/confirmDialog-D3S8BhIM.js +42 -0
- package/dist/confirmDialog-DR4c8j6S.mjs +87 -0
- package/dist/content-rules.cjs.js +6 -6
- package/dist/content-rules.esm.js +51 -51
- package/dist/data-binding.cjs.js +2 -2
- package/dist/data-binding.esm.js +2 -2
- package/dist/dialogHelpers-BbwpIXD9.mjs +183 -0
- package/dist/dialogHelpers-BxSQ7A6M.js +12 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-BL98a7YZ.mjs → documentManager-BFjGIeI8.mjs} +793 -781
- package/dist/{documentManager-r8t7yZEd.js → documentManager-C9d17K5W.js} +10 -10
- package/dist/embed-iframe.cjs.js +6 -6
- package/dist/embed-iframe.esm.js +6 -6
- package/dist/emojis.cjs.js +5 -5
- package/dist/emojis.esm.js +3 -3
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +12 -12
- package/dist/format-painter.cjs.js +1 -1
- package/dist/format-painter.esm.js +172 -151
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +96 -83
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +176 -97
- package/dist/{index-D5xugkYA.js → index-CtR8olYy.js} +2 -2
- package/dist/{index-B-VitI3v.mjs → index-Du_Ljqfz.mjs} +36 -35
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +90 -83
- package/dist/katex-Cc3-mvOY.js +257 -0
- package/dist/katex-DoRnZ_sp.mjs +11682 -0
- package/dist/katex.min--Ws3c9be.mjs +5 -0
- package/dist/katex.min-Dk2VscxB.js +2 -0
- package/dist/link.cjs.js +3 -3
- package/dist/link.esm.js +3 -3
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +140 -52
- package/dist/math.cjs.js +14 -14
- package/dist/math.esm.js +149 -136
- package/dist/media-manager.cjs.js +1 -619
- package/dist/media-manager.esm.js +30 -1017
- package/dist/mentions.cjs.js +12 -12
- package/dist/mentions.esm.js +149 -143
- package/dist/merge-tag.cjs.js +5 -3
- package/dist/merge-tag.esm.js +5 -3
- package/dist/notify-BkbzMopb.js +32 -0
- package/dist/notify-zOp-mUOJ.mjs +59 -0
- package/dist/pii-redaction.cjs.js +1 -1
- package/dist/pii-redaction.esm.js +1 -1
- package/dist/preview.cjs.js +1 -1
- package/dist/preview.esm.js +1 -1
- package/dist/shared-config.cjs.js +1 -1
- package/dist/shared-config.esm.js +14 -14
- package/dist/slash-commands.cjs.js +5 -5
- package/dist/slash-commands.esm.js +259 -236
- package/dist/smart-paste.cjs.js +1 -1
- package/dist/smart-paste.esm.js +1 -1
- package/dist/special-characters.cjs.js +3 -3
- package/dist/special-characters.esm.js +3 -3
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +288 -251
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +175 -154
- package/dist/template.cjs.js +5 -3
- package/dist/template.esm.js +15 -13
- package/dist/text-color.cjs.js +4 -4
- package/dist/text-color.esm.js +38 -34
- package/dist/translation-workflow.cjs.js +9 -9
- package/dist/translation-workflow.esm.js +98 -95
- package/dist/version-diff.cjs.js +4 -4
- package/dist/version-diff.esm.js +36 -36
- package/index.d.ts +183 -2
- package/package.json +6 -5
- package/dist/anchoredPopover-Bg-ey7Yo.js +0 -1
- package/dist/anchoredPopover-D_JbjvdA.mjs +0 -111
- package/dist/dialogHelpers-5d5BuOCW.mjs +0 -39
- package/dist/dialogHelpers-zU6zpMIA.js +0 -12
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ what you write in the `plugins` attribute of `<editora-editor>`.
|
|
|
147
147
|
| `LinkPlugin` | Links | `link` | `lite` | `link` | `link` |
|
|
148
148
|
| `ListPlugin` | Bulleted and numbered lists | `bullist` `numlist` | `lite` | `list` | `list` |
|
|
149
149
|
| `MathPlugin` | Math formulas (LaTeX or MathML) | `math` | | `math` | `math` |
|
|
150
|
-
| `MediaManagerPlugin` |
|
|
150
|
+
| `MediaManagerPlugin` | Advanced media manager: library, uploads, image editing, audio, video and embeds | `image` `video` | `enterprise` | `media-manager` | `image` |
|
|
151
151
|
| `MentionPlugin` | @mentions from a list you provide | `mention` | `enterprise` | `mentions` | `mentions` |
|
|
152
152
|
| `MergeTagPlugin` | Merge tags such as `{{ First name }}` | `mergetag` | `enterprise` | `merge-tag` | `mergeTag` |
|
|
153
153
|
| `PIIRedactionPlugin` | Scan for personal data | `piiredaction` | `enterprise` | `pii-redaction` | `piiRedaction` |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const P=require("./dialogHelpers-BxSQ7A6M.js"),D=require("./notify-BkbzMopb.js"),U=require("./confirmDialog-D3S8BhIM.js"),l=require("@editora/light-code-editor"),_=require("./sanitizeHtml-CDoBlNTk.js"),S='[data-theme="dark"], .dark, .editora-theme-dark',K=`/* Source Editor Dialog Styles */
|
|
2
2
|
.rte-source-editor-overlay {
|
|
3
3
|
position: fixed !important;
|
|
4
4
|
top: 0 !important;
|
|
@@ -297,7 +297,7 @@
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
|
|
300
|
-
background: #
|
|
300
|
+
background: #2563eb;
|
|
301
301
|
color: #ffffff;
|
|
302
302
|
}
|
|
303
303
|
|
|
@@ -339,11 +339,11 @@
|
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
|
|
342
|
-
background: #
|
|
342
|
+
background: #2563eb;
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
|
|
346
|
-
background: #
|
|
346
|
+
background: #1d4ed8;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
/* Responsive design */
|
|
@@ -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 c=(()=>{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(!c)return console.error("[CodePlugin] Editor content area not found"),D.notify("Editor content area not found. Please click inside the editor first."),!1;const N=c.innerHTML,O=a=>{let o="",e=0;const n=2,u=a.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=
|
|
381
|
+
`+" ".repeat(e*n)+r:o+=r.trim());return o.trim()};return(()=>{document.querySelectorAll(".rte-source-editor-overlay").forEach(t=>t.remove());const o=O(N);let e=null,n="dark",u=!1,r=!1,x=!1,w=!1;const R=!!c.closest(S)||document.body.matches(S)||document.documentElement.matches(S),i=document.createElement("div");P.initDialogOverlay(i),i.className="rte-source-editor-overlay",R&&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 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 E=document.createElement("div");E.className="rte-source-editor-body";const
|
|
417
|
+
`;const E=document.createElement("div");E.className="rte-source-editor-body";const v=document.createElement("div");v.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 g=document.createElement("div");g.className="rte-source-editor-light-editor",g.style.height="400px",v.appendChild(C),v.appendChild(g),E.appendChild(v);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
|
+
`,d.appendChild(h),d.appendChild(E),d.appendChild(f),i.appendChild(d),!document.getElementById("rte-source-editor-styles")){const t=document.createElement("style");t.id="rte-source-editor-styles",t.textContent=K,document.head.appendChild(t)}const y=h.querySelector(".theme-toggle-btn"),b=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=[],s=(t,p,B,A)=>{t.addEventListener(p,B,A),M.push(()=>t.removeEventListener(p,B,A))},q=t=>{x!==t&&(x=t,z&&(z.style.display=x?"inline":"none"))},m=()=>{if(!w){for(w=!0;M.length;)M.pop()?.();e&&(e.destroy(),e=null),i.isConnected&&i.remove()}},F=()=>{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
|
+
`)},V=()=>{u=!u,e?.setReadOnly(u),b&&(b.classList.toggle("active",u),b.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
|
+
`)},Z=()=>{r=!r,i.classList.toggle("fullscreen",r),g.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
|
+
`)},j=async()=>{x&&!await U.confirmAction("You have unsaved changes. Are you sure you want to cancel?",{title:"Discard changes?",confirmText:"Discard changes",cancelText:"Keep editing",danger:!0,context:c})||m()},I=()=>{try{const t=e?.getValue()||"";c.innerHTML=_.sanitizeHtml(t);try{c.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!1,inputType:"insertReplacementText"}))}catch{c.dispatchEvent(new Event("input",{bubbles:!0}))}c.dispatchEvent(new Event("change",{bubbles:!0})),q(!1),m()}catch(t){D.notify("Failed to update HTML. Please check your syntax.","error"),console.error("HTML update error:",t)}};y&&s(y,"click",F),b&&s(b,"click",V),k&&s(k,"click",Z),L&&s(L,"click",m),H&&s(H,"click",j),T&&s(T,"click",I),s(i,"click",t=>{t.target===i&&m()}),s(document,"keydown",t=>{const p=t;p.key==="Escape"&&(p.preventDefault(),m())}),document.body.appendChild(i),requestAnimationFrame(()=>{if(!(w||!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()||"";q(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,7 +1,9 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { i as I } from "./dialogHelpers-BbwpIXD9.mjs";
|
|
2
|
+
import { n as q } from "./notify-zOp-mUOJ.mjs";
|
|
3
|
+
import { c as U } from "./confirmDialog-DR4c8j6S.mjs";
|
|
4
|
+
import { createEditor as P, LineNumbersExtension as _, ThemeExtension as K, ReadOnlyExtension as $, BracketMatchingExtension as Y, SearchExtension as G, CodeFoldingExtension as J, SyntaxHighlightingExtension as Q } from "@editora/light-code-editor";
|
|
5
|
+
import { s as W } from "./sanitizeHtml-CtLy8um-.mjs";
|
|
6
|
+
const M = '[data-theme="dark"], .dark, .editora-theme-dark', X = `/* Source Editor Dialog Styles */
|
|
5
7
|
.rte-source-editor-overlay {
|
|
6
8
|
position: fixed !important;
|
|
7
9
|
top: 0 !important;
|
|
@@ -300,7 +302,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-toolbar-btn.active {
|
|
303
|
-
background: #
|
|
305
|
+
background: #2563eb;
|
|
304
306
|
color: #ffffff;
|
|
305
307
|
}
|
|
306
308
|
|
|
@@ -342,11 +344,11 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
342
344
|
}
|
|
343
345
|
|
|
344
346
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save {
|
|
345
|
-
background: #
|
|
347
|
+
background: #2563eb;
|
|
346
348
|
}
|
|
347
349
|
|
|
348
350
|
.rte-source-editor-overlay.rte-theme-dark .rte-source-editor-btn-save:hover:not(:disabled) {
|
|
349
|
-
background: #
|
|
351
|
+
background: #1d4ed8;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
/* Responsive design */
|
|
@@ -378,7 +380,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
378
380
|
flex: 1;
|
|
379
381
|
text-align: center;
|
|
380
382
|
}
|
|
381
|
-
}`,
|
|
383
|
+
}`, ae = () => ({
|
|
382
384
|
name: "code",
|
|
383
385
|
// Toolbar button configuration
|
|
384
386
|
toolbar: [
|
|
@@ -397,7 +399,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
397
399
|
* Opens a dialog to edit raw HTML
|
|
398
400
|
*/
|
|
399
401
|
toggleSourceView: () => {
|
|
400
|
-
const
|
|
402
|
+
const c = (() => {
|
|
401
403
|
const a = window.getSelection();
|
|
402
404
|
if (a && a.anchorNode) {
|
|
403
405
|
let e = a.anchorNode instanceof HTMLElement ? a.anchorNode : a.anchorNode.parentElement;
|
|
@@ -430,11 +432,11 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
430
432
|
}
|
|
431
433
|
return document.querySelector(".rte-content");
|
|
432
434
|
})();
|
|
433
|
-
if (!
|
|
434
|
-
return console.error("[CodePlugin] Editor content area not found"),
|
|
435
|
+
if (!c)
|
|
436
|
+
return console.error("[CodePlugin] Editor content area not found"), q(
|
|
435
437
|
"Editor content area not found. Please click inside the editor first."
|
|
436
438
|
), !1;
|
|
437
|
-
const
|
|
439
|
+
const N = c.innerHTML, D = (a) => {
|
|
438
440
|
let o = "", e = 0;
|
|
439
441
|
const n = 2, l = a.split(/(<\/?[a-zA-Z][^>]*>)/);
|
|
440
442
|
for (const r of l)
|
|
@@ -446,12 +448,12 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
446
448
|
};
|
|
447
449
|
return (() => {
|
|
448
450
|
document.querySelectorAll(".rte-source-editor-overlay").forEach((t) => t.remove());
|
|
449
|
-
const o = N
|
|
451
|
+
const o = D(N);
|
|
450
452
|
let e = null, n = "dark", l = !1, r = !1, p = !1, k = !1;
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
const
|
|
454
|
-
|
|
453
|
+
const O = !!c.closest(M) || document.body.matches(M) || document.documentElement.matches(M), i = document.createElement("div");
|
|
454
|
+
I(i), i.className = "rte-source-editor-overlay", O && i.classList.add("rte-theme-dark");
|
|
455
|
+
const d = document.createElement("div");
|
|
456
|
+
d.className = "rte-source-editor-modal", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "source-editor-title");
|
|
455
457
|
const u = document.createElement("div");
|
|
456
458
|
u.className = "rte-source-editor-header", u.innerHTML = `
|
|
457
459
|
<h2 id="source-editor-title">Source Editor</h2>
|
|
@@ -492,12 +494,12 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
492
494
|
`;
|
|
493
495
|
const w = document.createElement("div");
|
|
494
496
|
w.className = "rte-source-editor-body";
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
+
const x = document.createElement("div");
|
|
498
|
+
x.className = "rte-source-editor-content";
|
|
497
499
|
const E = document.createElement("div");
|
|
498
500
|
E.className = "rte-source-editor-warning", E.textContent = "⚠️ Advanced users only. Invalid HTML may break the editor.";
|
|
499
501
|
const f = document.createElement("div");
|
|
500
|
-
f.className = "rte-source-editor-light-editor", f.style.height = "400px",
|
|
502
|
+
f.className = "rte-source-editor-light-editor", f.style.height = "400px", x.appendChild(E), x.appendChild(f), w.appendChild(x);
|
|
501
503
|
const h = document.createElement("div");
|
|
502
504
|
if (h.className = "rte-source-editor-footer", h.innerHTML = `
|
|
503
505
|
<div class="rte-source-editor-footer-info">
|
|
@@ -507,13 +509,13 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
507
509
|
<button class="rte-source-editor-btn rte-source-editor-btn-cancel">Cancel</button>
|
|
508
510
|
<button class="rte-source-editor-btn rte-source-editor-btn-save">Save</button>
|
|
509
511
|
</div>
|
|
510
|
-
`,
|
|
512
|
+
`, d.appendChild(u), d.appendChild(w), d.appendChild(h), i.appendChild(d), !document.getElementById("rte-source-editor-styles")) {
|
|
511
513
|
const t = document.createElement("style");
|
|
512
|
-
t.id = "rte-source-editor-styles", t.textContent =
|
|
514
|
+
t.id = "rte-source-editor-styles", t.textContent = X, document.head.appendChild(t);
|
|
513
515
|
}
|
|
514
|
-
const
|
|
516
|
+
const v = u.querySelector(
|
|
515
517
|
".theme-toggle-btn"
|
|
516
|
-
),
|
|
518
|
+
), m = u.querySelector(
|
|
517
519
|
".readonly-toggle-btn"
|
|
518
520
|
), y = u.querySelector(
|
|
519
521
|
".rte-source-editor-fullscreen-btn"
|
|
@@ -521,24 +523,24 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
521
523
|
".rte-source-editor-close-btn"
|
|
522
524
|
), L = h.querySelector(
|
|
523
525
|
".rte-source-editor-btn-cancel"
|
|
524
|
-
), H = h.querySelector(
|
|
525
|
-
".rte-source-editor-btn-save"
|
|
526
526
|
), T = h.querySelector(
|
|
527
|
+
".rte-source-editor-btn-save"
|
|
528
|
+
), H = h.querySelector(
|
|
527
529
|
".unsaved-changes"
|
|
528
|
-
), C = [],
|
|
529
|
-
t.addEventListener(
|
|
530
|
-
() => t.removeEventListener(
|
|
530
|
+
), C = [], s = (t, b, B, A) => {
|
|
531
|
+
t.addEventListener(b, B, A), C.push(
|
|
532
|
+
() => t.removeEventListener(b, B, A)
|
|
531
533
|
);
|
|
532
534
|
}, z = (t) => {
|
|
533
|
-
p !== t && (p = t,
|
|
535
|
+
p !== t && (p = t, H && (H.style.display = p ? "inline" : "none"));
|
|
534
536
|
}, g = () => {
|
|
535
537
|
if (!k) {
|
|
536
538
|
for (k = !0; C.length; )
|
|
537
539
|
C.pop()?.();
|
|
538
540
|
e && (e.destroy(), e = null), i.isConnected && i.remove();
|
|
539
541
|
}
|
|
540
|
-
},
|
|
541
|
-
n = n === "dark" ? "light" : "dark", e?.setTheme(n),
|
|
542
|
+
}, R = () => {
|
|
543
|
+
n = n === "dark" ? "light" : "dark", e?.setTheme(n), v && (v.innerHTML = n === "light" ? `
|
|
542
544
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
543
545
|
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
|
|
544
546
|
</svg>
|
|
@@ -555,8 +557,8 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
555
557
|
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
|
|
556
558
|
</svg>
|
|
557
559
|
`);
|
|
558
|
-
},
|
|
559
|
-
l = !l, e?.setReadOnly(l),
|
|
560
|
+
}, F = () => {
|
|
561
|
+
l = !l, e?.setReadOnly(l), m && (m.classList.toggle("active", l), m.innerHTML = l ? `
|
|
560
562
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
561
563
|
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
|
|
562
564
|
<circle cx="12" cy="16" r="1"/>
|
|
@@ -568,7 +570,7 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
568
570
|
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
|
|
569
571
|
</svg>
|
|
570
572
|
`);
|
|
571
|
-
},
|
|
573
|
+
}, V = () => {
|
|
572
574
|
r = !r, i.classList.toggle("fullscreen", r), f.style.height = r ? "calc(100vh - 200px)" : "400px", y && (y.innerHTML = r ? `
|
|
573
575
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
574
576
|
<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"/>
|
|
@@ -578,14 +580,20 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
578
580
|
<path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/>
|
|
579
581
|
</svg>
|
|
580
582
|
`);
|
|
581
|
-
},
|
|
582
|
-
p && !
|
|
583
|
-
|
|
583
|
+
}, Z = async () => {
|
|
584
|
+
p && !await U("You have unsaved changes. Are you sure you want to cancel?", {
|
|
585
|
+
title: "Discard changes?",
|
|
586
|
+
confirmText: "Discard changes",
|
|
587
|
+
cancelText: "Keep editing",
|
|
588
|
+
danger: !0,
|
|
589
|
+
context: c
|
|
590
|
+
}) || g();
|
|
591
|
+
}, j = () => {
|
|
584
592
|
try {
|
|
585
593
|
const t = e?.getValue() || "";
|
|
586
|
-
|
|
594
|
+
c.innerHTML = W(t);
|
|
587
595
|
try {
|
|
588
|
-
|
|
596
|
+
c.dispatchEvent(
|
|
589
597
|
new InputEvent("input", {
|
|
590
598
|
bubbles: !0,
|
|
591
599
|
cancelable: !1,
|
|
@@ -593,37 +601,37 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
593
601
|
})
|
|
594
602
|
);
|
|
595
603
|
} catch {
|
|
596
|
-
|
|
604
|
+
c.dispatchEvent(
|
|
597
605
|
new Event("input", { bubbles: !0 })
|
|
598
606
|
);
|
|
599
607
|
}
|
|
600
|
-
|
|
608
|
+
c.dispatchEvent(
|
|
601
609
|
new Event("change", { bubbles: !0 })
|
|
602
610
|
), z(!1), g();
|
|
603
611
|
} catch (t) {
|
|
604
|
-
|
|
612
|
+
q("Failed to update HTML. Please check your syntax.", "error"), console.error("HTML update error:", t);
|
|
605
613
|
}
|
|
606
614
|
};
|
|
607
|
-
|
|
615
|
+
v && s(v, "click", R), m && s(m, "click", F), y && s(y, "click", V), S && s(S, "click", g), L && s(L, "click", Z), T && s(T, "click", j), s(i, "click", (t) => {
|
|
608
616
|
t.target === i && g();
|
|
609
|
-
}),
|
|
610
|
-
const
|
|
611
|
-
|
|
617
|
+
}), s(document, "keydown", (t) => {
|
|
618
|
+
const b = t;
|
|
619
|
+
b.key === "Escape" && (b.preventDefault(), g());
|
|
612
620
|
}), document.body.appendChild(i), requestAnimationFrame(() => {
|
|
613
621
|
if (!(k || !i.isConnected))
|
|
614
622
|
try {
|
|
615
|
-
e =
|
|
623
|
+
e = P(f, {
|
|
616
624
|
value: o,
|
|
617
625
|
theme: "dark",
|
|
618
626
|
readOnly: !1,
|
|
619
627
|
extensions: [
|
|
620
|
-
new U(),
|
|
621
|
-
new P(),
|
|
622
628
|
new _(),
|
|
623
|
-
new $(),
|
|
624
629
|
new K(),
|
|
630
|
+
new $(),
|
|
625
631
|
new Y(),
|
|
626
|
-
new G()
|
|
632
|
+
new G(),
|
|
633
|
+
new J(),
|
|
634
|
+
new Q()
|
|
627
635
|
]
|
|
628
636
|
}), e.on("change", () => {
|
|
629
637
|
const t = e?.getValue() || "";
|
|
@@ -643,5 +651,5 @@ const M = '[data-theme="dark"], .dark, .editora-theme-dark', Q = `/* Source Edit
|
|
|
643
651
|
}
|
|
644
652
|
});
|
|
645
653
|
export {
|
|
646
|
-
|
|
654
|
+
ae as C
|
|
647
655
|
};
|