@ones-editor/editor 1.1.3-bate.11 → 1.1.3-bate.12

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/index.js CHANGED
@@ -933,7 +933,7 @@ function print() { __p += __j.call(arguments, '') }
933
933
  <add as="fillColor" value="#ffffff"/>
934
934
  </add>
935
935
  </mxStylesheet>
936
- `,$4=0,NY=30*1e3,H4="editor-empty-drawio",j4="show-full-screen-iframe",je=I("embed-block-drawio");function oc(n){return n.options.componentsOptions.drawIO||{}}function PY(n){const e=oc(n).lang;return e?IY[e]:""}function FY(n){var i;const e=((i=(oc(n)||{}).cdn)==null?void 0:i.drawioIframe)||DY,r=PY(n);return Sg(e,{spin:1,proto:"json",configure:1,lang:r})}function KY(n){const t=()=>{p(je,n,"el does not exist");const r=document.body.clientWidth||document.documentElement.clientWidth,i=document.body.clientHeight||document.documentElement.clientHeight;n.setAttribute("width",`${r-2*$4}`),n.setAttribute("height",`${i-2*$4}`)},e=()=>{window.removeEventListener("resize",t)};return t(),window.addEventListener("resize",t),{disconnect:e}}async function VY(n,t){const r=(oc(n)||{}).callbacks||{},i=n.getCustom("iframe-embed-reauth-event-callback"),{onCreateDrawIoFrame:o,onCloseDrawIoFrame:s}=r;let l=null,c;if(o)l=await o(n),p(je,l,"iframe create failed"),c=()=>{p(je,l,"iframe does not exist"),p(je,s,"missing parameters: onCloseDrawIoFrame"),i.unRegister(),s(n,l)};else{const d=B("div",["editor-drawio-iframe-container","loading"],document.body);d.setAttribute("data-placeholder",D.t("drawio.loading")),l=B("iframe",["drawio-iframe-element"],d),l.setAttribute("frameborder","0"),z(d,j4);const{disconnect:h}=KY(l);c=()=>{p(je,l,"iframe does not exist"),i.unRegister(),h(),document.body.removeChild(d),ot(d,j4)}}return i.register(t,l,{onExit:()=>c()}),{drawioIframe:l,exit:c}}async function $Y(n,t,e,r){var i,o;try{r&&je.debug("auto saving drawio data");const s=new Blob([e]),l=new File([s],"drawio.svg",{type:"image/svg+xml"});try{const c=n.findBlockById(st(t));if(c){const d=await n.doc.uploadResource(l),{resourceId:h}=d,E=n.getBlockData(c).embedData,x={src:h,height:E==null?void 0:E.height};n.updateEmbedData(c,x)}else je.error("block has been deleted")}catch(c){const d=`failed to upload drawio data: ${c.message}`;je.error(d)}}catch(s){const l=`failed to save drawio data: ${s.message}`,c=oc(n);if((i=c.callbacks)!=null&&i.onError){const d=new Error(l);d.code="SaveDrawIo",(o=c.callbacks)==null||o.onError(n,d)}}}function HY(n,t,e,r,i,o,s){const l=()=>{window.removeEventListener("message",c),o()},c=async d=>{var h,C;if(p(je,r.contentWindow,"iframe.contentWindow does not exist"),d.data.length>0){const E=JSON.parse(d.data),x=e.xmlSvg||e.xml,v=document.querySelectorAll(".editor-drawio-iframe-container");switch(E.event){case"configure":r.contentWindow.postMessage(JSON.stringify({action:"configure",config:{defaultFonts:["Humor Sans","Helvetica","Times New Roman"]}}),"*");break;case"init":x!=null&&r.contentWindow.postMessage(JSON.stringify({action:"load",saveAndExit:1,noSaveBtn:1,noExitBtn:0,xml:x}),"*"),i(),v.forEach(L=>{ot(L,"loading")});break;case"export":const k=$c(E.data.substring(E.data.indexOf(",")+1));$Y(n,t,k,!!((h=E.message)!=null&&h.autoSave)),(C=E.message)!=null&&C.autoSave||l();break;case"save":r.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph"}),"*");break;case"exit":l();break}}};window.addEventListener("message",c)}async function z4(n,t,e,r){if(r)return;r=!0;const i=oc(n)||{},{callbacks:o}=i;let s;o&&(o==null?void 0:o.onBeginInitDrawIo)&&o.onBeginInitDrawIo(n,t);const{drawioIframe:l,exit:c}=await VY(n,t);if(AE(n,t),e.src){const E=await V4(n,n.doc.buildResourceUrl(e.src));E&&(e.xmlSvg=E)}HY(n,t,e,l,()=>{s=setInterval(()=>{!l||!l.contentWindow||l.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph",autoSave:!0}),"*")},NY)},()=>{c(),s&&clearInterval(s);const E=n.findBlockById(st(t));E&&xE(n,E)});const C=FY(n);l.setAttribute("src",C)}async function jY(n){var i,o;const t=oc(n),e=((i=t.cdn)==null?void 0:i.drawio)||_Y,r=((o=t.cdn)==null?void 0:o.pako)||MY;await Ds(r,"editor-pako"),await Ds(e,"editor-drawio"),await new Promise(s=>{setTimeout(s,100)})}function zY(n){ot(n,H4)}function sA(n){z(n,H4);const t=B("div",["drawio-empty-content"],n);t.innerHTML=UY,B("span",["drawio-empty-title"],t,D.t("drawio.empty"))}function GY(n,t,e){const r=nt(t);if(!r)return;const i=Ot(r);t.innerHTML="",t.style.height="100%",z(r,"drawio-load-error");const o=B("div",["drawio-error-content"],t),s=B("div",["drawio-error-brand-icon"],o);s.innerHTML=e0,B("div",["drawio-error-title"],o,D.t("drawio.errorTips"));const l=B("div",["drawio-error-sub-title"],o);B("span",[],l,D.t("drawio.errorSubTips"));const c=B("span",["drawio-error-retry-button"],l,D.t("drawio.retry"));c.onclick=()=>{t.innerHTML="",ot(r,"drawio-load-error"),e.src?G4(e.src,t,n):e.xml?W4(e.xml,t,n):e.xmlSvg&&q4(e.xmlSvg,t),e.height&&(i.style.height=`${e.height}px`,t.style.height=`${e.height-20}px`)}}function lA(n,t){if(p(je,t,"Required data is missing in setGraph"),"src"in t){n.setAttribute("data-src",t.src);return}if("xmlSvg"in t){n.setAttribute("data-xmlsvg",t.xmlSvg);return}if("graph"in t){const{xml:e,graph:r}=t;n.graph=r,n.setAttribute("data-mxfile",e)}}function WY(n){return{src:n.getAttribute("data-src")||"",xmlSvg:n.getAttribute("data-xmlsvg")||"",xml:n.getAttribute("data-mxfile")||""}}function G4(n,t,e){p(je,n,"params error: src"),p(je,e,"params error: editor");const r=t,i=e.doc.buildResourceUrl(n),o=document.createElement("img");r.innerHTML="",r.appendChild(o),o.src=i,o.draggable=!1,lA(r,{src:n}),o.onload=s=>{const l=r.querySelector("img");s.target!==l||!l||(wY(l)?sA(t):(l.style.width="100%",l.style.height="100%",zY(t)))},o.onerror=s=>{const l=r.querySelector("img");s.target===l&&GY(e,t,{src:n})}}function W4(n,t,e){p(je,e,"parameter missing"),jY(e).then(()=>{const{mxUtils:r,mxGraph:i,mxCodec:o}=window;p(je,r,"External resource loading exception: mxUtils"),p(je,i,"External resource loading exception: MxGraph"),p(je,o,"External resource loading exception: MxCodec");const s=r.parseXml(n);t.innerHTML="";const l=s.documentElement;p(je,l,"Resource parsing exception"),p(je,l.nodeName==="mxfile","Resource parsing exception");const c=l.getElementsByTagName("diagram");p(je,c.length>0,"Resource parsing exception");let d;const h=c[0];if(h.text||h.textContent){const k=LY(h),L=atob(k),M=window.pako;p(je,M,"External resource loading exception: pako");const U=M.inflateRaw(Uint8Array.from(L,G=>G.charCodeAt(0)),{to:"string"}),F=decodeURIComponent(U);d=r.parseXml(F)}else{const k=new XMLSerializer().serializeToString(h.firstChild);d=r.parseXml(k)}const C=new i(t);C.resetViewOnRootChange=!1,C.foldingEnabled=!1,C.setTooltips(!1),C.setEnabled(!1),C.setHtmlLabels(!0);const E=r.parseXml(OY);new o(E).decode(E.documentElement,C.getStylesheet());const v=new o(d);v.decode(v.document.documentElement,C.getModel()),C.maxFitScale=1,C.fit(),C.center(!0,!1),lA(t,{graph:C,xml:n})})}function q4(n,t){t.innerHTML=n,lA(t,{xmlSvg:n});const e=t.querySelectorAll("svg");for(let r=0;r<e.length;r++){const i=e[r];if(!SY(i))return}sA(t)}function qY(n,t){return{...qE(n,t,{handleExecuteCommand:(r,i,o)=>{if(o.id==="edit"){const s=r.getBlockData(i).embedData;return z4(r,i,s,!1),!0}return!1}}),abstract:D.t("drawio.abstract")}}const XY={"en-US":{drawio:{title:"Flowchart/UML",empty:"Empty graph",loading:"Loading",abstract:"Flowchart/UML",errorTips:"Flowchart/UML loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}},"zh-CN":{drawio:{title:"\u6D41\u7A0B\u56FE/UML",empty:"\u7A7A\u56FE\u8868",loading:"\u52A0\u8F7D\u4E2D",abstract:"\u6D41\u7A0B\u56FE/UML",errorTips:"\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}},"ja-JP":{drawio:{title:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",empty:"\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",loading:"\u8AAD\u8FBC\u4E2D",abstract:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",errorTips:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}}};D.mergeLang(XY);const om=I("embed-block-drawio"),QY=!1;function YY(n,t,e,r){p(om,e,`parameter missing: ${e}`),p(om,n,`parameter missing: ${n}`),z4(n,t,r,QY)}function X4(n,t,e){const{src:r,xml:i,xmlSvg:o}=e;r?G4(r,t,n):i?W4(i,t,n):o?q4(o,t):sA(t)}function JY(n,t,e){const r=B("div",["editor-drawio-content","editor-embed"],null);t.appendChild(r),X4(n,r,e),e.height&&(t.style.height=`${e.height}px`,r.style.height=`${e.height-20}px`)}function ZY(n,t,e){const{src:r,xml:i,xmlSvg:o}=e,s=WY(t);if(r!==s.src||(i||"")!==s.xml||(o||"")!==s.xmlSvg){X4(n,t,e);return}const l=t.parentElement,c=nt(l);e.height&&e.height!==Number.parseInt(l.style.height,10)&&(l.style.height=`${e.height}px`,c&&!c.classList.contains("drawio-load-error")?t.style.height=`${e.height-20}px`:t.style.height="100%")}function tJ(n,t,e,r,i,o){const s=e.embedData;JY(n,t,s),Cf.register(n,o)}function eJ(n,t,e){const r=e.embedData,o=Ot(t).querySelector(":scope > .editor-drawio-content");return p(om,o,"embed should not be null"),ZY(n,o,r),!0}function nJ(){return{name:"UML",insertEmbedCommandItems:[{id:"insert-drawio",name:D.t("drawio.title"),icon:kT,group:"common",order:600,subText:vn("insert-drawio")}],handleInsertEmptyEmbed:async(n,t)=>{const e={src:"",xml:"",xmlSvg:""},r=n.insertEmbed(t.containerId,t.blockIndex,"drawio",e);return setTimeout(()=>{const o=Ot(r).querySelector(":scope > .editor-drawio-content");p(om,o,"embed should not be null");const s=n.getBlockData(r);YY(n,r,o,s.embedData)},100),r}}}function rJ(n,t,e,r){const{embedData:i}=t,o=i;return r==="html"?o.src?`<img src="${n.doc.buildResourceUrl(o.src,{withToken:!0})}" />`:o.xmlSvg?o.xmlSvg:"<p>[drawio]</p>":r==="markdown"?o.src?`![drawio](${n.doc.buildResourceUrl(o.src,{withToken:!0})})`:o.xmlSvg?o.xmlSvg:"[drawio]":""}const Q4={embedType:"drawio",getOptions:nJ,createEmbedContent:tJ,handleUpdateBlock:eJ,getBlockProperties:qY,convertTo:rJ},dct="";class aA extends ve.TypedEmitter{constructor(e){super();g(this,"currentBlock");g(this,"currentIframe");g(this,"onReAuthErrorWhenIframeEditing");g(this,"onIframeExitEdit");g(this,"destroy",()=>{this.editor.doc.externalDoc.unregisterCallback(this)});g(this,"onError",e=>{e.code===Tu.err&&this.currentIframe&&this.onConnectReAuthError()});g(this,"onAuthRecover",()=>{this.currentBlock&&Ld(this.currentBlock.id)});g(this,"unregisterCallbacks",()=>{this.editor.doc.unregisterCallback(this)});g(this,"register",(e,r,i)=>{this.currentBlock=e,this.currentIframe=r,this.onReAuthErrorWhenIframeEditing=i.onError,this.onIframeExitEdit=i.onExit});g(this,"unRegister",()=>{this.currentBlock=void 0,this.currentIframe=void 0,this.onReAuthErrorWhenIframeEditing=void 0});g(this,"onConnectReAuthError",()=>{var e;if(this.currentBlock&&this.currentIframe){(e=this.onReAuthErrorWhenIframeEditing)==null||e.call(this,this.currentBlock,this.currentIframe);const r=Dg(this.currentBlock.id),i=B("div",["iframe-embed-auth-error-tips"],r);i.innerHTML=D.t("authError.tips"),i.addEventListener("click",o=>{var l,c;const s=o.target;if(s instanceof HTMLSpanElement)switch(s.id){case"retry":(c=(l=this.editor.doc).triggerReAuth)==null||c.call(l);break;case"exit":this.exit();break}})}});this.editor=e,this.editor.doc.externalDoc.registerCallback(this)}exit(){var e;this.currentBlock&&Ld(this.currentBlock.id),this.unRegister(),(e=this.onIframeExitEdit)==null||e.call(this)}}const iJ=`<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
936
+ `,$4=0,NY=30*1e3,H4="editor-empty-drawio",j4="show-full-screen-iframe",je=I("embed-block-drawio");function oc(n){return n.options.componentsOptions.drawIO||{}}function PY(n){const e=oc(n).lang;return e?IY[e]:""}function FY(n){var i;const e=((i=(oc(n)||{}).cdn)==null?void 0:i.drawioIframe)||DY,r=PY(n);return Sg(e,{spin:1,proto:"json",configure:1,lang:r})}function KY(n){const t=()=>{p(je,n,"el does not exist");const r=document.body.clientWidth||document.documentElement.clientWidth,i=document.body.clientHeight||document.documentElement.clientHeight;n.setAttribute("width",`${r-2*$4}`),n.setAttribute("height",`${i-2*$4}`)},e=()=>{window.removeEventListener("resize",t)};return t(),window.addEventListener("resize",t),{disconnect:e}}async function VY(n,t){const r=(oc(n)||{}).callbacks||{},i=n.getCustom("iframe-embed-reauth-event-callback"),{onCreateDrawIoFrame:o,onCloseDrawIoFrame:s}=r;let l=null,c;if(o)l=await o(n),p(je,l,"iframe create failed"),c=()=>{p(je,l,"iframe does not exist"),p(je,s,"missing parameters: onCloseDrawIoFrame"),i.unRegister(),s(n,l)};else{const d=B("div",["editor-drawio-iframe-container","loading"],document.body);d.setAttribute("data-placeholder",D.t("drawio.loading")),l=B("iframe",["drawio-iframe-element"],d),l.setAttribute("frameborder","0"),z(d,j4);const{disconnect:h}=KY(l);c=()=>{p(je,l,"iframe does not exist"),i.unRegister(),h(),document.body.removeChild(d),ot(d,j4)}}return i.register(t,l,{onExit:()=>c()}),{drawioIframe:l,exit:c}}async function $Y(n,t,e,r){var i,o;try{r&&je.debug("auto saving drawio data");const s=new Blob([e]),l=new File([s],"drawio.svg",{type:"image/svg+xml"});try{const c=n.findBlockById(st(t));if(c){const d=await n.doc.uploadResource(l),{resourceId:h}=d,E=n.getBlockData(c).embedData,x={src:h,height:E==null?void 0:E.height};n.updateEmbedData(c,x)}else je.error("block has been deleted")}catch(c){const d=`failed to upload drawio data: ${c.message}`;je.error(d)}}catch(s){const l=`failed to save drawio data: ${s.message}`,c=oc(n);if((i=c.callbacks)!=null&&i.onError){const d=new Error(l);d.code="SaveDrawIo",(o=c.callbacks)==null||o.onError(n,d)}}}function HY(n,t,e,r,i,o,s){const l=()=>{window.removeEventListener("message",c),o()},c=async d=>{var h,C;if(p(je,r.contentWindow,"iframe.contentWindow does not exist"),d.data.length>0){const E=JSON.parse(d.data),x=e.xmlSvg||e.xml,v=document.querySelectorAll(".editor-drawio-iframe-container");switch(E.event){case"configure":r.contentWindow.postMessage(JSON.stringify({action:"configure",config:{defaultFonts:["Humor Sans","Helvetica","Times New Roman"]}}),"*");break;case"init":x!=null&&r.contentWindow.postMessage(JSON.stringify({action:"load",saveAndExit:1,noSaveBtn:1,noExitBtn:0,xml:x}),"*"),i(),v.forEach(L=>{ot(L,"loading")});break;case"export":const k=$c(E.data.substring(E.data.indexOf(",")+1));$Y(n,t,k,!!((h=E.message)!=null&&h.autoSave)),(C=E.message)!=null&&C.autoSave||l();break;case"save":r.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph"}),"*");break;case"exit":l();break}}};window.addEventListener("message",c)}async function z4(n,t,e,r){if(r)return;r=!0;const i=oc(n)||{},{callbacks:o}=i;let s;o&&(o==null?void 0:o.onBeginInitDrawIo)&&o.onBeginInitDrawIo(n,t);const{drawioIframe:l,exit:c}=await VY(n,t);if(AE(n,t),e.src){const E=await V4(n,n.doc.buildResourceUrl(e.src));E&&(e.xmlSvg=E)}HY(n,t,e,l,()=>{s=setInterval(()=>{!l||!l.contentWindow||l.contentWindow.postMessage(JSON.stringify({action:"export",format:"xmlsvg",spin:"Saving graph",autoSave:!0}),"*")},NY)},()=>{c(),s&&clearInterval(s);const E=n.findBlockById(st(t));E&&xE(n,E)});const C=FY(n);l.setAttribute("src",C)}async function jY(n){var i,o;const t=oc(n),e=((i=t.cdn)==null?void 0:i.drawio)||_Y,r=((o=t.cdn)==null?void 0:o.pako)||MY;await Ds(r,"editor-pako"),await Ds(e,"editor-drawio"),await new Promise(s=>{setTimeout(s,100)})}function zY(n){ot(n,H4)}function sA(n){z(n,H4);const t=B("div",["drawio-empty-content"],n);t.innerHTML=UY,B("span",["drawio-empty-title"],t,D.t("drawio.empty"))}function GY(n,t,e){const r=nt(t);if(!r)return;const i=Ot(r);t.innerHTML="",t.style.height="100%",z(r,"drawio-load-error");const o=B("div",["drawio-error-content"],t),s=B("div",["drawio-error-brand-icon"],o);s.innerHTML=e0,B("div",["drawio-error-title"],o,D.t("drawio.errorTips"));const l=B("div",["drawio-error-sub-title"],o);B("span",[],l,D.t("drawio.errorSubTips"));const c=B("span",["drawio-error-retry-button"],l,D.t("drawio.retry"));c.onclick=()=>{t.innerHTML="",ot(r,"drawio-load-error"),e.src?G4(e.src,t,n):e.xml?W4(e.xml,t,n):e.xmlSvg&&q4(e.xmlSvg,t),e.height&&(i.style.height=`${e.height}px`,t.style.height=`${e.height-20}px`)}}function lA(n,t){if(p(je,t,"Required data is missing in setGraph"),"src"in t){n.setAttribute("data-src",t.src);return}if("xmlSvg"in t){n.setAttribute("data-xmlsvg",t.xmlSvg);return}if("graph"in t){const{xml:e,graph:r}=t;n.graph=r,n.setAttribute("data-mxfile",e)}}function WY(n){return{src:n.getAttribute("data-src")||"",xmlSvg:n.getAttribute("data-xmlsvg")||"",xml:n.getAttribute("data-mxfile")||""}}function G4(n,t,e){p(je,n,"params error: src"),p(je,e,"params error: editor");const r=t,i=e.doc.buildResourceUrl(n),o=document.createElement("img");r.innerHTML="",r.appendChild(o),o.src=i,o.draggable=!1,lA(r,{src:n}),o.onload=s=>{const l=r.querySelector("img");s.target!==l||!l||(wY(l)?sA(t):(l.style.width="100%",l.style.height="100%",zY(t)))},o.onerror=s=>{const l=r.querySelector("img");s.target===l&&GY(e,t,{src:n})}}function W4(n,t,e){p(je,e,"parameter missing"),jY(e).then(()=>{const{mxUtils:r,mxGraph:i,mxCodec:o}=window;p(je,r,"External resource loading exception: mxUtils"),p(je,i,"External resource loading exception: MxGraph"),p(je,o,"External resource loading exception: MxCodec");const s=r.parseXml(n);t.innerHTML="";const l=s.documentElement;p(je,l,"Resource parsing exception"),p(je,l.nodeName==="mxfile","Resource parsing exception");const c=l.getElementsByTagName("diagram");p(je,c.length>0,"Resource parsing exception");let d;const h=c[0];if(h.text||h.textContent){const k=LY(h),L=atob(k),M=window.pako;p(je,M,"External resource loading exception: pako");const U=M.inflateRaw(Uint8Array.from(L,G=>G.charCodeAt(0)),{to:"string"}),F=decodeURIComponent(U);d=r.parseXml(F)}else{const k=new XMLSerializer().serializeToString(h.firstChild);d=r.parseXml(k)}const C=new i(t);C.resetViewOnRootChange=!1,C.foldingEnabled=!1,C.setTooltips(!1),C.setEnabled(!1),C.setHtmlLabels(!0);const E=r.parseXml(OY);new o(E).decode(E.documentElement,C.getStylesheet());const v=new o(d);v.decode(v.document.documentElement,C.getModel()),C.maxFitScale=1,C.fit(),C.center(!0,!1),lA(t,{graph:C,xml:n})})}function q4(n,t){t.innerHTML=n,lA(t,{xmlSvg:n});const e=t.querySelectorAll("svg");for(let r=0;r<e.length;r++){const i=e[r];if(!SY(i))return}sA(t)}function qY(n,t){return{...qE(n,t,{handleExecuteCommand:(r,i,o)=>{if(o.id==="edit"){const s=r.getBlockData(i).embedData;return z4(r,i,s,!1),!0}return!1}}),abstract:D.t("drawio.abstract")}}const XY={"en-US":{drawio:{title:"Flowchart/UML",empty:"Empty graph",loading:"Loading",abstract:"Flowchart/UML",errorTips:"Flowchart/UML loading failed",errorSubTips:"The network service is abnormal, you can",retry:"Try again"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}},"zh-CN":{drawio:{title:"\u6D41\u7A0B\u56FE/UML",empty:"\u7A7A\u56FE\u8868",loading:"\u52A0\u8F7D\u4E2D",abstract:"\u6D41\u7A0B\u56FE/UML",errorTips:"\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",errorSubTips:"\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",retry:"\u91CD\u8BD5"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}},"ja-JP":{drawio:{title:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",empty:"\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",loading:"\u8AAD\u8FBC\u4E2D",abstract:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",errorTips:"\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",errorSubTips:"\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",retry:"\u518D\u8A66\u884C"},authError:{tips:'<div>\u670D\u52A1\u5DF2\u65AD\u5F00\uFF0C\u4E3A\u4E86\u907F\u514D\u5185\u5BB9\u4E22\u5931\uFF0C\u6211\u4EEC\u6682\u65F6\u7981\u7528\u7F16\u8F91\u529F\u80FD\uFF0C\u4F60\u53EF\u4EE5 <span id="retry">\u91CD\u8FDE\u670D\u52A1</span> \u6216 <span id="exit">\u9000\u51FA\u7F16\u8F91</span></div>'}}};D.mergeLang(XY);const om=I("embed-block-drawio"),QY=!1;function YY(n,t,e,r){p(om,e,`parameter missing: ${e}`),p(om,n,`parameter missing: ${n}`),z4(n,t,r,QY)}function X4(n,t,e){const{src:r,xml:i,xmlSvg:o}=e;r?G4(r,t,n):i?W4(i,t,n):o?q4(o,t):sA(t)}function JY(n,t,e){const r=B("div",["editor-drawio-content","editor-embed"],null);t.appendChild(r),X4(n,r,e),e.height&&(t.style.height=`${e.height}px`,r.style.height=`${e.height-20}px`)}function ZY(n,t,e){const{src:r,xml:i,xmlSvg:o}=e,s=WY(t);if(r!==s.src||(i||"")!==s.xml||(o||"")!==s.xmlSvg){X4(n,t,e);return}const l=t.parentElement,c=nt(l);e.height&&e.height!==Number.parseInt(l.style.height,10)&&(l.style.height=`${e.height}px`,c&&!c.classList.contains("drawio-load-error")?t.style.height=`${e.height-20}px`:t.style.height="100%")}function tJ(n,t,e,r,i,o){const s=e.embedData;JY(n,t,s),Cf.register(n,o)}function eJ(n,t,e){const r=e.embedData,o=Ot(t).querySelector(":scope > .editor-drawio-content");return p(om,o,"embed should not be null"),ZY(n,o,r),!0}function nJ(){return{name:"UML",insertEmbedCommandItems:[{id:"insert-drawio",name:D.t("drawio.title"),icon:kT,group:"common",order:600,subText:vn("insert-drawio")}],handleInsertEmptyEmbed:async(n,t)=>{const e={src:"",xml:"",xmlSvg:""},r=n.insertEmbed(t.containerId,t.blockIndex,"drawio",e);return setTimeout(()=>{const o=Ot(r).querySelector(":scope > .editor-drawio-content");p(om,o,"embed should not be null");const s=n.getBlockData(r);YY(n,r,o,s.embedData)},100),r}}}function rJ(n,t,e,r){const{embedData:i}=t,o=i;return r==="html"?o.src?`<img src="${n.doc.buildResourceUrl(o.src,{withToken:!0})}" />`:o.xmlSvg?o.xmlSvg:"<p>[drawio]</p>":r==="markdown"?o.src?`![drawio](${n.doc.buildResourceUrl(o.src,{withToken:!0})})`:o.xmlSvg?o.xmlSvg:"[drawio]":""}const Q4={embedType:"drawio",getOptions:nJ,createEmbedContent:tJ,handleUpdateBlock:eJ,getBlockProperties:qY,convertTo:rJ},dct="";class aA extends ve.TypedEmitter{constructor(e){super();g(this,"currentBlock");g(this,"currentIframe");g(this,"onReAuthErrorWhenIframeEditing");g(this,"onIframeExitEdit");g(this,"onRecover");g(this,"destroy",()=>{this.editor.doc.externalDoc.unregisterCallback(this)});g(this,"onError",e=>{e.code===Tu.err&&this.currentIframe&&this.onConnectReAuthError()});g(this,"onAuthRecover",()=>{var e;this.currentBlock&&(Ld(this.currentBlock.id),(e=this.onRecover)==null||e.call(this))});g(this,"unregisterCallbacks",()=>{this.editor.doc.unregisterCallback(this)});g(this,"register",(e,r,i)=>{this.currentBlock=e,this.currentIframe=r,this.onReAuthErrorWhenIframeEditing=i.onError,this.onIframeExitEdit=i.onExit});g(this,"unRegister",()=>{this.currentBlock=void 0,this.currentIframe=void 0,this.onReAuthErrorWhenIframeEditing=void 0});g(this,"onConnectReAuthError",()=>{var e;if(this.currentBlock&&this.currentIframe){(e=this.onReAuthErrorWhenIframeEditing)==null||e.call(this,this.currentBlock,this.currentIframe);const r=Dg(this.currentBlock.id),i=B("div",["iframe-embed-auth-error-tips"],r);i.innerHTML=D.t("authError.tips"),i.addEventListener("click",o=>{var l,c;const s=o.target;if(s instanceof HTMLSpanElement)switch(s.id){case"retry":(c=(l=this.editor.doc).triggerReAuth)==null||c.call(l);break;case"exit":this.exit();break}})}});this.editor=e,this.editor.doc.externalDoc.registerCallback(this)}exit(){var e;this.currentBlock&&Ld(this.currentBlock.id),this.unRegister(),(e=this.onIframeExitEdit)==null||e.call(this)}}const iJ=`<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
937
937
  <g>
