md-editor-v3 4.5.0-beta.0 → 4.5.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/lib/cjs/MdEditor.cjs +10 -10
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +513 -512
- package/lib/es/index.mjs +16 -17
- package/lib/types/MdEditor/type.d.ts +2 -4
- package/lib/umd/index.js +35 -35
- package/package.json +2 -2
package/README.md
CHANGED
package/lib/cjs/MdEditor.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var mt=Object.defineProperty;var ft=(e,l,o)=>l in e?mt(e,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[l]=o;var R=(e,l,o)=>(ft(e,typeof l!="symbol"?l+"":l,o),o);const t=require("vue"),r=require("./chunks/config.cjs"),z=require("@vavt/util"),W=require("./chunks/index2.cjs"),b=require("./chunks/index4.cjs"),w=require("./chunks/index.cjs"),gt=require("./chunks/dom.cjs"),k=require("./chunks/index3.cjs"),J=require("codemirror"),te=require("@codemirror/view"),bt=require("@codemirror/language-data"),ht=require("@codemirror/lang-markdown"),dt=require("@codemirror/lang-html"),ne=require("@codemirror/commands"),oe=require("@codemirror/language"),c=require("@lezer/highlight"),M=require("@codemirror/state"),vt=require("@codemirror/autocomplete"),ut=require("./MdCatalog.cjs"),Je=require("./chunks/vue-tsx.cjs"),pt=require("./NormalToolbar.cjs"),kt=require("./ModalToolbar.cjs");require("medium-zoom");require("copy-to-clipboard");require("markdown-it");require("markdown-it-image-figures");require("markdown-it-task-lists");require("lru-cache");const Ct=t.defineComponent({setup(){return()=>t.createVNode("div",{class:`${r.prefix}-divider`},null)}}),xt={noPrettier:{type:Boolean},toolbars:{type:Array,default:()=>[]},toolbarsExclude:{type:Array,default:()=>[]},setting:{type:Object,default:()=>({})},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:""},updateSetting:{type:Function,default:()=>{}},tableShape:{type:Array,default:()=>[6,4]},defToolbars:{type:Object},noUploadImg:{type:Boolean},showToolbarName:{type:Boolean}},Nt=e=>{var s,f,m,h;const l=t.inject("editorId");let o=(f=(s=r.configOption.editorExtensions)==null?void 0:s.screenfull)==null?void 0:f.instance;const a=(h=(m=r.configOption.editorExtensions)==null?void 0:m.screenfull)==null?void 0:h.js,n=t.ref(!1),i=N=>{if(!o){b.bus.emit(l,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}o.isEnabled?(n.value=!0,(N===void 0?!o.isFullscreen:N)?o.request():o.exit()):console.error("browser does not support screenfull!")},u=()=>{o&&o.isEnabled&&o.on("change",()=>{(n.value||e.setting.fullscreen)&&(n.value=!1,e.updateSetting("fullscreen"))})},d=()=>{o=window.screenfull,u()};return t.onMounted(()=>{if(u(),!o){const N=document.createElement("script");N.src=a||r.screenfullUrl,N.onload=d,N.id=`${r.prefix}-screenfull`,gt.appendHandler(N,"screenfull")}}),t.onMounted(()=>{b.bus.on(l,{name:w.CHANGE_FULL_SCREEN,callback:i})}),{fullscreenHandler:i}},Vt={tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}},$t=t.defineComponent({name:"TableShape",props:Vt,setup(e){const l=t.reactive({x:-1,y:-1});return()=>t.createVNode("div",{class:`${r.prefix}-table-shape`,onMouseleave:()=>{l.x=-1,l.y=-1}},[new Array(e.tableShape[1]).fill("").map((o,a)=>t.createVNode("div",{class:`${r.prefix}-table-shape-row`,key:`table-shape-row-${a}`},[new Array(e.tableShape[0]).fill("").map((n,i)=>t.createVNode("div",{class:`${r.prefix}-table-shape-col`,key:`table-shape-col-${i}`,onMouseenter:()=>{l.x=a,l.y=i},onClick:()=>{e.onSelected(l)}},[t.createVNode("div",{class:[`${r.prefix}-table-shape-col-default`,a<=l.x&&i<=l.y&&`${r.prefix}-table-shape-col-include`]},null)]))]))])}}),yt=$t,Tt={type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},wt=t.defineComponent({props:Tt,setup(e){const l=t.inject("usedLanguageText"),o=t.inject("editorId"),a=t.computed(()=>{var i,u;switch(e.type){case"link":return(i=l.value.linkModalTips)==null?void 0:i.linkTitle;case"image":return(u=l.value.linkModalTips)==null?void 0:u.imageTitle;default:return""}}),n=t.reactive({desc:"",url:""});return t.watch(()=>e.visible,i=>{i||setTimeout(()=>{n.desc="",n.url=""},200)}),()=>t.createVNode(k.MdModal,{title:a.value,visible:e.visible,onClose:e.onCancel},{default:()=>{var i,u,d,s,f;return[t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("label",{class:`${r.prefix}-label`,for:`link-desc-${o}`},[(i=l.value.linkModalTips)==null?void 0:i.descLabel]),t.createVNode("input",{placeholder:(u=l.value.linkModalTips)==null?void 0:u.descLabelPlaceHolder,class:`${r.prefix}-input`,id:`link-desc-${o}`,type:"text",value:n.desc,onChange:m=>{n.desc=m.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("label",{class:`${r.prefix}-label`,for:`link-url-${o}`},[(d=l.value.linkModalTips)==null?void 0:d.urlLabel]),t.createVNode("input",{placeholder:(s=l.value.linkModalTips)==null?void 0:s.urlLabelPlaceHolder,class:`${r.prefix}-input`,id:`link-url-${o}`,type:"text",value:n.url,onChange:m=>{n.url=m.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("button",{class:[`${r.prefix}-btn`,`${r.prefix}-btn-row`],type:"button",onClick:()=>{e.onOk(n),n.desc="",n.url=""}},[(f=l.value.linkModalTips)==null?void 0:f.buttonOK])])]}})}}),St={visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},It=t.defineComponent({props:St,setup(e){var m,h,N;const l=t.inject("usedLanguageText"),o=t.inject("editorId");let a=(N=(h=(m=r.configOption)==null?void 0:m.editorExtensions)==null?void 0:h.cropper)==null?void 0:N.instance;const n=t.ref(),i=t.ref(),u=t.ref(),d=t.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let s=null;t.watch(()=>e.visible,()=>{e.visible&&!d.cropperInited&&(a=a||window.Cropper,n.value.onchange=()=>{if(!a){b.bus.emit(o,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const $=n.value.files||[];if(d.imgSelected=!0,($==null?void 0:$.length)>0){const v=new FileReader;v.onload=g=>{d.imgSrc=g.target.result,t.nextTick(()=>{s=new a(i.value,{viewMode:2,preview:`.${r.prefix}-clip-preview-target`})})},v.readAsDataURL($[0])}})}),t.watch(()=>[d.imgSelected],()=>{u.value.style=""}),t.watch(()=>d.isFullscreen,()=>{t.nextTick(()=>{s==null||s.destroy(),u.value.style="",i.value&&(s=new a(i.value,{viewMode:2,preview:`.${r.prefix}-clip-preview-target`}))})});const f=()=>{s.clear(),s.destroy(),s=null,n.value.value="",d.imgSelected=!1};return()=>{var $;return t.createVNode(k.MdModal,{class:`${r.prefix}-modal-clip`,title:($=l.value.clipModalTips)==null?void 0:$.title,visible:e.visible,onClose:e.onCancel,showAdjust:!0,isFullscreen:d.isFullscreen,onAdjust:v=>{d.isFullscreen=v},width:"668px",height:"421px"},{default:()=>{var v,g;return[t.createVNode("div",{class:`${r.prefix}-form-item ${r.prefix}-clip`},[t.createVNode("div",{class:`${r.prefix}-clip-main`},[d.imgSelected?t.createVNode("div",{class:`${r.prefix}-clip-cropper`},[t.createVNode("img",{src:d.imgSrc,ref:i,style:{display:"none"},alt:""},null),t.createVNode("div",{class:`${r.prefix}-clip-delete`,onClick:f},[t.createVNode(k.Icon,{name:"delete"},null)])]):t.createVNode("div",{class:`${r.prefix}-clip-upload`,onClick:()=>{n.value.click()}},[t.createVNode(k.Icon,{name:"upload"},null)])]),t.createVNode("div",{class:`${r.prefix}-clip-preview`},[t.createVNode("div",{class:`${r.prefix}-clip-preview-target`,ref:u},null)])]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("button",{class:`${r.prefix}-btn`,type:"button",onClick:()=>{if(s){const p=s.getCroppedCanvas();b.bus.emit(o,"uploadImage",[b.base642File(p.toDataURL("image/png"))],e.onOk),f()}}},[((v=l.value.clipModalTips)==null?void 0:v.buttonUpload)||((g=l.value.linkModalTips)==null?void 0:g.buttonOK)])]),t.createVNode("input",{ref:n,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),At={type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},Mt=t.defineComponent({props:At,setup(e){return()=>t.createVNode(t.Fragment,null,[t.createVNode(wt,{type:e.type,visible:e.linkVisible,onOk:e.onOk,onCancel:e.onCancel},null),t.createVNode(It,{visible:e.clipVisible,onOk:e.onOk,onCancel:e.onCancel},null)])}}),Et=t.defineComponent({name:"MDEditorToolbar",props:xt,setup(e){const l=t.inject("editorId"),o=t.inject("usedLanguageText"),{fullscreenHandler:a}=Nt(e),n=`${l}-toolbar-wrapper`,i=t.ref(),u=t.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),d=(v,g)=>{b.bus.emit(l,"replace",v,g)},s=t.reactive({type:"link",linkVisible:!1,clipVisible:!1}),f=t.ref();t.onMounted(()=>{b.bus.on(l,{name:"openModals",callback(v){s.type=v,s.linkVisible=!0}})});const m=t.computed(()=>{const v=e.toolbars.filter(y=>!e.toolbarsExclude.includes(y)),g=v.indexOf("="),p=g===-1?v:v.slice(0,g+1),V=g===-1?[]:v.slice(g,Number.MAX_SAFE_INTEGER);return[p,V]}),h=t.ref(),N=()=>{b.bus.emit(l,"uploadImage",Array.from(h.value.files||[])),h.value.value=""};t.onMounted(()=>{h.value.addEventListener("change",N)});const $=v=>{var g,p,V,y,T,A,x,I,q,E,L,B,O,D,G,P,le,Z,U,j,X,_,H,F,Y,ae,ue,me,fe,ge,be,he,ve,pe,ke,Ce,xe,Ne,Ve,$e,ye,Te,we,Se,Ie,Ae,Me,Ee,Le,De,He,Oe,Fe,Be,qe,Re,Pe,je,Ge,Ue,_e,Ke,We,ze,Ze,Xe,Ye;if(r.allToolbar.includes(v))switch(v){case"-":return t.createVNode(Ct,null,null);case"bold":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(g=o.value.toolbarTips)==null?void 0:g.bold,onClick:()=>{d("bold")}},[t.createVNode(k.Icon,{name:"bold"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(p=o.value.toolbarTips)==null?void 0:p.bold])]);case"underline":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(V=o.value.toolbarTips)==null?void 0:V.underline,onClick:()=>{d("underline")}},[t.createVNode(k.Icon,{name:"underline"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(y=o.value.toolbarTips)==null?void 0:y.underline])]);case"italic":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(T=o.value.toolbarTips)==null?void 0:T.italic,onClick:()=>{d("italic")}},[t.createVNode(k.Icon,{name:"italic"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(A=o.value.toolbarTips)==null?void 0:A.italic])]);case"strikeThrough":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(x=o.value.toolbarTips)==null?void 0:x.strikeThrough,onClick:()=>{d("strikeThrough")}},[t.createVNode(k.Icon,{name:"strike-through"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(I=o.value.toolbarTips)==null?void 0:I.strikeThrough])]);case"title":return t.createVNode(W.Dropdown,{relative:`#${n}`,visible:u.title,onChange:C=>{u.title=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.title=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h1")}},[(q=o.value.titleItem)==null?void 0:q.h1]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h2")}},[(E=o.value.titleItem)==null?void 0:E.h2]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h3")}},[(L=o.value.titleItem)==null?void 0:L.h3]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h4")}},[(B=o.value.titleItem)==null?void 0:B.h4]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h5")}},[(O=o.value.titleItem)==null?void 0:O.h5]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h6")}},[(D=o.value.titleItem)==null?void 0:D.h6])])},{default:()=>{var C,S;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.title},[t.createVNode(k.Icon,{name:"title"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(S=o.value.toolbarTips)==null?void 0:S.title])])]}});case"sub":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(G=o.value.toolbarTips)==null?void 0:G.sub,onClick:()=>{d("sub")}},[t.createVNode(k.Icon,{name:"sub"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(P=o.value.toolbarTips)==null?void 0:P.sub])]);case"sup":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(le=o.value.toolbarTips)==null?void 0:le.sup,onClick:()=>{d("sup")}},[t.createVNode(k.Icon,{name:"sup"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Z=o.value.toolbarTips)==null?void 0:Z.sup])]);case"quote":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(U=o.value.toolbarTips)==null?void 0:U.quote,onClick:()=>{d("quote")}},[t.createVNode(k.Icon,{name:"quote"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(j=o.value.toolbarTips)==null?void 0:j.quote])]);case"unorderedList":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(X=o.value.toolbarTips)==null?void 0:X.unorderedList,onClick:()=>{d("unorderedList")}},[t.createVNode(k.Icon,{name:"unordered-list"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(_=o.value.toolbarTips)==null?void 0:_.unorderedList])]);case"orderedList":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(H=o.value.toolbarTips)==null?void 0:H.orderedList,onClick:()=>{d("orderedList")}},[t.createVNode(k.Icon,{name:"ordered-list"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(F=o.value.toolbarTips)==null?void 0:F.orderedList])]);case"task":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Y=o.value.toolbarTips)==null?void 0:Y.task,onClick:()=>{d("task")}},[t.createVNode(k.Icon,{name:"task"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ae=o.value.toolbarTips)==null?void 0:ae.task])]);case"codeRow":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(ue=o.value.toolbarTips)==null?void 0:ue.codeRow,onClick:()=>{d("codeRow")}},[t.createVNode(k.Icon,{name:"code-row"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(me=o.value.toolbarTips)==null?void 0:me.codeRow])]);case"code":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(fe=o.value.toolbarTips)==null?void 0:fe.code,onClick:()=>{d("code")}},[t.createVNode(k.Icon,{name:"code"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ge=o.value.toolbarTips)==null?void 0:ge.code])]);case"link":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(be=o.value.toolbarTips)==null?void 0:be.link,onClick:()=>{s.type="link",s.linkVisible=!0}},[t.createVNode(k.Icon,{name:"link"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(he=o.value.toolbarTips)==null?void 0:he.link])]);case"image":return e.noUploadImg?t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(ve=o.value.toolbarTips)==null?void 0:ve.image,onClick:()=>{s.type="image",s.linkVisible=!0}},[t.createVNode(k.Icon,{name:"image"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(pe=o.value.toolbarTips)==null?void 0:pe.image])]):t.createVNode(W.Dropdown,{relative:`#${n}`,visible:u.image,onChange:C=>{u.image=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.title=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{s.type="image",s.linkVisible=!0}},[(ke=o.value.imgTitleItem)==null?void 0:ke.link]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{h.value.click()}},[(Ce=o.value.imgTitleItem)==null?void 0:Ce.upload]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{s.clipVisible=!0}},[(xe=o.value.imgTitleItem)==null?void 0:xe.clip2upload])])},{default:()=>{var C,S;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.image},[t.createVNode(k.Icon,{name:"image"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(S=o.value.toolbarTips)==null?void 0:S.image])])]}});case"table":return t.createVNode(W.Dropdown,{relative:`#${n}`,visible:u.table,onChange:C=>{u.table=C},key:"bar-table",overlay:t.createVNode(yt,{tableShape:e.tableShape,onSelected:C=>{d("table",{selectedShape:C})}},null)},{default:()=>{var C,S;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.table},[t.createVNode(k.Icon,{name:"table"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(S=o.value.toolbarTips)==null?void 0:S.table])])]}});case"revoke":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Ne=o.value.toolbarTips)==null?void 0:Ne.revoke,onClick:()=>{b.bus.emit(l,"ctrlZ")}},[t.createVNode(k.Icon,{name:"revoke"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Ve=o.value.toolbarTips)==null?void 0:Ve.revoke])]);case"next":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:($e=o.value.toolbarTips)==null?void 0:$e.next,onClick:()=>{b.bus.emit(l,"ctrlShiftZ")}},[t.createVNode(k.Icon,{name:"next"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ye=o.value.toolbarTips)==null?void 0:ye.next])]);case"save":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Te=o.value.toolbarTips)==null?void 0:Te.save,onClick:()=>{b.bus.emit(l,w.ON_SAVE)}},[t.createVNode(k.Icon,{name:"baocun"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(we=o.value.toolbarTips)==null?void 0:we.save])]);case"prettier":return e.noPrettier?"":t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Se=o.value.toolbarTips)==null?void 0:Se.prettier,onClick:()=>{d("prettier")}},[t.createVNode(k.Icon,{name:"prettier"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Ie=o.value.toolbarTips)==null?void 0:Ie.prettier])]);case"pageFullscreen":return!e.setting.fullscreen&&t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Ae=o.value.toolbarTips)==null?void 0:Ae.pageFullscreen,onClick:()=>{e.updateSetting("pageFullscreen")}},[t.createVNode(k.Icon,{name:e.setting.pageFullscreen?"suoxiao":"fangda"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Me=o.value.toolbarTips)==null?void 0:Me.pageFullscreen])]);case"fullscreen":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Ee=o.value.toolbarTips)==null?void 0:Ee.fullscreen,onClick:()=>{a()}},[t.createVNode(k.Icon,{name:e.setting.fullscreen?"fullscreen-exit":"fullscreen"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Le=o.value.toolbarTips)==null?void 0:Le.fullscreen])]);case"preview":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(De=o.value.toolbarTips)==null?void 0:De.preview,onClick:()=>{e.updateSetting("preview")}},[t.createVNode(k.Icon,{name:"preview"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(He=o.value.toolbarTips)==null?void 0:He.preview])]);case"htmlPreview":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Oe=o.value.toolbarTips)==null?void 0:Oe.htmlPreview,onClick:()=>{e.updateSetting("htmlPreview")}},[t.createVNode(k.Icon,{name:"coding"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Fe=o.value.toolbarTips)==null?void 0:Fe.htmlPreview])]);case"catalog":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Be=o.value.toolbarTips)==null?void 0:Be.catalog,onClick:()=>{b.bus.emit(l,w.CHANGE_CATALOG_VISIBLE)},key:"bar-catalog"},[t.createVNode(k.Icon,{name:"catalog"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(qe=o.value.toolbarTips)==null?void 0:qe.catalog])]);case"github":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Re=o.value.toolbarTips)==null?void 0:Re.github,onClick:()=>z.linkTo("https://github.com/imzbf/md-editor-v3")},[t.createVNode(k.Icon,{name:"github"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Pe=o.value.toolbarTips)==null?void 0:Pe.github])]);case"mermaid":return t.createVNode(W.Dropdown,{relative:`#${n}`,visible:u.mermaid,onChange:C=>{u.mermaid=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.mermaid=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("flow")}},[(je=o.value.mermaid)==null?void 0:je.flow]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("sequence")}},[(Ge=o.value.mermaid)==null?void 0:Ge.sequence]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("gantt")}},[(Ue=o.value.mermaid)==null?void 0:Ue.gantt]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("class")}},[(_e=o.value.mermaid)==null?void 0:_e.class]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("state")}},[(Ke=o.value.mermaid)==null?void 0:Ke.state]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("pie")}},[(We=o.value.mermaid)==null?void 0:We.pie]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("relationship")}},[(ze=o.value.mermaid)==null?void 0:ze.relationship]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("journey")}},[(Ze=o.value.mermaid)==null?void 0:Ze.journey])]),key:"bar-mermaid"},{default:()=>{var C,S;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.mermaid},[t.createVNode(k.Icon,{name:"mermaid"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(S=o.value.toolbarTips)==null?void 0:S.mermaid])])]}});case"katex":return t.createVNode(W.Dropdown,{relative:`#${n}`,visible:u.katex,onChange:C=>{u.katex=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.katex=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("katexInline")}},[(Xe=o.value.katex)==null?void 0:Xe.inline]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("katexBlock")}},[(Ye=o.value.katex)==null?void 0:Ye.block])]),key:"bar-katex"},{default:()=>{var C,S;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.katex},[t.createVNode(k.Icon,{name:"formula"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(S=o.value.toolbarTips)==null?void 0:S.katex])])]}})}else if(e.defToolbars instanceof Array){const C=e.defToolbars[v];return C?t.cloneVNode(C,{insert(ce){b.bus.emit(l,"replace","universal",{generate:ce})}}):""}else if(e.defToolbars&&e.defToolbars.children instanceof Array){const C=e.defToolbars.children[v];return C?t.cloneVNode(C,{insert(ce){b.bus.emit(l,"replace","universal",{generate:ce})}}):""}else return""};return t.watch(()=>e.toolbars,()=>{t.nextTick(()=>{i.value&&z.draggingScroll(i.value)})},{immediate:!0}),()=>{const v=m.value[0].map(p=>$(p)),g=m.value[1].map(p=>$(p));return t.createVNode(t.Fragment,null,[e.toolbars.length>0&&t.createVNode("div",{class:`${r.prefix}-toolbar-wrapper`,ref:i,id:n},[t.createVNode("div",{class:[`${r.prefix}-toolbar`,e.showToolbarName&&`${r.prefix}-stn`]},[t.createVNode("div",{class:`${r.prefix}-toolbar-left`,ref:f},[v]),t.createVNode("div",{class:`${r.prefix}-toolbar-right`},[g])])]),t.createVNode("input",{ref:h,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),t.createVNode(Mt,{linkVisible:s.linkVisible,clipVisible:s.clipVisible,type:s.type,onCancel:()=>{s.linkVisible=!1,s.clipVisible=!1},onOk:p=>{p&&d(s.type,{desc:p.desc,url:p.url}),s.linkVisible=!1,s.clipVisible=!1}},null)])}}}),Lt=(e,l)=>{const o=z.debounce(()=>{e.removeEventListener("scroll",a),e.addEventListener("scroll",a),l.removeEventListener("scroll",a),l.addEventListener("scroll",a)},50),a=n=>{const i=e.clientHeight,u=l.clientHeight,d=e.scrollHeight,s=l.scrollHeight,f=(d-i)/(s-u);n.target===e?(l.removeEventListener("scroll",a),l.scrollTo({top:e.scrollTop/f}),o()):(e.removeEventListener("scroll",a),e.scrollTo({top:l.scrollTop*f}),o())};return[()=>{o().finally(()=>{e.dispatchEvent(new Event("scroll"))})},()=>{e.removeEventListener("scroll",a),l.removeEventListener("scroll",a)}]},Dt=(e,l,o)=>{const{view:a}=o,n=h=>a.lineBlockAt(a.state.doc.line(h).from).top,i=h=>a.lineBlockAt(a.state.doc.line(h).from).height;let u=[];const d=()=>{u=[];const h=Array.from(l.querySelectorAll("[data-line]")).map(g=>Number(g.dataset.line)+1),{lines:N}=a.state.doc;let $=1,v=h.shift()??N;for(let g=1;g<=N;g++)g===v&&($=g,v=h.shift()||N+1),u.push({start:$,end:v-1})};let s=0,f=0;const m=z.throttle(h=>{var v,g,p,V,y,T,A;if(!((v=l.firstElementChild)!=null&&v.firstElementChild))return;const N=a.lineBlockAtHeight(a.scrollDOM.scrollTop),{number:$}=a.state.doc.lineAt(N.from);if(!($>u.length)&&!(a.state.doc.lines<u[u.length-1].end))if(h.target===e){if(f!==0)return;s++;const x=u[$-1],I=n(x.end)+i(x.end);let q=0;const E=n(x.start),L=l.querySelector(`[data-line="${x.start-1}"]`)||((g=l.firstElementChild)==null?void 0:g.firstElementChild),B=l.querySelector(`[data-line="${x.end}"]`)||((p=l.lastElementChild)==null?void 0:p.lastElementChild);let O=0,D=0;E===0?(q=(a.scrollDOM.scrollTop-E)/(I-E),O=B.offsetTop):I>a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight?(q=(a.scrollDOM.scrollTop-E)/(a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight-E),D=L.offsetTop,O=l.scrollHeight-l.clientHeight-D+10):(q=(a.scrollDOM.scrollTop-E)/(I-E),D=L.offsetTop,O=B.offsetTop-D);const G=D-10+O*q;z.smoothScroll(l,G,()=>{s--})}else{if(s!==0)return;f++;const x=Array.from(l.querySelectorAll("[data-line]")),I=l.scrollTop,q=l.scrollHeight;let E=x.length===0?1:Math.ceil(Number(x[x.length-1].dataset.line)*(I/q)),L=(V=l.firstElementChild)==null?void 0:V.firstElementChild;for(let H=E;H>=0;H--){const F=l.querySelector(`[data-line="${H}"]`);if(F&&F.offsetTop<=I){L=F,E=H;break}}let B=(y=l.firstElementChild)==null?void 0:y.firstElementChild,O=(T=l.firstElementChild)==null?void 0:T.lastElementChild;for(;x.length>0;){const H=x.indexOf(L);if(H+1>=x.length)break;const F=x[H+1];if(H===-1){O=F;break}const Y=L.offsetTop;if(Y>I){if(H===0){B=L,O=F;break}L=x[H-1];continue}const ae=F.offsetTop;if(Y<=I&&ae>I){B=L,O=F;break}L=F}const D=B.offsetTop,G=O.offsetTop;let P=0;const{start:le,end:Z}=u[Number(B.dataset.line||0)],U=n(le);let j=n(Z);const X=i(Z);let _=0;B===((A=l.firstElementChild)==null?void 0:A.firstElementChild)?(P=Math.max(I/G,0),_=j+X-U):j>a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight?(P=Math.max((I-D)/(l.scrollHeight-D-l.clientHeight),0),j=n(a.state.doc.lines)+i(a.state.doc.lines),_=8+j-U-e.clientHeight):(P=Math.max((I-D)/(G-D),0),_=j+X-U),z.smoothScroll(e,U+_*P,()=>{f--})}},10);return[()=>{d(),e.addEventListener("scroll",m),l.addEventListener("scroll",m),e.dispatchEvent(new Event("scroll"))},()=>{u=[],e.removeEventListener("scroll",m),l.removeEventListener("scroll",m)}]},Ht=(e,l,o)=>{const a=t.inject("editorId");let n=()=>{},i=()=>{};const u=()=>{n();const d=document.querySelector(".cm-scroller"),s=document.querySelector(`[id="${a}-preview-wrapper"][data-show="true"]`),f=document.querySelector(`[id="${a}-html-wrapper"][data-show="true"]`);(s||f)&&([i,n]=(s?Dt:Lt)(d,s||f,o.value)),e.scrollAuto&&i()};t.watch([l,t.toRef(e.setting,"preview"),t.toRef(e.setting,"htmlPreview"),t.toRef(e.setting,"fullscreen"),t.toRef(e.setting,"pageFullscreen")],()=>{t.nextTick(u)}),t.watch(()=>e.scrollAuto,d=>{d?i():n()}),t.onMounted(u)},Ot=Ht,Ft=(e,l,o)=>{var m,h,N,$,v,g;let a="",n=0,i=0,u=!0,d=!1;const s=l.getSelectedText(),f=(m=r.configOption.editorConfig)==null?void 0:m.mermaidTemplate;if(/^h[1-6]{1}$/.test(e)){const p=e.replace(/^h(\d)/,(V,y)=>new Array(Number(y)).fill("#",0,y).join(""));a=`${p} ${s}`,n=p.length+1}else if(e==="prettier"){const p=window.prettier||((N=(h=r.configOption.editorExtensions)==null?void 0:h.prettier)==null?void 0:N.prettierInstance),V=[(($=window.prettierPlugins)==null?void 0:$.markdown)||((g=(v=r.configOption.editorExtensions)==null?void 0:v.prettier)==null?void 0:g.parserMarkdownInstance)];!p||V[0]===void 0?(b.bus.emit(o.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),a=l.getValue()):a=p.format(l.getValue(),{parser:"markdown",plugins:V}),u=!1,d=!0}else switch(e){case"bold":{a=`**${s}**`,n=2,i=-2;break}case"underline":{a=`<u>${s}</u>`,n=3,i=-4;break}case"italic":{a=`*${s}*`,n=1,i=-1;break}case"strikeThrough":{a=`~~${s}~~`,n=2,i=-2;break}case"sub":{a=`<sub>${s}</sub>`,n=5,i=-6;break}case"sup":{a=`<sup>${s}</sup>`,n=5,i=-6;break}case"codeRow":{a="`"+s+"`",n=1,i=-1;break}case"quote":{a=`> ${s}`,n=2;break}case"orderedList":{a=`1. ${s}`,n=3;break}case"unorderedList":{a=`- ${s}`,n=2;break}case"task":{a=`- [ ] ${s}`,n=6;break}case"code":{const p=o.text||s||"",V=o.mode||"language";a=`\`\`\`${V}
|
|
2
|
-
${
|
|
1
|
+
"use strict";var ut=Object.defineProperty;var mt=(e,l,o)=>l in e?ut(e,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[l]=o;var P=(e,l,o)=>(mt(e,typeof l!="symbol"?l+"":l,o),o);const t=require("vue"),r=require("./chunks/config.cjs"),Z=require("@vavt/util"),z=require("./chunks/index2.cjs"),b=require("./chunks/index4.cjs"),S=require("./chunks/index.cjs"),ft=require("./chunks/dom.cjs"),k=require("./chunks/index3.cjs"),ee=require("codemirror"),le=require("@codemirror/view"),gt=require("@codemirror/language-data"),bt=require("@codemirror/lang-markdown"),ce=require("@codemirror/commands"),ae=require("@codemirror/language"),c=require("@lezer/highlight"),H=require("@codemirror/state"),ht=require("@codemirror/autocomplete"),dt=require("./MdCatalog.cjs"),Je=require("./chunks/vue-tsx.cjs"),pt=require("./NormalToolbar.cjs"),vt=require("./ModalToolbar.cjs");require("medium-zoom");require("copy-to-clipboard");require("markdown-it");require("markdown-it-image-figures");require("markdown-it-task-lists");require("lru-cache");const kt=t.defineComponent({setup(){return()=>t.createVNode("div",{class:`${r.prefix}-divider`},null)}}),Ct={noPrettier:{type:Boolean},toolbars:{type:Array,default:()=>[]},toolbarsExclude:{type:Array,default:()=>[]},setting:{type:Object,default:()=>({})},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:""},updateSetting:{type:Function,default:()=>{}},tableShape:{type:Array,default:()=>[6,4]},defToolbars:{type:Object},noUploadImg:{type:Boolean},showToolbarName:{type:Boolean}},xt=e=>{var s,f,m,h;const l=t.inject("editorId");let o=(f=(s=r.configOption.editorExtensions)==null?void 0:s.screenfull)==null?void 0:f.instance;const a=(h=(m=r.configOption.editorExtensions)==null?void 0:m.screenfull)==null?void 0:h.js,n=t.ref(!1),i=x=>{if(!o){b.bus.emit(l,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}o.isEnabled?(n.value=!0,(x===void 0?!o.isFullscreen:x)?o.request():o.exit()):console.error("browser does not support screenfull!")},u=()=>{o&&o.isEnabled&&o.on("change",()=>{(n.value||e.setting.fullscreen)&&(n.value=!1,e.updateSetting("fullscreen"))})},d=()=>{o=window.screenfull,u()};return t.onMounted(()=>{if(u(),!o){const x=document.createElement("script");x.src=a||r.screenfullUrl,x.onload=d,x.id=`${r.prefix}-screenfull`,ft.appendHandler(x,"screenfull")}}),t.onMounted(()=>{b.bus.on(l,{name:S.CHANGE_FULL_SCREEN,callback:i})}),{fullscreenHandler:i}},Nt={tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}},Vt=t.defineComponent({name:"TableShape",props:Nt,setup(e){const l=t.reactive({x:-1,y:-1});return()=>t.createVNode("div",{class:`${r.prefix}-table-shape`,onMouseleave:()=>{l.x=-1,l.y=-1}},[new Array(e.tableShape[1]).fill("").map((o,a)=>t.createVNode("div",{class:`${r.prefix}-table-shape-row`,key:`table-shape-row-${a}`},[new Array(e.tableShape[0]).fill("").map((n,i)=>t.createVNode("div",{class:`${r.prefix}-table-shape-col`,key:`table-shape-col-${i}`,onMouseenter:()=>{l.x=a,l.y=i},onClick:()=>{e.onSelected(l)}},[t.createVNode("div",{class:[`${r.prefix}-table-shape-col-default`,a<=l.x&&i<=l.y&&`${r.prefix}-table-shape-col-include`]},null)]))]))])}}),$t=Vt,yt={type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},Tt=t.defineComponent({props:yt,setup(e){const l=t.inject("usedLanguageText"),o=t.inject("editorId"),a=t.computed(()=>{var i,u;switch(e.type){case"link":return(i=l.value.linkModalTips)==null?void 0:i.linkTitle;case"image":return(u=l.value.linkModalTips)==null?void 0:u.imageTitle;default:return""}}),n=t.reactive({desc:"",url:""});return t.watch(()=>e.visible,i=>{i||setTimeout(()=>{n.desc="",n.url=""},200)}),()=>t.createVNode(k.MdModal,{title:a.value,visible:e.visible,onClose:e.onCancel},{default:()=>{var i,u,d,s,f;return[t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("label",{class:`${r.prefix}-label`,for:`link-desc-${o}`},[(i=l.value.linkModalTips)==null?void 0:i.descLabel]),t.createVNode("input",{placeholder:(u=l.value.linkModalTips)==null?void 0:u.descLabelPlaceHolder,class:`${r.prefix}-input`,id:`link-desc-${o}`,type:"text",value:n.desc,onChange:m=>{n.desc=m.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("label",{class:`${r.prefix}-label`,for:`link-url-${o}`},[(d=l.value.linkModalTips)==null?void 0:d.urlLabel]),t.createVNode("input",{placeholder:(s=l.value.linkModalTips)==null?void 0:s.urlLabelPlaceHolder,class:`${r.prefix}-input`,id:`link-url-${o}`,type:"text",value:n.url,onChange:m=>{n.url=m.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("button",{class:[`${r.prefix}-btn`,`${r.prefix}-btn-row`],type:"button",onClick:()=>{e.onOk(n),n.desc="",n.url=""}},[(f=l.value.linkModalTips)==null?void 0:f.buttonOK])])]}})}}),wt={visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},St=t.defineComponent({props:wt,setup(e){var m,h,x;const l=t.inject("usedLanguageText"),o=t.inject("editorId");let a=(x=(h=(m=r.configOption)==null?void 0:m.editorExtensions)==null?void 0:h.cropper)==null?void 0:x.instance;const n=t.ref(),i=t.ref(),u=t.ref(),d=t.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let s=null;t.watch(()=>e.visible,()=>{e.visible&&!d.cropperInited&&(a=a||window.Cropper,n.value.onchange=()=>{if(!a){b.bus.emit(o,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const V=n.value.files||[];if(d.imgSelected=!0,(V==null?void 0:V.length)>0){const p=new FileReader;p.onload=g=>{d.imgSrc=g.target.result,t.nextTick(()=>{s=new a(i.value,{viewMode:2,preview:`.${r.prefix}-clip-preview-target`})})},p.readAsDataURL(V[0])}})}),t.watch(()=>[d.imgSelected],()=>{u.value.style=""}),t.watch(()=>d.isFullscreen,()=>{t.nextTick(()=>{s==null||s.destroy(),u.value.style="",i.value&&(s=new a(i.value,{viewMode:2,preview:`.${r.prefix}-clip-preview-target`}))})});const f=()=>{s.clear(),s.destroy(),s=null,n.value.value="",d.imgSelected=!1};return()=>{var V;return t.createVNode(k.MdModal,{class:`${r.prefix}-modal-clip`,title:(V=l.value.clipModalTips)==null?void 0:V.title,visible:e.visible,onClose:e.onCancel,showAdjust:!0,isFullscreen:d.isFullscreen,onAdjust:p=>{d.isFullscreen=p},width:"668px",height:"421px"},{default:()=>{var p,g;return[t.createVNode("div",{class:`${r.prefix}-form-item ${r.prefix}-clip`},[t.createVNode("div",{class:`${r.prefix}-clip-main`},[d.imgSelected?t.createVNode("div",{class:`${r.prefix}-clip-cropper`},[t.createVNode("img",{src:d.imgSrc,ref:i,style:{display:"none"},alt:""},null),t.createVNode("div",{class:`${r.prefix}-clip-delete`,onClick:f},[t.createVNode(k.Icon,{name:"delete"},null)])]):t.createVNode("div",{class:`${r.prefix}-clip-upload`,onClick:()=>{n.value.click()}},[t.createVNode(k.Icon,{name:"upload"},null)])]),t.createVNode("div",{class:`${r.prefix}-clip-preview`},[t.createVNode("div",{class:`${r.prefix}-clip-preview-target`,ref:u},null)])]),t.createVNode("div",{class:`${r.prefix}-form-item`},[t.createVNode("button",{class:`${r.prefix}-btn`,type:"button",onClick:()=>{if(s){const v=s.getCroppedCanvas();b.bus.emit(o,"uploadImage",[b.base642File(v.toDataURL("image/png"))],e.onOk),f()}}},[((p=l.value.clipModalTips)==null?void 0:p.buttonUpload)||((g=l.value.linkModalTips)==null?void 0:g.buttonOK)])]),t.createVNode("input",{ref:n,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),It={type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}},Mt=t.defineComponent({props:It,setup(e){return()=>t.createVNode(t.Fragment,null,[t.createVNode(Tt,{type:e.type,visible:e.linkVisible,onOk:e.onOk,onCancel:e.onCancel},null),t.createVNode(St,{visible:e.clipVisible,onOk:e.onOk,onCancel:e.onCancel},null)])}}),At=t.defineComponent({name:"MDEditorToolbar",props:Ct,setup(e){const l=t.inject("editorId"),o=t.inject("usedLanguageText"),{fullscreenHandler:a}=xt(e),n=`${l}-toolbar-wrapper`,i=t.ref(),u=t.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),d=(p,g)=>{b.bus.emit(l,"replace",p,g)},s=t.reactive({type:"link",linkVisible:!1,clipVisible:!1}),f=t.ref();t.onMounted(()=>{b.bus.on(l,{name:"openModals",callback(p){s.type=p,s.linkVisible=!0}})});const m=t.computed(()=>{const p=e.toolbars.filter($=>!e.toolbarsExclude.includes($)),g=p.indexOf("="),v=g===-1?p:p.slice(0,g+1),N=g===-1?[]:p.slice(g,Number.MAX_SAFE_INTEGER);return[v,N]}),h=t.ref(),x=()=>{b.bus.emit(l,"uploadImage",Array.from(h.value.files||[])),h.value.value=""};t.onMounted(()=>{h.value.addEventListener("change",x)});const V=p=>{var g,v,N,$,y,D,I,X,T,w,R,q,L,A,E,O,j,G,re,Y,K,U,J,_,F,B,Q,ne,fe,ge,be,he,pe,ve,ke,Ce,xe,Ne,Ve,$e,ye,Te,we,Se,Ie,Me,Ae,Ee,De,Le,He,Oe,Fe,Be,qe,Re,Pe,je,Ge,Ue,_e,Ke,We,ze,Ze,Xe,Ye;if(r.allToolbar.includes(p))switch(p){case"-":return t.createVNode(kt,null,null);case"bold":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(g=o.value.toolbarTips)==null?void 0:g.bold,onClick:()=>{d("bold")}},[t.createVNode(k.Icon,{name:"bold"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(v=o.value.toolbarTips)==null?void 0:v.bold])]);case"underline":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(N=o.value.toolbarTips)==null?void 0:N.underline,onClick:()=>{d("underline")}},[t.createVNode(k.Icon,{name:"underline"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[($=o.value.toolbarTips)==null?void 0:$.underline])]);case"italic":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(y=o.value.toolbarTips)==null?void 0:y.italic,onClick:()=>{d("italic")}},[t.createVNode(k.Icon,{name:"italic"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(D=o.value.toolbarTips)==null?void 0:D.italic])]);case"strikeThrough":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(I=o.value.toolbarTips)==null?void 0:I.strikeThrough,onClick:()=>{d("strikeThrough")}},[t.createVNode(k.Icon,{name:"strike-through"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(X=o.value.toolbarTips)==null?void 0:X.strikeThrough])]);case"title":return t.createVNode(z.Dropdown,{relative:`#${n}`,visible:u.title,onChange:C=>{u.title=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.title=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h1")}},[(T=o.value.titleItem)==null?void 0:T.h1]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h2")}},[(w=o.value.titleItem)==null?void 0:w.h2]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h3")}},[(R=o.value.titleItem)==null?void 0:R.h3]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h4")}},[(q=o.value.titleItem)==null?void 0:q.h4]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h5")}},[(L=o.value.titleItem)==null?void 0:L.h5]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("h6")}},[(A=o.value.titleItem)==null?void 0:A.h6])])},{default:()=>{var C,M;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.title},[t.createVNode(k.Icon,{name:"title"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(M=o.value.toolbarTips)==null?void 0:M.title])])]}});case"sub":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(E=o.value.toolbarTips)==null?void 0:E.sub,onClick:()=>{d("sub")}},[t.createVNode(k.Icon,{name:"sub"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(O=o.value.toolbarTips)==null?void 0:O.sub])]);case"sup":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(j=o.value.toolbarTips)==null?void 0:j.sup,onClick:()=>{d("sup")}},[t.createVNode(k.Icon,{name:"sup"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(G=o.value.toolbarTips)==null?void 0:G.sup])]);case"quote":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(re=o.value.toolbarTips)==null?void 0:re.quote,onClick:()=>{d("quote")}},[t.createVNode(k.Icon,{name:"quote"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Y=o.value.toolbarTips)==null?void 0:Y.quote])]);case"unorderedList":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(K=o.value.toolbarTips)==null?void 0:K.unorderedList,onClick:()=>{d("unorderedList")}},[t.createVNode(k.Icon,{name:"unordered-list"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(U=o.value.toolbarTips)==null?void 0:U.unorderedList])]);case"orderedList":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(J=o.value.toolbarTips)==null?void 0:J.orderedList,onClick:()=>{d("orderedList")}},[t.createVNode(k.Icon,{name:"ordered-list"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(_=o.value.toolbarTips)==null?void 0:_.orderedList])]);case"task":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(F=o.value.toolbarTips)==null?void 0:F.task,onClick:()=>{d("task")}},[t.createVNode(k.Icon,{name:"task"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(B=o.value.toolbarTips)==null?void 0:B.task])]);case"codeRow":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Q=o.value.toolbarTips)==null?void 0:Q.codeRow,onClick:()=>{d("codeRow")}},[t.createVNode(k.Icon,{name:"code-row"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ne=o.value.toolbarTips)==null?void 0:ne.codeRow])]);case"code":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(fe=o.value.toolbarTips)==null?void 0:fe.code,onClick:()=>{d("code")}},[t.createVNode(k.Icon,{name:"code"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ge=o.value.toolbarTips)==null?void 0:ge.code])]);case"link":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(be=o.value.toolbarTips)==null?void 0:be.link,onClick:()=>{s.type="link",s.linkVisible=!0}},[t.createVNode(k.Icon,{name:"link"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(he=o.value.toolbarTips)==null?void 0:he.link])]);case"image":return e.noUploadImg?t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(pe=o.value.toolbarTips)==null?void 0:pe.image,onClick:()=>{s.type="image",s.linkVisible=!0}},[t.createVNode(k.Icon,{name:"image"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ve=o.value.toolbarTips)==null?void 0:ve.image])]):t.createVNode(z.Dropdown,{relative:`#${n}`,visible:u.image,onChange:C=>{u.image=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.title=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{s.type="image",s.linkVisible=!0}},[(ke=o.value.imgTitleItem)==null?void 0:ke.link]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{h.value.click()}},[(Ce=o.value.imgTitleItem)==null?void 0:Ce.upload]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{s.clipVisible=!0}},[(xe=o.value.imgTitleItem)==null?void 0:xe.clip2upload])])},{default:()=>{var C,M;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.image},[t.createVNode(k.Icon,{name:"image"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(M=o.value.toolbarTips)==null?void 0:M.image])])]}});case"table":return t.createVNode(z.Dropdown,{relative:`#${n}`,visible:u.table,onChange:C=>{u.table=C},key:"bar-table",overlay:t.createVNode($t,{tableShape:e.tableShape,onSelected:C=>{d("table",{selectedShape:C})}},null)},{default:()=>{var C,M;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.table},[t.createVNode(k.Icon,{name:"table"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(M=o.value.toolbarTips)==null?void 0:M.table])])]}});case"revoke":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Ne=o.value.toolbarTips)==null?void 0:Ne.revoke,onClick:()=>{b.bus.emit(l,"ctrlZ")}},[t.createVNode(k.Icon,{name:"revoke"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Ve=o.value.toolbarTips)==null?void 0:Ve.revoke])]);case"next":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:($e=o.value.toolbarTips)==null?void 0:$e.next,onClick:()=>{b.bus.emit(l,"ctrlShiftZ")}},[t.createVNode(k.Icon,{name:"next"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(ye=o.value.toolbarTips)==null?void 0:ye.next])]);case"save":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Te=o.value.toolbarTips)==null?void 0:Te.save,onClick:()=>{b.bus.emit(l,S.ON_SAVE)}},[t.createVNode(k.Icon,{name:"baocun"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(we=o.value.toolbarTips)==null?void 0:we.save])]);case"prettier":return e.noPrettier?"":t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Se=o.value.toolbarTips)==null?void 0:Se.prettier,onClick:()=>{d("prettier")}},[t.createVNode(k.Icon,{name:"prettier"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Ie=o.value.toolbarTips)==null?void 0:Ie.prettier])]);case"pageFullscreen":return!e.setting.fullscreen&&t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Me=o.value.toolbarTips)==null?void 0:Me.pageFullscreen,onClick:()=>{e.updateSetting("pageFullscreen")}},[t.createVNode(k.Icon,{name:e.setting.pageFullscreen?"suoxiao":"fangda"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Ae=o.value.toolbarTips)==null?void 0:Ae.pageFullscreen])]);case"fullscreen":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Ee=o.value.toolbarTips)==null?void 0:Ee.fullscreen,onClick:()=>{a()}},[t.createVNode(k.Icon,{name:e.setting.fullscreen?"fullscreen-exit":"fullscreen"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(De=o.value.toolbarTips)==null?void 0:De.fullscreen])]);case"preview":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Le=o.value.toolbarTips)==null?void 0:Le.preview,onClick:()=>{e.updateSetting("preview")}},[t.createVNode(k.Icon,{name:"preview"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(He=o.value.toolbarTips)==null?void 0:He.preview])]);case"htmlPreview":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Oe=o.value.toolbarTips)==null?void 0:Oe.htmlPreview,onClick:()=>{e.updateSetting("htmlPreview")}},[t.createVNode(k.Icon,{name:"coding"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Fe=o.value.toolbarTips)==null?void 0:Fe.htmlPreview])]);case"catalog":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Be=o.value.toolbarTips)==null?void 0:Be.catalog,onClick:()=>{b.bus.emit(l,S.CHANGE_CATALOG_VISIBLE)},key:"bar-catalog"},[t.createVNode(k.Icon,{name:"catalog"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(qe=o.value.toolbarTips)==null?void 0:qe.catalog])]);case"github":return t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(Re=o.value.toolbarTips)==null?void 0:Re.github,onClick:()=>Z.linkTo("https://github.com/imzbf/md-editor-v3")},[t.createVNode(k.Icon,{name:"github"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(Pe=o.value.toolbarTips)==null?void 0:Pe.github])]);case"mermaid":return t.createVNode(z.Dropdown,{relative:`#${n}`,visible:u.mermaid,onChange:C=>{u.mermaid=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.mermaid=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("flow")}},[(je=o.value.mermaid)==null?void 0:je.flow]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("sequence")}},[(Ge=o.value.mermaid)==null?void 0:Ge.sequence]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("gantt")}},[(Ue=o.value.mermaid)==null?void 0:Ue.gantt]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("class")}},[(_e=o.value.mermaid)==null?void 0:_e.class]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("state")}},[(Ke=o.value.mermaid)==null?void 0:Ke.state]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("pie")}},[(We=o.value.mermaid)==null?void 0:We.pie]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("relationship")}},[(ze=o.value.mermaid)==null?void 0:ze.relationship]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("journey")}},[(Ze=o.value.mermaid)==null?void 0:Ze.journey])]),key:"bar-mermaid"},{default:()=>{var C,M;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.mermaid},[t.createVNode(k.Icon,{name:"mermaid"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(M=o.value.toolbarTips)==null?void 0:M.mermaid])])]}});case"katex":return t.createVNode(z.Dropdown,{relative:`#${n}`,visible:u.katex,onChange:C=>{u.katex=C},overlay:t.createVNode("ul",{class:`${r.prefix}-menu`,onClick:()=>{u.katex=!1}},[t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("katexInline")}},[(Xe=o.value.katex)==null?void 0:Xe.inline]),t.createVNode("li",{class:`${r.prefix}-menu-item`,onClick:()=>{d("katexBlock")}},[(Ye=o.value.katex)==null?void 0:Ye.block])]),key:"bar-katex"},{default:()=>{var C,M;return[t.createVNode("div",{class:`${r.prefix}-toolbar-item`,title:(C=o.value.toolbarTips)==null?void 0:C.katex},[t.createVNode(k.Icon,{name:"formula"},null),e.showToolbarName&&t.createVNode("div",{class:`${r.prefix}-toolbar-item-name`},[(M=o.value.toolbarTips)==null?void 0:M.katex])])]}})}else if(e.defToolbars instanceof Array){const C=e.defToolbars[p];return C?t.cloneVNode(C,{insert(de){b.bus.emit(l,"replace","universal",{generate:de})}}):""}else if(e.defToolbars&&e.defToolbars.children instanceof Array){const C=e.defToolbars.children[p];return C?t.cloneVNode(C,{insert(de){b.bus.emit(l,"replace","universal",{generate:de})}}):""}else return""};return t.watch(()=>e.toolbars,()=>{t.nextTick(()=>{i.value&&Z.draggingScroll(i.value)})},{immediate:!0}),()=>{const p=m.value[0].map(v=>V(v)),g=m.value[1].map(v=>V(v));return t.createVNode(t.Fragment,null,[e.toolbars.length>0&&t.createVNode("div",{class:`${r.prefix}-toolbar-wrapper`,ref:i,id:n},[t.createVNode("div",{class:[`${r.prefix}-toolbar`,e.showToolbarName&&`${r.prefix}-stn`]},[t.createVNode("div",{class:`${r.prefix}-toolbar-left`,ref:f},[p]),t.createVNode("div",{class:`${r.prefix}-toolbar-right`},[g])])]),t.createVNode("input",{ref:h,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),t.createVNode(Mt,{linkVisible:s.linkVisible,clipVisible:s.clipVisible,type:s.type,onCancel:()=>{s.linkVisible=!1,s.clipVisible=!1},onOk:v=>{v&&d(s.type,{desc:v.desc,url:v.url}),s.linkVisible=!1,s.clipVisible=!1}},null)])}}}),Et=(e,l)=>{const o=Z.debounce(()=>{e.removeEventListener("scroll",a),e.addEventListener("scroll",a),l.removeEventListener("scroll",a),l.addEventListener("scroll",a)},50),a=n=>{const i=e.clientHeight,u=l.clientHeight,d=e.scrollHeight,s=l.scrollHeight,f=(d-i)/(s-u);n.target===e?(l.removeEventListener("scroll",a),l.scrollTo({top:e.scrollTop/f}),o()):(e.removeEventListener("scroll",a),e.scrollTo({top:l.scrollTop*f}),o())};return[()=>{o().finally(()=>{e.dispatchEvent(new Event("scroll"))})},()=>{e.removeEventListener("scroll",a),l.removeEventListener("scroll",a)}]},Dt=(e,l,o)=>{const{view:a}=o,n=h=>a.lineBlockAt(a.state.doc.line(h).from).top,i=h=>a.lineBlockAt(a.state.doc.line(h).from).height;let u=[];const d=()=>{u=[];const h=Array.from(l.querySelectorAll("[data-line]")).map(g=>Number(g.dataset.line)+1),{lines:x}=a.state.doc;let V=1,p=h.shift()??x;for(let g=1;g<=x;g++)g===p&&(V=g,p=h.shift()||x+1),u.push({start:V,end:p-1})};let s=0,f=0;const m=Z.throttle(h=>{var v,N,$,y,D,I,X;if(!((v=l.firstElementChild)!=null&&v.firstElementChild))return;const x=a.lineBlockAtHeight(a.scrollDOM.scrollTop),{number:V}=a.state.doc.lineAt(x.from);if(V>u.length||a.state.doc.lines<u[u.length-1].end)return;let p=+getComputedStyle(l).paddingTop.replace("px","");const g=+getComputedStyle(l).paddingBottom.replace("px","");if(h.target===e){if(f!==0)return;s++;const T=u[V-1];let w=n(T.end)+i(T.end),R=0;const q=n(T.start),L=l.querySelector(`[data-line="${T.start-1}"]`)||((N=l.firstElementChild)==null?void 0:N.firstElementChild),A=l.querySelector(`[data-line="${T.end}"]`)||(($=l.lastElementChild)==null?void 0:$.lastElementChild);let E=0,O=0;q===0?L===A?(p=0,w=a.contentDOM.offsetHeight-a.scrollDOM.offsetHeight,R=a.scrollDOM.scrollTop/w,E=A.offsetTop+A.offsetHeight-l.clientHeight):(R=a.scrollDOM.scrollTop/w,E=A.offsetTop):w>a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight?(R=(a.scrollDOM.scrollTop-q)/(a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight-q),O=L.offsetTop,E=l.scrollHeight-l.clientHeight-O+10):(R=(a.scrollDOM.scrollTop-q)/(w-q),O=L.offsetTop,E=A.offsetTop-O);const j=O-p+E*R;Z.smoothScroll(l,j,()=>{s--})}else{if(s!==0)return;f++;const T=Array.from(l.querySelectorAll("[data-line]")),w=l.scrollTop,R=l.scrollHeight;let q=T.length===0?1:Math.ceil(Number(T[T.length-1].dataset.line)*(w/R)),L=(y=l.firstElementChild)==null?void 0:y.firstElementChild;for(let F=q;F>=0;F--){const B=l.querySelector(`[data-line="${F}"]`);if(B&&B.offsetTop<=w){L=B,q=F;break}}let A=(D=l.firstElementChild)==null?void 0:D.firstElementChild,E=(I=l.firstElementChild)==null?void 0:I.lastElementChild;for(;T.length>0;){const F=T.indexOf(L);if(F+1>=T.length)break;const B=T[F+1];if(F===-1){E=B;break}const Q=L.offsetTop;if(Q>w){if(F===0){A=L,E=B;break}L=T[F-1];continue}const ne=B.offsetTop;if(Q<=w&&ne>w){A=L,E=B;break}L=B}const O=A.offsetTop;let j=E.offsetTop,G=0;const{start:re,end:Y}=u[Number(A.dataset.line||0)],K=n(re);let U=n(Y);const J=i(Y);let _=0;A===((X=l.firstElementChild)==null?void 0:X.firstElementChild)?(A===E?(j=E.offsetHeight-l.offsetHeight+p+g,_=a.contentDOM.offsetHeight-a.scrollDOM.offsetHeight):_=U+J-K,G=Math.max(w/j,0)):U>a.scrollDOM.scrollHeight-a.scrollDOM.clientHeight?(G=Math.max((w-O)/(l.scrollHeight-O-l.clientHeight),0),U=n(a.state.doc.lines)+i(a.state.doc.lines),_=8+U-K-e.clientHeight):(G=Math.max((w-O)/(j-O),0),_=U+J-K),Z.smoothScroll(e,K+_*G,()=>{f--})}},10);return[()=>{d(),e.addEventListener("scroll",m),l.addEventListener("scroll",m),e.dispatchEvent(new Event("scroll"))},()=>{u=[],e.removeEventListener("scroll",m),l.removeEventListener("scroll",m)}]},Lt=(e,l,o)=>{const a=t.inject("editorId");let n=()=>{},i=()=>{};const u=()=>{n();const d=document.querySelector(".cm-scroller"),s=document.querySelector(`[id="${a}-preview-wrapper"][data-show="true"]`),f=document.querySelector(`[id="${a}-html-wrapper"][data-show="true"]`);(s||f)&&([i,n]=(s?Dt:Et)(d,s||f,o.value)),e.scrollAuto&&i()};t.watch([l,t.toRef(e.setting,"preview"),t.toRef(e.setting,"htmlPreview"),t.toRef(e.setting,"fullscreen"),t.toRef(e.setting,"pageFullscreen")],()=>{t.nextTick(u)}),t.watch(()=>e.scrollAuto,d=>{d?i():n()}),t.onMounted(u)},Ht=Lt,Ot=(e,l,o)=>{var m,h,x,V,p,g;let a="",n=0,i=0,u=!0,d=!1;const s=l.getSelectedText(),f=(m=r.configOption.editorConfig)==null?void 0:m.mermaidTemplate;if(/^h[1-6]{1}$/.test(e)){const v=e.replace(/^h(\d)/,(N,$)=>new Array(Number($)).fill("#",0,$).join(""));a=`${v} ${s}`,n=v.length+1}else if(e==="prettier"){const v=window.prettier||((x=(h=r.configOption.editorExtensions)==null?void 0:h.prettier)==null?void 0:x.prettierInstance),N=[((V=window.prettierPlugins)==null?void 0:V.markdown)||((g=(p=r.configOption.editorExtensions)==null?void 0:p.prettier)==null?void 0:g.parserMarkdownInstance)];!v||N[0]===void 0?(b.bus.emit(o.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),a=l.getValue()):a=v.format(l.getValue(),{parser:"markdown",plugins:N}),u=!1,d=!0}else switch(e){case"bold":{a=`**${s}**`,n=2,i=-2;break}case"underline":{a=`<u>${s}</u>`,n=3,i=-4;break}case"italic":{a=`*${s}*`,n=1,i=-1;break}case"strikeThrough":{a=`~~${s}~~`,n=2,i=-2;break}case"sub":{a=`<sub>${s}</sub>`,n=5,i=-6;break}case"sup":{a=`<sup>${s}</sup>`,n=5,i=-6;break}case"codeRow":{a="`"+s+"`",n=1,i=-1;break}case"quote":{a=`> ${s}`,n=2;break}case"orderedList":{a=`1. ${s}`,n=3;break}case"unorderedList":{a=`- ${s}`,n=2;break}case"task":{a=`- [ ] ${s}`,n=6;break}case"code":{const v=o.text||s||"",N=o.mode||"language";a=`\`\`\`${N}
|
|
2
|
+
${v}
|
|
3
3
|
\`\`\`
|
|
4
|
-
`,n=3,i=3+
|
|
5
|
-
|`;for(let
|
|
6
|
-
|`;for(let
|
|
7
|
-
`,""):a=``,u=!1;break}case"image":{const{desc:v,url:N,urls:$}=o;$ instanceof Array?a=$.reduce((y,D)=>y+`
|
|
7
|
+
`,""):a=`
|
|
8
8
|
`,u=!1;break}case"flow":{a=`\`\`\`mermaid
|
|
9
9
|
${(f==null?void 0:f.flow)||`flowchart TD
|
|
10
10
|
Start --> Stop`}
|
|
@@ -57,11 +57,11 @@ ${(f==null?void 0:f.journey)||`journey
|
|
|
57
57
|
`,n=3,i=10-a.length;break}case"katexInline":{a="$$",n=1,i=-1;break}case"katexBlock":{a=`$$
|
|
58
58
|
|
|
59
59
|
$$
|
|
60
|
-
`,n=3,i=-4;break}case"universal":{const{generate:
|
|
60
|
+
`,n=3,i=-4;break}case"universal":{const{generate:v}=o,N=v(s);a=N.targetValue,u=N.select,n=N.deviationStart,i=N.deviationEnd}}return{text:a,options:{select:u,deviationStart:n,deviationEnd:i,replaceAll:d}}},Ft="#e5c07b",Qe="var(--md-color)",Bt="#56b6c2",qt="#ffffff",te="var(--md-color)",et="#e5c07b",Rt="#e5c07b",Pt="var(--md-color)",tt="#d19a66",jt="#c678dd",Gt="#21252b",Ut="#2c313a",ot="var(--md-bk-color)",ue="var(--md-bk-color)",_t="#ceedfa33",lt="#528bff",Kt=le.EditorView.theme({"&":{color:te,backgroundColor:ot},".cm-content":{caretColor:lt},".cm-cursor, .cm-dropCursor":{borderLeftColor:lt},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_t},".cm-panels":{backgroundColor:Gt,color:te},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#ceedfa33"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ot,color:te,borderRight:"1px solid",borderColor:"var(--md-border-color)"},".cm-activeLineGutter":{backgroundColor:Ut},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"1px solid var(--md-border-color)",backgroundColor:ue},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:ue,borderBottomColor:ue},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{color:te}}},{dark:!0}),Wt=ae.HighlightStyle.define([{tag:c.tags.keyword,color:jt},{tag:[c.tags.name,c.tags.deleted,c.tags.character,c.tags.propertyName,c.tags.macroName],color:Qe},{tag:[c.tags.function(c.tags.variableName),c.tags.labelName],color:Rt},{tag:[c.tags.color,c.tags.constant(c.tags.name),c.tags.standard(c.tags.name)],color:tt},{tag:[c.tags.definition(c.tags.name),c.tags.separator],color:te},{tag:[c.tags.typeName,c.tags.className,c.tags.number,c.tags.changed,c.tags.annotation,c.tags.modifier,c.tags.self,c.tags.namespace],color:Ft},{tag:[c.tags.operator,c.tags.operatorKeyword,c.tags.url,c.tags.escape,c.tags.regexp,c.tags.link,c.tags.special(c.tags.string)],color:Bt},{tag:[c.tags.meta,c.tags.comment],color:et},{tag:c.tags.strong,fontWeight:"bold"},{tag:c.tags.emphasis,fontStyle:"italic"},{tag:c.tags.strikethrough,textDecoration:"line-through"},{tag:c.tags.link,color:et,textDecoration:"underline"},{tag:c.tags.heading,fontWeight:"bold",color:Qe},{tag:[c.tags.atom,c.tags.bool,c.tags.special(c.tags.variableName)],color:tt},{tag:[c.tags.processingInstruction,c.tags.string,c.tags.inserted],color:Pt},{tag:c.tags.invalid,color:qt}]),zt=[Kt,ae.syntaxHighlighting(Wt)],Zt="#e5c07b",at="#3f4a54",Xt="#56b6c2",Yt="#fff",oe="#3f4a54",rt="#2d8cf0",Jt="#2d8cf0",Qt="#3f4a54",nt="#d19a66",eo="#c678dd",to="#21252b",oo="#ceedfa33",it="var(--md-bk-color)",me="var(--md-bk-color)",lo="#bad5fa",ct="#3f4a54",ao=le.EditorView.theme({"&":{color:oe,backgroundColor:it},".cm-content":{caretColor:ct},".cm-cursor, .cm-dropCursor":{borderLeftColor:ct},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:lo},".cm-panels":{backgroundColor:to,color:oe},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#ceedfa33"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:it,color:oe,borderRight:"1px solid",borderColor:"var(--md-border-color)"},".cm-activeLineGutter":{backgroundColor:oo},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"1px solid var(--md-border-color)",backgroundColor:me},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:me,borderBottomColor:me},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{color:oe}}}),ro=ae.HighlightStyle.define([{tag:c.tags.keyword,color:eo},{tag:[c.tags.name,c.tags.deleted,c.tags.character,c.tags.propertyName,c.tags.macroName],color:at},{tag:[c.tags.function(c.tags.variableName),c.tags.labelName],color:Jt},{tag:[c.tags.color,c.tags.constant(c.tags.name),c.tags.standard(c.tags.name)],color:nt},{tag:[c.tags.definition(c.tags.name),c.tags.separator],color:oe},{tag:[c.tags.typeName,c.tags.className,c.tags.number,c.tags.changed,c.tags.annotation,c.tags.modifier,c.tags.self,c.tags.namespace],color:Zt},{tag:[c.tags.operator,c.tags.operatorKeyword,c.tags.url,c.tags.escape,c.tags.regexp,c.tags.link,c.tags.special(c.tags.string)],color:Xt},{tag:[c.tags.meta,c.tags.comment],color:rt},{tag:c.tags.strong,fontWeight:"bold"},{tag:c.tags.emphasis,fontStyle:"italic"},{tag:c.tags.strikethrough,textDecoration:"line-through"},{tag:c.tags.link,color:rt,textDecoration:"underline"},{tag:c.tags.heading,fontWeight:"bold",color:at},{tag:[c.tags.atom,c.tags.bool,c.tags.special(c.tags.variableName)],color:nt},{tag:[c.tags.processingInstruction,c.tags.string,c.tags.inserted],color:Qt},{tag:c.tags.invalid,color:Yt}]),no=[ao,ae.syntaxHighlighting(ro)],ie=(e,l,o,a,n)=>(i,u,d,s)=>{const f=`${e}${l}`.slice(s-d);i.dispatch(i.state.replaceSelection(`${f}${o}${a}`));const m=d+u.label.length+(n==="title"?o.length:0);i.dispatch({selection:H.EditorSelection.create([H.EditorSelection.range(d+u.label.length+(n==="title"?1:-l.length),m),H.EditorSelection.cursor(m)],1)}),i.focus()},st=e=>(l,o,a,n)=>{const i=e.slice(n-a);l.dispatch(l.state.replaceSelection(`${i} `))},io=e=>{const l=o=>{const a=o.matchBefore(/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/);return a===null||a.from==a.to&&o.explicit?null:{from:a.from,options:[...["h1","h2","h3","h4","h5","h6"].map((n,i)=>{const u=new Array(i+1).fill("#").join("");return{label:u,type:"text",apply:st(u)}}),...["unchecked","checked"].map(n=>{const i=n==="checked"?"- [x]":"- [ ]";return{label:i,type:"text",apply:st(i)}}),...[["`",""],["```","language"],["```mermaid\n",""]].map(n=>({label:`${n[0]}${n[1]}`,type:"text",apply:ie(n[0],n[1],"",n[0]==="`"?"`":"\n```","type")})),{label:"[]()",type:"text"},{label:"![]()",type:"text"},{label:"| |",type:"text",detail:"table",apply:`| col | col | col |
|
|
61
61
|
| - | - | - |
|
|
62
62
|
| content | content | content |
|
|
63
|
-
| content | content | content |`},{label:"$",type:"text",apply:
|
|
63
|
+
| content | content | content |`},{label:"$",type:"text",apply:ie("$","","","$","type")},{label:"$$",type:"text",apply:ie("$$","",`
|
|
64
64
|
`,`
|
|
65
|
-
$$`,"title")},...["note","abstract","info","tip","success","question","warning","failure","danger","bug","example","quote","hint","caution","error","attention"].map(n=>({label:`!!! ${n}`,type:"text",apply:
|
|
65
|
+
$$`,"title")},...["note","abstract","info","tip","success","question","warning","failure","danger","bug","example","quote","hint","caution","error","attention"].map(n=>({label:`!!! ${n}`,type:"text",apply:ie("!!!",` ${n}`," Title",`
|
|
66
66
|
|
|
67
|
-
!!!`,"title")}))]}};return vt.autocompletion({override:e?[l,dt.htmlCompletionSource,...e]:[l]})},so=co,K=e=>{const l=new M.Compartment;return a=>(l.get(e.state)?e.dispatch({effects:l.reconfigure(a)}):e.dispatch({effects:M.StateEffect.appendConfig.of(l.of(a))}),!0)};class uo{constructor(l){R(this,"view");R(this,"maxLength",Number.MAX_SAFE_INTEGER);R(this,"toggleTabSize");R(this,"togglePlaceholder");R(this,"setExtensions");R(this,"toggleDisabled");R(this,"toggleReadOnly");R(this,"toggleMaxlength");this.view=l,this.toggleTabSize=K(this.view),this.togglePlaceholder=K(this.view),this.setExtensions=K(this.view),this.toggleDisabled=K(this.view),this.toggleReadOnly=K(this.view),this.toggleMaxlength=K(this.view)}getValue(){return this.view.state.doc.toString()}setValue(l,o=0,a=this.view.state.doc.length){this.view.dispatch({changes:{from:o,to:a,insert:l}})}getSelectedText(){const{from:l,to:o}=this.view.state.selection.main;return this.view.state.sliceDoc(l,o)}replaceSelectedText(l,o={select:!0,deviationStart:0,deviationEnd:0,replaceAll:!1},a){try{if(o.replaceAll){if(this.setValue(l),l.length>this.maxLength)throw new Error("The input text is too long");return}if(this.view.state.doc.length-this.getSelectedText().length+l.length>this.maxLength)throw new Error("The input text is too long");const{from:n}=this.view.state.selection.main;if(this.view.dispatch(this.view.state.replaceSelection(l)),o.select){const i=n+l.length+o.deviationEnd;this.view.dispatch({selection:M.EditorSelection.create([M.EditorSelection.range(n+o.deviationStart,i),M.EditorSelection.cursor(i)],1)})}this.view.focus()}catch(n){if(n.message==="The input text is too long")b.bus.emit(a,"errorCatcher",{name:"overlength",message:n.message,data:l});else throw n}}setTabSize(l){this.toggleTabSize([M.EditorState.tabSize.of(l),oe.indentUnit.of(" ".repeat(l))])}setPlaceholder(l){this.togglePlaceholder(te.placeholder(l))}focus(l){if(this.view.focus(),!l)return;let o=0,a=0,n=0;switch(l){case"start":break;case"end":{o=a=n=this.getValue().length;break}default:o=l.rangeAnchor||l.cursorPos,a=l.rangeHead||l.cursorPos,n=l.cursorPos}this.view.dispatch({scrollIntoView:!0,selection:M.EditorSelection.create([M.EditorSelection.range(o,a),M.EditorSelection.cursor(n)],1)})}setDisabled(l){this.toggleDisabled([te.EditorView.editable.of(!l)])}setReadOnly(l){this.toggleReadOnly([M.EditorState.readOnly.of(l)])}setMaxLength(l){this.maxLength=l,this.toggleMaxlength([M.EditorState.changeFilter.of(o=>o.newDoc.length<=l)])}}const mo=e=>{const l=t.inject("editorId");return a=>{if(!a.clipboardData)return;if(a.clipboardData.files.length>0){const{files:i}=a.clipboardData;b.bus.emit(l,"uploadImage",Array.from(i).filter(u=>/image\/.*/.test(u.type))),a.preventDefault();return}if(e.autoDetectCode&&a.clipboardData.types.includes("vscode-editor-data")){const i=JSON.parse(a.clipboardData.getData("vscode-editor-data"));b.bus.emit(l,"replace","code",{mode:i.mode,text:a.clipboardData.getData("text/plain")}),a.preventDefault();return}const n=a.clipboardData.getData("text/plain");e.maxlength&&n.length+e.modelValue.length>e.maxlength&&b.bus.emit(l,"errorCatcher",{name:"overlength",message:"The input text is too long",data:n})}},fo=mo,go=e=>{const l=t.inject("editorId");t.onMounted(()=>{b.bus.on(l,{name:w.TEXTAREA_FOCUS,callback(o){var a;(a=e.value)==null||a.focus(o)}})})},bo=go,ho=(e,l)=>{const o={key:"Ctrl-b",mac:"Cmd-b",run:()=>(b.bus.emit(e,"replace","bold"),!0)},a={key:"Ctrl-s",mac:"Cmd-s",run:A=>(b.bus.emit(e,w.ON_SAVE,A.state.doc.toString()),!0),shift:()=>(b.bus.emit(e,"replace","strikeThrough"),!0)},n={key:"Ctrl-u",mac:"Cmd-u",run:()=>(b.bus.emit(e,"replace","underline"),!0),shift:()=>(b.bus.emit(e,"replace","unorderedList"),!0)},i={key:"Ctrl-i",mac:"Cmd-i",run:()=>(b.bus.emit(e,"replace","italic"),!0),shift:()=>(b.bus.emit(e,"openModals","image"),!0)},u={key:"Ctrl-1",mac:"Cmd-1",run:()=>(b.bus.emit(e,"replace","h1"),!0)},d={key:"Ctrl-2",mac:"Cmd-2",run:()=>(b.bus.emit(e,"replace","h2"),!0)},s={key:"Ctrl-3",mac:"Cmd-3",run:()=>(b.bus.emit(e,"replace","h3"),!0)},f={key:"Ctrl-4",mac:"Cmd-4",run:()=>(b.bus.emit(e,"replace","h4"),!0)},m={key:"Ctrl-5",mac:"Cmd-5",run:()=>(b.bus.emit(e,"replace","h5"),!0)},h={key:"Ctrl-6",mac:"Cmd-6",run:()=>(b.bus.emit(e,"replace","h6"),!0)},N={key:"Ctrl-ArrowUp",mac:"Cmd-ArrowUp",run:()=>(b.bus.emit(e,"replace","sup"),!0)},$={key:"Ctrl-ArrowDown",mac:"Cmd-ArrowDown",run:()=>(b.bus.emit(e,"replace","sub"),!0)},v={key:"Ctrl-o",mac:"Cmd-o",run:()=>(b.bus.emit(e,"replace","orderedList"),!0)},g={key:"Ctrl-c",mac:"Cmd-c",shift:()=>(b.bus.emit(e,"replace","code"),!0),any(A,x){return(x.ctrlKey||x.metaKey)&&x.altKey&&x.code==="KeyC"?(b.bus.emit(e,"replace","codeRow"),!0):!1}},p={key:"Ctrl-l",mac:"Cmd-l",run:()=>(b.bus.emit(e,"openModals","link"),!0)},V={key:"Ctrl-f",mac:"Cmd-f",shift:()=>l.noPrettier?!1:(b.bus.emit(e,"replace","prettier"),!0)},y={any:(A,x)=>(x.ctrlKey||x.metaKey)&&x.altKey&&x.shiftKey&&x.code==="KeyT"?(b.bus.emit(e,"replace","table"),!0):!1},T={key:"Ctrl-d",mac:"Cmd-d",run:ne.deleteLine,preventDefault:!0};return[o,T,a,n,i,u,d,s,f,m,h,N,$,v,g,p,V,y]},vo=ho,po=e=>{const l=t.inject("tabWidth"),o=t.inject("editorId"),a=t.inject("theme"),n=t.ref(),i=t.shallowRef(),u=vo(o,e),d=fo(e),s=[te.keymap.of([...u,ne.indentWithTab]),J.minimalSetup,dt.html(),ht.markdown({codeLanguages:bt.languages}),J.EditorView.lineWrapping,J.EditorView.updateListener.of(m=>{m.docChanged&&e.onChange(m.state.doc.toString())}),J.EditorView.domEventHandlers({paste:d,blur:e.onBlur,focus:e.onFocus,input:m=>{e.onInput&&e.onInput(m);const{data:h}=m;e.maxlength&&e.modelValue.length+h.length>e.maxlength&&b.bus.emit(o,"errorCatcher",{name:"overlength",message:"The input text is too long",data:h})}})],f=()=>{const m=[...s,a.value==="light"?io:Zt,so(e.completions)];return r.configOption.codeMirrorExtensions(a.value,m,[...u])};return t.onMounted(()=>{const m=new J.EditorView({doc:e.modelValue,parent:n.value}),h=new uo(m);i.value=h,setTimeout(()=>{h.setTabSize(l),h.setDisabled(e.disabled),h.setReadOnly(e.readonly),h.setExtensions(f()),e.placeholder&&h.setPlaceholder(e.placeholder),typeof e.maxlength=="number"&&h.setMaxLength(e.maxlength),e.autofocus&&m.focus()},0),b.bus.on(o,{name:"ctrlZ",callback(){ne.undo(m)}}),b.bus.on(o,{name:"ctrlShiftZ",callback(){ne.redo(m)}}),b.bus.on(o,{name:"replace",callback(N,$={}){var p;const{text:v,options:g}=Ft(N,i.value,$);(p=i.value)==null||p.replaceSelectedText(v,g,o)}})}),t.watch([a,t.toRef(e,"completions")],()=>{var m;(m=i.value)==null||m.setExtensions(f())},{deep:!0}),t.watch(()=>e.modelValue,()=>{var m,h;((m=i.value)==null?void 0:m.getValue())!==e.modelValue&&((h=i.value)==null||h.setValue(e.modelValue))}),t.watch(()=>e.placeholder,()=>{var m;(m=i.value)==null||m.setPlaceholder(e.placeholder)}),t.watch(()=>e.disabled,()=>{var m;(m=i.value)==null||m.setDisabled(e.disabled)}),t.watch(()=>e.readonly,()=>{var m;(m=i.value)==null||m.setDisabled(e.readonly)}),t.watch(()=>e.maxlength,()=>{var m;e.maxlength&&((m=i.value)==null||m.setMaxLength(e.maxlength))}),bo(i),{inputWrapperRef:n,codeMirrorUt:i}},ko=po,Co=t.defineComponent({name:"MDEditorContent",props:w.contentProps,setup(e){const l=t.inject("editorId"),o=t.ref(""),{inputWrapperRef:a,codeMirrorUt:n}=ko(e);return Ot(e,o,n),()=>t.createVNode("div",{class:`${r.prefix}-content`},[t.createVNode("div",{class:`${r.prefix}-input-wrapper`,ref:a},null),t.createVNode(w.ContentPreview,{modelValue:e.modelValue,setting:e.setting,onHtmlChanged:i=>{o.value=i,e.onHtmlChanged(i)},onGetCatalog:e.onGetCatalog,mdHeadingId:e.mdHeadingId,noMermaid:e.noMermaid,sanitize:e.sanitize,noKatex:e.noKatex,formatCopiedText:e.formatCopiedText,noHighlight:e.noHighlight,noImgZoomIn:e.noImgZoomIn},null),e.catalogVisible&&t.createVNode(ut,{theme:e.theme,class:`${r.prefix}-catalog-editor`,editorId:l,mdHeadingId:e.mdHeadingId,key:"internal-catalog"},null)])}}),xo=t.defineComponent({props:{modelValue:{type:String,default:""}},setup(e){const l=t.inject("usedLanguageText");return()=>{var o,a;return t.createVNode("div",{class:`${r.prefix}-footer-item`},[t.createVNode("label",{class:`${r.prefix}-footer-label`},[`${(o=l.value.footer)==null?void 0:o.markdownTotal}:`]),t.createVNode("span",null,[((a=e.modelValue)==null?void 0:a.length)||0])])}}}),No={checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}},Vo=t.defineComponent({props:No,setup(e){return()=>t.createVNode("div",{class:[`${r.prefix}-checkbox`,e.checked&&`${r.prefix}-checkbox-checked`],onClick:()=>{e.onChange(!e.checked)}},null)}}),$o={scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}},yo=t.defineComponent({props:$o,setup(e){const l=t.inject("usedLanguageText");return()=>{var o;return t.createVNode("div",{class:`${r.prefix}-footer-item`},[t.createVNode("label",{class:`${r.prefix}-footer-label`,onClick:()=>{e.onScrollAutoChange(!e.scrollAuto)}},[(o=l.value.footer)==null?void 0:o.scrollAuto]),t.createVNode(Vo,{checked:e.scrollAuto,onChange:e.onScrollAutoChange},null)])}}}),To={modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}},wo=t.defineComponent({name:"MDEditorFooter",props:To,setup(e){const l=t.computed(()=>{const a=e.footers.indexOf("="),n=a===-1?e.footers:e.footers.slice(0,a),i=a===-1?[]:e.footers.slice(a,Number.MAX_SAFE_INTEGER);return[n,i]}),o=a=>{if(r.allFooter.includes(a))switch(a){case"markdownTotal":return t.createVNode(xo,{modelValue:e.modelValue},null);case"scrollSwitch":return t.createVNode(yo,{scrollAuto:e.scrollAuto,onScrollAutoChange:e.onScrollAutoChange},null)}else return e.defFooters instanceof Array?e.defFooters[a]||"":e.defFooters&&e.defFooters.children instanceof Array&&e.defFooters.children[a]||""};return()=>{const a=l.value[0].map(i=>o(i)),n=l.value[1].map(i=>o(i));return t.createVNode("div",{class:`${r.prefix}-footer`},[t.createVNode("div",{class:`${r.prefix}-footer-left`},[a]),t.createVNode("div",{class:`${r.prefix}-footer-right`},[n])])}}}),So=t.defineComponent({name:"MdEditorV3",props:w.editorProps,emits:w.editorEmits,setup(e,l){const{editorId:o,noKatex:a,noMermaid:n,noPrettier:i,noUploadImg:u,noHighlight:d}=e,s=t.reactive({scrollAuto:e.scrollAuto});w.useOnSave(e,l),w.useProvide(e),w.useExpansion(e),w.useErrorCatcher(e,l);const[f,m]=w.useConfig(e,l),h=w.useCatalog(e);return t.onBeforeUnmount(()=>{b.bus.clear(o)}),w.useExpose(e,l,h,f,m),()=>{var v;const N=Je.getSlot({props:e,ctx:l},"defToolbars"),$=Je.getSlot({props:e,ctx:l},"defFooters");return t.createVNode("div",{id:o,class:[r.prefix,e.class,e.theme==="dark"&&`${r.prefix}-dark`,f.fullscreen||f.pageFullscreen?`${r.prefix}-fullscreen`:""],style:e.style},[t.createVNode(Et,{noPrettier:i,toolbars:e.toolbars,toolbarsExclude:e.toolbarsExclude,setting:f,updateSetting:m,tableShape:e.tableShape,defToolbars:N,noUploadImg:u,showToolbarName:e.showToolbarName},null),t.createVNode(Co,{modelValue:e.modelValue,setting:f,mdHeadingId:e.mdHeadingId,noMermaid:n,noPrettier:i,sanitize:e.sanitize,placeholder:e.placeholder,noKatex:a,scrollAuto:s.scrollAuto,formatCopiedText:e.formatCopiedText,autofocus:e.autoFocus,disabled:e.disabled,readonly:e.readOnly,maxlength:e.maxLength,autoDetectCode:e.autoDetectCode,noHighlight:d,onChange:g=>{e.onChange?e.onChange(g):(l.emit("update:modelValue",g),l.emit("onChange",g))},onHtmlChanged:g=>{e.onHtmlChanged?e.onHtmlChanged(g):l.emit("onHtmlChanged",g)},onGetCatalog:g=>{e.onGetCatalog?e.onGetCatalog(g):l.emit("onGetCatalog",g)},onBlur:g=>{e.onBlur?e.onBlur(g):l.emit("onBlur",g)},onFocus:g=>{e.onFocus?e.onFocus(g):l.emit("onFocus",g)},onInput:g=>{e.onInput?e.onInput(g):l.emit("onInput",g)},completions:e.completions,catalogVisible:h.value,theme:e.theme,noImgZoomIn:e.noImgZoomIn},null),((v=e.footers)==null?void 0:v.length)>0&&t.createVNode(wo,{modelValue:e.modelValue,footers:e.footers,defFooters:$,scrollAuto:s.scrollAuto,onScrollAutoChange:g=>s.scrollAuto=g},null)])}}}),ie=So;ie.install=e=>(e.component(ie.name,ie),e.use(pt).use(W.DropdownToolbar).use(kt).use(ut).use(w.MdPreview),e);module.exports=ie;
|
|
67
|
+
!!!`,"title")}))]}};return ht.autocompletion({override:e?[l,...e]:[l]})},co=io,W=e=>{const l=new H.Compartment;return a=>(l.get(e.state)?e.dispatch({effects:l.reconfigure(a)}):e.dispatch({effects:H.StateEffect.appendConfig.of(l.of(a))}),!0)};class so{constructor(l){P(this,"view");P(this,"maxLength",Number.MAX_SAFE_INTEGER);P(this,"toggleTabSize");P(this,"togglePlaceholder");P(this,"setExtensions");P(this,"toggleDisabled");P(this,"toggleReadOnly");P(this,"toggleMaxlength");this.view=l,this.toggleTabSize=W(this.view),this.togglePlaceholder=W(this.view),this.setExtensions=W(this.view),this.toggleDisabled=W(this.view),this.toggleReadOnly=W(this.view),this.toggleMaxlength=W(this.view)}getValue(){return this.view.state.doc.toString()}setValue(l,o=0,a=this.view.state.doc.length){this.view.dispatch({changes:{from:o,to:a,insert:l}})}getSelectedText(){const{from:l,to:o}=this.view.state.selection.main;return this.view.state.sliceDoc(l,o)}replaceSelectedText(l,o={select:!0,deviationStart:0,deviationEnd:0,replaceAll:!1},a){try{if(o.replaceAll){if(this.setValue(l),l.length>this.maxLength)throw new Error("The input text is too long");return}if(this.view.state.doc.length-this.getSelectedText().length+l.length>this.maxLength)throw new Error("The input text is too long");const{from:n}=this.view.state.selection.main;if(this.view.dispatch(this.view.state.replaceSelection(l)),o.select){const i=n+l.length+o.deviationEnd;this.view.dispatch({selection:H.EditorSelection.create([H.EditorSelection.range(n+o.deviationStart,i),H.EditorSelection.cursor(i)],1)})}this.view.focus()}catch(n){if(n.message==="The input text is too long")b.bus.emit(a,"errorCatcher",{name:"overlength",message:n.message,data:l});else throw n}}setTabSize(l){this.toggleTabSize([H.EditorState.tabSize.of(l),ae.indentUnit.of(" ".repeat(l))])}setPlaceholder(l){this.togglePlaceholder(le.placeholder(l))}focus(l){if(this.view.focus(),!l)return;let o=0,a=0,n=0;switch(l){case"start":break;case"end":{o=a=n=this.getValue().length;break}default:o=l.rangeAnchor||l.cursorPos,a=l.rangeHead||l.cursorPos,n=l.cursorPos}this.view.dispatch({scrollIntoView:!0,selection:H.EditorSelection.create([H.EditorSelection.range(o,a),H.EditorSelection.cursor(n)],1)})}setDisabled(l){this.toggleDisabled([le.EditorView.editable.of(!l)])}setReadOnly(l){this.toggleReadOnly([H.EditorState.readOnly.of(l)])}setMaxLength(l){this.maxLength=l,this.toggleMaxlength([H.EditorState.changeFilter.of(o=>o.newDoc.length<=l)])}}const uo=e=>{const l=t.inject("editorId");return a=>{if(!a.clipboardData)return;if(a.clipboardData.files.length>0){const{files:i}=a.clipboardData;b.bus.emit(l,"uploadImage",Array.from(i).filter(u=>/image\/.*/.test(u.type))),a.preventDefault();return}if(e.autoDetectCode&&a.clipboardData.types.includes("vscode-editor-data")){const i=JSON.parse(a.clipboardData.getData("vscode-editor-data"));b.bus.emit(l,"replace","code",{mode:i.mode,text:a.clipboardData.getData("text/plain")}),a.preventDefault();return}const n=a.clipboardData.getData("text/plain");e.maxlength&&n.length+e.modelValue.length>e.maxlength&&b.bus.emit(l,"errorCatcher",{name:"overlength",message:"The input text is too long",data:n})}},mo=uo,fo=e=>{const l=t.inject("editorId");t.onMounted(()=>{b.bus.on(l,{name:S.TEXTAREA_FOCUS,callback(o){var a;(a=e.value)==null||a.focus(o)}})})},go=fo,bo=(e,l)=>{const o={key:"Ctrl-b",mac:"Cmd-b",run:()=>(b.bus.emit(e,"replace","bold"),!0)},a={key:"Ctrl-s",mac:"Cmd-s",run:D=>(b.bus.emit(e,S.ON_SAVE,D.state.doc.toString()),!0),shift:()=>(b.bus.emit(e,"replace","strikeThrough"),!0)},n={key:"Ctrl-u",mac:"Cmd-u",run:()=>(b.bus.emit(e,"replace","underline"),!0),shift:()=>(b.bus.emit(e,"replace","unorderedList"),!0)},i={key:"Ctrl-i",mac:"Cmd-i",run:()=>(b.bus.emit(e,"replace","italic"),!0),shift:()=>(b.bus.emit(e,"openModals","image"),!0)},u={key:"Ctrl-1",mac:"Cmd-1",run:()=>(b.bus.emit(e,"replace","h1"),!0)},d={key:"Ctrl-2",mac:"Cmd-2",run:()=>(b.bus.emit(e,"replace","h2"),!0)},s={key:"Ctrl-3",mac:"Cmd-3",run:()=>(b.bus.emit(e,"replace","h3"),!0)},f={key:"Ctrl-4",mac:"Cmd-4",run:()=>(b.bus.emit(e,"replace","h4"),!0)},m={key:"Ctrl-5",mac:"Cmd-5",run:()=>(b.bus.emit(e,"replace","h5"),!0)},h={key:"Ctrl-6",mac:"Cmd-6",run:()=>(b.bus.emit(e,"replace","h6"),!0)},x={key:"Ctrl-ArrowUp",mac:"Cmd-ArrowUp",run:()=>(b.bus.emit(e,"replace","sup"),!0)},V={key:"Ctrl-ArrowDown",mac:"Cmd-ArrowDown",run:()=>(b.bus.emit(e,"replace","sub"),!0)},p={key:"Ctrl-o",mac:"Cmd-o",run:()=>(b.bus.emit(e,"replace","orderedList"),!0)},g={key:"Ctrl-c",mac:"Cmd-c",shift:()=>(b.bus.emit(e,"replace","code"),!0),any(D,I){return(I.ctrlKey||I.metaKey)&&I.altKey&&I.code==="KeyC"?(b.bus.emit(e,"replace","codeRow"),!0):!1}},v={key:"Ctrl-l",mac:"Cmd-l",run:()=>(b.bus.emit(e,"openModals","link"),!0)},N={key:"Ctrl-f",mac:"Cmd-f",shift:()=>l.noPrettier?!1:(b.bus.emit(e,"replace","prettier"),!0)},$={any:(D,I)=>(I.ctrlKey||I.metaKey)&&I.altKey&&I.shiftKey&&I.code==="KeyT"?(b.bus.emit(e,"replace","table"),!0):!1},y={key:"Ctrl-d",mac:"Cmd-d",run:ce.deleteLine,preventDefault:!0};return[o,y,a,n,i,u,d,s,f,m,h,x,V,p,g,v,N,$]},ho=bo,po=e=>{const l=t.inject("tabWidth"),o=t.inject("editorId"),a=t.inject("theme"),n=t.ref(),i=t.shallowRef(),u=ho(o,e),d=mo(e),s=[le.keymap.of([...u,ce.indentWithTab]),ee.minimalSetup,bt.markdown({codeLanguages:gt.languages}),ee.EditorView.lineWrapping,ee.EditorView.updateListener.of(m=>{m.docChanged&&e.onChange(m.state.doc.toString())}),ee.EditorView.domEventHandlers({paste:d,blur:e.onBlur,focus:e.onFocus,input:m=>{e.onInput&&e.onInput(m);const{data:h}=m;e.maxlength&&e.modelValue.length+h.length>e.maxlength&&b.bus.emit(o,"errorCatcher",{name:"overlength",message:"The input text is too long",data:h})}})],f=()=>{const m=[...s,a.value==="light"?no:zt,co(e.completions)];return r.configOption.codeMirrorExtensions(a.value,m,[...u])};return t.onMounted(()=>{const m=new ee.EditorView({doc:e.modelValue,parent:n.value}),h=new so(m);i.value=h,setTimeout(()=>{h.setTabSize(l),h.setDisabled(e.disabled),h.setReadOnly(e.readonly),h.setExtensions(f()),e.placeholder&&h.setPlaceholder(e.placeholder),typeof e.maxlength=="number"&&h.setMaxLength(e.maxlength),e.autofocus&&m.focus()},0),b.bus.on(o,{name:"ctrlZ",callback(){ce.undo(m)}}),b.bus.on(o,{name:"ctrlShiftZ",callback(){ce.redo(m)}}),b.bus.on(o,{name:"replace",callback(x,V={}){var v;const{text:p,options:g}=Ot(x,i.value,V);(v=i.value)==null||v.replaceSelectedText(p,g,o)}})}),t.watch([a,t.toRef(e,"completions")],()=>{var m;(m=i.value)==null||m.setExtensions(f())},{deep:!0}),t.watch(()=>e.modelValue,()=>{var m,h;((m=i.value)==null?void 0:m.getValue())!==e.modelValue&&((h=i.value)==null||h.setValue(e.modelValue))}),t.watch(()=>e.placeholder,()=>{var m;(m=i.value)==null||m.setPlaceholder(e.placeholder)}),t.watch(()=>e.disabled,()=>{var m;(m=i.value)==null||m.setDisabled(e.disabled)}),t.watch(()=>e.readonly,()=>{var m;(m=i.value)==null||m.setDisabled(e.readonly)}),t.watch(()=>e.maxlength,()=>{var m;e.maxlength&&((m=i.value)==null||m.setMaxLength(e.maxlength))}),go(i),{inputWrapperRef:n,codeMirrorUt:i}},vo=po,ko=t.defineComponent({name:"MDEditorContent",props:S.contentProps,setup(e){const l=t.inject("editorId"),o=t.ref(""),{inputWrapperRef:a,codeMirrorUt:n}=vo(e);return Ht(e,o,n),()=>t.createVNode("div",{class:`${r.prefix}-content`},[t.createVNode("div",{class:`${r.prefix}-input-wrapper`,ref:a},null),t.createVNode(S.ContentPreview,{modelValue:e.modelValue,setting:e.setting,onHtmlChanged:i=>{o.value=i,e.onHtmlChanged(i)},onGetCatalog:e.onGetCatalog,mdHeadingId:e.mdHeadingId,noMermaid:e.noMermaid,sanitize:e.sanitize,noKatex:e.noKatex,formatCopiedText:e.formatCopiedText,noHighlight:e.noHighlight,noImgZoomIn:e.noImgZoomIn},null),e.catalogVisible&&t.createVNode(dt,{theme:e.theme,class:`${r.prefix}-catalog-editor`,editorId:l,mdHeadingId:e.mdHeadingId,key:"internal-catalog"},null)])}}),Co=t.defineComponent({props:{modelValue:{type:String,default:""}},setup(e){const l=t.inject("usedLanguageText");return()=>{var o,a;return t.createVNode("div",{class:`${r.prefix}-footer-item`},[t.createVNode("label",{class:`${r.prefix}-footer-label`},[`${(o=l.value.footer)==null?void 0:o.markdownTotal}:`]),t.createVNode("span",null,[((a=e.modelValue)==null?void 0:a.length)||0])])}}}),xo={checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}},No=t.defineComponent({props:xo,setup(e){return()=>t.createVNode("div",{class:[`${r.prefix}-checkbox`,e.checked&&`${r.prefix}-checkbox-checked`],onClick:()=>{e.onChange(!e.checked)}},null)}}),Vo={scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}},$o=t.defineComponent({props:Vo,setup(e){const l=t.inject("usedLanguageText");return()=>{var o;return t.createVNode("div",{class:`${r.prefix}-footer-item`},[t.createVNode("label",{class:`${r.prefix}-footer-label`,onClick:()=>{e.onScrollAutoChange(!e.scrollAuto)}},[(o=l.value.footer)==null?void 0:o.scrollAuto]),t.createVNode(No,{checked:e.scrollAuto,onChange:e.onScrollAutoChange},null)])}}}),yo={modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}},To=t.defineComponent({name:"MDEditorFooter",props:yo,setup(e){const l=t.computed(()=>{const a=e.footers.indexOf("="),n=a===-1?e.footers:e.footers.slice(0,a),i=a===-1?[]:e.footers.slice(a,Number.MAX_SAFE_INTEGER);return[n,i]}),o=a=>{if(r.allFooter.includes(a))switch(a){case"markdownTotal":return t.createVNode(Co,{modelValue:e.modelValue},null);case"scrollSwitch":return t.createVNode($o,{scrollAuto:e.scrollAuto,onScrollAutoChange:e.onScrollAutoChange},null)}else return e.defFooters instanceof Array?e.defFooters[a]||"":e.defFooters&&e.defFooters.children instanceof Array&&e.defFooters.children[a]||""};return()=>{const a=l.value[0].map(i=>o(i)),n=l.value[1].map(i=>o(i));return t.createVNode("div",{class:`${r.prefix}-footer`},[t.createVNode("div",{class:`${r.prefix}-footer-left`},[a]),t.createVNode("div",{class:`${r.prefix}-footer-right`},[n])])}}}),wo=t.defineComponent({name:"MdEditorV3",props:S.editorProps,emits:S.editorEmits,setup(e,l){const{editorId:o,noKatex:a,noMermaid:n,noPrettier:i,noUploadImg:u,noHighlight:d}=e,s=t.reactive({scrollAuto:e.scrollAuto});S.useOnSave(e,l),S.useProvide(e),S.useExpansion(e),S.useErrorCatcher(e,l);const[f,m]=S.useConfig(e,l),h=S.useCatalog(e);return t.onBeforeUnmount(()=>{b.bus.clear(o)}),S.useExpose(e,l,h,f,m),()=>{var p;const x=Je.getSlot({props:e,ctx:l},"defToolbars"),V=Je.getSlot({props:e,ctx:l},"defFooters");return t.createVNode("div",{id:o,class:[r.prefix,e.class,e.theme==="dark"&&`${r.prefix}-dark`,f.fullscreen||f.pageFullscreen?`${r.prefix}-fullscreen`:""],style:e.style},[t.createVNode(At,{noPrettier:i,toolbars:e.toolbars,toolbarsExclude:e.toolbarsExclude,setting:f,updateSetting:m,tableShape:e.tableShape,defToolbars:x,noUploadImg:u,showToolbarName:e.showToolbarName},null),t.createVNode(ko,{modelValue:e.modelValue,setting:f,mdHeadingId:e.mdHeadingId,noMermaid:n,noPrettier:i,sanitize:e.sanitize,placeholder:e.placeholder,noKatex:a,scrollAuto:s.scrollAuto,formatCopiedText:e.formatCopiedText,autofocus:e.autoFocus,disabled:e.disabled,readonly:e.readOnly,maxlength:e.maxLength,autoDetectCode:e.autoDetectCode,noHighlight:d,onChange:g=>{e.onChange?e.onChange(g):(l.emit("update:modelValue",g),l.emit("onChange",g))},onHtmlChanged:g=>{e.onHtmlChanged?e.onHtmlChanged(g):l.emit("onHtmlChanged",g)},onGetCatalog:g=>{e.onGetCatalog?e.onGetCatalog(g):l.emit("onGetCatalog",g)},onBlur:g=>{e.onBlur?e.onBlur(g):l.emit("onBlur",g)},onFocus:g=>{e.onFocus?e.onFocus(g):l.emit("onFocus",g)},onInput:g=>{e.onInput?e.onInput(g):l.emit("onInput",g)},completions:e.completions,catalogVisible:h.value,theme:e.theme,noImgZoomIn:e.noImgZoomIn},null),((p=e.footers)==null?void 0:p.length)>0&&t.createVNode(To,{modelValue:e.modelValue,footers:e.footers,defFooters:V,scrollAuto:s.scrollAuto,onScrollAutoChange:g=>s.scrollAuto=g},null)])}}}),se=wo;se.install=e=>(e.component(se.name,se),e.use(pt).use(z.DropdownToolbar).use(vt).use(dt).use(S.MdPreview),e);module.exports=se;
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./MdEditor.cjs"),e=require("./chunks/index.cjs"),o=require("./NormalToolbar.cjs"),i=require("./chunks/index2.cjs"),u=require("./ModalToolbar.cjs"),q=require("./MdCatalog.cjs"),d=require("./chunks/config.cjs"),a=require("./chunks/index3.cjs");require("vue");require("@vavt/util");require("./chunks/index4.cjs");require("./chunks/dom.cjs");require("codemirror");require("@codemirror/view");require("@codemirror/language-data");require("@codemirror/lang-markdown");require("@codemirror/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./MdEditor.cjs"),e=require("./chunks/index.cjs"),o=require("./NormalToolbar.cjs"),i=require("./chunks/index2.cjs"),u=require("./ModalToolbar.cjs"),q=require("./MdCatalog.cjs"),d=require("./chunks/config.cjs"),a=require("./chunks/index3.cjs");require("vue");require("@vavt/util");require("./chunks/index4.cjs");require("./chunks/dom.cjs");require("codemirror");require("@codemirror/view");require("@codemirror/language-data");require("@codemirror/lang-markdown");require("@codemirror/commands");require("@codemirror/language");require("@lezer/highlight");require("@codemirror/state");require("@codemirror/autocomplete");require("./chunks/vue-tsx.cjs");require("medium-zoom");require("copy-to-clipboard");require("markdown-it");require("markdown-it-image-figures");require("markdown-it-task-lists");require("lru-cache");exports.MdEditor=r;exports.MdPreview=e.MdPreview;exports.NormalToolbar=o;exports.DropdownToolbar=i.DropdownToolbar;exports.ModalToolbar=u;exports.MdCatalog=q;exports.config=d.config;exports.MdModal=a.MdModal;
|