md-editor-v3 4.11.0-beta.0 → 4.11.0-beta.1
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/lib/cjs/chunks/index.cjs +6 -6
- package/lib/es/chunks/index.mjs +80 -73
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/type.d.ts +1 -0
- package/lib/types/MdPreview/composition/useExpose.d.ts +3 -0
- package/lib/umd/index.js +24 -24
- package/package.json +2 -2
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";const c=require("vue"),u=require("./config.cjs"),
|
|
2
|
-
`:"")+e.getLines(i+1,r,e.tShift[i],!0)+(
|
|
3
|
-
`},ce=
|
|
4
|
-
|
|
5
|
-
`+
|
|
1
|
+
"use strict";const c=require("vue"),u=require("./config.cjs"),d=require("./index4.cjs"),I=require("./dom.cjs"),D=require("medium-zoom"),_=require("@vavt/util"),G=require("copy-to-clipboard"),j=require("markdown-it"),U=require("markdown-it-image-figures"),V=require("markdown-it-task-lists"),q=require("lru-cache"),z=(e,i)=>{const l=c.inject("editorId"),{noImgZoomIn:t}=e,n=_.debounce(()=>{const a=document.querySelectorAll(`#${l}-preview img`);a.length!==0&&D(a,{background:"#00000073"})});c.onMounted(()=>{!t&&n()}),c.watch([i,c.toRef(e.setting,"preview")],()=>{!t&&n()})},W=z,K=(e,i)=>{if(typeof i[e]=="string")return i[e];const l=`<i class="${u.prefix}-iconfont ${u.prefix}-icon-${e}"></i>`;switch(u.configOption.iconfontType){case"svg":return`<svg class="${u.prefix}-icon" aria-hidden="true"><use xlink:href="#${u.prefix}-icon-${e}"></use></svg>`;default:return l}},Z=(e,i)=>{const l=c.inject("editorId"),t=c.inject("usedLanguageText"),n=c.inject("customIcon"),a=()=>{document.querySelectorAll(`#${l}-preview pre`).forEach(s=>{var k,b;let p=-1;(k=s.querySelector(".copy-button"))==null||k.remove();const o=((b=t.value.copyCode)==null?void 0:b.text)||"复制代码",m=document.createElement("span");m.setAttribute("class","copy-button"),m.dataset.tips=o,m.innerHTML=K("copy",n.value),m.addEventListener("click",()=>{var y,w;clearTimeout(p);const h=s.querySelector("code").innerText,v=G(e.formatCopiedText(h)),g=((y=t.value.copyCode)==null?void 0:y.successTips)||"已复制!",C=((w=t.value.copyCode)==null?void 0:w.failTips)||"已复制!";m.dataset.tips=v?g:C,p=window.setTimeout(()=>{m.dataset.tips=o},1500)}),s.appendChild(m)})},r=()=>{c.nextTick(a)},f=s=>{s&&c.nextTick(a)};c.watch(()=>i.value,r),c.watch(()=>e.setting.preview,f),c.watch(()=>e.setting.htmlPreview,f),c.watch(()=>t.value,a),c.onMounted(a)},J=Z,Q=e=>{var a;const i=(a=u.configOption.editorExtensions)==null?void 0:a.highlight,l=i==null?void 0:i.instance,t=c.inject("highlight"),n=c.shallowRef(l);return c.onMounted(()=>{if(!e.noHighlight&&!n.value){const r=document.createElement("script");r.src=t.value.js,r.onload=()=>{n.value=window.hljs},r.id=`${u.prefix}-hljs`,I.appendHandler(r,"hljs");const f=document.createElement("link");f.rel="stylesheet",f.href=t.value.css,f.id=`${u.prefix}-hlCss`,I.appendHandler(f)}}),c.watch(()=>t.value.css,r=>{I.updateHandler(`${u.prefix}-hlCss`,"href",r)}),n},X=Q,Y=e=>{const i=c.inject("theme"),{editorExtensions:l,mermaidConfig:t}=u.configOption,n=l==null?void 0:l.mermaid,a=c.shallowRef(n==null?void 0:n.instance),r=c.shallowRef(-1),f=new q({max:1e3,ttl:6e5}),s=()=>{const o=a.value;!e.noMermaid&&o&&(o.initialize(t({startOnLoad:!1,theme:i.value==="dark"?"dark":"default"})),r.value=r.value+1)};return c.watch(()=>i.value,()=>{f.clear(),s()}),c.onMounted(()=>{if(!e.noMermaid&&!(n!=null&&n.instance)){const o=(n==null?void 0:n.js)||u.mermaidUrl;if(/\.mjs/.test(o))import(o).then(m=>{a.value=m.default,s()});else{const m=document.createElement("script");m.id=`${u.prefix}-mermaid`,m.src=o,m.onload=()=>{a.value=window.mermaid,s()},I.appendHandler(m,"mermaid")}}}),{mermaidRef:a,reRenderRef:r,replaceMermaid:()=>{c.nextTick(()=>{if(!e.noMermaid&&a.value){const o=document.querySelectorAll(`div.${u.prefix}-mermaid`),m=document.createElement("div");m.style.width=document.body.offsetWidth+"px",m.style.height=document.body.offsetHeight+"px",m.style.position="fixed",m.style.zIndex="-10000",m.style.top="-10000";let k=o.length;k>0&&document.body.appendChild(m),o.forEach(async b=>{let h=f.get(b.innerText);if(!h){const g=_.uuid(),C=a.value.renderAsync||a.value.render;let y="";try{y=await C(g,b.innerText,m)}catch{}h=await e.sanitizeMermaid(typeof y=="string"?y:y.svg),f.set(b.innerText,h)}const v=document.createElement("p");v.className=`${u.prefix}-mermaid`,v.setAttribute("data-processed",""),v.innerHTML=h,b.dataset.line!==void 0&&(v.dataset.line=b.dataset.line),b.replaceWith(v),--k===0&&m.remove()})}})}}},ee=Y,te=e=>{var n;const i=(n=u.configOption.editorExtensions)==null?void 0:n.katex,l=i==null?void 0:i.instance,t=c.shallowRef(l);return c.onMounted(()=>{if(!e.noKatex&&!t.value){const a=document.createElement("script");a.src=(i==null?void 0:i.js)||u.katexUrl.js,a.onload=()=>{t.value=window.katex},a.id=`${u.prefix}-katex`;const r=document.createElement("link");r.rel="stylesheet",r.href=(i==null?void 0:i.css)||u.katexUrl.css,r.id=`${u.prefix}-katexCss`,I.appendHandler(a,"katex"),I.appendHandler(r)}}),t},ne=te,oe=(e,i)=>{const l=e.renderer.rules.fence.bind(e.renderer.rules);e.renderer.rules.fence=(t,n,a,r,f)=>{const s=t[n],p=s.content.trim();if(s.info==="mermaid"){let o;return t[n].map&&t[n].level===0&&(o=t[n].map[0],t[n].attrSet("data-line",String(o))),`<div class="${u.prefix}-mermaid" ${o!==void 0?"data-line="+o:""} data-mermaid-theme=${i.themeRef.value}>${p}</div>`}return l(t,n,a,r,f)}},re=oe,M=(e,i)=>{let l=!0,t=!0;const n=e.posMax,a=i>0?e.src.charCodeAt(i-1):-1,r=i+1<=n?e.src.charCodeAt(i+1):-1;return(a===32||a===9||r>=48&&r<=57)&&(t=!1),(r===32||r===9)&&(l=!1),{can_open:l,can_close:t}},ie=(e,i)=>{let l,t,n,a;if(e.src[e.pos]!=="$")return!1;if(n=M(e,e.pos),!n.can_open)return i||(e.pending+="$"),e.pos+=1,!0;const r=e.pos+1;for(l=r;(l=e.src.indexOf("$",l))!==-1;){for(a=l-1;e.src[a]==="\\";)a-=1;if((l-a)%2==1)break;l+=1}return l===-1?(i||(e.pending+="$"),e.pos=r,!0):l-r===0?(i||(e.pending+="$$"),e.pos=r+1,!0):(n=M(e,l),n.can_close?(i||(t=e.push("math_inline","math",0),t.markup="$",t.content=e.src.slice(r,l)),e.pos=l+1,!0):(i||(e.pending+="$"),e.pos=r,!0))},ae=(e,i,l,t)=>{let n,a,r,f,s=!1,p=e.bMarks[i]+e.tShift[i],o=e.eMarks[i];if(p+2>o||e.src.slice(p,p+2)!=="$$")return!1;if(p+=2,n=e.src.slice(p,o),t)return!0;for(n.trim().slice(-2)==="$$"&&(n=n.trim().slice(0,-2),s=!0),r=i;!s&&(r++,!(r>=l||(p=e.bMarks[r]+e.tShift[r],o=e.eMarks[r],p<o&&e.tShift[r]<e.blkIndent)));)e.src.slice(p,o).trim().slice(-2)==="$$"&&(f=e.src.slice(0,o).lastIndexOf("$$"),a=e.src.slice(p,f),s=!0);e.line=r+1;const m=e.push("math_block","math",0);return m.block=!0,m.content=(n&&n.trim()?n+`
|
|
2
|
+
`:"")+e.getLines(i+1,r,e.tShift[i],!0)+(a&&a.trim()?a:""),m.map=[i,e.line],m.markup="$$",!0},le=(e,i)=>{const l=n=>{if(i.katexRef.value){const a=i.katexRef.value.renderToString(n,{throwOnError:!1});return`<span class="${u.prefix}-katex-inline" data-processed>${a}</span>`}else return`<span class="${u.prefix}-katex-inline">${n}</span>`},t=(n,a)=>{if(i.katexRef.value){const r=i.katexRef.value.renderToString(n,{throwOnError:!1,displayMode:!0});return`<p class="${u.prefix}-katex-block" data-line=${a} data-processed>${r}</p>`}else return`<p class="${u.prefix}-katex-block" data-line=${a}>${n}</p>`};e.inline.ruler.after("escape","math_inline",ie),e.block.ruler.after("blockquote","math_block",ae,{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.math_inline=(n,a)=>l(n[a].content),e.renderer.rules.math_block=(n,a)=>t(n[a].content,n[a].map[0])+`
|
|
3
|
+
`},ce=le,se=(e,i)=>{i=i||{};const l=3,t=i.marker||"!",n=t.charCodeAt(0),a=t.length;let r="",f="";const s=(o,m,k,b,h)=>{const v=o[m];return v.type==="admonition_open"?(o[m].attrPush(["class",`${u.prefix}-admonition ${u.prefix}-admonition-${v.info}`]),o[m].attrSet("data-line",String(o[m].map[0]))):v.type==="admonition_title_open"&&o[m].attrPush(["class",`${u.prefix}-admonition-title`]),h.renderToken(o,m,k)},p=o=>{const m=o.trim().split(" ",2);f="",r=m[0],m.length>1&&(f=o.substring(r.length+2)),(f===""||!f)&&(f=r)};e.block.ruler.before("code","admonition",(o,m,k,b)=>{let h,v,g,C=!1,y=o.bMarks[m]+o.tShift[m],w=o.eMarks[m];if(n!==o.src.charCodeAt(y))return!1;for(h=y+1;h<=w&&t[(h-y)%a]===o.src[h];h++);const x=Math.floor((h-y)/a);if(x!==l)return!1;h-=(h-y)%a;const $=o.src.slice(y,h),E=o.src.slice(h,w);if(p(E),b)return!0;for(v=m;v++,!(v>=k||(y=o.bMarks[v]+o.tShift[v],w=o.eMarks[v],y<w&&o.sCount[v]<o.blkIndent));)if(n===o.src.charCodeAt(y)&&!(o.sCount[v]-o.blkIndent>=4)){for(h=y+1;h<=w&&t[(h-y)%a]===o.src[h];h++);if(!(Math.floor((h-y)/a)<x)&&(h-=(h-y)%a,h=o.skipSpaces(h),!(h<w))){C=!0;break}}const P=o.parentType,S=o.lineMax;return o.parentType="root",o.lineMax=v,g=o.push("admonition_open","div",1),g.markup=$,g.block=!0,g.info=r,g.map=[m,v],g=o.push("admonition_title_open","p",1),g.markup=$+" "+r,g.map=[m,v],g=o.push("inline","",0),g.content=f,g.map=[m,o.line-1],g.children=[],g=o.push("admonition_title_close","p",-1),g.markup=$+" "+r,o.md.block.tokenize(o,m+1,v),g=o.push("admonition_close","div",-1),g.markup=o.src.slice(y,h),g.block=!0,o.parentType=P,o.lineMax=S,o.line=v+(C?1:0),!0},{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.admonition_open=s,e.renderer.rules.admonition_title_open=s,e.renderer.rules.admonition_title_close=s,e.renderer.rules.admonition_close=s},ue=se,de=(e,i)=>{e.renderer.rules.heading_open=(l,t)=>{var f;const n=l[t],a=((f=l[t+1].children)==null?void 0:f.reduce((s,p)=>s+(p.content||""),""))||"",r=n.markup.length;return i.headsRef.value.push({text:a,level:r}),n.map&&n.level===0&&(n.attrSet("data-line",String(n.map[0])),n.attrSet("id",i.mdHeadingId(a,r,i.headsRef.value.length))),e.renderer.renderToken(l,t,i)},e.renderer.rules.heading_close=(l,t,n,a,r)=>r.renderToken(l,t,n)},pe=de,me=(e,i)=>{const l=e.renderer.rules.fence,t=e.utils.unescapeAll,n=/\[(\w*)(?::([\w ]*))?\]/;function a(p){return p.info?t(p.info).trim():""}function r(p){const o=a(p),[m=null,k=""]=(n.exec(o)||[]).slice(1);return[m,k]}function f(p){const o=a(p);return o?o.split(/(\s+)/g)[0]:""}const s=(p,o,m,k,b)=>{if(p[o].hidden)return"";const[h,v]=r(p[o]);if(h===null)return l(p,o,m,k,b);let g,C,y,w,x="",$="";for(let E=o;E<p.length&&(g=p[E],[C,y]=r(g),C===h);E++)g.info=g.info.replace(n,""),g.hidden=!0,w=E-o>0?"":" checked",x+=`<li><input type="radio" name="label-group-${i.editorId}-${o}"${w}><label for="group-${i.editorId}-${o}-tab-${E-o}" onclick="this.previousElementSibling.click()">${y||f(g)}</label></li>
|
|
4
|
+
`,$+=`<input type="radio" id="group-${i.editorId}-${o}-tab-${E-o}" name="group-${i.editorId}-${o}"${w}>
|
|
5
|
+
`+l(p,E,m,k,b);return`<div class="code-tabs">
|
|
6
6
|
<ul>
|
|
7
7
|
`+x+`</ul>
|
|
8
|
-
`+E+"</div>"};e.renderer.rules.fence=s},fe=me,he=e=>{["paragraph_open","table_open","ordered_list_open","bullet_list_open","blockquote_open","hr","html_block","fence"].forEach(i=>{const a=e.renderer.rules[i];a?e.renderer.rules[i]=(t,n,l,r,f)=>{let s;const d=a(t,n,l,r,f);return t[n].map&&t[n].level===0&&!/^<!--/.test(d)?(s=t[n].map[0],d.replace(/^(<[^>]*)/,`$1 data-line="${s}"`)):d}:e.renderer.rules[i]=(t,n,l,r,f)=>{let s;return t[n].map&&t[n].level===0&&(s=t[n].map[0],t[n].attrSet("data-line",String(s))),f.renderToken(t,n,l)}})},ge=(e,i)=>{const{editorConfig:a,markdownItConfig:t,markdownItPlugins:n}=u.configOption,l=c.inject("editorId"),r=c.inject("showCodeRowNumber"),f=c.inject("theme"),s=c.ref([]),d=X(e),o=ne(e),{reRenderRef:m,replaceMermaid:k}=ee(e),b=j({html:!0,breaks:!0});t(b,{editorId:l});const h=[{type:"katex",plugin:ce,options:{katexRef:o}},{type:"image",plugin:U,options:{figcaption:!0,classes:"md-zoom"}},{type:"admonition",plugin:ue,options:{}},{type:"taskList",plugin:V,options:{}},{type:"heading",plugin:pe,options:{mdHeadingId:e.mdHeadingId,headsRef:s}},{type:"codeTabs",plugin:fe,options:{editorId:l}}];e.noMermaid||h.push({type:"mermaid",plugin:re,options:{themeRef:f}}),n(h,{editorId:l}).forEach(E=>{b.use(E.plugin,E.options)});const v=b.options.highlight;b.set({highlight:(E,$,P)=>{if(v){const T=v(E,$,P);if(T)return T}let S;!e.noHighlight&&d.value?d.value.getLanguage($)?S=d.value.highlight(E,{language:$,ignoreIllegals:!0}).value:S=d.value.highlightAuto(E).value:S=b.utils.escapeHtml(E);const O=r?p.generateCodeRowNumber(S.replace(/^\n+|\n+$/g,"")):`<span class="code-block">${S.replace(/^\n+|\n+$/g,"")}</span>`;return`<pre><code class="language-${$}" language=${$}>${O}</code></pre>`}}),he(b);const g=c.ref(`_article-key_${_.uuid()}`),C=c.ref(e.sanitize(b.render(e.modelValue))),y=()=>{p.bus.emit(l,p.BUILD_FINISHED,C.value),e.onHtmlChanged(C.value),e.onGetCatalog(s.value),p.bus.emit(l,p.CATALOG_CHANGED,s.value),k()};c.onMounted(y);const w=()=>{s.value=[],C.value=e.sanitize(b.render(e.modelValue)),y()},x=c.computed(()=>(e.noKatex||o.value)&&(e.noHighlight||d.value));return c.watch([c.toRef(e,"modelValue"),x,m],_.debounce(w,(a==null?void 0:a.renderDelay)!==void 0?a==null?void 0:a.renderDelay:i?0:500)),c.onMounted(()=>{p.bus.on(l,{name:p.PUSH_CATALOG,callback(){p.bus.emit(l,p.CATALOG_CHANGED,s.value)}}),p.bus.on(l,{name:p.RERENDER,callback:()=>{w(),g.value=`_article-key_${_.uuid()}`}})}),{html:C,key:g}},ve=ge,A={modelValue:{type:String,default:""},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>{}},onGetCatalog:{type:Function,default:()=>{}},mdHeadingId:{type:Function,default:()=>""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:e=>e},noKatex:{type:Boolean,default:!1},formatCopiedText:{type:Function,default:e=>e},noHighlight:{type:Boolean,default:!1},previewOnly:{type:Boolean,default:!1},noImgZoomIn:{type:Boolean},sanitizeMermaid:{type:Function}},ye={...A,onChange:{type:Function,default:()=>{}},placeholder:{type:String,default:""},scrollAuto:{type:Boolean},autofocus:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},maxlength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function,default:()=>{}},onFocus:{type:Function,default:()=>{}},noPrettier:{type:Boolean},completions:{type:Array},catalogVisible:{type:Boolean},theme:{type:String,default:"light"},onInput:{type:Function},onDrop:{type:Function,default:()=>{}},inputBoxWitdh:{type:String},onInputBoxWitdhChange:{type:Function}},F=c.defineComponent({name:"ContentPreview",props:A,setup(e){const i=c.inject("editorId"),a=c.inject("previewTheme"),t=c.inject("showCodeRowNumber"),{html:n,key:l}=ve(e,e.previewOnly);return J(e,n),W(e,n),()=>c.createVNode(c.Fragment,null,[c.createVNode("div",{id:`${i}-preview-wrapper`,class:`${u.prefix}-preview-wrapper`,"data-show":e.setting.preview,key:"content-preview-wrapper"},[c.createVNode("article",{key:l.value,id:`${i}-preview`,class:[`${u.prefix}-preview`,`${a==null?void 0:a.value}-theme`,t&&`${u.prefix}-scrn`],innerHTML:n.value},null)]),!e.previewOnly&&c.createVNode("div",{id:`${i}-html-wrapper`,class:`${u.prefix}-preview-wrapper`,"data-show":e.setting.htmlPreview,key:"html-preview-wrapper"},[c.createVNode("div",{class:`${u.prefix}-html`},[n.value])])])}}),be=(e,i)=>{const{editorId:a}=e,t=c.reactive({buildFinished:!1,html:""});c.watch(()=>e.modelValue,()=>{t.buildFinished=!1}),c.onMounted(()=>{p.bus.on(a,{name:p.BUILD_FINISHED,callback(n){t.buildFinished=!0,t.html=n}}),p.bus.on(a,{name:p.ON_SAVE,callback(){const n=new Promise(l=>{if(t.buildFinished)l(t.html);else{const r=f=>{l(f),p.bus.remove(a,p.BUILD_FINISHED,r)};p.bus.on(a,{name:p.BUILD_FINISHED,callback:r})}});e.onSave?e.onSave(e.modelValue,n):i.emit("onSave",e.modelValue,n)}})})},R=e=>{var n,l;const{editorId:i}=e,a=(l=(n=u.configOption)==null?void 0:n.editorExtensions)==null?void 0:l.highlight;c.provide("editorId",i),c.provide("theme",c.computed(()=>e.theme)),c.provide("language",c.computed(()=>e.language)),c.provide("highlight",c.computed(()=>{const r={...u.codeCss,...a==null?void 0:a.css},f=e.codeStyleReverse&&e.codeStyleReverseList.includes(e.previewTheme)?"dark":e.theme;return{js:(a==null?void 0:a.js)||u.highlightUrl,css:r[e.codeTheme]?r[e.codeTheme][f]:u.codeCss.atom[f]}})),c.provide("showCodeRowNumber",e.showCodeRowNumber);const t=c.computed(()=>{var f,s;const r={...u.staticTextDefault,...(s=(f=u.configOption)==null?void 0:f.editorConfig)==null?void 0:s.languageUserDefined};return r[e.language]?r[e.language]:u.staticTextDefault["zh-CN"]});c.provide("usedLanguageText",t),c.provide("previewTheme",c.computed(()=>e.previewTheme)),c.provide("customIcon",c.computed(()=>e.customIcon))},we=e=>{R(e),c.provide("tabWidth",e.tabWidth)},L=e=>{c.onMounted(()=>{var i,a;if(!e.noIconfont)if(u.configOption.iconfontType==="svg"){const t=document.createElement("script");t.src=((i=u.configOption.editorExtensions)==null?void 0:i.iconfont)||u.iconfontSvgUrl,t.id=`${u.prefix}-icon`,I.appendHandler(t)}else{const t=document.createElement("link");t.rel="stylesheet",t.href=((a=u.configOption.editorExtensions)==null?void 0:a.iconfontClass)||u.iconfontClassUrl,t.id=`${u.prefix}-icon-class`,I.appendHandler(t)}})},ke=e=>{var f,s,d,o,m,k;const{noPrettier:i,noUploadImg:a}=e,{editorExtensions:t}=u.configOption,n=i||!!((s=(f=u.configOption.editorExtensions)==null?void 0:f.prettier)!=null&&s.prettierInstance),l=i||!!((o=(d=u.configOption.editorExtensions)==null?void 0:d.prettier)!=null&&o.parserMarkdownInstance),r=a||!!((k=(m=u.configOption.editorExtensions)==null?void 0:m.cropper)!=null&&k.instance);c.onMounted(()=>{var C,y,w,x;const b=document.createElement("script"),h=document.createElement("script");b.src=((C=t==null?void 0:t.prettier)==null?void 0:C.standaloneJs)||u.prettierUrl.main,b.id=`${u.prefix}-prettier`,h.src=((y=t==null?void 0:t.prettier)==null?void 0:y.parserMarkdownJs)||u.prettierUrl.markdown,h.id=`${u.prefix}-prettierMD`;const v=document.createElement("link");v.rel="stylesheet",v.href=((w=t==null?void 0:t.cropper)==null?void 0:w.css)||u.cropperUrl.css,v.id=`${u.prefix}-cropperCss`;const g=document.createElement("script");g.src=((x=t==null?void 0:t.cropper)==null?void 0:x.js)||u.cropperUrl.js,g.id=`${u.prefix}-cropper`,r||(I.appendHandler(v),I.appendHandler(g)),n||I.appendHandler(b),l||I.appendHandler(h)}),L(e)},Ce=(e,i)=>{const{editorId:a}=e;c.onMounted(()=>{p.bus.on(a,{name:p.ERROR_CATCHER,callback:t=>{e.onError instanceof Function?e.onError(t):i.emit("onError",t)}})})},$e=(e,i)=>{const{editorId:a}=e,t=c.reactive({pageFullscreen:e.pageFullscreen,fullscreen:!1,preview:e.preview,htmlPreview:e.preview?!1:e.htmlPreview}),n=(f,s)=>{t[f]=s===void 0?!t[f]:s,f==="preview"&&t.preview?t.htmlPreview=!1:f==="htmlPreview"&&t.htmlPreview&&(t.preview=!1)};let l="";const r=()=>{t.pageFullscreen||t.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=l};return c.watch(()=>[t.pageFullscreen,t.fullscreen],r),c.onMounted(()=>{p.bus.on(a,{name:p.UPLOAD_IMAGE,callback(f,s){const d=o=>{p.bus.emit(a,p.REPLACE,"image",{desc:"",urls:o}),s&&s()};e.onUploadImg?e.onUploadImg(f,d):i.emit("onUploadImg",f,d)}}),l=document.body.style.overflow,r()}),[t,n]},Ee=e=>{const{editorId:i}=e,a=c.ref(!1);return c.onMounted(()=>{p.bus.on(i,{name:p.CHANGE_CATALOG_VISIBLE,callback:n=>{n===void 0?a.value=!a.value:a.value=n}})}),c.computed(()=>!e.toolbarsExclude.includes("catalog")&&e.toolbars.includes("catalog")&&a.value)},Ie=(e,i,a,t,n,l)=>{const{editorId:r}=e;c.watch(()=>t.pageFullscreen,s=>{p.bus.emit(r,p.PAGE_FULL_SCREEN_CHANGED,s)}),c.watch(()=>t.fullscreen,s=>{p.bus.emit(r,p.FULL_SCREEN_CHANGED,s)}),c.watch(()=>t.preview,s=>{p.bus.emit(r,p.PREVIEW_CHANGED,s)}),c.watch(()=>t.htmlPreview,s=>{p.bus.emit(r,p.HTML_PREVIEW_CHANGED,s)}),c.watch(a,s=>{p.bus.emit(r,p.CATALOG_VISIBLE_CHANGED,s)});const f={on(s,d){switch(s){case"pageFullscreen":{p.bus.on(r,{name:p.PAGE_FULL_SCREEN_CHANGED,callback(o){d(o)}});break}case"fullscreen":{p.bus.on(r,{name:p.FULL_SCREEN_CHANGED,callback(o){d(o)}});break}case"preview":{p.bus.on(r,{name:p.PREVIEW_CHANGED,callback(o){d(o)}});break}case"htmlPreview":{p.bus.on(r,{name:p.HTML_PREVIEW_CHANGED,callback(o){d(o)}});break}case"catalog":{p.bus.on(r,{name:p.CATALOG_VISIBLE_CHANGED,callback(o){d(o)}});break}}},togglePageFullscreen(s){n("pageFullscreen",s)},toggleFullscreen(s){p.bus.emit(r,p.CHANGE_FULL_SCREEN,s)},togglePreview(s){n("preview",s)},toggleHtmlPreview(s){n("htmlPreview",s)},toggleCatalog(s){p.bus.emit(r,p.CHANGE_CATALOG_VISIBLE,s)},triggerSave(){p.bus.emit(r,p.ON_SAVE)},insert(s){p.bus.emit(r,p.REPLACE,"universal",{generate:s})},focus(s){var d;(d=l.value)==null||d.focus(s)},rerender(){p.bus.emit(r,p.RERENDER)},getSelectedText(){var s;return(s=l.value)==null?void 0:s.getSelectedText()},resetHistory(){var s;(s=l.value)==null||s.resetHistory()}};i.expose(f)},xe=e=>e,N={modelValue:{type:String,default:""},theme:{type:String,default:"light"},class:{type:String,default:""},language:{type:String,default:"zh-CN"},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:u.defaultEditorId},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},mdHeadingId:{type:Function,default:xe},sanitize:{type:Function,default:e=>e},noMermaid:{type:Boolean,default:!1},noKatex:{type:Boolean,default:!1},codeTheme:{type:String,default:"atom"},noIconfont:{type:Boolean},formatCopiedText:{type:Function,default:e=>e},codeStyleReverse:{type:Boolean,default:!0},codeStyleReverseList:{type:Array,default:["default","mk-cute"]},noHighlight:{type:Boolean,default:!1},noImgZoomIn:{type:Boolean,default:!1},customIcon:{type:Object,default:{}},sanitizeMermaid:{type:Function,default:e=>Promise.resolve(e)}},Se={...N,onChange:{type:Function},onSave:{type:Function},onUploadImg:{type:Function},pageFullscreen:{type:Boolean,default:!1},preview:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1},toolbars:{type:Array,default:u.allToolbar},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},tabWidth:{type:Number,default:2},tableShape:{type:Array,default:()=>[6,4]},placeholder:{type:String,default:""},defToolbars:{type:[String,Object]},onError:{type:Function},footers:{type:Array,default:u.allFooter},scrollAuto:{type:Boolean,default:!0},defFooters:{type:[String,Object]},noUploadImg:{type:Boolean},autoFocus:{type:Boolean},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function},onFocus:{type:Function},completions:{type:Array},showToolbarName:{type:Boolean,default:!1},onInput:{type:Function},onDrop:{type:Function},inputBoxWitdh:{type:String,default:"50%"},onInputBoxWitdhChange:{type:Function}},B=["onHtmlChanged","onGetCatalog"],_e=[...B,"onChange","onSave","onUploadImg","onError","update:modelValue","onBlur","onFocus","onInput","onDrop","onInputBoxWitdhChange"],He=c.defineComponent({name:"MdPreview",props:N,emits:B,setup(e,i){const{editorId:a,noKatex:t,noMermaid:n,noHighlight:l}=e;return R(e),L(e),c.onBeforeUnmount(()=>{p.bus.clear(a)}),()=>c.createVNode("div",{id:a,class:[u.prefix,e.class,e.theme==="dark"&&`${u.prefix}-dark`,`${u.prefix}-previewOnly`],style:e.style},[c.createVNode(F,{modelValue:e.modelValue,onHtmlChanged:r=>{e.onHtmlChanged?e.onHtmlChanged(r):i.emit("onHtmlChanged",r)},onGetCatalog:r=>{e.onGetCatalog?e.onGetCatalog(r):i.emit("onGetCatalog",r)},mdHeadingId:e.mdHeadingId,noMermaid:n,sanitize:e.sanitize,noKatex:t,formatCopiedText:e.formatCopiedText,noHighlight:l,noImgZoomIn:e.noImgZoomIn,previewOnly:!0,sanitizeMermaid:e.sanitizeMermaid},null)])}}),H=He;H.install=e=>(e.component(H.name,H),e);exports.ContentPreview=F;exports.MdPreview=H;exports.contentProps=ye;exports.editorEmits=_e;exports.editorProps=Se;exports.useCatalog=Ee;exports.useConfig=$e;exports.useErrorCatcher=Ce;exports.useExpansion=ke;exports.useExpose=Ie;exports.useOnSave=be;exports.useProvide=we;
|
|
8
|
+
`+$+"</div>"};e.renderer.rules.fence=s},fe=me,he=e=>{["paragraph_open","table_open","ordered_list_open","bullet_list_open","blockquote_open","hr","html_block","fence"].forEach(i=>{const l=e.renderer.rules[i];l?e.renderer.rules[i]=(t,n,a,r,f)=>{let s;const p=l(t,n,a,r,f);return t[n].map&&t[n].level===0&&!/^<!--/.test(p)?(s=t[n].map[0],p.replace(/^(<[^>]*)/,`$1 data-line="${s}"`)):p}:e.renderer.rules[i]=(t,n,a,r,f)=>{let s;return t[n].map&&t[n].level===0&&(s=t[n].map[0],t[n].attrSet("data-line",String(s))),f.renderToken(t,n,a)}})},ge=(e,i)=>{const{editorConfig:l,markdownItConfig:t,markdownItPlugins:n}=u.configOption,a=c.inject("editorId"),r=c.inject("showCodeRowNumber"),f=c.inject("theme"),s=c.ref([]),p=X(e),o=ne(e),{reRenderRef:m,replaceMermaid:k}=ee(e),b=j({html:!0,breaks:!0});t(b,{editorId:a});const h=[{type:"katex",plugin:ce,options:{katexRef:o}},{type:"image",plugin:U,options:{figcaption:!0,classes:"md-zoom"}},{type:"admonition",plugin:ue,options:{}},{type:"taskList",plugin:V,options:{}},{type:"heading",plugin:pe,options:{mdHeadingId:e.mdHeadingId,headsRef:s}},{type:"codeTabs",plugin:fe,options:{editorId:a}}];e.noMermaid||h.push({type:"mermaid",plugin:re,options:{themeRef:f}}),n(h,{editorId:a}).forEach($=>{b.use($.plugin,$.options)});const v=b.options.highlight;b.set({highlight:($,E,P)=>{if(v){const T=v($,E,P);if(T)return T}let S;!e.noHighlight&&p.value?p.value.getLanguage(E)?S=p.value.highlight($,{language:E,ignoreIllegals:!0}).value:S=p.value.highlightAuto($).value:S=b.utils.escapeHtml($);const O=r?d.generateCodeRowNumber(S.replace(/^\n+|\n+$/g,"")):`<span class="code-block">${S.replace(/^\n+|\n+$/g,"")}</span>`;return`<pre><code class="language-${E}" language=${E}>${O}</code></pre>`}}),he(b);const g=c.ref(`_article-key_${_.uuid()}`),C=c.ref(e.sanitize(b.render(e.modelValue))),y=()=>{d.bus.emit(a,d.BUILD_FINISHED,C.value),e.onHtmlChanged(C.value),e.onGetCatalog(s.value),d.bus.emit(a,d.CATALOG_CHANGED,s.value),k()};c.onMounted(y);const w=()=>{s.value=[],C.value=e.sanitize(b.render(e.modelValue)),y()},x=c.computed(()=>(e.noKatex||o.value)&&(e.noHighlight||p.value));return c.watch([c.toRef(e,"modelValue"),x,m],_.debounce(w,(l==null?void 0:l.renderDelay)!==void 0?l==null?void 0:l.renderDelay:i?0:500)),c.onMounted(()=>{d.bus.on(a,{name:d.PUSH_CATALOG,callback(){d.bus.emit(a,d.CATALOG_CHANGED,s.value)}}),d.bus.on(a,{name:d.RERENDER,callback:()=>{w(),g.value=`_article-key_${_.uuid()}`}})}),{html:C,key:g}},ve=ge,A={modelValue:{type:String,default:""},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>{}},onGetCatalog:{type:Function,default:()=>{}},mdHeadingId:{type:Function,default:()=>""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:e=>e},noKatex:{type:Boolean,default:!1},formatCopiedText:{type:Function,default:e=>e},noHighlight:{type:Boolean,default:!1},previewOnly:{type:Boolean,default:!1},noImgZoomIn:{type:Boolean},sanitizeMermaid:{type:Function}},ye={...A,onChange:{type:Function,default:()=>{}},placeholder:{type:String,default:""},scrollAuto:{type:Boolean},autofocus:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},maxlength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function,default:()=>{}},onFocus:{type:Function,default:()=>{}},noPrettier:{type:Boolean},completions:{type:Array},catalogVisible:{type:Boolean},theme:{type:String,default:"light"},onInput:{type:Function},onDrop:{type:Function,default:()=>{}},inputBoxWitdh:{type:String},onInputBoxWitdhChange:{type:Function}},R=c.defineComponent({name:"ContentPreview",props:A,setup(e){const i=c.inject("editorId"),l=c.inject("previewTheme"),t=c.inject("showCodeRowNumber"),{html:n,key:a}=ve(e,e.previewOnly);return J(e,n),W(e,n),()=>c.createVNode(c.Fragment,null,[c.createVNode("div",{id:`${i}-preview-wrapper`,class:`${u.prefix}-preview-wrapper`,"data-show":e.setting.preview,key:"content-preview-wrapper"},[c.createVNode("div",{key:a.value,id:`${i}-preview`,class:[`${u.prefix}-preview`,`${l==null?void 0:l.value}-theme`,t&&`${u.prefix}-scrn`],innerHTML:n.value},null)]),!e.previewOnly&&c.createVNode("div",{id:`${i}-html-wrapper`,class:`${u.prefix}-preview-wrapper`,"data-show":e.setting.htmlPreview,key:"html-preview-wrapper"},[c.createVNode("div",{class:`${u.prefix}-html`},[n.value])])])}}),be=(e,i)=>{const{editorId:l}=e,t=c.reactive({buildFinished:!1,html:""});c.watch(()=>e.modelValue,()=>{t.buildFinished=!1}),c.onMounted(()=>{d.bus.on(l,{name:d.BUILD_FINISHED,callback(n){t.buildFinished=!0,t.html=n}}),d.bus.on(l,{name:d.ON_SAVE,callback(){const n=new Promise(a=>{if(t.buildFinished)a(t.html);else{const r=f=>{a(f),d.bus.remove(l,d.BUILD_FINISHED,r)};d.bus.on(l,{name:d.BUILD_FINISHED,callback:r})}});e.onSave?e.onSave(e.modelValue,n):i.emit("onSave",e.modelValue,n)}})})},F=e=>{var n,a;const{editorId:i}=e,l=(a=(n=u.configOption)==null?void 0:n.editorExtensions)==null?void 0:a.highlight;c.provide("editorId",i),c.provide("theme",c.computed(()=>e.theme)),c.provide("language",c.computed(()=>e.language)),c.provide("highlight",c.computed(()=>{const r={...u.codeCss,...l==null?void 0:l.css},f=e.codeStyleReverse&&e.codeStyleReverseList.includes(e.previewTheme)?"dark":e.theme;return{js:(l==null?void 0:l.js)||u.highlightUrl,css:r[e.codeTheme]?r[e.codeTheme][f]:u.codeCss.atom[f]}})),c.provide("showCodeRowNumber",e.showCodeRowNumber);const t=c.computed(()=>{var f,s;const r={...u.staticTextDefault,...(s=(f=u.configOption)==null?void 0:f.editorConfig)==null?void 0:s.languageUserDefined};return r[e.language]?r[e.language]:u.staticTextDefault["zh-CN"]});c.provide("usedLanguageText",t),c.provide("previewTheme",c.computed(()=>e.previewTheme)),c.provide("customIcon",c.computed(()=>e.customIcon))},we=e=>{F(e),c.provide("tabWidth",e.tabWidth)},L=e=>{c.onMounted(()=>{var i,l;if(!e.noIconfont)if(u.configOption.iconfontType==="svg"){const t=document.createElement("script");t.src=((i=u.configOption.editorExtensions)==null?void 0:i.iconfont)||u.iconfontSvgUrl,t.id=`${u.prefix}-icon`,I.appendHandler(t)}else{const t=document.createElement("link");t.rel="stylesheet",t.href=((l=u.configOption.editorExtensions)==null?void 0:l.iconfontClass)||u.iconfontClassUrl,t.id=`${u.prefix}-icon-class`,I.appendHandler(t)}})},ke=e=>{var f,s,p,o,m,k;const{noPrettier:i,noUploadImg:l}=e,{editorExtensions:t}=u.configOption,n=i||!!((s=(f=u.configOption.editorExtensions)==null?void 0:f.prettier)!=null&&s.prettierInstance),a=i||!!((o=(p=u.configOption.editorExtensions)==null?void 0:p.prettier)!=null&&o.parserMarkdownInstance),r=l||!!((k=(m=u.configOption.editorExtensions)==null?void 0:m.cropper)!=null&&k.instance);c.onMounted(()=>{var C,y,w,x;const b=document.createElement("script"),h=document.createElement("script");b.src=((C=t==null?void 0:t.prettier)==null?void 0:C.standaloneJs)||u.prettierUrl.main,b.id=`${u.prefix}-prettier`,h.src=((y=t==null?void 0:t.prettier)==null?void 0:y.parserMarkdownJs)||u.prettierUrl.markdown,h.id=`${u.prefix}-prettierMD`;const v=document.createElement("link");v.rel="stylesheet",v.href=((w=t==null?void 0:t.cropper)==null?void 0:w.css)||u.cropperUrl.css,v.id=`${u.prefix}-cropperCss`;const g=document.createElement("script");g.src=((x=t==null?void 0:t.cropper)==null?void 0:x.js)||u.cropperUrl.js,g.id=`${u.prefix}-cropper`,r||(I.appendHandler(v),I.appendHandler(g)),n||I.appendHandler(b),a||I.appendHandler(h)}),L(e)},Ce=(e,i)=>{const{editorId:l}=e;c.onMounted(()=>{d.bus.on(l,{name:d.ERROR_CATCHER,callback:t=>{e.onError instanceof Function?e.onError(t):i.emit("onError",t)}})})},Ee=(e,i)=>{const{editorId:l}=e,t=c.reactive({pageFullscreen:e.pageFullscreen,fullscreen:!1,preview:e.preview,htmlPreview:e.preview?!1:e.htmlPreview}),n=(f,s)=>{t[f]=s===void 0?!t[f]:s,f==="preview"&&t.preview?t.htmlPreview=!1:f==="htmlPreview"&&t.htmlPreview&&(t.preview=!1)};let a="";const r=()=>{t.pageFullscreen||t.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=a};return c.watch(()=>[t.pageFullscreen,t.fullscreen],r),c.onMounted(()=>{d.bus.on(l,{name:d.UPLOAD_IMAGE,callback(f,s){const p=o=>{d.bus.emit(l,d.REPLACE,"image",{desc:"",urls:o}),s&&s()};e.onUploadImg?e.onUploadImg(f,p):i.emit("onUploadImg",f,p)}}),a=document.body.style.overflow,r()}),[t,n]},$e=e=>{const{editorId:i}=e,l=c.ref(!1);return c.onMounted(()=>{d.bus.on(i,{name:d.CHANGE_CATALOG_VISIBLE,callback:n=>{n===void 0?l.value=!l.value:l.value=n}})}),c.computed(()=>!e.toolbarsExclude.includes("catalog")&&e.toolbars.includes("catalog")&&l.value)},Ie=(e,i,l,t,n,a)=>{const{editorId:r}=e;c.watch(()=>t.pageFullscreen,s=>{d.bus.emit(r,d.PAGE_FULL_SCREEN_CHANGED,s)}),c.watch(()=>t.fullscreen,s=>{d.bus.emit(r,d.FULL_SCREEN_CHANGED,s)}),c.watch(()=>t.preview,s=>{d.bus.emit(r,d.PREVIEW_CHANGED,s)}),c.watch(()=>t.htmlPreview,s=>{d.bus.emit(r,d.HTML_PREVIEW_CHANGED,s)}),c.watch(l,s=>{d.bus.emit(r,d.CATALOG_VISIBLE_CHANGED,s)});const f={on(s,p){switch(s){case"pageFullscreen":{d.bus.on(r,{name:d.PAGE_FULL_SCREEN_CHANGED,callback(o){p(o)}});break}case"fullscreen":{d.bus.on(r,{name:d.FULL_SCREEN_CHANGED,callback(o){p(o)}});break}case"preview":{d.bus.on(r,{name:d.PREVIEW_CHANGED,callback(o){p(o)}});break}case"htmlPreview":{d.bus.on(r,{name:d.HTML_PREVIEW_CHANGED,callback(o){p(o)}});break}case"catalog":{d.bus.on(r,{name:d.CATALOG_VISIBLE_CHANGED,callback(o){p(o)}});break}}},togglePageFullscreen(s){n("pageFullscreen",s)},toggleFullscreen(s){d.bus.emit(r,d.CHANGE_FULL_SCREEN,s)},togglePreview(s){n("preview",s)},toggleHtmlPreview(s){n("htmlPreview",s)},toggleCatalog(s){d.bus.emit(r,d.CHANGE_CATALOG_VISIBLE,s)},triggerSave(){d.bus.emit(r,d.ON_SAVE)},insert(s){d.bus.emit(r,d.REPLACE,"universal",{generate:s})},focus(s){var p;(p=a.value)==null||p.focus(s)},rerender(){d.bus.emit(r,d.RERENDER)},getSelectedText(){var s;return(s=a.value)==null?void 0:s.getSelectedText()},resetHistory(){var s;(s=a.value)==null||s.resetHistory()}};i.expose(f)},xe=e=>e,N={modelValue:{type:String,default:""},theme:{type:String,default:"light"},class:{type:String,default:""},language:{type:String,default:"zh-CN"},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:u.defaultEditorId},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},mdHeadingId:{type:Function,default:xe},sanitize:{type:Function,default:e=>e},noMermaid:{type:Boolean,default:!1},noKatex:{type:Boolean,default:!1},codeTheme:{type:String,default:"atom"},noIconfont:{type:Boolean},formatCopiedText:{type:Function,default:e=>e},codeStyleReverse:{type:Boolean,default:!0},codeStyleReverseList:{type:Array,default:["default","mk-cute"]},noHighlight:{type:Boolean,default:!1},noImgZoomIn:{type:Boolean,default:!1},customIcon:{type:Object,default:{}},sanitizeMermaid:{type:Function,default:e=>Promise.resolve(e)}},Se={...N,onChange:{type:Function},onSave:{type:Function},onUploadImg:{type:Function},pageFullscreen:{type:Boolean,default:!1},preview:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1},toolbars:{type:Array,default:u.allToolbar},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},tabWidth:{type:Number,default:2},tableShape:{type:Array,default:()=>[6,4]},placeholder:{type:String,default:""},defToolbars:{type:[String,Object]},onError:{type:Function},footers:{type:Array,default:u.allFooter},scrollAuto:{type:Boolean,default:!0},defFooters:{type:[String,Object]},noUploadImg:{type:Boolean},autoFocus:{type:Boolean},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function},onFocus:{type:Function},completions:{type:Array},showToolbarName:{type:Boolean,default:!1},onInput:{type:Function},onDrop:{type:Function},inputBoxWitdh:{type:String,default:"50%"},onInputBoxWitdhChange:{type:Function}},B=["onHtmlChanged","onGetCatalog"],_e=[...B,"onChange","onSave","onUploadImg","onError","update:modelValue","onBlur","onFocus","onInput","onDrop","onInputBoxWitdhChange"],He=(e,i)=>{const{editorId:l}=e,t={rerender(){d.bus.emit(l,d.RERENDER)}};i.expose(t)},Pe=c.defineComponent({name:"MdPreview",props:N,emits:B,setup(e,i){const{editorId:l,noKatex:t,noMermaid:n,noHighlight:a}=e;return F(e),L(e),He(e,i),c.onBeforeUnmount(()=>{d.bus.clear(l)}),()=>c.createVNode("div",{id:l,class:[u.prefix,e.class,e.theme==="dark"&&`${u.prefix}-dark`,`${u.prefix}-previewOnly`],style:e.style},[c.createVNode(R,{modelValue:e.modelValue,onHtmlChanged:r=>{e.onHtmlChanged?e.onHtmlChanged(r):i.emit("onHtmlChanged",r)},onGetCatalog:r=>{e.onGetCatalog?e.onGetCatalog(r):i.emit("onGetCatalog",r)},mdHeadingId:e.mdHeadingId,noMermaid:n,sanitize:e.sanitize,noKatex:t,formatCopiedText:e.formatCopiedText,noHighlight:a,noImgZoomIn:e.noImgZoomIn,previewOnly:!0,sanitizeMermaid:e.sanitizeMermaid},null)])}}),H=Pe;H.install=e=>(e.component(H.name,H),e);exports.ContentPreview=R;exports.MdPreview=H;exports.contentProps=ye;exports.editorEmits=_e;exports.editorProps=Se;exports.useCatalog=$e;exports.useConfig=Ee;exports.useErrorCatcher=Ce;exports.useExpansion=ke;exports.useExpose=Ie;exports.useOnSave=be;exports.useProvide=we;
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { inject as P, onMounted as E, watch as C, toRef as
|
|
2
|
-
import { e as S, p as h, m as ge, k as
|
|
3
|
-
import { a as Ce, b as y, P as Ie, C as
|
|
1
|
+
import { inject as P, onMounted as E, watch as C, toRef as te, nextTick as U, shallowRef as B, ref as R, computed as F, defineComponent as ne, createVNode as M, Fragment as pe, reactive as oe, provide as H, onBeforeUnmount as he } from "vue";
|
|
2
|
+
import { e as S, p as h, m as ge, k as D, f as V, h as ye, s as z, a as ve, i as be, g as W, j as K, l as we, b as ke, d as $e } from "./config.mjs";
|
|
3
|
+
import { a as Ce, b as y, P as Ie, C as q, R as G, B as A, O as re, E as Se, U as Ee, c as ae, d as Z, F as J, e as Q, H as X, f as Y, h as le, i as Pe } from "./index4.mjs";
|
|
4
4
|
import { a as _, u as _e } from "./dom.mjs";
|
|
5
5
|
import Te from "medium-zoom";
|
|
6
6
|
import { debounce as ie, uuid as j } from "@vavt/util";
|
|
7
7
|
import He from "copy-to-clipboard";
|
|
8
8
|
import Fe from "markdown-it";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import xe from "markdown-it-image-figures";
|
|
10
|
+
import Me from "markdown-it-task-lists";
|
|
11
11
|
import Re from "lru-cache";
|
|
12
12
|
const Ae = (e, a) => {
|
|
13
13
|
const i = P("editorId"), { noImgZoomIn: t } = e, n = ie(() => {
|
|
@@ -18,7 +18,7 @@ const Ae = (e, a) => {
|
|
|
18
18
|
});
|
|
19
19
|
E(() => {
|
|
20
20
|
!t && n();
|
|
21
|
-
}), C([a,
|
|
21
|
+
}), C([a, te(e.setting, "preview")], () => {
|
|
22
22
|
!t && n();
|
|
23
23
|
});
|
|
24
24
|
}, Be = Ae, Le = (e, a) => {
|
|
@@ -141,11 +141,11 @@ const Ae = (e, a) => {
|
|
|
141
141
|
return E(() => {
|
|
142
142
|
if (!e.noKatex && !t.value) {
|
|
143
143
|
const l = document.createElement("script");
|
|
144
|
-
l.src = (a == null ? void 0 : a.js) ||
|
|
144
|
+
l.src = (a == null ? void 0 : a.js) || D.js, l.onload = () => {
|
|
145
145
|
t.value = window.katex;
|
|
146
146
|
}, l.id = `${h}-katex`;
|
|
147
147
|
const r = document.createElement("link");
|
|
148
|
-
r.rel = "stylesheet", r.href = (a == null ? void 0 : a.css) ||
|
|
148
|
+
r.rel = "stylesheet", r.href = (a == null ? void 0 : a.css) || D.css, r.id = `${h}-katexCss`, _(l, "katex"), _(r);
|
|
149
149
|
}
|
|
150
150
|
}), t;
|
|
151
151
|
}, ze = Ve, We = (e, a) => {
|
|
@@ -158,7 +158,7 @@ const Ae = (e, a) => {
|
|
|
158
158
|
}
|
|
159
159
|
return i(t, n, l, r, d);
|
|
160
160
|
};
|
|
161
|
-
}, Ke = We,
|
|
161
|
+
}, Ke = We, ee = (e, a) => {
|
|
162
162
|
let i = !0, t = !0;
|
|
163
163
|
const n = e.posMax, l = a > 0 ? e.src.charCodeAt(a - 1) : -1, r = a + 1 <= n ? e.src.charCodeAt(a + 1) : -1;
|
|
164
164
|
return (l === 32 || l === 9 || r >= 48 && r <= 57) && (t = !1), (r === 32 || r === 9) && (i = !1), {
|
|
@@ -169,7 +169,7 @@ const Ae = (e, a) => {
|
|
|
169
169
|
let i, t, n, l;
|
|
170
170
|
if (e.src[e.pos] !== "$")
|
|
171
171
|
return !1;
|
|
172
|
-
if (n =
|
|
172
|
+
if (n = ee(e, e.pos), !n.can_open)
|
|
173
173
|
return a || (e.pending += "$"), e.pos += 1, !0;
|
|
174
174
|
const r = e.pos + 1;
|
|
175
175
|
for (i = r; (i = e.src.indexOf("$", i)) !== -1; ) {
|
|
@@ -179,7 +179,7 @@ const Ae = (e, a) => {
|
|
|
179
179
|
break;
|
|
180
180
|
i += 1;
|
|
181
181
|
}
|
|
182
|
-
return i === -1 ? (a || (e.pending += "$"), e.pos = r, !0) : i - r === 0 ? (a || (e.pending += "$$"), e.pos = r + 1, !0) : (n =
|
|
182
|
+
return i === -1 ? (a || (e.pending += "$"), e.pos = r, !0) : i - r === 0 ? (a || (e.pending += "$$"), e.pos = r + 1, !0) : (n = ee(e, i), n.can_close ? (a || (t = e.push("math_inline", "math", 0), t.markup = "$", t.content = e.src.slice(r, i)), e.pos = i + 1, !0) : (a || (e.pending += "$"), e.pos = r, !0));
|
|
183
183
|
}, Ze = (e, a, i, t) => {
|
|
184
184
|
let n, l, r, d, c = !1, s = e.bMarks[a] + e.tShift[a], o = e.eMarks[a];
|
|
185
185
|
if (s + 2 > o || e.src.slice(s, s + 2) !== "$$")
|
|
@@ -254,8 +254,8 @@ const Ae = (e, a) => {
|
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
const L = o.parentType,
|
|
258
|
-
return o.parentType = "root", o.lineMax = p, f = o.push("admonition_open", "div", 1), f.markup = I, f.block = !0, f.info = r, f.map = [u, p], f = o.push("admonition_title_open", "p", 1), f.markup = I + " " + r, f.map = [u, p], f = o.push("inline", "", 0), f.content = d, f.map = [u, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = I + " " + r, o.md.block.tokenize(o, u + 1, p), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(g, m), f.block = !0, o.parentType = L, o.lineMax =
|
|
257
|
+
const L = o.parentType, x = o.lineMax;
|
|
258
|
+
return o.parentType = "root", o.lineMax = p, f = o.push("admonition_open", "div", 1), f.markup = I, f.block = !0, f.info = r, f.map = [u, p], f = o.push("admonition_title_open", "p", 1), f.markup = I + " " + r, f.map = [u, p], f = o.push("inline", "", 0), f.content = d, f.map = [u, o.line - 1], f.children = [], f = o.push("admonition_title_close", "p", -1), f.markup = I + " " + r, o.md.block.tokenize(o, u + 1, p), f = o.push("admonition_close", "div", -1), f.markup = o.src.slice(g, m), f.block = !0, o.parentType = L, o.lineMax = x, o.line = p + (k ? 1 : 0), !0;
|
|
259
259
|
},
|
|
260
260
|
{
|
|
261
261
|
alt: ["paragraph", "reference", "blockquote", "list"]
|
|
@@ -340,7 +340,7 @@ const Ae = (e, a) => {
|
|
|
340
340
|
},
|
|
341
341
|
{
|
|
342
342
|
type: "image",
|
|
343
|
-
plugin:
|
|
343
|
+
plugin: xe,
|
|
344
344
|
options: { figcaption: !0, classes: "md-zoom" }
|
|
345
345
|
},
|
|
346
346
|
{
|
|
@@ -350,7 +350,7 @@ const Ae = (e, a) => {
|
|
|
350
350
|
},
|
|
351
351
|
{
|
|
352
352
|
type: "taskList",
|
|
353
|
-
plugin:
|
|
353
|
+
plugin: Me,
|
|
354
354
|
options: {}
|
|
355
355
|
},
|
|
356
356
|
{
|
|
@@ -381,24 +381,24 @@ const Ae = (e, a) => {
|
|
|
381
381
|
if (N)
|
|
382
382
|
return N;
|
|
383
383
|
}
|
|
384
|
-
let
|
|
385
|
-
!e.noHighlight && s.value ? s.value.getLanguage($) ?
|
|
384
|
+
let x;
|
|
385
|
+
!e.noHighlight && s.value ? s.value.getLanguage($) ? x = s.value.highlight(I, {
|
|
386
386
|
language: $,
|
|
387
387
|
ignoreIllegals: !0
|
|
388
|
-
}).value :
|
|
389
|
-
const fe = r ? Ce(
|
|
388
|
+
}).value : x = s.value.highlightAuto(I).value : x = v.utils.escapeHtml(I);
|
|
389
|
+
const fe = r ? Ce(x.replace(/^\n+|\n+$/g, "")) : `<span class="code-block">${x.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
390
390
|
return `<pre><code class="language-${$}" language=${$}>${fe}</code></pre>`;
|
|
391
391
|
}
|
|
392
392
|
}), rt(v);
|
|
393
393
|
const f = R(`_article-key_${j()}`), k = R(e.sanitize(v.render(e.modelValue))), g = () => {
|
|
394
|
-
y.emit(l, A, k.value), e.onHtmlChanged(k.value), e.onGetCatalog(c.value), y.emit(l,
|
|
394
|
+
y.emit(l, A, k.value), e.onHtmlChanged(k.value), e.onGetCatalog(c.value), y.emit(l, q, c.value), w();
|
|
395
395
|
};
|
|
396
396
|
E(g);
|
|
397
397
|
const b = () => {
|
|
398
398
|
c.value = [], k.value = e.sanitize(v.render(e.modelValue)), g();
|
|
399
399
|
}, T = F(() => (e.noKatex || o.value) && (e.noHighlight || s.value));
|
|
400
400
|
return C(
|
|
401
|
-
[
|
|
401
|
+
[te(e, "modelValue"), T, u],
|
|
402
402
|
ie(
|
|
403
403
|
b,
|
|
404
404
|
(i == null ? void 0 : i.renderDelay) !== void 0 ? i == null ? void 0 : i.renderDelay : a ? 0 : 500
|
|
@@ -407,10 +407,10 @@ const Ae = (e, a) => {
|
|
|
407
407
|
y.on(l, {
|
|
408
408
|
name: Ie,
|
|
409
409
|
callback() {
|
|
410
|
-
y.emit(l,
|
|
410
|
+
y.emit(l, q, c.value);
|
|
411
411
|
}
|
|
412
412
|
}), y.on(l, {
|
|
413
|
-
name:
|
|
413
|
+
name: G,
|
|
414
414
|
callback: () => {
|
|
415
415
|
b(), f.value = `_article-key_${j()}`;
|
|
416
416
|
}
|
|
@@ -470,7 +470,7 @@ const Ae = (e, a) => {
|
|
|
470
470
|
sanitizeMermaid: {
|
|
471
471
|
type: Function
|
|
472
472
|
}
|
|
473
|
-
},
|
|
473
|
+
}, $t = {
|
|
474
474
|
...ce,
|
|
475
475
|
onChange: {
|
|
476
476
|
type: Function,
|
|
@@ -542,7 +542,7 @@ const Ae = (e, a) => {
|
|
|
542
542
|
onInputBoxWitdhChange: {
|
|
543
543
|
type: Function
|
|
544
544
|
}
|
|
545
|
-
}, it = /* @__PURE__ */
|
|
545
|
+
}, it = /* @__PURE__ */ ne({
|
|
546
546
|
name: "ContentPreview",
|
|
547
547
|
props: ce,
|
|
548
548
|
setup(e) {
|
|
@@ -550,27 +550,27 @@ const Ae = (e, a) => {
|
|
|
550
550
|
html: n,
|
|
551
551
|
key: l
|
|
552
552
|
} = lt(e, e.previewOnly);
|
|
553
|
-
return Oe(e, n), Be(e, n), () =>
|
|
553
|
+
return Oe(e, n), Be(e, n), () => M(pe, null, [M("div", {
|
|
554
554
|
id: `${a}-preview-wrapper`,
|
|
555
555
|
class: `${h}-preview-wrapper`,
|
|
556
556
|
"data-show": e.setting.preview,
|
|
557
557
|
key: "content-preview-wrapper"
|
|
558
|
-
}, [
|
|
558
|
+
}, [M("div", {
|
|
559
559
|
key: l.value,
|
|
560
560
|
id: `${a}-preview`,
|
|
561
561
|
class: [`${h}-preview`, `${i == null ? void 0 : i.value}-theme`, t && `${h}-scrn`],
|
|
562
562
|
innerHTML: n.value
|
|
563
|
-
}, null)]), !e.previewOnly &&
|
|
563
|
+
}, null)]), !e.previewOnly && M("div", {
|
|
564
564
|
id: `${a}-html-wrapper`,
|
|
565
565
|
class: `${h}-preview-wrapper`,
|
|
566
566
|
"data-show": e.setting.htmlPreview,
|
|
567
567
|
key: "html-preview-wrapper"
|
|
568
|
-
}, [
|
|
568
|
+
}, [M("div", {
|
|
569
569
|
class: `${h}-html`
|
|
570
570
|
}, [n.value])])]);
|
|
571
571
|
}
|
|
572
|
-
}),
|
|
573
|
-
const { editorId: i } = e, t =
|
|
572
|
+
}), Ct = (e, a) => {
|
|
573
|
+
const { editorId: i } = e, t = oe({
|
|
574
574
|
// 是否已编译成html
|
|
575
575
|
buildFinished: !1,
|
|
576
576
|
// 存储当前最新的html
|
|
@@ -620,22 +620,22 @@ const Ae = (e, a) => {
|
|
|
620
620
|
"highlight",
|
|
621
621
|
F(() => {
|
|
622
622
|
const r = {
|
|
623
|
-
...
|
|
623
|
+
...V,
|
|
624
624
|
...i == null ? void 0 : i.css
|
|
625
625
|
}, d = e.codeStyleReverse && e.codeStyleReverseList.includes(e.previewTheme) ? "dark" : e.theme;
|
|
626
626
|
return {
|
|
627
627
|
js: (i == null ? void 0 : i.js) || ye,
|
|
628
|
-
css: r[e.codeTheme] ? r[e.codeTheme][d] :
|
|
628
|
+
css: r[e.codeTheme] ? r[e.codeTheme][d] : V.atom[d]
|
|
629
629
|
};
|
|
630
630
|
})
|
|
631
631
|
), H("showCodeRowNumber", e.showCodeRowNumber);
|
|
632
632
|
const t = F(() => {
|
|
633
633
|
var d, c;
|
|
634
634
|
const r = {
|
|
635
|
-
...
|
|
635
|
+
...z,
|
|
636
636
|
...(c = (d = S) == null ? void 0 : d.editorConfig) == null ? void 0 : c.languageUserDefined
|
|
637
637
|
};
|
|
638
|
-
return r[e.language] ? r[e.language] :
|
|
638
|
+
return r[e.language] ? r[e.language] : z["zh-CN"];
|
|
639
639
|
});
|
|
640
640
|
H("usedLanguageText", t), H(
|
|
641
641
|
"previewTheme",
|
|
@@ -644,7 +644,7 @@ const Ae = (e, a) => {
|
|
|
644
644
|
"customIcon",
|
|
645
645
|
F(() => e.customIcon)
|
|
646
646
|
);
|
|
647
|
-
},
|
|
647
|
+
}, It = (e) => {
|
|
648
648
|
se(e), H("tabWidth", e.tabWidth);
|
|
649
649
|
}, ue = (e) => {
|
|
650
650
|
E(() => {
|
|
@@ -658,19 +658,19 @@ const Ae = (e, a) => {
|
|
|
658
658
|
t.rel = "stylesheet", t.href = ((i = S.editorExtensions) == null ? void 0 : i.iconfontClass) || be, t.id = `${h}-icon-class`, _(t);
|
|
659
659
|
}
|
|
660
660
|
});
|
|
661
|
-
},
|
|
661
|
+
}, St = (e) => {
|
|
662
662
|
var d, c, s, o, u, w;
|
|
663
663
|
const { noPrettier: a, noUploadImg: i } = e, { editorExtensions: t } = S, n = a || !!((c = (d = S.editorExtensions) == null ? void 0 : d.prettier) != null && c.prettierInstance), l = a || !!((o = (s = S.editorExtensions) == null ? void 0 : s.prettier) != null && o.parserMarkdownInstance), r = i || !!((w = (u = S.editorExtensions) == null ? void 0 : u.cropper) != null && w.instance);
|
|
664
664
|
E(() => {
|
|
665
665
|
var k, g, b, T;
|
|
666
666
|
const v = document.createElement("script"), m = document.createElement("script");
|
|
667
|
-
v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) ||
|
|
667
|
+
v.src = ((k = t == null ? void 0 : t.prettier) == null ? void 0 : k.standaloneJs) || W.main, v.id = `${h}-prettier`, m.src = ((g = t == null ? void 0 : t.prettier) == null ? void 0 : g.parserMarkdownJs) || W.markdown, m.id = `${h}-prettierMD`;
|
|
668
668
|
const p = document.createElement("link");
|
|
669
|
-
p.rel = "stylesheet", p.href = ((b = t == null ? void 0 : t.cropper) == null ? void 0 : b.css) ||
|
|
669
|
+
p.rel = "stylesheet", p.href = ((b = t == null ? void 0 : t.cropper) == null ? void 0 : b.css) || K.css, p.id = `${h}-cropperCss`;
|
|
670
670
|
const f = document.createElement("script");
|
|
671
|
-
f.src = ((T = t == null ? void 0 : t.cropper) == null ? void 0 : T.js) ||
|
|
671
|
+
f.src = ((T = t == null ? void 0 : t.cropper) == null ? void 0 : T.js) || K.js, f.id = `${h}-cropper`, r || (_(p), _(f)), n || _(v), l || _(m);
|
|
672
672
|
}), ue(e);
|
|
673
|
-
},
|
|
673
|
+
}, Et = (e, a) => {
|
|
674
674
|
const { editorId: i } = e;
|
|
675
675
|
E(() => {
|
|
676
676
|
y.on(i, {
|
|
@@ -680,8 +680,8 @@ const Ae = (e, a) => {
|
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
682
|
});
|
|
683
|
-
},
|
|
684
|
-
const { editorId: i } = e, t =
|
|
683
|
+
}, Pt = (e, a) => {
|
|
684
|
+
const { editorId: i } = e, t = oe({
|
|
685
685
|
pageFullscreen: e.pageFullscreen,
|
|
686
686
|
fullscreen: !1,
|
|
687
687
|
preview: e.preview,
|
|
@@ -707,7 +707,7 @@ const Ae = (e, a) => {
|
|
|
707
707
|
}
|
|
708
708
|
}), l = document.body.style.overflow, r();
|
|
709
709
|
}), [t, n];
|
|
710
|
-
},
|
|
710
|
+
}, _t = (e) => {
|
|
711
711
|
const { editorId: a } = e, i = R(!1);
|
|
712
712
|
return E(() => {
|
|
713
713
|
y.on(a, {
|
|
@@ -717,37 +717,37 @@ const Ae = (e, a) => {
|
|
|
717
717
|
}
|
|
718
718
|
});
|
|
719
719
|
}), F(() => !e.toolbarsExclude.includes("catalog") && e.toolbars.includes("catalog") && i.value);
|
|
720
|
-
},
|
|
720
|
+
}, Tt = (e, a, i, t, n, l) => {
|
|
721
721
|
const { editorId: r } = e;
|
|
722
722
|
C(
|
|
723
723
|
() => t.pageFullscreen,
|
|
724
724
|
(c) => {
|
|
725
|
-
y.emit(r,
|
|
725
|
+
y.emit(r, Z, c);
|
|
726
726
|
}
|
|
727
727
|
), C(
|
|
728
728
|
() => t.fullscreen,
|
|
729
729
|
(c) => {
|
|
730
|
-
y.emit(r,
|
|
730
|
+
y.emit(r, J, c);
|
|
731
731
|
}
|
|
732
732
|
), C(
|
|
733
733
|
() => t.preview,
|
|
734
734
|
(c) => {
|
|
735
|
-
y.emit(r,
|
|
735
|
+
y.emit(r, Q, c);
|
|
736
736
|
}
|
|
737
737
|
), C(
|
|
738
738
|
() => t.htmlPreview,
|
|
739
739
|
(c) => {
|
|
740
|
-
y.emit(r,
|
|
740
|
+
y.emit(r, X, c);
|
|
741
741
|
}
|
|
742
742
|
), C(i, (c) => {
|
|
743
|
-
y.emit(r,
|
|
743
|
+
y.emit(r, Y, c);
|
|
744
744
|
});
|
|
745
745
|
const d = {
|
|
746
746
|
on(c, s) {
|
|
747
747
|
switch (c) {
|
|
748
748
|
case "pageFullscreen": {
|
|
749
749
|
y.on(r, {
|
|
750
|
-
name:
|
|
750
|
+
name: Z,
|
|
751
751
|
callback(o) {
|
|
752
752
|
s(o);
|
|
753
753
|
}
|
|
@@ -756,7 +756,7 @@ const Ae = (e, a) => {
|
|
|
756
756
|
}
|
|
757
757
|
case "fullscreen": {
|
|
758
758
|
y.on(r, {
|
|
759
|
-
name:
|
|
759
|
+
name: J,
|
|
760
760
|
callback(o) {
|
|
761
761
|
s(o);
|
|
762
762
|
}
|
|
@@ -765,7 +765,7 @@ const Ae = (e, a) => {
|
|
|
765
765
|
}
|
|
766
766
|
case "preview": {
|
|
767
767
|
y.on(r, {
|
|
768
|
-
name:
|
|
768
|
+
name: Q,
|
|
769
769
|
callback(o) {
|
|
770
770
|
s(o);
|
|
771
771
|
}
|
|
@@ -774,7 +774,7 @@ const Ae = (e, a) => {
|
|
|
774
774
|
}
|
|
775
775
|
case "htmlPreview": {
|
|
776
776
|
y.on(r, {
|
|
777
|
-
name:
|
|
777
|
+
name: X,
|
|
778
778
|
callback(o) {
|
|
779
779
|
s(o);
|
|
780
780
|
}
|
|
@@ -783,7 +783,7 @@ const Ae = (e, a) => {
|
|
|
783
783
|
}
|
|
784
784
|
case "catalog": {
|
|
785
785
|
y.on(r, {
|
|
786
|
-
name:
|
|
786
|
+
name: Y,
|
|
787
787
|
callback(o) {
|
|
788
788
|
s(o);
|
|
789
789
|
}
|
|
@@ -818,7 +818,7 @@ const Ae = (e, a) => {
|
|
|
818
818
|
(s = l.value) == null || s.focus(c);
|
|
819
819
|
},
|
|
820
820
|
rerender() {
|
|
821
|
-
y.emit(r,
|
|
821
|
+
y.emit(r, G);
|
|
822
822
|
},
|
|
823
823
|
getSelectedText() {
|
|
824
824
|
var c;
|
|
@@ -1018,7 +1018,7 @@ const Ae = (e, a) => {
|
|
|
1018
1018
|
type: Function,
|
|
1019
1019
|
default: (e) => Promise.resolve(e)
|
|
1020
1020
|
}
|
|
1021
|
-
},
|
|
1021
|
+
}, Ht = {
|
|
1022
1022
|
...de,
|
|
1023
1023
|
/**
|
|
1024
1024
|
* input回调事件
|
|
@@ -1270,7 +1270,7 @@ const Ae = (e, a) => {
|
|
|
1270
1270
|
onInputBoxWitdhChange: {
|
|
1271
1271
|
type: Function
|
|
1272
1272
|
}
|
|
1273
|
-
}, me = ["onHtmlChanged", "onGetCatalog"],
|
|
1273
|
+
}, me = ["onHtmlChanged", "onGetCatalog"], Ft = [
|
|
1274
1274
|
...me,
|
|
1275
1275
|
"onChange",
|
|
1276
1276
|
"onSave",
|
|
@@ -1282,7 +1282,14 @@ const Ae = (e, a) => {
|
|
|
1282
1282
|
"onInput",
|
|
1283
1283
|
"onDrop",
|
|
1284
1284
|
"onInputBoxWitdhChange"
|
|
1285
|
-
], st =
|
|
1285
|
+
], st = (e, a) => {
|
|
1286
|
+
const { editorId: i } = e, t = {
|
|
1287
|
+
rerender() {
|
|
1288
|
+
y.emit(i, G);
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
a.expose(t);
|
|
1292
|
+
}, ut = /* @__PURE__ */ ne({
|
|
1286
1293
|
name: "MdPreview",
|
|
1287
1294
|
props: de,
|
|
1288
1295
|
emits: me,
|
|
@@ -1293,13 +1300,13 @@ const Ae = (e, a) => {
|
|
|
1293
1300
|
noMermaid: n,
|
|
1294
1301
|
noHighlight: l
|
|
1295
1302
|
} = e;
|
|
1296
|
-
return se(e), ue(e), he(() => {
|
|
1303
|
+
return se(e), ue(e), st(e, a), he(() => {
|
|
1297
1304
|
y.clear(i);
|
|
1298
|
-
}), () =>
|
|
1305
|
+
}), () => M("div", {
|
|
1299
1306
|
id: i,
|
|
1300
1307
|
class: [h, e.class, e.theme === "dark" && `${h}-dark`, `${h}-previewOnly`],
|
|
1301
1308
|
style: e.style
|
|
1302
|
-
}, [
|
|
1309
|
+
}, [M(it, {
|
|
1303
1310
|
modelValue: e.modelValue,
|
|
1304
1311
|
onHtmlChanged: (r) => {
|
|
1305
1312
|
e.onHtmlChanged ? e.onHtmlChanged(r) : a.emit("onHtmlChanged", r);
|
|
@@ -1318,19 +1325,19 @@ const Ae = (e, a) => {
|
|
|
1318
1325
|
sanitizeMermaid: e.sanitizeMermaid
|
|
1319
1326
|
}, null)]);
|
|
1320
1327
|
}
|
|
1321
|
-
}), O =
|
|
1328
|
+
}), O = ut;
|
|
1322
1329
|
O.install = (e) => (e.component(O.name, O), e);
|
|
1323
1330
|
export {
|
|
1324
1331
|
it as C,
|
|
1325
1332
|
O as M,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1333
|
+
Ft as a,
|
|
1334
|
+
It as b,
|
|
1335
|
+
$t as c,
|
|
1336
|
+
St as d,
|
|
1337
|
+
Ht as e,
|
|
1338
|
+
Et as f,
|
|
1339
|
+
Pt as g,
|
|
1340
|
+
_t as h,
|
|
1341
|
+
Tt as i,
|
|
1342
|
+
Ct as u
|
|
1336
1343
|
};
|