938
938
  <path fill-rule="evenodd" clip-rule="evenodd" d="M12 7.61719C11.4477 7.61719 11 7.16947 11 6.61719V3.61719C11 3.0649 11.4477 2.61719 12 2.61719C12.5523 2.61719 13 3.0649 13 3.61719V6.61719C13 7.16947 12.5523 7.61719 12 7.61719ZM4.92893 5.54612C5.31946 5.15559 5.95262 5.1556 6.34315 5.54612L8.46447 7.66744C8.85499 8.05796 8.85499 8.69113 8.46447 9.08165C8.07394 9.47218 7.44078 9.47218 7.05025 9.08165L4.92893 6.96033C4.53841 6.56981 4.53841 5.93664 4.92893 5.54612ZM15.5355 9.08165C15.145 8.69113 15.145 8.05796 15.5355 7.66744L17.6569 5.54612C18.0474 5.1556 18.6805 5.1556 19.0711 5.54612C19.4616 5.93664 19.4616 6.56981 19.0711 6.96033L16.9497 9.08165C16.5592 9.47218 15.9261 9.47218 15.5355 9.08165ZM2 12.6172C2 12.0649 2.44772 11.6172 3 11.6172L6 11.6172C6.55229 11.6172 7 12.0649 7 12.6172C7 13.1695 6.55228 13.6172 6 13.6172L3 13.6172C2.44772 13.6172 2 13.1695 2 12.6172ZM17 12.6172C17 12.0649 17.4477 11.6172 18 11.6172L21 11.6172C21.5523 11.6172 22 12.0649 22 12.6172C22 13.1695 21.5523 13.6172 21 13.6172L18 13.6172C17.4477 13.6172 17 13.1695 17 12.6172ZM15.5355 16.1527C15.9261 15.7622 16.5592 15.7622 16.9497 16.1527L19.0711 18.274C19.4616 18.6646 19.4616 19.2977 19.0711 19.6883C18.6805 20.0788 18.0474 20.0788 17.6569 19.6883L15.5355 17.5669C15.145 17.1764 15.145 16.5432 15.5355 16.1527ZM4.92893 19.6883C4.53841 19.2977 4.53841 18.6646 4.92893 18.274L7.05025 16.1527C7.44078 15.7622 8.07394 15.7622 8.46447 16.1527C8.85499 16.5432 8.85499 17.1764 8.46447 17.5669L6.34315 19.6883C5.95262 20.0788 5.31946 20.0788 4.92893 19.6883ZM12 22.6172C11.4477 22.6172 11 22.1695 11 21.6172V18.6172C11 18.0649 11.4477 17.6172 12 17.6172C12.5523 17.6172 13 18.0649 13 18.6172V21.6172C13 22.1695 12.5523 22.6172 12 22.6172Z" fill="#5587F0"/>
939
939
  <animateTransform attributeType="xml" attributeName="transform" type="rotate" values="0 12 12.5;360 12 12.5" dur="2s" repeatCount="indefinite" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.3-bate.11",
3
+ "version": "1.1.3-bate.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",