md-editor-v3 7.0.0-0 → 7.0.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/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/es/chunks/index2.mjs +11 -11
- package/lib/es/chunks/index3.mjs +1 -3
- package/lib/types/index.d.ts +68 -68
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),i=require("./config.cjs"),
|
|
1
|
+
"use strict";const e=require("vue"),i=require("./config.cjs"),S=require("./index5.cjs"),x=require("./dom.cjs"),k=require("./vue-tsx.cjs"),t=require("@lucide/vue"),V=()=>e.createVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-github-icon"},[e.createVNode("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"},null),e.createVNode("path",{d:"M9 18c-4.51 2-5-2-7-2"},null)]),P={bold:t.Bold,underline:t.Underline,italic:t.Italic,"strike-through":t.Strikethrough,title:t.Heading,sub:t.Subscript,sup:t.Superscript,quote:t.Quote,"unordered-list":t.List,"ordered-list":t.ListOrdered,task:t.ListTodo,"code-row":t.Code,code:t.SquareCode,link:t.Link,image:t.Image,table:t.Table,revoke:t.Reply,next:t.Forward,save:t.Save,prettier:t.SquareCode,minimize:t.Minimize2,maximize:t.Maximize2,"fullscreen-exit":t.Shrink,fullscreen:t.Expand,"preview-only":t.View,preview:t.Eye,"preview-html":t.CodeXml,catalog:t.ListTree,github:V,mermaid:t.ChartArea,formula:t.SquareSigma,close:t.X,delete:t.Trash2,upload:t.Upload},$=e.defineComponent({name:`${i.prefix}-icon-set`,props:{name:{type:String,default:""}},setup(n){return()=>e.h(P[n.name],{class:`${i.prefix}-icon`})}}),p=e.defineComponent({name:`${i.prefix}-icon`,props:{name:{type:String,default:""}},setup(n){const d=e.inject("customIcon");return()=>{const r=d.value[n.name];return typeof r=="object"?typeof r.component=="object"?e.h(r.component,r.props):e.createVNode("span",{innerHTML:r.component},null):e.createVNode($,{name:n.name},null)}}}),B={title:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String,default:void 0},style:{type:[Object,String],default:()=>({})},showMask:{type:Boolean,default:!0}},m=e.defineComponent({name:"MdModal",props:B,emits:["onClose"],setup(n,d){const r=e.inject("theme"),C=e.inject("rootRef"),f=e.ref(n.visible),c=e.ref([`${i.prefix}-modal`]),h=e.ref(),v=e.ref(),y=e.ref(),b=e.shallowRef();let u=()=>{};const o=e.reactive({maskStyle:{zIndex:-1},modalStyle:{zIndex:-1},initPos:{insetInlineStart:"0px",insetBlockStart:"0px"},historyPos:{insetInlineStart:"0px",insetBlockStart:"0px"}}),w=e.computed(()=>n.isFullscreen?{width:"100%",height:"100%"}:{width:n.width,height:n.height});e.watch(()=>n.isFullscreen,l=>{l?u():e.nextTick(()=>{u=x.keyMove(v.value,(a,s)=>{o.initPos.insetInlineStart=a+"px",o.initPos.insetBlockStart=s+"px"})})}),e.watch(()=>n.visible,l=>{l?(o.maskStyle.zIndex=i.globalConfig.editorConfig.zIndex+S.getZIndexIncrement(),o.modalStyle.zIndex=i.globalConfig.editorConfig.zIndex+S.getZIndexIncrement(),c.value.push("zoom-in"),f.value=l,e.nextTick(()=>{const a=h.value.offsetWidth/2,s=h.value.offsetHeight/2,N=document.documentElement.clientWidth/2,M=document.documentElement.clientHeight/2;o.initPos.insetInlineStart=N-a+"px",o.initPos.insetBlockStart=M-s+"px",n.isFullscreen||(u=x.keyMove(v.value,(j,z)=>{o.initPos.insetInlineStart=j+"px",o.initPos.insetBlockStart=z+"px"}))}),setTimeout(()=>{c.value=c.value.filter(a=>a!=="zoom-in")},140)):(c.value.push("zoom-out"),u(),setTimeout(()=>{c.value=c.value.filter(a=>a!=="zoom-out"),f.value=l},130))});const g=e.computed(()=>({display:f.value?"block":"none"})),I=e.computed(()=>{if(typeof n.style=="string"){const l=Object.entries(g.value).map(([a,s])=>`${a}: ${s}`).join("; ");return[n.style,l].join("; ")}else return n.style instanceof Object?{...g.value,...n.style}:g.value});return e.onMounted(()=>{const l=C.value?.getRootNode();y.value=l instanceof Document?document.body:l}),()=>{const l=k.getSlot({ctx:d}),a=k.getSlot({props:n,ctx:d},"title");return y.value?e.createVNode(e.Teleport,{to:y.value},{default:()=>[e.createVNode("div",{ref:b,class:`${i.prefix}-modal-container`,"data-theme":r.value},[e.createVNode("div",{class:n.class,style:I.value},[n.showMask&&e.createVNode("div",{class:`${i.prefix}-modal-mask`,style:o.maskStyle,onClick:()=>{n.onClose?.(),d.emit("onClose")}},null),e.createVNode("div",{class:c.value,style:{...o.modalStyle,...o.initPos,...w.value},ref:h},[e.createVNode("div",{class:`${i.prefix}-modal-header`,ref:v},[a||""]),e.createVNode("div",{class:`${i.prefix}-modal-body`},[l]),e.createVNode("div",{class:`${i.prefix}-modal-func`},[n.showAdjust&&e.createVNode("div",{class:`${i.prefix}-modal-adjust`,onClick:s=>{s.stopPropagation(),n.isFullscreen?o.initPos=o.historyPos:(o.historyPos=o.initPos,o.initPos={insetInlineStart:"0",insetBlockStart:"0"}),n.onAdjust(!n.isFullscreen)}},[e.createVNode(p,{name:n.isFullscreen?"minimize":"maximize"},null)]),e.createVNode("div",{class:`${i.prefix}-modal-close`,onClick:s=>{s.stopPropagation(),n.onClose?.(),d.emit("onClose")}},[e.createVNode(p,{name:"close"},null)])])])])])]}):""}}});m.install=n=>(n.component(m.name,m),n);exports.Icon=p;exports.MdModal=m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),D=require("./config.cjs"),P=require("@vavt/util"),S=require("./event-bus.cjs"),F=require("./index5.cjs"),G=`.${D.prefix}-preview > [data-line]`,w=(e,l)=>+getComputedStyle(e).getPropertyValue(l).replace("px",""),j=(e,l)=>{const I=P.debounce(()=>{e.removeEventListener("scroll",c),e.addEventListener("scroll",c),l.removeEventListener("scroll",c),l.addEventListener("scroll",c)},50),c=k=>{const u=e.clientHeight,y=l.clientHeight,m=e.scrollHeight,d=l.scrollHeight,s=(m-u)/(d-y);k.target===e?(l.removeEventListener("scroll",c),l.scrollTo({top:e.scrollTop/s}),I()):(e.removeEventListener("scroll",c),e.scrollTo({top:l.scrollTop*s}),I())};return[()=>{I().finally(()=>{e.dispatchEvent(new Event("scroll"))})},()=>{e.removeEventListener("scroll",c),l.removeEventListener("scroll",c)}]},U=(e,l,I)=>{const{view:c}=I,k=P.createSmoothScroll(),u=r=>c.lineBlockAt(c.state.doc.line(r+1).from).top,y=r=>c.lineBlockAt(c.state.doc.line(r+1).from).bottom;let m=[],d=[],s=[];const N=()=>{m=[],d=Array.from(l.querySelectorAll(G)),s=d.map(n=>Number(n.dataset.line));const r=[...s],{lines:h}=c.state.doc;r[0]!==0&&r.unshift(0);let C=r.shift()||0,t=r.shift()||h;for(let n=0;n<h;n++)n===t&&(C=n,t=r.shift()||h),m.push({start:C,end:t-1})},R=(r,h)=>{let C=1;for(let t=d.length-1;t-1>=0;t--){const n=d[t];if(n.offsetTop<=h){C=Number(n.dataset.line);break}}for(let t=m.length-1;t>=0;t--)if(u(m[t].start)<=r){C=C<m[t].start?C:m[t].start;break}return C};let A=0,$=0;const V=()=>{if($!==0)return!1;A++;const{scrollDOM:r}=c;let h=w(l,"padding-block-start");const C=c.lineBlockAtHeight(r.scrollTop),{number:t}=c.state.doc.lineAt(C.from),n=m[t-1];if(!n)return!1;let H=1;const f=l.querySelector(`[data-line="${n.start}"]`)||l.firstElementChild?.firstElementChild,v=l.querySelector(`[data-line="${n.end+1}"]`)||l.lastElementChild?.lastElementChild,g=r.scrollHeight-r.clientHeight,i=l.scrollHeight-l.clientHeight;let T=u(n.start)
|
|
1
|
+
"use strict";const o=require("vue"),D=require("./config.cjs"),P=require("@vavt/util"),S=require("./event-bus.cjs"),F=require("./index5.cjs"),G=`.${D.prefix}-preview > [data-line]`,w=(e,l)=>+getComputedStyle(e).getPropertyValue(l).replace("px",""),j=(e,l)=>{const I=P.debounce(()=>{e.removeEventListener("scroll",c),e.addEventListener("scroll",c),l.removeEventListener("scroll",c),l.addEventListener("scroll",c)},50),c=k=>{const u=e.clientHeight,y=l.clientHeight,m=e.scrollHeight,d=l.scrollHeight,s=(m-u)/(d-y);k.target===e?(l.removeEventListener("scroll",c),l.scrollTo({top:e.scrollTop/s}),I()):(e.removeEventListener("scroll",c),e.scrollTo({top:l.scrollTop*s}),I())};return[()=>{I().finally(()=>{e.dispatchEvent(new Event("scroll"))})},()=>{e.removeEventListener("scroll",c),l.removeEventListener("scroll",c)}]},U=(e,l,I)=>{const{view:c}=I,k=P.createSmoothScroll(),u=r=>c.lineBlockAt(c.state.doc.line(r+1).from).top,y=r=>c.lineBlockAt(c.state.doc.line(r+1).from).bottom;let m=[],d=[],s=[];const N=()=>{m=[],d=Array.from(l.querySelectorAll(G)),s=d.map(n=>Number(n.dataset.line));const r=[...s],{lines:h}=c.state.doc;r[0]!==0&&r.unshift(0);let C=r.shift()||0,t=r.shift()||h;for(let n=0;n<h;n++)n===t&&(C=n,t=r.shift()||h),m.push({start:C,end:t-1})},R=(r,h)=>{let C=1;for(let t=d.length-1;t-1>=0;t--){const n=d[t];if(n.offsetTop<=h){C=Number(n.dataset.line);break}}for(let t=m.length-1;t>=0;t--)if(u(m[t].start)<=r){C=C<m[t].start?C:m[t].start;break}return C};let A=0,$=0;const V=()=>{if($!==0)return!1;A++;const{scrollDOM:r}=c;let h=w(l,"padding-block-start");const C=c.lineBlockAtHeight(r.scrollTop),{number:t}=c.state.doc.lineAt(C.from),n=m[t-1];if(!n)return!1;let H=1;const f=l.querySelector(`[data-line="${n.start}"]`)||l.firstElementChild?.firstElementChild,v=l.querySelector(`[data-line="${n.end+1}"]`)||l.lastElementChild?.lastElementChild,g=r.scrollHeight-r.clientHeight,i=l.scrollHeight-l.clientHeight;let T=u(n.start),b=y(n.end),a=f.offsetTop,x=v.offsetTop-a;T===0&&(a=0,f===v?(h=0,x=0):x=v.offsetTop),H=(r.scrollTop-T)/(b-T);const M=v==l.lastElementChild?.lastElementChild?v.offsetTop+v.clientHeight:v.offsetTop;if(b>=g||M>i){const L=R(g,i);T=u(L),H=(r.scrollTop-T)/(g-T);const E=l.querySelector(`[data-line="${L}"]`);T>0&&E&&(a=E.offsetTop),x=i-a+w(l,"padding-block-start")}const q=a-h+x*H;k(l,q,()=>{A--})},B=()=>{if(A!==0)return;$++;const{scrollDOM:r}=c,h=l.scrollTop,C=l.scrollHeight,t=r.scrollHeight-r.clientHeight,n=l.scrollHeight-l.clientHeight;let H=l.firstElementChild?.firstElementChild,f=l.firstElementChild?.lastElementChild;if(s.length>0){let L=Math.ceil(s[s.length-1]*(h/C)),E=s.findLastIndex(p=>p<=L);E=E===-1?0:E,L=s[E];for(let p=E;p>=0&&p<s.length;)if(d[p].offsetTop>h){if(p-1>=0){p--;continue}L=-1,E=-1;break}else{if(p+1<s.length&&d[p+1].offsetTop<h){p++;continue}L=s[p],E=p;break}switch(E){case-1:{H=l.firstElementChild?.firstElementChild,f=d[0];break}case s.length-1:{H=d[E],f=l.firstElementChild?.lastElementChild;break}default:H=d[E],f=d[E+1]}}let v=H===l.firstElementChild?.firstElementChild?0:H.offsetTop-w(H,"margin-block-start"),g=f.offsetTop,i=0;const{start:T,end:b}=m[Number(H.dataset.line||0)];let a=u(T);const x=u(b+1===c.state.doc.lines?b:b+1);let M=0;const q=f==l.lastElementChild?.lastElementChild?f.offsetTop+f.offsetHeight:f.offsetTop;if(x>t||q>n){const L=R(t,n),E=l.querySelector(`[data-line="${L}"]`);v=E?E.offsetTop-w(E,"margin-block-start"):v,a=u(L),i=(h-v)/(n-v),M=t-a}else H===l.firstElementChild?.firstElementChild?(H===f&&(g=f.offsetTop+f.offsetHeight+w(f,"margin-block-end")),M=x,a=0,i=Math.max(h/g,0)):(i=Math.max((h-v)/(g-v),0),M=x-a);k(e,a+M*i,()=>{$--})},O=r=>{const{scrollDOM:h,contentHeight:C}=c,t=h.clientHeight;if(C<=t||l.firstElementChild.clientHeight<=l.clientHeight||c.state.doc.lines<=m[m.length-1]?.end)return!1;r.target===e?V():B()};return[()=>{N(),e.addEventListener("scroll",O),l.addEventListener("scroll",O),e.dispatchEvent(new Event("scroll"))},()=>{e.removeEventListener("scroll",O),l.removeEventListener("scroll",O)}]},z={tocItem:{type:Object,default:()=>({})},mdHeadingId:{type:Function,default:()=>{}},onActive:{type:Function,default:()=>{}},onClick:{type:Function,default:()=>{}},scrollElementOffsetTop:{type:Number,default:0}},W=o.defineComponent({props:z,setup(e){const l=o.inject("scrollElementRef"),I=o.inject("roorNodeRef"),c=o.ref();o.watch(()=>e.tocItem.active,u=>{u&&e.onActive(e.tocItem,c.value)}),o.onMounted(()=>{e.tocItem.active&&e.onActive(e.tocItem,c.value)});const k=u=>{if(u.stopPropagation(),e.onClick(u,e.tocItem),u.defaultPrevented)return;const y=e.mdHeadingId({text:e.tocItem.text,level:e.tocItem.level,index:e.tocItem.index,currentToken:e.tocItem.currentToken,nextToken:e.tocItem.nextToken}),m=I.value.getElementById(y),d=l.value;if(m&&d){let s=m.offsetParent,N=m.offsetTop;if(d.contains(s))for(;s&&d!=s;)N+=s?.offsetTop,s=s?.offsetParent;const R=m.previousElementSibling;let A=0;R||(A=w(m,"margin-block-start")),d?.scrollTo({top:N-e.scrollElementOffsetTop-A,behavior:"smooth"})}};return()=>o.createVNode("div",{ref:c,class:[`${D.prefix}-catalog-link`,e.tocItem.active&&`${D.prefix}-catalog-active`],onClick:k},[o.createVNode("span",{title:e.tocItem.text},[e.tocItem.text]),e.tocItem.children&&e.tocItem.children.length>0&&o.createVNode("div",{class:`${D.prefix}-catalog-wrapper`},[e.tocItem.children.map(u=>o.createVNode(W,{mdHeadingId:e.mdHeadingId,key:`${e.tocItem.text}-link-${u.level}-${u.text}`,tocItem:u,onActive:e.onActive,onClick:e.onClick,scrollElementOffsetTop:e.scrollElementOffsetTop},null))])])}}),J={editorId:{type:String,default:void 0},class:{type:String,default:""},mdHeadingId:{type:Function,default:({text:e})=>e},scrollElement:{type:[String,Object],default:void 0},theme:{type:String,default:"light"},offsetTop:{type:Number,default:20},scrollElementOffsetTop:{type:Number,default:0},onClick:{type:Function,default:void 0},onActive:{type:Function,default:void 0},isScrollElementInShadow:{type:Boolean,default:!1},syncWith:{type:String,default:"preview"},catalogMaxDepth:{type:Number,default:void 0}},_=o.defineComponent({name:"MdCatalog",props:J,emits:["onClick","onActive"],setup(e,l){const I=e.editorId,c=`#${I}-preview-wrapper`,k=o.reactive({list:[],show:!1,scrollElement:e.scrollElement||c}),u=o.shallowRef(),y=o.ref(),m=o.ref(),d=o.ref(),s=o.ref(),N=o.shallowRef(),R=o.ref({});o.provide("scrollElementRef",m),o.provide("roorNodeRef",s);const A=o.computed(()=>{const t=[];return k.list.forEach((n,H)=>{if(e.catalogMaxDepth&&n.level>e.catalogMaxDepth)return;const{text:f,level:v,line:g}=n,i={level:v,text:f,line:g,index:H+1,active:u.value===n};if(t.length===0)t.push(i);else{let T=t[t.length-1];if(i.level>T.level)for(let b=T.level+1;b<=6;b++){const{children:a}=T;if(!a){T.children=[i];break}if(T=a[a.length-1],i.level<=T.level){a.push(i);break}}else t.push(i)}}),t}),$=()=>{if(k.scrollElement instanceof HTMLElement)return k.scrollElement;let t=document;return(k.scrollElement===c||e.isScrollElementInShadow)&&(t=y.value?.getRootNode()),t.querySelector(k.scrollElement)},V=t=>{if(t.length===0)return u.value=void 0,k.list=[],!1;const{activeHead:n,activeIndex:H}=t.reduce((g,i,T)=>{let b=0;if(e.syncWith==="preview"){const a=s.value?.getElementById(e.mdHeadingId({text:i.text,level:i.level,index:T+1,currentToken:i.currentToken,nextToken:i.nextToken}));a instanceof HTMLElement&&(b=F.getRelativeTop(a,m.value))}else{const a=N.value;if(a){const x=a.lineBlockAt(a.state.doc.line(i.line+1).from).top,M=a.scrollDOM.scrollTop;b=x-M}}return b<e.offsetTop&&b>g.minTop?{activeHead:i,activeIndex:T,minTop:b}:g},{activeHead:t[0],activeIndex:0,minTop:Number.MIN_SAFE_INTEGER});let f=n;const{catalogMaxDepth:v}=e;if(v&&f.level>v){for(let g=H;g>=0;g--){const i=t[g];if(i.level<=v){f=i;break}}if(f.level>v){const g=t.find(i=>i.level<=v);g&&(f=g)}}u.value=f,k.list=t},B=(t,n)=>{R.value.top=n.offsetTop+w(n,"padding-block-start")+"px",e.onActive?.(t,n),l.emit("onActive",t,n)},O=()=>{V(k.list)},r=t=>{if(d.value?.removeEventListener("scroll",O),e.syncWith==="editor")d.value=N.value?.scrollDOM;else{const n=$();m.value=n,d.value=n===document.documentElement?document:n}V(t),d.value?.addEventListener("scroll",O)},h=t=>{N.value=t};o.watch([()=>e.syncWith,N,()=>e.catalogMaxDepth],()=>{r(k.list)}),o.onMounted(()=>{s.value=y.value.getRootNode(),S.bus.on(I,{name:S.CATALOG_CHANGED,callback:r}),S.bus.on(I,{name:S.GET_EDITOR_VIEW,callback:h}),S.bus.emit(I,S.PUSH_CATALOG),S.bus.emit(I,S.SEND_EDITOR_VIEW)}),o.onBeforeUnmount(()=>{S.bus.remove(I,S.CATALOG_CHANGED,r),S.bus.remove(I,S.GET_EDITOR_VIEW,h),d.value?.removeEventListener("scroll",O)});const C=(t,n)=>{e.onClick?.(t,n),l.emit("onClick",t,n)};return()=>o.createVNode("div",{class:[`${D.prefix}-catalog`,e.class||""],"data-theme":e.theme,ref:y},[A.value.length>0&&o.createVNode(o.Fragment,null,[o.createVNode("div",{class:`${D.prefix}-catalog-indicator`,style:R.value},null),o.createVNode("div",{class:`${D.prefix}-catalog-container`},[A.value.map(t=>o.createVNode(W,{mdHeadingId:e.mdHeadingId,tocItem:t,key:`link-${t.level}-${t.text}`,onActive:B,onClick:C,scrollElementOffsetTop:e.scrollElementOffsetTop},null))])])])}});_.install=e=>(e.component(_.name,_),e);exports.MdCatalog=_;exports.scrollAuto=U;exports.scrollAutoWithScale=j;
|
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createVNode as t, defineComponent as k, h as j, inject as p, ref as c, shallowRef as O, reactive as E, computed as g, watch as x, nextTick as b, onMounted as W, Teleport as q } from "vue";
|
|
2
2
|
import { p as l, g as C } from "./config.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { c as w } from "./index5.mjs";
|
|
4
|
+
import { k as I } from "./dom.mjs";
|
|
5
|
+
import { g as z } from "./vue-tsx.mjs";
|
|
6
|
+
import { Upload as N, Trash2 as D, X as U, SquareSigma as X, ChartArea as G, ListTree as Q, CodeXml as V, Eye as Z, View as J, Expand as K, Shrink as Y, Maximize2 as _, Minimize2 as ee, SquareCode as M, Save as te, Forward as ne, Reply as oe, Table as ie, Image as le, Link as se, Code as ae, ListTodo as re, ListOrdered as ue, List as ce, Quote as de, Superscript as me, Subscript as fe, Heading as he, Strikethrough as ve, Italic as ye, Underline as ge, Bold as Se } from "@lucide/vue";
|
|
7
7
|
const pe = () => t("svg", {
|
|
8
8
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9
9
|
viewBox: "0 0 24 24",
|
|
@@ -30,14 +30,14 @@ const pe = () => t("svg", {
|
|
|
30
30
|
"ordered-list": ue,
|
|
31
31
|
task: re,
|
|
32
32
|
"code-row": ae,
|
|
33
|
-
code:
|
|
33
|
+
code: M,
|
|
34
34
|
link: se,
|
|
35
35
|
image: le,
|
|
36
36
|
table: ie,
|
|
37
37
|
revoke: oe,
|
|
38
38
|
next: ne,
|
|
39
39
|
save: te,
|
|
40
|
-
prettier:
|
|
40
|
+
prettier: M,
|
|
41
41
|
minimize: ee,
|
|
42
42
|
maximize: _,
|
|
43
43
|
"fullscreen-exit": Y,
|
|
@@ -161,14 +161,14 @@ const pe = () => t("svg", {
|
|
|
161
161
|
});
|
|
162
162
|
x(() => e.isFullscreen, (o) => {
|
|
163
163
|
o ? d() : b(() => {
|
|
164
|
-
d =
|
|
164
|
+
d = I(h.value, (i, s) => {
|
|
165
165
|
n.initPos.insetInlineStart = i + "px", n.initPos.insetBlockStart = s + "px";
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
168
|
}), x(() => e.visible, (o) => {
|
|
169
|
-
o ? (n.maskStyle.zIndex = C.editorConfig.zIndex +
|
|
169
|
+
o ? (n.maskStyle.zIndex = C.editorConfig.zIndex + w(), n.modalStyle.zIndex = C.editorConfig.zIndex + w(), r.value.push("zoom-in"), m.value = o, b(() => {
|
|
170
170
|
const i = f.value.offsetWidth / 2, s = f.value.offsetHeight / 2, T = document.documentElement.clientWidth / 2, H = document.documentElement.clientHeight / 2;
|
|
171
|
-
n.initPos.insetInlineStart = T - i + "px", n.initPos.insetBlockStart = H - s + "px", e.isFullscreen || (d =
|
|
171
|
+
n.initPos.insetInlineStart = T - i + "px", n.initPos.insetBlockStart = H - s + "px", e.isFullscreen || (d = I(h.value, (A, L) => {
|
|
172
172
|
n.initPos.insetInlineStart = A + "px", n.initPos.insetBlockStart = L + "px";
|
|
173
173
|
}));
|
|
174
174
|
}), setTimeout(() => {
|
|
@@ -192,9 +192,9 @@ const pe = () => t("svg", {
|
|
|
192
192
|
const o = $.value?.getRootNode();
|
|
193
193
|
v.value = o instanceof Document ? document.body : o;
|
|
194
194
|
}), () => {
|
|
195
|
-
const o =
|
|
195
|
+
const o = z({
|
|
196
196
|
ctx: u
|
|
197
|
-
}), i =
|
|
197
|
+
}), i = z({
|
|
198
198
|
props: e,
|
|
199
199
|
ctx: u
|
|
200
200
|
}, "title");
|
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -69,9 +69,7 @@ const ce = `.${w}-preview > [data-line]`, R = (e, l) => +getComputedStyle(e).get
|
|
|
69
69
|
return !1;
|
|
70
70
|
let E = 1;
|
|
71
71
|
const f = l.querySelector(`[data-line="${n.start}"]`) || l.firstElementChild?.firstElementChild, u = l.querySelector(`[data-line="${n.end + 1}"]`) || l.lastElementChild?.lastElementChild, h = c.scrollHeight - c.clientHeight, i = l.scrollHeight - l.clientHeight;
|
|
72
|
-
let g = d(n.start);
|
|
73
|
-
const p = y(n.end);
|
|
74
|
-
let r = f.offsetTop, b = u.offsetTop - r;
|
|
72
|
+
let g = d(n.start), p = y(n.end), r = f.offsetTop, b = u.offsetTop - r;
|
|
75
73
|
g === 0 && (r = 0, f === u ? (v = 0, b = 0) : b = u.offsetTop), E = (c.scrollTop - g) / (p - g);
|
|
76
74
|
const A = u == l.lastElementChild?.lastElementChild ? u.offsetTop + u.clientHeight : u.offsetTop;
|
|
77
75
|
if (p >= h || A > i) {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1850,10 +1850,18 @@ declare const Editor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
1850
1850
|
onOnInputBoxWidthChange?: ((...args: any[]) => any) | undefined;
|
|
1851
1851
|
onOnRemount?: ((...args: any[]) => any) | undefined;
|
|
1852
1852
|
}>, {
|
|
1853
|
+
onChange: ChangeEvent;
|
|
1854
|
+
language: string;
|
|
1855
|
+
theme: Themes;
|
|
1856
|
+
previewTheme: string;
|
|
1857
|
+
codeTheme: string;
|
|
1858
|
+
disabled: boolean;
|
|
1859
|
+
showToolbarName: boolean;
|
|
1860
|
+
class: string;
|
|
1861
|
+
style: string | vue.CSSProperties;
|
|
1853
1862
|
preview: boolean;
|
|
1854
1863
|
pageFullscreen: boolean;
|
|
1855
1864
|
htmlPreview: boolean;
|
|
1856
|
-
onChange: ChangeEvent;
|
|
1857
1865
|
onSave: SaveEvent;
|
|
1858
1866
|
onUploadImg: UploadImgEvent;
|
|
1859
1867
|
onHtmlChanged: HtmlChangedEvent;
|
|
@@ -1882,30 +1890,22 @@ declare const Editor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
1882
1890
|
}>;
|
|
1883
1891
|
noUploadImg: boolean;
|
|
1884
1892
|
autoFocus: boolean;
|
|
1885
|
-
disabled: boolean;
|
|
1886
1893
|
readOnly: boolean;
|
|
1887
1894
|
maxLength: number;
|
|
1888
1895
|
autoDetectCode: boolean;
|
|
1889
1896
|
completions: _codemirror_autocomplete.CompletionSource[];
|
|
1890
|
-
showToolbarName: boolean;
|
|
1891
1897
|
inputBoxWidth: string;
|
|
1892
1898
|
transformImgUrl: (t: string) => string | Promise<string>;
|
|
1893
|
-
catalogLayout: "
|
|
1899
|
+
catalogLayout: "flat" | "fixed";
|
|
1894
1900
|
catalogMaxDepth: number;
|
|
1895
1901
|
modelValue: string;
|
|
1896
|
-
theme: Themes;
|
|
1897
|
-
class: string;
|
|
1898
|
-
language: string;
|
|
1899
1902
|
editorId: string;
|
|
1900
1903
|
id: string;
|
|
1901
1904
|
showCodeRowNumber: boolean;
|
|
1902
|
-
previewTheme: string;
|
|
1903
|
-
style: string | vue.CSSProperties;
|
|
1904
1905
|
mdHeadingId: MdHeadingId;
|
|
1905
1906
|
sanitize: (html: string) => string;
|
|
1906
1907
|
noMermaid: boolean;
|
|
1907
1908
|
noKatex: boolean;
|
|
1908
|
-
codeTheme: string;
|
|
1909
1909
|
formatCopiedText: (text: string) => string;
|
|
1910
1910
|
codeStyleReverse: boolean;
|
|
1911
1911
|
codeStyleReverseList: string[];
|
|
@@ -2025,17 +2025,17 @@ declare const _default$b: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2025
2025
|
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
2026
2026
|
}>, {
|
|
2027
2027
|
title: string;
|
|
2028
|
-
disabled: boolean;
|
|
2029
|
-
showToolbarName: boolean;
|
|
2030
|
-
theme: Themes;
|
|
2031
|
-
language: string;
|
|
2032
|
-
previewTheme: string;
|
|
2033
|
-
codeTheme: string;
|
|
2034
|
-
onClick: (e: MouseEvent) => void;
|
|
2035
2028
|
trigger: string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
2036
2029
|
[key: string]: any;
|
|
2037
2030
|
}>;
|
|
2038
2031
|
insert: () => void;
|
|
2032
|
+
language: string;
|
|
2033
|
+
theme: Themes;
|
|
2034
|
+
previewTheme: string;
|
|
2035
|
+
codeTheme: string;
|
|
2036
|
+
disabled: boolean;
|
|
2037
|
+
showToolbarName: boolean;
|
|
2038
|
+
onClick: (e: MouseEvent) => void;
|
|
2039
2039
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
2040
2040
|
|
|
2041
2041
|
declare const _default$a: typeof _default$b & {
|
|
@@ -2159,22 +2159,22 @@ declare const _default$9: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2159
2159
|
}>> & Readonly<{
|
|
2160
2160
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
2161
2161
|
}>, {
|
|
2162
|
-
title: string;
|
|
2163
2162
|
onChange: (visible: boolean) => void;
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
theme: Themes;
|
|
2167
|
-
language: string;
|
|
2168
|
-
previewTheme: string;
|
|
2169
|
-
codeTheme: string;
|
|
2163
|
+
title: string;
|
|
2164
|
+
visible: boolean;
|
|
2170
2165
|
trigger: string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
2171
2166
|
[key: string]: any;
|
|
2172
2167
|
}>;
|
|
2173
|
-
insert: () => void;
|
|
2174
|
-
visible: boolean;
|
|
2175
2168
|
overlay: string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
2176
2169
|
[key: string]: any;
|
|
2177
2170
|
}>;
|
|
2171
|
+
insert: () => void;
|
|
2172
|
+
language: string;
|
|
2173
|
+
theme: Themes;
|
|
2174
|
+
previewTheme: string;
|
|
2175
|
+
codeTheme: string;
|
|
2176
|
+
disabled: boolean;
|
|
2177
|
+
showToolbarName: boolean;
|
|
2178
2178
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
2179
2179
|
|
|
2180
2180
|
declare const _default$8: typeof _default$9 & {
|
|
@@ -2369,20 +2369,18 @@ declare const _default$7: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2369
2369
|
onOnAdjust?: ((...args: any[]) => any) | undefined;
|
|
2370
2370
|
}>, {
|
|
2371
2371
|
title: string;
|
|
2372
|
-
|
|
2373
|
-
showToolbarName: boolean;
|
|
2374
|
-
theme: Themes;
|
|
2375
|
-
class: string;
|
|
2376
|
-
language: string;
|
|
2377
|
-
previewTheme: string;
|
|
2378
|
-
style: string | CSSProperties;
|
|
2379
|
-
codeTheme: string;
|
|
2380
|
-
onClick: () => void;
|
|
2372
|
+
visible: boolean;
|
|
2381
2373
|
trigger: string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
2382
2374
|
[key: string]: any;
|
|
2383
2375
|
}>;
|
|
2384
2376
|
insert: () => void;
|
|
2385
|
-
|
|
2377
|
+
language: string;
|
|
2378
|
+
theme: Themes;
|
|
2379
|
+
previewTheme: string;
|
|
2380
|
+
codeTheme: string;
|
|
2381
|
+
disabled: boolean;
|
|
2382
|
+
showToolbarName: boolean;
|
|
2383
|
+
onClick: () => void;
|
|
2386
2384
|
onClose: () => void;
|
|
2387
2385
|
onAdjust: (val: boolean) => void;
|
|
2388
2386
|
modalTitle: string | VNode<vue.RendererNode, vue.RendererElement, {
|
|
@@ -2392,6 +2390,8 @@ declare const _default$7: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2392
2390
|
height: string;
|
|
2393
2391
|
showAdjust: boolean;
|
|
2394
2392
|
isFullscreen: boolean;
|
|
2393
|
+
class: string;
|
|
2394
|
+
style: string | CSSProperties;
|
|
2395
2395
|
showMask: boolean;
|
|
2396
2396
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
2397
2397
|
|
|
@@ -2495,14 +2495,14 @@ declare const _default$5: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2495
2495
|
}> | VNode<vue.RendererNode, vue.RendererElement, {
|
|
2496
2496
|
[key: string]: any;
|
|
2497
2497
|
}>[];
|
|
2498
|
-
class: string;
|
|
2499
|
-
style: string | CSSProperties;
|
|
2500
2498
|
visible: boolean;
|
|
2501
2499
|
onAdjust: (val: boolean) => void;
|
|
2502
2500
|
width: string;
|
|
2503
2501
|
height: string;
|
|
2504
2502
|
showAdjust: boolean;
|
|
2505
2503
|
isFullscreen: boolean;
|
|
2504
|
+
class: string;
|
|
2505
|
+
style: string | CSSProperties;
|
|
2506
2506
|
showMask: boolean;
|
|
2507
2507
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
2508
2508
|
|
|
@@ -2555,9 +2555,9 @@ declare const _default$3: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
2555
2555
|
}>> & Readonly<{
|
|
2556
2556
|
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
2557
2557
|
}>, {
|
|
2558
|
-
disabled: boolean;
|
|
2559
|
-
theme: Themes;
|
|
2560
2558
|
language: string;
|
|
2559
|
+
theme: Themes;
|
|
2560
|
+
disabled: boolean;
|
|
2561
2561
|
onClick: (e: MouseEvent) => void;
|
|
2562
2562
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
2563
2563
|
|
|
@@ -2566,49 +2566,49 @@ declare const _default$2: typeof _default$3 & {
|
|
|
2566
2566
|
};
|
|
2567
2567
|
|
|
2568
2568
|
declare const MdPreview: vue.DefineComponent<{
|
|
2569
|
-
readonly modelValue: string;
|
|
2570
|
-
readonly theme: Themes;
|
|
2571
|
-
readonly class: string;
|
|
2572
2569
|
readonly language: string;
|
|
2573
|
-
readonly
|
|
2570
|
+
readonly theme: Themes;
|
|
2574
2571
|
readonly previewTheme: string;
|
|
2572
|
+
readonly codeTheme: string;
|
|
2573
|
+
readonly class: string;
|
|
2575
2574
|
readonly style: string | vue.CSSProperties;
|
|
2575
|
+
readonly modelValue: string;
|
|
2576
|
+
readonly showCodeRowNumber: boolean;
|
|
2576
2577
|
readonly mdHeadingId: MdHeadingId;
|
|
2577
2578
|
readonly sanitize: (html: string) => string;
|
|
2578
2579
|
readonly noMermaid: boolean;
|
|
2579
2580
|
readonly noKatex: boolean;
|
|
2580
|
-
readonly codeTheme: string;
|
|
2581
2581
|
readonly formatCopiedText: (text: string) => string;
|
|
2582
2582
|
readonly codeStyleReverse: boolean;
|
|
2583
2583
|
readonly codeStyleReverseList: string[];
|
|
2584
2584
|
readonly noHighlight: boolean;
|
|
2585
2585
|
readonly noImgZoomIn: boolean;
|
|
2586
2586
|
readonly customIcon: {
|
|
2587
|
-
|
|
2587
|
+
title?: {
|
|
2588
2588
|
component: vue.Component | vue.VNode | string;
|
|
2589
2589
|
props?: {
|
|
2590
2590
|
[key: string | number | symbol]: any;
|
|
2591
2591
|
};
|
|
2592
2592
|
} | undefined;
|
|
2593
|
-
|
|
2593
|
+
bold?: {
|
|
2594
2594
|
component: vue.Component | vue.VNode | string;
|
|
2595
2595
|
props?: {
|
|
2596
2596
|
[key: string | number | symbol]: any;
|
|
2597
2597
|
};
|
|
2598
2598
|
} | undefined;
|
|
2599
|
-
|
|
2599
|
+
underline?: {
|
|
2600
2600
|
component: vue.Component | vue.VNode | string;
|
|
2601
2601
|
props?: {
|
|
2602
2602
|
[key: string | number | symbol]: any;
|
|
2603
2603
|
};
|
|
2604
2604
|
} | undefined;
|
|
2605
|
-
|
|
2605
|
+
italic?: {
|
|
2606
2606
|
component: vue.Component | vue.VNode | string;
|
|
2607
2607
|
props?: {
|
|
2608
2608
|
[key: string | number | symbol]: any;
|
|
2609
2609
|
};
|
|
2610
2610
|
} | undefined;
|
|
2611
|
-
|
|
2611
|
+
"strike-through"?: {
|
|
2612
2612
|
component: vue.Component | vue.VNode | string;
|
|
2613
2613
|
props?: {
|
|
2614
2614
|
[key: string | number | symbol]: any;
|
|
@@ -2801,49 +2801,49 @@ declare const MdPreview: vue.DefineComponent<{
|
|
|
2801
2801
|
readonly id: string | undefined;
|
|
2802
2802
|
readonly previewComponent: vue.Component | undefined;
|
|
2803
2803
|
}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, EditorEmits, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue" | "onBlur" | "onFocus" | "onInput" | "onDrop" | "onInputBoxWidthChange" | "onRemount", vue.PublicProps, Readonly<{
|
|
2804
|
-
readonly modelValue: string;
|
|
2805
|
-
readonly theme: Themes;
|
|
2806
|
-
readonly class: string;
|
|
2807
2804
|
readonly language: string;
|
|
2808
|
-
readonly
|
|
2805
|
+
readonly theme: Themes;
|
|
2809
2806
|
readonly previewTheme: string;
|
|
2807
|
+
readonly codeTheme: string;
|
|
2808
|
+
readonly class: string;
|
|
2810
2809
|
readonly style: string | vue.CSSProperties;
|
|
2810
|
+
readonly modelValue: string;
|
|
2811
|
+
readonly showCodeRowNumber: boolean;
|
|
2811
2812
|
readonly mdHeadingId: MdHeadingId;
|
|
2812
2813
|
readonly sanitize: (html: string) => string;
|
|
2813
2814
|
readonly noMermaid: boolean;
|
|
2814
2815
|
readonly noKatex: boolean;
|
|
2815
|
-
readonly codeTheme: string;
|
|
2816
2816
|
readonly formatCopiedText: (text: string) => string;
|
|
2817
2817
|
readonly codeStyleReverse: boolean;
|
|
2818
2818
|
readonly codeStyleReverseList: string[];
|
|
2819
2819
|
readonly noHighlight: boolean;
|
|
2820
2820
|
readonly noImgZoomIn: boolean;
|
|
2821
2821
|
readonly customIcon: {
|
|
2822
|
-
|
|
2822
|
+
title?: {
|
|
2823
2823
|
component: vue.Component | vue.VNode | string;
|
|
2824
2824
|
props?: {
|
|
2825
2825
|
[key: string | number | symbol]: any;
|
|
2826
2826
|
};
|
|
2827
2827
|
} | undefined;
|
|
2828
|
-
|
|
2828
|
+
bold?: {
|
|
2829
2829
|
component: vue.Component | vue.VNode | string;
|
|
2830
2830
|
props?: {
|
|
2831
2831
|
[key: string | number | symbol]: any;
|
|
2832
2832
|
};
|
|
2833
2833
|
} | undefined;
|
|
2834
|
-
|
|
2834
|
+
underline?: {
|
|
2835
2835
|
component: vue.Component | vue.VNode | string;
|
|
2836
2836
|
props?: {
|
|
2837
2837
|
[key: string | number | symbol]: any;
|
|
2838
2838
|
};
|
|
2839
2839
|
} | undefined;
|
|
2840
|
-
|
|
2840
|
+
italic?: {
|
|
2841
2841
|
component: vue.Component | vue.VNode | string;
|
|
2842
2842
|
props?: {
|
|
2843
2843
|
[key: string | number | symbol]: any;
|
|
2844
2844
|
};
|
|
2845
2845
|
} | undefined;
|
|
2846
|
-
|
|
2846
|
+
"strike-through"?: {
|
|
2847
2847
|
component: vue.Component | vue.VNode | string;
|
|
2848
2848
|
props?: {
|
|
2849
2849
|
[key: string | number | symbol]: any;
|
|
@@ -3051,23 +3051,23 @@ declare const MdPreview: vue.DefineComponent<{
|
|
|
3051
3051
|
onOnRemount?: ((...args: any[]) => any) | undefined;
|
|
3052
3052
|
}>, {
|
|
3053
3053
|
onChange: ChangeEvent;
|
|
3054
|
+
language: string;
|
|
3055
|
+
theme: Themes;
|
|
3056
|
+
previewTheme: string;
|
|
3057
|
+
codeTheme: string;
|
|
3058
|
+
class: string;
|
|
3059
|
+
style: string | vue.CSSProperties;
|
|
3054
3060
|
onHtmlChanged: HtmlChangedEvent;
|
|
3055
3061
|
onGetCatalog: GetCatalogEvent;
|
|
3056
3062
|
onRemount: () => void;
|
|
3057
3063
|
modelValue: string;
|
|
3058
|
-
theme: Themes;
|
|
3059
|
-
class: string;
|
|
3060
|
-
language: string;
|
|
3061
3064
|
editorId: string;
|
|
3062
3065
|
id: string;
|
|
3063
3066
|
showCodeRowNumber: boolean;
|
|
3064
|
-
previewTheme: string;
|
|
3065
|
-
style: string | vue.CSSProperties;
|
|
3066
3067
|
mdHeadingId: MdHeadingId;
|
|
3067
3068
|
sanitize: (html: string) => string;
|
|
3068
3069
|
noMermaid: boolean;
|
|
3069
3070
|
noKatex: boolean;
|
|
3070
|
-
codeTheme: string;
|
|
3071
3071
|
formatCopiedText: (text: string) => string;
|
|
3072
3072
|
codeStyleReverse: boolean;
|
|
3073
3073
|
codeStyleReverseList: string[];
|
|
@@ -3255,12 +3255,12 @@ declare const MdCatalog: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
3255
3255
|
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
3256
3256
|
onOnActive?: ((...args: any[]) => any) | undefined;
|
|
3257
3257
|
}>, {
|
|
3258
|
-
catalogMaxDepth: number;
|
|
3259
3258
|
theme: Themes;
|
|
3259
|
+
onClick: (e: MouseEvent, t: TocItem) => void;
|
|
3260
3260
|
class: string;
|
|
3261
|
+
catalogMaxDepth: number;
|
|
3261
3262
|
editorId: string;
|
|
3262
3263
|
mdHeadingId: MdHeadingId;
|
|
3263
|
-
onClick: (e: MouseEvent, t: TocItem) => void;
|
|
3264
3264
|
onActive: (heading: HeadList | undefined, activeElement: HTMLDivElement) => void;
|
|
3265
3265
|
scrollElement: string | HTMLElement;
|
|
3266
3266
|
offsetTop: number;
|