@editora/plugins 1.0.9 → 1.0.10
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 +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
package/dist/direction.esm.js
CHANGED
|
@@ -28,7 +28,8 @@ const g = /* @__PURE__ */ new Set([
|
|
|
28
28
|
if (n.getAttribute("contenteditable") === "true")
|
|
29
29
|
return n;
|
|
30
30
|
const t = n.closest('[contenteditable="true"]');
|
|
31
|
-
if (t)
|
|
31
|
+
if (t)
|
|
32
|
+
return t;
|
|
32
33
|
}
|
|
33
34
|
return document.querySelector('[contenteditable="true"]');
|
|
34
35
|
}, u = (e) => {
|
|
@@ -36,8 +37,10 @@ const g = /* @__PURE__ */ new Set([
|
|
|
36
37
|
for (; n && n !== document.body; ) {
|
|
37
38
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
38
39
|
const t = n;
|
|
39
|
-
if (l(t))
|
|
40
|
-
|
|
40
|
+
if (l(t))
|
|
41
|
+
return t;
|
|
42
|
+
if (t.getAttribute("contenteditable") === "true")
|
|
43
|
+
break;
|
|
41
44
|
}
|
|
42
45
|
n = n.parentNode;
|
|
43
46
|
}
|
|
@@ -54,7 +57,8 @@ const g = /* @__PURE__ */ new Set([
|
|
|
54
57
|
{
|
|
55
58
|
acceptNode: (o) => {
|
|
56
59
|
const d = o;
|
|
57
|
-
if (!l(d))
|
|
60
|
+
if (!l(d))
|
|
61
|
+
return NodeFilter.FILTER_SKIP;
|
|
58
62
|
if (typeof e.intersectsNode == "function")
|
|
59
63
|
return e.intersectsNode(d) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
60
64
|
const a = document.createRange();
|
|
@@ -67,7 +71,8 @@ const g = /* @__PURE__ */ new Set([
|
|
|
67
71
|
i(c), c = s.nextNode();
|
|
68
72
|
return t.length === 0 && i(u(e.commonAncestorContainer)), t;
|
|
69
73
|
}, T = (e, n) => {
|
|
70
|
-
if (n === e.innerHTML)
|
|
74
|
+
if (n === e.innerHTML)
|
|
75
|
+
return;
|
|
71
76
|
const t = window.execEditorCommand || window.executeEditorCommand;
|
|
72
77
|
if (typeof t == "function")
|
|
73
78
|
try {
|
|
@@ -76,13 +81,17 @@ const g = /* @__PURE__ */ new Set([
|
|
|
76
81
|
}
|
|
77
82
|
}, f = (e) => {
|
|
78
83
|
const n = h();
|
|
79
|
-
if (!n)
|
|
84
|
+
if (!n)
|
|
85
|
+
return !1;
|
|
80
86
|
const t = window.getSelection();
|
|
81
|
-
if (!t || t.rangeCount === 0)
|
|
87
|
+
if (!t || t.rangeCount === 0)
|
|
88
|
+
return !1;
|
|
82
89
|
const r = t.getRangeAt(0);
|
|
83
|
-
if (!n.contains(r.commonAncestorContainer))
|
|
90
|
+
if (!n.contains(r.commonAncestorContainer))
|
|
91
|
+
return !1;
|
|
84
92
|
const i = C(r, n);
|
|
85
|
-
if (i.length === 0)
|
|
93
|
+
if (i.length === 0)
|
|
94
|
+
return !1;
|
|
86
95
|
const s = n.innerHTML;
|
|
87
96
|
return i.forEach((c) => {
|
|
88
97
|
e === "rtl" ? c.setAttribute("dir", "rtl") : c.removeAttribute("dir");
|
package/dist/doc-schema.cjs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=".rte-content, .editora-content",ie="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",fe="__editoraCommandEditorRoot",he="rte-doc-schema-styles",m="rte-doc-schema-panel",v="document-schema",M="doc-schema",H="docSchema",E=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Ie={panelTitle:"Document Schema",panelAriaLabel:"Document schema panel",schemaLabel:"Schema",schemaDescriptionPrefix:"Description",validateText:"Run Validation",insertMissingText:"Insert Missing Sections",realtimeOnText:"Realtime On",realtimeOffText:"Realtime Off",closeText:"Close",noIssuesText:"No schema violations detected.",summaryPrefix:"Schema",issueListLabel:"Schema issues",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+G (panel), Ctrl/Cmd+Alt+Shift+J (validate)",helperText:"Choose a schema, validate structure, then insert missing sections safely.",readonlyMessage:"Editor is read-only. Missing sections cannot be inserted.",defaultPlaceholderText:"Add section content.",missingSectionMessage:"Missing required section",duplicateSectionMessage:"Section appears too many times",outOfOrderMessage:"Section appears out of required order",unknownHeadingMessage:"Heading is not part of selected schema",insertedSummaryPrefix:"Inserted missing sections"},u=new WeakMap,X=new WeakMap,j=new WeakMap,p=new Map,F=new WeakMap,te=new WeakMap,ne=new Set;let W=0,Ae=0,ge=0,w=null,b=null,q=null,z=null,B=null,R=null,K=null;function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Le(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function P(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):t}function xe(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e,t){return t(e).toLowerCase().replace(/^[\s\-\u2022]*(?:[0-9]+(?:\.[0-9]+)*)[\)\.\-:\s]+/,"").replace(/^[\s\-\u2022]*(?:[ivxlcdm]+)[\)\.\-:\s]+/i,"").replace(/[::]+$/g,"").replace(/\s+/g," ").trim()}function be(){return[{id:"contract",label:"Contract",description:"Template for legal/commercial agreements with strict section ordering.",strictOrder:!0,allowUnknownHeadings:!1,sections:[{id:"summary",title:"Executive Summary",aliases:["Overview"]},{id:"scope",title:"Scope"},{id:"terms",title:"Terms and Conditions",aliases:["Terms"]},{id:"responsibilities",title:"Responsibilities"},{id:"sla",title:"Service Levels",aliases:["SLA","Service Level Agreement"]},{id:"termination",title:"Termination"}]},{id:"sop",label:"SOP",description:"Standard operating procedure with clear implementation and governance sections.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"purpose",title:"Purpose"},{id:"scope",title:"Scope"},{id:"procedure",title:"Procedure",maxOccurrences:10},{id:"roles",title:"Roles and Responsibilities",aliases:["Responsibilities"]},{id:"validation",title:"Validation"},{id:"revision-history",title:"Revision History",aliases:["Change History"]}]},{id:"policy",label:"Policy",description:"Policy document with control ownership, exception handling, and enforcement.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"statement",title:"Policy Statement"},{id:"applicability",title:"Applicability",aliases:["Scope"]},{id:"controls",title:"Controls"},{id:"exceptions",title:"Exceptions"},{id:"enforcement",title:"Enforcement"}]}]}function Oe(e,t,n){const r=n(e.title||"");if(!r)return null;const s=xe(n(e.id||r))||`section-${t+1}`,o=P(Number(e.minOccurrences??1),0,20),a=Math.max(1,o),c=P(Number(e.maxOccurrences??a),o,40),i=n(e.placeholder||""),l=Array.isArray(e.aliases)?e.aliases.map(y=>n(y)).filter(Boolean):[],d=[r,...l].map(y=>ce(y,n)).filter(Boolean);return{id:s,title:r,minOccurrences:o,maxOccurrences:c,placeholder:i,matchKeys:Array.from(new Set(d))}}function Se(e,t){const n=Array.isArray(e)&&e.length>0?e:be(),r=[],s=new Set;return n.forEach((o,a)=>{const c=t(o.label||"");if(!c)return;const i=xe(t(o.id||c))||`schema-${a+1}`;let l=i,d=1;for(;s.has(l);)l=`${i}-${d++}`;s.add(l);const y=Array.isArray(o.sections)?o.sections:[],f=[],k=new Set;if(y.forEach(($,h)=>{const x=Oe($,h,t);if(!x)return;let N=x.id,Te=1;for(;k.has(N);)N=`${x.id}-${Te++}`;k.add(N),f.push({...x,id:N})}),f.length===0)return;const O=new Map,A=new Map;f.forEach(($,h)=>{A.set($.id,h),$.matchKeys.forEach(x=>{O.has(x)||O.set(x,$)})}),r.push({id:l,label:c,description:t(o.description||""),strictOrder:o.strictOrder!==!1,allowUnknownHeadings:!!o.allowUnknownHeadings,sections:f,matchKeyToSection:O,orderBySectionId:A})}),r.length>0?r:Se(be(),t)}function Z(e={}){const t=e.normalizeText||Le,n=Se(e.schemas,t),r=t(e.defaultSchemaId||""),s=n.some(o=>o.id===r)?r:n[0]?.id||null;return{schemas:n,defaultSchemaId:s,enableRealtime:e.enableRealtime!==!1,debounceMs:P(Number(e.debounceMs??260),60,2e3),maxIssues:P(Number(e.maxIssues??80),5,500),labels:{...Ie,...e.labels||{}},normalizeText:t}}function He(e){return{schemas:e.schemas.map(t=>({id:t.id,label:t.label,description:t.description||void 0,strictOrder:t.strictOrder,allowUnknownHeadings:t.allowUnknownHeadings,sections:t.sections.map(n=>({id:n.id,title:n.title,minOccurrences:n.minOccurrences,maxOccurrences:n.maxOccurrences,placeholder:n.placeholder||void 0}))})),defaultSchemaId:e.defaultSchemaId||void 0,enableRealtime:e.enableRealtime,debounceMs:e.debounceMs,maxIssues:e.maxIssues,labels:{...e.labels},normalizeText:e.normalizeText}}function le(e){return e.closest(ie)||e}function U(e){if(!e)return null;if(e.matches(S))return e;const t=e.querySelector(S);return t instanceof HTMLElement?t:null}function Re(){if(typeof window>"u")return null;const e=window[fe];if(!(e instanceof HTMLElement))return null;window[fe]=null;const t=U(e);if(t)return t;const n=e.closest(ie);if(n){const s=U(n);if(s)return s}const r=e.closest(S);return r instanceof HTMLElement?r:null}function De(e){const t=e.closest("[data-editora-editor]");if(t&&U(t)===e)return t;let n=e;for(;n;){if(n.matches(ie)&&(n===e||U(n)===e))return n;n=n.parentElement}return le(e)}function ye(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Y(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Ne(e){const t=le(e);if(Y(t))return!0;const n=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Y(n)?!0:Y(document.documentElement)||Y(document.body)}function oe(e,t){e.classList.remove("rte-doc-schema-theme-dark"),Ne(t)&&e.classList.add("rte-doc-schema-theme-dark")}function Pe(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(!(n.type!=="childList"||n.removedNodes.length===0))for(let r=0;r<n.removedNodes.length;r+=1){const s=n.removedNodes[r];if(s.nodeType!==Node.ELEMENT_NODE)continue;const o=s;if(o.matches?.(S)||o.matches?.(`.${m}`)||o.querySelector?.(S)||o.querySelector?.(`.${m}`))return!0}}return!1}function Q(){Array.from(ne).forEach(t=>{t.isConnected||ue(t)})}function T(e,t=!0,n=!0){if(Q(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const c=U(e.editorElement);if(c)return c}const r=Re();if(r)return r;const s=window.getSelection();if(s&&s.rangeCount>0){const c=ye(s.getRangeAt(0).startContainer)?.closest(S);if(c)return c}const o=document.activeElement;if(o){if(o.matches(S))return o;const c=o.closest(S);if(c)return c}if(n&&b&&b.isConnected)return b;if(!t)return null;const a=document.querySelector(S);return a instanceof HTMLElement?a:null}function _e(e){const t=e.target;if(t){const r=t.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=t.closest(S);if(s)return s}const n=document.activeElement;if(n){const r=n.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=n.closest(S);if(s)return s}return null}function pe(e,t,n){const r=De(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",n),o.setAttribute("data-active",n?"true":"false"),o.setAttribute("aria-pressed",n?"true":"false")})}function de(e){const t=te.get(e);typeof t=="number"&&(window.clearTimeout(t),te.delete(e))}function L(e,t){return t&&e.schemas.find(n=>n.id===t)||null}function re(e){return e.defaultSchemaId||e.schemas[0]?.id||null}function g(e,t){u.has(e)||u.set(e,t);let n=j.get(e);return n||(n={activeSchemaId:re(t),realtimeEnabled:t.enableRealtime,issues:[],headingCount:0,recognizedHeadingCount:0,missingCount:0,lastRunAt:null,snapshot:""},j.set(e,n)),(!n.activeSchemaId||!L(t,n.activeSchemaId))&&(n.activeSchemaId=re(t)),ne.add(e),n}function ue(e){de(e),p.get(e)?.remove(),p.delete(e),F.delete(e),u.delete(e),X.delete(e),j.delete(e),ne.delete(e),b===e&&(b=null)}function me(e){return F.get(e)===!0}function ve(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function se(e,t){if(!t.classList.contains("show"))return;const n=le(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,440),s=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,n.right-r),s),a=Math.max(10,Math.min(window.innerHeight-10,n.top+12));t.style.width=`${r}px`,t.style.left=`${o}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ee(e,t){const n=e.querySelector(".rte-doc-schema-live");n&&(n.textContent=t)}function qe(e,t){const n=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),r=[];return n.forEach((s,o)=>{const a=t(s.textContent||"");if(!a)return;const c=Number(s.tagName.slice(1))||0,i=ce(a,t);r.push({text:a,key:i,index:o,level:c})}),r}function Ee(e,t,n){const r=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),s=[];return r.forEach(o=>{const a=n(o.textContent||"");if(!a)return;const c=ce(a,n),i=c&&t.matchKeyToSection.get(c)||null,l=i?t.orderBySectionId.get(i.id)??null:null,d=P(Number(o.tagName.slice(1))||0,1,6);s.push({element:o,level:d,section:i,order:l})}),s}function ze(e,t=2){const n=e.filter(i=>i.section).map(i=>i.level),r=n.length>0?n:e.map(i=>i.level);if(r.length===0)return t;const s=new Map;r.forEach((i,l)=>{s.has(i)||s.set(i,{count:0,firstIndex:l});const d=s.get(i);d.count+=1});let o=t,a=-1,c=Number.MAX_SAFE_INTEGER;return s.forEach((i,l)=>{(i.count>a||i.count===a&&i.firstIndex<c||i.count===a&&i.firstIndex===c&&l<o)&&(o=l,a=i.count,c=i.firstIndex)}),P(o,1,6)}function Be(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(ye(n.startContainer)?.closest(S)!==e)return null;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const o=n.startContainer,a=o.childNodes[n.startOffset]||null;return{parent:o,referenceNode:a}}const s=n.startContainer.parentNode;return s?{parent:s,referenceNode:n.startContainer.nextSibling||null}:null}function Ke(e,t,n,r){const s=Ee(e,n,r),o=n.orderBySectionId.get(t.id);if(typeof o!="number"||s.length===0)return{parent:e,referenceNode:null};const a=s.find(i=>typeof i.order=="number"&&i.order>o);if(a&&a.element.parentNode)return{parent:a.element.parentNode,referenceNode:a.element};let c=-1;for(let i=0;i<s.length;i+=1){const l=s[i];typeof l.order=="number"&&l.order<o&&(c=i)}if(c>=0){const i=s[c+1]?.element||null;return{parent:i?.parentNode||s[c].element.parentNode||e,referenceNode:i}}return{parent:e,referenceNode:null}}function Ve(e,t,n,r){const s=e.ownerDocument||document,o=`h${P(r,1,6)}`,a=s.createElement(o);a.setAttribute("data-doc-schema-section",t.id),a.textContent=t.title;const c=s.createElement("p");return c.textContent=t.placeholder||n.labels.defaultPlaceholderText,[a,c]}function V(e,t,n,r={}){return ge+=1,{id:`doc-schema-issue-${ge}`,type:e,severity:t,message:n,...r}}function J(e,t,n){return e.replace(/\{section\}/g,t||"").replace(/\{heading\}/g,n||"").trim()}function je(e,t,n){const r=qe(e,n.normalizeText),s=[],o=new Map,a=[];for(let i=0;i<r.length&&!(s.length>=n.maxIssues);i+=1){const l=r[i];if(!l.key)continue;const d=t.matchKeyToSection.get(l.key);if(d){o.set(d.id,(o.get(d.id)||0)+1),a.push({section:d,heading:l});continue}t.allowUnknownHeadings||s.push(V("unknown-heading","warning",J(n.labels.unknownHeadingMessage,null,l.text),{headingText:l.text,suggestion:"Map this heading to a schema alias or remove it from strict structure mode."}))}let c=0;for(let i=0;i<t.sections.length&&!(s.length>=n.maxIssues);i+=1){const l=t.sections[i],d=o.get(l.id)||0;d<l.minOccurrences&&(c+=1,s.push(V("missing-section","error",J(n.labels.missingSectionMessage,l.title,null),{sectionId:l.id,sectionTitle:l.title,suggestion:`Add heading "${l.title}" to satisfy schema requirements.`}))),d>l.maxOccurrences&&s.length<n.maxIssues&&s.push(V("duplicate-section","warning",J(n.labels.duplicateSectionMessage,l.title,null),{sectionId:l.id,sectionTitle:l.title,suggestion:`Keep at most ${l.maxOccurrences} instance(s) of "${l.title}".`}))}if(t.strictOrder&&s.length<n.maxIssues){let i=-1;for(let l=0;l<a.length&&!(s.length>=n.maxIssues);l+=1){const d=a[l],y=t.orderBySectionId.get(d.section.id)??l;y<i?s.push(V("out-of-order","warning",J(n.labels.outOfOrderMessage,d.section.title,d.heading.text),{sectionId:d.section.id,sectionTitle:d.section.title,headingText:d.heading.text,suggestion:`Move "${d.section.title}" after earlier required sections.`})):i=y}}return{issues:s,headingCount:r.length,recognizedHeadingCount:a.length,missingCount:c}}function we(e){const t=u.get(e)||w,n=j.get(e),r=t?L(t,n?.activeSchemaId||null):null;return{activeSchemaId:n?.activeSchemaId||null,activeSchemaLabel:r?.label||null,realtimeEnabled:n?.realtimeEnabled===!0,issues:n?.issues?n.issues.map(s=>({...s})):[],headingCount:n?.headingCount||0,recognizedHeadingCount:n?.recognizedHeadingCount||0,missingCount:n?.missingCount||0,lastRunAt:n?.lastRunAt||null}}function D(e){const t=j.get(e);pe(e,"toggleDocSchemaPanel",me(e)),pe(e,"toggleDocSchemaRealtime",t?.realtimeEnabled===!0)}function _(e){const t=p.get(e);if(!t)return;const n=u.get(e)||w;if(!n)return;const r=g(e,n),s=L(n,r.activeSchemaId),o=t.querySelector(".rte-doc-schema-label");o&&(o.textContent=n.labels.schemaLabel);const a=t.querySelector('[data-field="schema"]');a&&(a.innerHTML=n.schemas.map(h=>`<option value="${I(h.id)}">${I(h.label)}</option>`).join(""),a.value=r.activeSchemaId||"");const c=t.querySelector(".rte-doc-schema-description");if(c){const h=s?.description||"";c.textContent=h?`${n.labels.schemaDescriptionPrefix}: ${h}`:"",c.hidden=!h}const i=t.querySelector(".rte-doc-schema-summary");if(i){const h=s?.label||"N/A",x=r.issues.length;i.textContent=`${n.labels.summaryPrefix}: ${h} • ${x} issue${x===1?"":"s"}`}const l=t.querySelector(".rte-doc-schema-helper");l&&(l.textContent=n.labels.helperText);const d=t.querySelector(".rte-doc-schema-shortcut");d&&(d.textContent=n.labels.shortcutText);const y=t.querySelector('[data-action="run-validation"]');y&&(y.textContent=n.labels.validateText);const f=t.querySelector('[data-action="insert-missing"]');if(f){f.textContent=n.labels.insertMissingText;const h=r.issues.some(x=>x.type==="missing-section");f.disabled=!h||ve(e)}const k=t.querySelector('[data-action="toggle-realtime"]');k&&(k.textContent=r.realtimeEnabled?n.labels.realtimeOnText:n.labels.realtimeOffText,k.setAttribute("aria-pressed",r.realtimeEnabled?"true":"false"));const O=t.querySelector('[data-action="close"]');O&&O.setAttribute("aria-label",n.labels.closeText);const A=t.querySelector(".rte-doc-schema-issues"),$=t.querySelector(".rte-doc-schema-empty");A&&(A.setAttribute("aria-label",n.labels.issueListLabel),r.issues.length===0?(A.innerHTML="",$&&($.hidden=!1,$.textContent=n.labels.noIssuesText)):($&&($.hidden=!0),A.innerHTML=r.issues.map(h=>{const x=h.severity==="error"?"error":h.severity==="warning"?"warning":"info",N=h.sectionTitle||h.headingText||"";return`
|
|
2
|
-
<li class="rte-doc-schema-issue ${
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=".rte-content, .editora-content",ie="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",fe="__editoraCommandEditorRoot",he="rte-doc-schema-styles",m="rte-doc-schema-panel",E="document-schema",M="doc-schema",R="docSchema",v=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',Ie={panelTitle:"Document Schema",panelAriaLabel:"Document schema panel",schemaLabel:"Schema",schemaDescriptionPrefix:"Description",validateText:"Run Validation",insertMissingText:"Insert Missing Sections",realtimeOnText:"Realtime On",realtimeOffText:"Realtime Off",closeText:"Close",noIssuesText:"No schema violations detected.",summaryPrefix:"Schema",issueListLabel:"Schema issues",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+G (panel), Ctrl/Cmd+Alt+Shift+J (validate)",helperText:"Choose a schema, validate structure, then insert missing sections safely.",readonlyMessage:"Editor is read-only. Missing sections cannot be inserted.",defaultPlaceholderText:"Add section content.",missingSectionMessage:"Missing required section",duplicateSectionMessage:"Section appears too many times",outOfOrderMessage:"Section appears out of required order",unknownHeadingMessage:"Heading is not part of selected schema",insertedSummaryPrefix:"Inserted missing sections"},u=new WeakMap,X=new WeakMap,j=new WeakMap,p=new Map,F=new WeakMap,te=new WeakMap,ne=new Set;let W=0,Ae=0,ge=0,w=null,b=null,q=null,z=null,B=null,D=null,K=null;function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Le(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function P(e,t,n){return Number.isFinite(e)?Math.max(t,Math.min(n,e)):t}function ye(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function ce(e,t){return t(e).toLowerCase().replace(/^[\s\-\u2022]*(?:[0-9]+(?:\.[0-9]+)*)[\)\.\-:\s]+/,"").replace(/^[\s\-\u2022]*(?:[ivxlcdm]+)[\)\.\-:\s]+/i,"").replace(/[::]+$/g,"").replace(/\s+/g," ").trim()}function be(){return[{id:"contract",label:"Contract",description:"Template for legal/commercial agreements with strict section ordering.",strictOrder:!0,allowUnknownHeadings:!1,sections:[{id:"summary",title:"Executive Summary",aliases:["Overview"]},{id:"scope",title:"Scope"},{id:"terms",title:"Terms and Conditions",aliases:["Terms"]},{id:"responsibilities",title:"Responsibilities"},{id:"sla",title:"Service Levels",aliases:["SLA","Service Level Agreement"]},{id:"termination",title:"Termination"}]},{id:"sop",label:"SOP",description:"Standard operating procedure with clear implementation and governance sections.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"purpose",title:"Purpose"},{id:"scope",title:"Scope"},{id:"procedure",title:"Procedure",maxOccurrences:10},{id:"roles",title:"Roles and Responsibilities",aliases:["Responsibilities"]},{id:"validation",title:"Validation"},{id:"revision-history",title:"Revision History",aliases:["Change History"]}]},{id:"policy",label:"Policy",description:"Policy document with control ownership, exception handling, and enforcement.",strictOrder:!0,allowUnknownHeadings:!0,sections:[{id:"statement",title:"Policy Statement"},{id:"applicability",title:"Applicability",aliases:["Scope"]},{id:"controls",title:"Controls"},{id:"exceptions",title:"Exceptions"},{id:"enforcement",title:"Enforcement"}]}]}function Oe(e,t,n){const r=n(e.title||"");if(!r)return null;const s=ye(n(e.id||r))||`section-${t+1}`,o=P(Number(e.minOccurrences??1),0,20),a=Math.max(1,o),l=P(Number(e.maxOccurrences??a),o,40),c=n(e.placeholder||""),i=Array.isArray(e.aliases)?e.aliases.map(x=>n(x)).filter(Boolean):[],d=[r,...i].map(x=>ce(x,n)).filter(Boolean);return{id:s,title:r,minOccurrences:o,maxOccurrences:l,placeholder:c,matchKeys:Array.from(new Set(d))}}function Se(e,t){const n=Array.isArray(e)&&e.length>0?e:be(),r=[],s=new Set;return n.forEach((o,a)=>{const l=t(o.label||"");if(!l)return;const c=ye(t(o.id||l))||`schema-${a+1}`;let i=c,d=1;for(;s.has(i);)i=`${c}-${d++}`;s.add(i);const x=Array.isArray(o.sections)?o.sections:[],f=[],k=new Set;if(x.forEach(($,h)=>{const y=Oe($,h,t);if(!y)return;let N=y.id,Te=1;for(;k.has(N);)N=`${y.id}-${Te++}`;k.add(N),f.push({...y,id:N})}),f.length===0)return;const O=new Map,A=new Map;f.forEach(($,h)=>{A.set($.id,h),$.matchKeys.forEach(y=>{O.has(y)||O.set(y,$)})}),r.push({id:i,label:l,description:t(o.description||""),strictOrder:o.strictOrder!==!1,allowUnknownHeadings:!!o.allowUnknownHeadings,sections:f,matchKeyToSection:O,orderBySectionId:A})}),r.length>0?r:Se(be(),t)}function Z(e={}){var o;const t=e.normalizeText||Le,n=Se(e.schemas,t),r=t(e.defaultSchemaId||""),s=n.some(a=>a.id===r)?r:((o=n[0])==null?void 0:o.id)||null;return{schemas:n,defaultSchemaId:s,enableRealtime:e.enableRealtime!==!1,debounceMs:P(Number(e.debounceMs??260),60,2e3),maxIssues:P(Number(e.maxIssues??80),5,500),labels:{...Ie,...e.labels||{}},normalizeText:t}}function Re(e){return{schemas:e.schemas.map(t=>({id:t.id,label:t.label,description:t.description||void 0,strictOrder:t.strictOrder,allowUnknownHeadings:t.allowUnknownHeadings,sections:t.sections.map(n=>({id:n.id,title:n.title,minOccurrences:n.minOccurrences,maxOccurrences:n.maxOccurrences,placeholder:n.placeholder||void 0}))})),defaultSchemaId:e.defaultSchemaId||void 0,enableRealtime:e.enableRealtime,debounceMs:e.debounceMs,maxIssues:e.maxIssues,labels:{...e.labels},normalizeText:e.normalizeText}}function le(e){return e.closest(ie)||e}function U(e){if(!e)return null;if(e.matches(S))return e;const t=e.querySelector(S);return t instanceof HTMLElement?t:null}function De(){if(typeof window>"u")return null;const e=window[fe];if(!(e instanceof HTMLElement))return null;window[fe]=null;const t=U(e);if(t)return t;const n=e.closest(ie);if(n){const s=U(n);if(s)return s}const r=e.closest(S);return r instanceof HTMLElement?r:null}function He(e){const t=e.closest("[data-editora-editor]");if(t&&U(t)===e)return t;let n=e;for(;n;){if(n.matches(ie)&&(n===e||U(n)===e))return n;n=n.parentElement}return le(e)}function xe(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function Y(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function Ne(e){const t=le(e);if(Y(t))return!0;const n=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return Y(n)?!0:Y(document.documentElement)||Y(document.body)}function oe(e,t){e.classList.remove("rte-doc-schema-theme-dark"),Ne(t)&&e.classList.add("rte-doc-schema-theme-dark")}function Pe(e){var t,n,r,s;for(let o=0;o<e.length;o+=1){const a=e[o];if(!(a.type!=="childList"||a.removedNodes.length===0))for(let l=0;l<a.removedNodes.length;l+=1){const c=a.removedNodes[l];if(c.nodeType!==Node.ELEMENT_NODE)continue;const i=c;if((t=i.matches)!=null&&t.call(i,S)||(n=i.matches)!=null&&n.call(i,`.${m}`)||(r=i.querySelector)!=null&&r.call(i,S)||(s=i.querySelector)!=null&&s.call(i,`.${m}`))return!0}}return!1}function Q(){Array.from(ne).forEach(t=>{t.isConnected||ue(t)})}function T(e,t=!0,n=!0){var l;if(Q(),(e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const c=U(e.editorElement);if(c)return c}const r=De();if(r)return r;const s=window.getSelection();if(s&&s.rangeCount>0){const c=(l=xe(s.getRangeAt(0).startContainer))==null?void 0:l.closest(S);if(c)return c}const o=document.activeElement;if(o){if(o.matches(S))return o;const c=o.closest(S);if(c)return c}if(n&&b&&b.isConnected)return b;if(!t)return null;const a=document.querySelector(S);return a instanceof HTMLElement?a:null}function _e(e){const t=e.target;if(t){const r=t.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=t.closest(S);if(s)return s}const n=document.activeElement;if(n){const r=n.closest(`.${m}`);if(r){const o=Array.from(p.entries()).find(([,a])=>a===r);if(o)return o[0]}const s=n.closest(S);if(s)return s}return null}function pe(e,t,n){const r=He(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",n),o.setAttribute("data-active",n?"true":"false"),o.setAttribute("aria-pressed",n?"true":"false")})}function de(e){const t=te.get(e);typeof t=="number"&&(window.clearTimeout(t),te.delete(e))}function L(e,t){return t&&e.schemas.find(n=>n.id===t)||null}function re(e){var t;return e.defaultSchemaId||((t=e.schemas[0])==null?void 0:t.id)||null}function g(e,t){u.has(e)||u.set(e,t);let n=j.get(e);return n||(n={activeSchemaId:re(t),realtimeEnabled:t.enableRealtime,issues:[],headingCount:0,recognizedHeadingCount:0,missingCount:0,lastRunAt:null,snapshot:""},j.set(e,n)),(!n.activeSchemaId||!L(t,n.activeSchemaId))&&(n.activeSchemaId=re(t)),ne.add(e),n}function ue(e){var t;de(e),(t=p.get(e))==null||t.remove(),p.delete(e),F.delete(e),u.delete(e),X.delete(e),j.delete(e),ne.delete(e),b===e&&(b=null)}function me(e){return F.get(e)===!0}function Ee(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function se(e,t){if(!t.classList.contains("show"))return;const n=le(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,440),s=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,n.right-r),s),a=Math.max(10,Math.min(window.innerHeight-10,n.top+12));t.style.width=`${r}px`,t.style.left=`${o}px`,t.style.top=`${a}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function ee(e,t){const n=e.querySelector(".rte-doc-schema-live");n&&(n.textContent=t)}function qe(e,t){const n=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),r=[];return n.forEach((s,o)=>{const a=t(s.textContent||"");if(!a)return;const l=Number(s.tagName.slice(1))||0,c=ce(a,t);r.push({text:a,key:c,index:o,level:l})}),r}function ve(e,t,n){const r=Array.from(e.querySelectorAll("h1, h2, h3, h4, h5, h6")),s=[];return r.forEach(o=>{const a=n(o.textContent||"");if(!a)return;const l=ce(a,n),c=l&&t.matchKeyToSection.get(l)||null,i=c?t.orderBySectionId.get(c.id)??null:null,d=P(Number(o.tagName.slice(1))||0,1,6);s.push({element:o,level:d,section:c,order:i})}),s}function ze(e,t=2){const n=e.filter(c=>c.section).map(c=>c.level),r=n.length>0?n:e.map(c=>c.level);if(r.length===0)return t;const s=new Map;r.forEach((c,i)=>{s.has(c)||s.set(c,{count:0,firstIndex:i});const d=s.get(c);d.count+=1});let o=t,a=-1,l=Number.MAX_SAFE_INTEGER;return s.forEach((c,i)=>{(c.count>a||c.count===a&&c.firstIndex<l||c.count===a&&c.firstIndex===l&&i<o)&&(o=i,a=c.count,l=c.firstIndex)}),P(o,1,6)}function Be(e){var o;const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(((o=xe(n.startContainer))==null?void 0:o.closest(S))!==e)return null;if(n.startContainer.nodeType===Node.ELEMENT_NODE){const a=n.startContainer,l=a.childNodes[n.startOffset]||null;return{parent:a,referenceNode:l}}const s=n.startContainer.parentNode;return s?{parent:s,referenceNode:n.startContainer.nextSibling||null}:null}function Ke(e,t,n,r){var c;const s=ve(e,n,r),o=n.orderBySectionId.get(t.id);if(typeof o!="number"||s.length===0)return{parent:e,referenceNode:null};const a=s.find(i=>typeof i.order=="number"&&i.order>o);if(a&&a.element.parentNode)return{parent:a.element.parentNode,referenceNode:a.element};let l=-1;for(let i=0;i<s.length;i+=1){const d=s[i];typeof d.order=="number"&&d.order<o&&(l=i)}if(l>=0){const i=((c=s[l+1])==null?void 0:c.element)||null;return{parent:(i==null?void 0:i.parentNode)||s[l].element.parentNode||e,referenceNode:i}}return{parent:e,referenceNode:null}}function Ve(e,t,n,r){const s=e.ownerDocument||document,o=`h${P(r,1,6)}`,a=s.createElement(o);a.setAttribute("data-doc-schema-section",t.id),a.textContent=t.title;const l=s.createElement("p");return l.textContent=t.placeholder||n.labels.defaultPlaceholderText,[a,l]}function V(e,t,n,r={}){return ge+=1,{id:`doc-schema-issue-${ge}`,type:e,severity:t,message:n,...r}}function J(e,t,n){return e.replace(/\{section\}/g,t||"").replace(/\{heading\}/g,n||"").trim()}function je(e,t,n){const r=qe(e,n.normalizeText),s=[],o=new Map,a=[];for(let c=0;c<r.length&&!(s.length>=n.maxIssues);c+=1){const i=r[c];if(!i.key)continue;const d=t.matchKeyToSection.get(i.key);if(d){o.set(d.id,(o.get(d.id)||0)+1),a.push({section:d,heading:i});continue}t.allowUnknownHeadings||s.push(V("unknown-heading","warning",J(n.labels.unknownHeadingMessage,null,i.text),{headingText:i.text,suggestion:"Map this heading to a schema alias or remove it from strict structure mode."}))}let l=0;for(let c=0;c<t.sections.length&&!(s.length>=n.maxIssues);c+=1){const i=t.sections[c],d=o.get(i.id)||0;d<i.minOccurrences&&(l+=1,s.push(V("missing-section","error",J(n.labels.missingSectionMessage,i.title,null),{sectionId:i.id,sectionTitle:i.title,suggestion:`Add heading "${i.title}" to satisfy schema requirements.`}))),d>i.maxOccurrences&&s.length<n.maxIssues&&s.push(V("duplicate-section","warning",J(n.labels.duplicateSectionMessage,i.title,null),{sectionId:i.id,sectionTitle:i.title,suggestion:`Keep at most ${i.maxOccurrences} instance(s) of "${i.title}".`}))}if(t.strictOrder&&s.length<n.maxIssues){let c=-1;for(let i=0;i<a.length&&!(s.length>=n.maxIssues);i+=1){const d=a[i],x=t.orderBySectionId.get(d.section.id)??i;x<c?s.push(V("out-of-order","warning",J(n.labels.outOfOrderMessage,d.section.title,d.heading.text),{sectionId:d.section.id,sectionTitle:d.section.title,headingText:d.heading.text,suggestion:`Move "${d.section.title}" after earlier required sections.`})):c=x}}return{issues:s,headingCount:r.length,recognizedHeadingCount:a.length,missingCount:l}}function we(e){const t=u.get(e)||w,n=j.get(e),r=t?L(t,(n==null?void 0:n.activeSchemaId)||null):null;return{activeSchemaId:(n==null?void 0:n.activeSchemaId)||null,activeSchemaLabel:(r==null?void 0:r.label)||null,realtimeEnabled:(n==null?void 0:n.realtimeEnabled)===!0,issues:n!=null&&n.issues?n.issues.map(s=>({...s})):[],headingCount:(n==null?void 0:n.headingCount)||0,recognizedHeadingCount:(n==null?void 0:n.recognizedHeadingCount)||0,missingCount:(n==null?void 0:n.missingCount)||0,lastRunAt:(n==null?void 0:n.lastRunAt)||null}}function H(e){const t=j.get(e);pe(e,"toggleDocSchemaPanel",me(e)),pe(e,"toggleDocSchemaRealtime",(t==null?void 0:t.realtimeEnabled)===!0)}function _(e){const t=p.get(e);if(!t)return;const n=u.get(e)||w;if(!n)return;const r=g(e,n),s=L(n,r.activeSchemaId),o=t.querySelector(".rte-doc-schema-label");o&&(o.textContent=n.labels.schemaLabel);const a=t.querySelector('[data-field="schema"]');a&&(a.innerHTML=n.schemas.map(h=>`<option value="${I(h.id)}">${I(h.label)}</option>`).join(""),a.value=r.activeSchemaId||"");const l=t.querySelector(".rte-doc-schema-description");if(l){const h=(s==null?void 0:s.description)||"";l.textContent=h?`${n.labels.schemaDescriptionPrefix}: ${h}`:"",l.hidden=!h}const c=t.querySelector(".rte-doc-schema-summary");if(c){const h=(s==null?void 0:s.label)||"N/A",y=r.issues.length;c.textContent=`${n.labels.summaryPrefix}: ${h} • ${y} issue${y===1?"":"s"}`}const i=t.querySelector(".rte-doc-schema-helper");i&&(i.textContent=n.labels.helperText);const d=t.querySelector(".rte-doc-schema-shortcut");d&&(d.textContent=n.labels.shortcutText);const x=t.querySelector('[data-action="run-validation"]');x&&(x.textContent=n.labels.validateText);const f=t.querySelector('[data-action="insert-missing"]');if(f){f.textContent=n.labels.insertMissingText;const h=r.issues.some(y=>y.type==="missing-section");f.disabled=!h||Ee(e)}const k=t.querySelector('[data-action="toggle-realtime"]');k&&(k.textContent=r.realtimeEnabled?n.labels.realtimeOnText:n.labels.realtimeOffText,k.setAttribute("aria-pressed",r.realtimeEnabled?"true":"false"));const O=t.querySelector('[data-action="close"]');O&&O.setAttribute("aria-label",n.labels.closeText);const A=t.querySelector(".rte-doc-schema-issues"),$=t.querySelector(".rte-doc-schema-empty");A&&(A.setAttribute("aria-label",n.labels.issueListLabel),r.issues.length===0?(A.innerHTML="",$&&($.hidden=!1,$.textContent=n.labels.noIssuesText)):($&&($.hidden=!0),A.innerHTML=r.issues.map(h=>{const y=h.severity==="error"?"error":h.severity==="warning"?"warning":"info",N=h.sectionTitle||h.headingText||"";return`
|
|
2
|
+
<li class="rte-doc-schema-issue ${y}" role="listitem">
|
|
3
3
|
<p class="rte-doc-schema-issue-message">${I(h.message)}${N?`: <strong>${I(N)}</strong>`:""}</p>
|
|
4
4
|
${h.suggestion?`<p class="rte-doc-schema-issue-suggestion">${I(h.suggestion)}</p>`:""}
|
|
5
5
|
</li>
|
|
6
|
-
`}).join(""))),t.setAttribute("aria-label",n.labels.panelAriaLabel)}function G(e,t=!1){const n=p.get(e);n&&(n.classList.remove("show"),F.set(e,!1),
|
|
6
|
+
`}).join(""))),t.setAttribute("aria-label",n.labels.panelAriaLabel)}function G(e,t=!1){const n=p.get(e);n&&(n.classList.remove("show"),F.set(e,!1),H(e),t&&e.focus({preventScroll:!0}))}function ae(e){const t=Fe(e);p.forEach((r,s)=>{s!==e&&G(s,!1)}),t.classList.add("show"),F.set(e,!0),_(e),se(e,t),H(e);const n=t.querySelector('[data-field="schema"]');n==null||n.focus(),C(e,"panel-open",!1)}function ke(e,t){const n=me(e);return(typeof t=="boolean"?t:!n)?ae(e):G(e,!1),!0}function Ue(e,t){if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}}function Ge(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function C(e,t,n){const r=u.get(e)||w;if(!r)return[];const s=g(e,r),o=p.get(e),a=e.innerHTML;if(!n&&s.snapshot===a)return s.issues;const l=L(r,s.activeSchemaId);if(!l)return s.issues=[V("missing-section","error","No active schema is configured for this editor.",{suggestion:"Set `defaultSchemaId` or update schema options."})],s.headingCount=0,s.recognizedHeadingCount=0,s.missingCount=1,s.lastRunAt=new Date().toISOString(),s.snapshot=a,_(e),H(e),s.issues;const c=je(e,l,r);return s.issues=c.issues,s.headingCount=c.headingCount,s.recognizedHeadingCount=c.recognizedHeadingCount,s.missingCount=c.missingCount,s.lastRunAt=new Date().toISOString(),s.snapshot=a,_(e),H(e),e.dispatchEvent(new CustomEvent("editora:doc-schema-validation",{bubbles:!0,detail:{reason:t,state:we(e)}})),o&&ee(o,c.issues.length===0?r.labels.noIssuesText:`${c.issues.length} issue${c.issues.length===1?"":"s"} detected.`),s.issues}function $e(e){const t=u.get(e)||w;if(!t)return;de(e);const n=window.setTimeout(()=>{te.delete(e),C(e,"realtime",!1)},t.debounceMs);te.set(e,n)}function Ce(e,t){const n=u.get(e)||w;if(!n)return!1;const r=g(e,n),s=typeof t=="boolean"?t:!r.realtimeEnabled;return r.realtimeEnabled=s,s?$e(e):de(e),_(e),H(e),!0}function Me(e){const t=u.get(e)||w;if(!t)return!1;const n=g(e,t),r=p.get(e);if(Ee(e))return r&&ee(r,t.labels.readonlyMessage),!1;const s=L(t,n.activeSchemaId);if(!s)return!1;C(e,"insert-missing-pre",!0);const o=Array.from(new Set(n.issues.filter(f=>f.type==="missing-section"&&f.sectionId).map(f=>f.sectionId))),a=s.sections.filter(f=>o.includes(f.id));if(a.length===0)return r&&ee(r,t.labels.noIssuesText),!1;const l=e.innerHTML,c=ve(e,s,t.normalizeText),i=ze(c,2),d=Be(e);a.forEach(f=>{const k=s.strictOrder?Ke(e,f,s,t.normalizeText):d||{parent:e,referenceNode:null},[O,A]=Ve(e,f,t,i);k.parent.insertBefore(O,k.referenceNode),k.parent.insertBefore(A,k.referenceNode)}),Ue(e,l),Ge(e),C(e,"insert-missing-post",!0);const x=a.map(f=>f.title).join(", ");return e.dispatchEvent(new CustomEvent("editora:doc-schema-insert-missing",{bubbles:!0,detail:{schemaId:s.id,sectionIds:a.map(f=>f.id)}})),r&&ee(r,`${t.labels.insertedSummaryPrefix}: ${x}`),!0}function Fe(e){const t=p.get(e);if(t)return t;const n=u.get(e)||w||Z();g(e,n);const r=`rte-doc-schema-panel-${Ae++}`,s=`${r}-schema`,o=document.createElement("section");return o.className=m,o.id=r,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","false"),o.setAttribute("aria-label",n.labels.panelAriaLabel),o.innerHTML=`
|
|
7
7
|
<header class="rte-doc-schema-header">
|
|
8
8
|
<h2 class="rte-doc-schema-title">${I(n.labels.panelTitle)}</h2>
|
|
9
9
|
<button type="button" class="rte-doc-schema-icon-btn" data-action="close" aria-label="${I(n.labels.closeText)}">✕</button>
|
|
@@ -26,60 +26,60 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
</div>
|
|
28
28
|
<div class="rte-doc-schema-live" aria-live="polite" aria-atomic="true"></div>
|
|
29
|
-
`,o.addEventListener("click",a=>{const
|
|
30
|
-
.rte-toolbar-group-items.${
|
|
31
|
-
.editora-toolbar-group-items.${
|
|
29
|
+
`,o.addEventListener("click",a=>{const l=a.target,c=l==null?void 0:l.closest("[data-action]");if(!c)return;const i=c.getAttribute("data-action");if(i==="close"){G(e,!0);return}if(i==="run-validation"){C(e,"panel-button",!0);return}if(i==="insert-missing"){Me(e);return}i==="toggle-realtime"&&Ce(e)}),o.addEventListener("change",a=>{const l=a.target;if(!(l instanceof HTMLSelectElement)||l.getAttribute("data-field")!=="schema")return;const c=u.get(e)||w;if(!c)return;const i=g(e,c),d=l.value;L(c,d)&&(i.activeSchemaId=d,i.snapshot="",C(e,"schema-change",!0))}),o.addEventListener("keydown",a=>{a.key==="Escape"&&(a.preventDefault(),G(e,!0))}),oe(o,e),document.body.appendChild(o),p.set(e,o),F.set(e,!1),_(e),o}function We(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="g"}function Ye(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="j"}function Je(e){w=e,q||(q=t=>{Q();const n=t.target,r=n==null?void 0:n.closest(S);if(!r)return;const s=u.get(r)||e;g(r,s),u.set(r,s),b=r,H(r);const o=p.get(r);o&&(oe(o,r),se(r,o),_(r))},document.addEventListener("focusin",q,!0)),z||(z=t=>{const n=t.target,r=n==null?void 0:n.closest(S);if(!r)return;const s=u.get(r)||w;!s||!g(r,s).realtimeEnabled||$e(r)},document.addEventListener("input",z,!0)),B||(B=t=>{if(t.defaultPrevented)return;const n=t.target;if(n!=null&&n.closest(`.${m}`)&&t.key!=="Escape")return;const r=_e(t);if(!r)return;const s=u.get(r)||w||e;if(g(r,s),u.set(r,s),b=r,t.key==="Escape"&&me(r)){t.preventDefault(),G(r,!0);return}if(We(t)){t.preventDefault(),t.stopPropagation(),ke(r);return}Ye(t)&&(t.preventDefault(),t.stopPropagation(),C(r,"shortcut",!0))},document.addEventListener("keydown",B,!0)),D||(D=()=>{Q(),p.forEach((t,n)=>{!n.isConnected||!t.isConnected||(oe(t,n),se(n,t))})},window.addEventListener("scroll",D,!0),window.addEventListener("resize",D)),!K&&typeof MutationObserver<"u"&&document.body&&(K=new MutationObserver(t=>{Pe(t)&&Q()}),K.observe(document.body,{childList:!0,subtree:!0}))}function Xe(){q&&(document.removeEventListener("focusin",q,!0),q=null),z&&(document.removeEventListener("input",z,!0),z=null),B&&(document.removeEventListener("keydown",B,!0),B=null),D&&(window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D),D=null),K&&(K.disconnect(),K=null),p.forEach(t=>t.remove()),p.clear(),Array.from(ne).forEach(t=>ue(t)),w=null,b=null}function Ze(){if(typeof document>"u"||document.getElementById(he))return;const e=document.createElement("style");e.id=he,e.textContent=`
|
|
30
|
+
.rte-toolbar-group-items.${E},
|
|
31
|
+
.editora-toolbar-group-items.${E},
|
|
32
32
|
.rte-toolbar-group-items.${M},
|
|
33
33
|
.editora-toolbar-group-items.${M},
|
|
34
|
-
.rte-toolbar-group-items.${
|
|
35
|
-
.editora-toolbar-group-items.${
|
|
34
|
+
.rte-toolbar-group-items.${R},
|
|
35
|
+
.editora-toolbar-group-items.${R} {
|
|
36
36
|
display: flex;
|
|
37
37
|
border: 1px solid #cbd5e1;
|
|
38
38
|
border-radius: 4px;
|
|
39
39
|
background: #ffffff;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.rte-toolbar-group-items.${
|
|
43
|
-
.editora-toolbar-group-items.${
|
|
42
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
43
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-button,
|
|
44
44
|
.rte-toolbar-group-items.${M} .rte-toolbar-button,
|
|
45
45
|
.editora-toolbar-group-items.${M} .editora-toolbar-button,
|
|
46
|
-
.rte-toolbar-group-items.${
|
|
47
|
-
.editora-toolbar-group-items.${
|
|
46
|
+
.rte-toolbar-group-items.${R} .rte-toolbar-button,
|
|
47
|
+
.editora-toolbar-group-items.${R} .editora-toolbar-button {
|
|
48
48
|
border: none;
|
|
49
49
|
border-right: 1px solid #cbd5e1;
|
|
50
50
|
border-radius: 0;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.rte-toolbar-group-items.${
|
|
54
|
-
.editora-toolbar-group-items.${
|
|
53
|
+
.rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
54
|
+
.editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
55
55
|
.rte-toolbar-group-items.${M} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
56
56
|
.editora-toolbar-group-items.${M} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
57
|
-
.rte-toolbar-group-items.${
|
|
58
|
-
.editora-toolbar-group-items.${
|
|
57
|
+
.rte-toolbar-group-items.${R} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
58
|
+
.editora-toolbar-group-items.${R} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
59
59
|
border-right: none;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
${
|
|
63
|
-
${
|
|
64
|
-
${
|
|
65
|
-
${
|
|
66
|
-
${
|
|
67
|
-
${
|
|
62
|
+
${v} .rte-toolbar-group-items.${E},
|
|
63
|
+
${v} .editora-toolbar-group-items.${E},
|
|
64
|
+
${v} .rte-toolbar-group-items.${M},
|
|
65
|
+
${v} .editora-toolbar-group-items.${M},
|
|
66
|
+
${v} .rte-toolbar-group-items.${R},
|
|
67
|
+
${v} .editora-toolbar-group-items.${R} {
|
|
68
68
|
border-color: #566275;
|
|
69
69
|
}
|
|
70
70
|
.rte-toolbar-button[data-command="toggleDocSchemaRealtime"].active,
|
|
71
71
|
.editora-toolbar-button[data-command="toggleDocSchemaRealtime"].active {
|
|
72
72
|
background-color: #ccc;
|
|
73
73
|
}
|
|
74
|
-
${
|
|
75
|
-
${
|
|
76
|
-
${
|
|
77
|
-
${
|
|
74
|
+
${v} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
|
|
75
|
+
${v} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
|
|
76
|
+
${v} .rte-toolbar-group-items.${M} .rte-toolbar-button svg,
|
|
77
|
+
${v} .editora-toolbar-group-items.${M} .editora-toolbar-button svg
|
|
78
78
|
{
|
|
79
79
|
fill: none;
|
|
80
80
|
}
|
|
81
|
-
${
|
|
82
|
-
${
|
|
81
|
+
${v} .rte-toolbar-group-items.${E} .rte-toolbar-button,
|
|
82
|
+
${v} .editora-toolbar-group-items.${E} .editora-toolbar-button
|
|
83
83
|
{
|
|
84
84
|
border-color: #566275;
|
|
85
85
|
}
|
|
@@ -395,4 +395,4 @@
|
|
|
395
395
|
grid-template-columns: 1fr;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
`,document.head.appendChild(e)}const Qe=(e={})=>{const t=Z(e),n=new Set;return Ze(),{name:"docSchema",toolbar:[{id:"docSchemaGroup",label:"Document Schema",type:"group",command:"docSchema",items:[{id:"toggleDocSchemaPanel",label:"Document Schema",command:"toggleDocSchemaPanel",shortcut:"Mod-Alt-Shift-g",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 4.5h12A1.5 1.5 0 0 1 19.5 6v12A1.5 1.5 0 0 1 18 19.5H6A1.5 1.5 0 0 1 4.5 18V6A1.5 1.5 0 0 1 6 4.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M8 8h8M8 12h8M8 16h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"runDocSchemaValidation",label:"Run Schema Validation",command:"runDocSchemaValidation",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3.5 4.5 6.5v5c0 4.8 3.1 8.9 7.5 10 4.4-1.1 7.5-5.2 7.5-10v-5L12 3.5Z" stroke="currentColor" stroke-width="1.6"/><path d="m9 12.5 2 2 4-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"toggleDocSchemaRealtime",label:"Toggle Schema Realtime",command:"toggleDocSchemaRealtime",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 12a7.5 7.5 0 1 1 7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M9.5 19.5H5.5v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>'}]}],commands:{docSchema:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},openDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},toggleDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ke(o,typeof r=="boolean"?r:void 0)},runDocSchemaValidation:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,C(o,"command",!0),!0},insertMissingDocSchemaSections:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Me(o)},toggleDocSchemaRealtime:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Ce(o,typeof r=="boolean"?r:void 0)},setDocSchemaMode:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t,
|
|
398
|
+
`,document.head.appendChild(e)}const Qe=(e={})=>{const t=Z(e),n=new Set;return Ze(),{name:"docSchema",toolbar:[{id:"docSchemaGroup",label:"Document Schema",type:"group",command:"docSchema",items:[{id:"toggleDocSchemaPanel",label:"Document Schema",command:"toggleDocSchemaPanel",shortcut:"Mod-Alt-Shift-g",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 4.5h12A1.5 1.5 0 0 1 19.5 6v12A1.5 1.5 0 0 1 18 19.5H6A1.5 1.5 0 0 1 4.5 18V6A1.5 1.5 0 0 1 6 4.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M8 8h8M8 12h8M8 16h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"runDocSchemaValidation",label:"Run Schema Validation",command:"runDocSchemaValidation",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3.5 4.5 6.5v5c0 4.8 3.1 8.9 7.5 10 4.4-1.1 7.5-5.2 7.5-10v-5L12 3.5Z" stroke="currentColor" stroke-width="1.6"/><path d="m9 12.5 2 2 4-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"toggleDocSchemaRealtime",label:"Toggle Schema Realtime",command:"toggleDocSchemaRealtime",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 12a7.5 7.5 0 1 1 7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M9.5 19.5H5.5v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><circle cx="12" cy="12" r="2" fill="currentColor"/></svg>'}]}],commands:{docSchema:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},openDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ae(o),!0},toggleDocSchemaPanel:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,ke(o,typeof r=="boolean"?r:void 0)},runDocSchemaValidation:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,C(o,"command",!0),!0},insertMissingDocSchemaSections:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Me(o)},toggleDocSchemaRealtime:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;return g(o,a),u.set(o,a),b=o,Ce(o,typeof r=="boolean"?r:void 0)},setDocSchemaMode:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t,l=g(o,a);u.set(o,a);const c=typeof r=="string"?r:(r==null?void 0:r.schemaId)||(r==null?void 0:r.id);return!c||!L(a,c)?!1:(l.activeSchemaId=c,l.snapshot="",C(o,"set-mode",!0),!0)},setDocSchemaOptions:(r,s)=>{const o=T(s,!1,!1);if(!o||!r||typeof r!="object")return!1;const a=u.get(o)||t,l=X.get(o)||Re(a),c={...l,...r,labels:{...l.labels||{},...r.labels||{}},schemas:Array.isArray(r.schemas)?r.schemas:l.schemas,normalizeText:r.normalizeText||a.normalizeText},i=Z(c);u.set(o,i),X.set(o,c);const d=g(o,i);return typeof r.enableRealtime=="boolean"&&(d.realtimeEnabled=r.enableRealtime),(!d.activeSchemaId||!L(i,d.activeSchemaId))&&(d.activeSchemaId=re(i)),typeof r.defaultSchemaId=="string"&&L(i,r.defaultSchemaId)&&(d.activeSchemaId=r.defaultSchemaId),d.snapshot="",C(o,"set-options",!0),_(o),H(o),!0},getDocSchemaState:(r,s)=>{const o=T(s,!1,!1);if(!o)return!1;const a=u.get(o)||t;g(o,a);const l=we(o);if(typeof r=="function")try{r(l)}catch{}return o.__docSchemaState=l,o.dispatchEvent(new CustomEvent("editora:doc-schema-state",{bubbles:!0,detail:l})),!0}},keymap:{"Mod-Alt-Shift-g":"toggleDocSchemaPanel","Mod-Alt-Shift-G":"toggleDocSchemaPanel","Mod-Alt-Shift-j":"runDocSchemaValidation","Mod-Alt-Shift-J":"runDocSchemaValidation"},init:function(s){W+=1;const o=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,a=Z(o);Je(a);const l=T(s!=null&&s.editorElement?{editorElement:s.editorElement}:void 0,!1,!1);l&&(b=l,n.add(l),g(l,a),u.set(l,a),X.set(l,o),H(l),C(l,"init",!0))},destroy:()=>{n.forEach(r=>ue(r)),n.clear(),W=Math.max(0,W-1),!(W>0)&&Xe()}}};exports.DocSchemaPlugin=Qe;
|