qzhuli-markdown-wysiwyg 0.1.13 → 0.1.14

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.
@@ -11479,11 +11479,11 @@
11479
11479
  return headings
11480
11480
  }
11481
11481
 
11482
- function getCurrentTocEntries() {
11483
- if (sourceMode) {
11484
- const textarea = document.getElementById('markdown-source-editor')
11485
- return collectSourceModeHeadings(textarea ? textarea.value : '')
11486
- }
11482
+ function getCurrentTocEntries() {
11483
+ if (sourceMode) {
11484
+ const textarea = document.getElementById('markdown-source-editor')
11485
+ return collectSourceModeHeadings(textarea ? textarea.value : '')
11486
+ }
11487
11487
 
11488
11488
  const content = document.getElementById('doc-content')
11489
11489
  if (!content) return []
@@ -11495,15 +11495,16 @@
11495
11495
  text: heading.textContent || '',
11496
11496
  element: heading,
11497
11497
  lineIndex: index,
11498
- }
11499
- })
11500
- }
11501
-
11502
- if (sourceTextarea) {
11503
- const revealToolbar = () => {
11504
- if (editorReadOnly || !toolbarWrapper) return
11505
- clearTimeout(hideToolbarTimer)
11506
- hideToolbarTimer = setTimeout(() => {
11498
+ }
11499
+ })
11500
+ }
11501
+
11502
+ const sourceTextarea = document.getElementById('markdown-source-editor')
11503
+ if (sourceTextarea) {
11504
+ const revealToolbar = () => {
11505
+ if (editorReadOnly || !toolbarWrapper) return
11506
+ clearTimeout(hideToolbarTimer)
11507
+ hideToolbarTimer = setTimeout(() => {
11507
11508
  toolbarWrapper.classList.remove('toolbar-hidden')
11508
11509
  toolbarHidden = false
11509
11510
  }, 100)
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue");var y=typeof document<"u"?document.currentScript:null;const H="qzhuli-markdown-wysiwyg",D="./editor/markdown-editor-wysiwyg.html",z=/\/node_modules\/\.vite\/deps\/[^/?#]*qzhuli-markdown-wysiwyg[^/?#]*\.js(?:[?#].*)?$/i,S=(o,i)=>{const p=String(i||"").trim();!p||o.includes(p)||o.push(p)},G=()=>new URL(D,typeof document>"u"?require("url").pathToFileURL(__filename).href:y&&y.tagName.toUpperCase()==="SCRIPT"&&y.src||new URL("index.cjs",document.baseURI).href).href,K=()=>{const o=String((typeof document>"u"?require("url").pathToFileURL(__filename).href:y&&y.tagName.toUpperCase()==="SCRIPT"&&y.src||new URL("index.cjs",document.baseURI).href)||"").trim();return!o||!z.test(o)?"":o.replace(z,`/node_modules/${H}/dist/editor/markdown-editor-wysiwyg.html`)},b=o=>{const i=[];return S(i,o),i.length>0||(S(i,G()),S(i,K())),i},Y=o=>b(o)[0]||"",$=["src","title"],_=a.defineComponent({name:"MarkdownEditorWysiwyg",__name:"MarkdownEditorWysiwyg",props:{modelValue:{default:""},readOnly:{type:Boolean,default:!1},viewMode:{},theme:{default:"system"},filename:{default:""},path:{default:""},runtimeUrl:{default:""},iframeTitle:{default:"Markdown WYSIWYG editor"},atUserList:{default:()=>[]}},emits:["update:modelValue","change","ready","scroll","get-at-list","at-who","mention-click","file-save"],setup(o,{expose:i,emit:p}){const r=o,s=p,w=a.ref(null),U=a.getCurrentInstance(),I=()=>{var e;const t=(e=U==null?void 0:U.subTree)==null?void 0:e.el;w.value=t instanceof HTMLIFrameElement?t:null},l=a.ref(!1),P=a.ref(0),d=a.ref(0),c=a.ref(0),k=a.ref(r.modelValue??""),q=a.ref(r.filename??""),A=a.ref(r.path??""),C=a.computed(()=>F(r.atUserList)),L=a.computed(()=>r.viewMode?r.viewMode:r.readOnly?"readonly":"default"),h=a.computed(()=>b(r.runtimeUrl)),E=a.computed(()=>h.value[d.value]||"");let g=null;const m=()=>{g===null||typeof window>"u"||(window.clearTimeout(g),g=null)},T=()=>{m(),!(typeof window>"u")&&(l.value||d.value>=h.value.length-1||(g=window.setTimeout(()=>{l.value||d.value>=h.value.length-1||(l.value=!1,c.value=0,d.value+=1)},1200)))},v=t=>{var e,n;(n=(e=w.value)==null?void 0:e.contentWindow)==null||n.postMessage(t,"*")},M=(t,e)=>{if(typeof t=="string"){const f=t.trim();return{id:f||e,name:f,displayName:f,label:f,subtitle:"",keywords:[],searchTerms:[]}}const n=String(t.name||t.displayName||t.label||"").trim(),u=String(t.displayName||t.label||t.name||"").trim(),R=String(t.subtitle||"").trim();return{id:t.id??n??u??e,name:n||u,displayName:u||n,label:u||n,avatar:String(t.avatar||"").trim(),subtitle:R,keywords:Array.isArray(t.keywords)?[...t.keywords]:[],searchTerms:Array.isArray(t.searchTerms)?[...t.searchTerms]:[]}},F=(t=[])=>t.map((e,n)=>M(e,n)),N=()=>{const t=r.modelValue??"",e=r.filename??"",n=r.path??"";v({type:"load-content",content:t,filename:e,path:n}),k.value=t,q.value=e,A.value=n},V=()=>{v({type:"apply-settings",theme:r.theme,readOnly:L.value==="readonly",viewMode:L.value})},O=()=>{v({type:"set-host-mode",mode:"external"})},x=(t=c.value)=>{v({type:"set-at-list",requestId:t,users:C.value})},j=()=>{l.value&&(O(),N(),V(),x())},B=()=>{m(),l.value=!1,c.value=0,d.value=0,P.value+=1},W=t=>{if(w.value&&t.source!==w.value.contentWindow||!t.data||typeof t.data!="object")return;const e=t.data;if(e.type==="editor-ready"){m(),l.value=!0,s("ready"),j();return}if(e.type==="get-at-list"){const n=Number(e.requestId)||Date.now();c.value=n;const u={requestId:n,query:String(e.query||"")};s("get-at-list",u);return}if(e.type==="at-who"){if(!e.user)return;const n={requestId:Number(e.requestId)||c.value||Date.now(),value:String(e.value||""),user:M(e.user,0)};s("at-who",n);return}if(e.type==="mention-click"){if(!e.user)return;const n={value:String(e.value||""),user:M(e.user,0)};s("mention-click",n);return}if(e.type==="file-save"){const n={content:String(e.content??""),filename:String(e.filename??r.filename??""),path:String(e.path??r.path??"")};s("file-save",n);return}if(e.type==="content-change"){const n=e.content??"";k.value=n,s("update:modelValue",n),s("change",n);return}e.type==="scroll-position"&&s("scroll",Number(e.position)||0)};return a.watch(h,()=>{m(),d.value=0,l.value||T()},{deep:!0}),a.watch(E,()=>{E.value&&(m(),l.value=!1,c.value=0,T())}),a.watch(()=>[r.modelValue,r.filename,r.path],([t,e,n])=>{if(!l.value)return;const u=t??"",R=e??"",f=n??"";u===k.value&&R===q.value&&f===A.value||N()}),a.watch(()=>[r.readOnly,r.viewMode,r.theme],()=>{l.value&&V()}),a.watch(C,()=>{l.value&&x()},{deep:!0}),i({reload:B,postMessage:v}),a.onMounted(()=>{I(),window.addEventListener("message",W),T()}),a.onUpdated(()=>{I()}),a.onBeforeUnmount(()=>{m(),window.removeEventListener("message",W)}),(t,e)=>(a.openBlock(),a.createElementBlock("iframe",{key:P.value,src:E.value,title:o.iframeTitle,class:"markdown-editor-wysiwyg-frame",style:{display:"block",width:"100%",height:"100%",border:"0"}},null,8,$))}}),J={install(o){o.component("MarkdownEditorWysiwyg",_)}};exports.MarkdownEditorWysiwyg=_;exports.MarkdownEditorWysiwygPlugin=J;exports.default=_;exports.resolveEditorRuntimeUrl=Y;exports.resolveEditorRuntimeUrls=b;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue");var p=typeof document<"u"?document.currentScript:null;const D="qzhuli-markdown-wysiwyg",G="./editor/markdown-editor-wysiwyg.html",W=/\/node_modules\/\.vite\/deps\/[^/?#]*qzhuli-markdown-wysiwyg[^/?#]*\.js(?:[?#].*)?$/i,U=(o,i)=>{const s=String(i||"").trim();!s||o.includes(s)||o.push(s)},F=()=>new URL(G,typeof document>"u"?require("url").pathToFileURL(__filename).href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("index.cjs",document.baseURI).href).href,K=()=>{const o=String((typeof document>"u"?require("url").pathToFileURL(__filename).href:p&&p.tagName.toUpperCase()==="SCRIPT"&&p.src||new URL("index.cjs",document.baseURI).href)||"").trim();return!o||!W.test(o)?"":o.replace(W,`/node_modules/${D}/dist/editor/markdown-editor-wysiwyg.html`)},b=o=>{const i=[];if(U(i,o),i.length>0)return i;const s=K();return s?(U(i,s),U(i,F()),i):(U(i,F()),i)},Y=o=>b(o)[0]||"",$=["src","title"],_=r.defineComponent({name:"MarkdownEditorWysiwyg",__name:"MarkdownEditorWysiwyg",props:{modelValue:{default:""},readOnly:{type:Boolean,default:!1},viewMode:{},theme:{default:"system"},filename:{default:""},path:{default:""},runtimeUrl:{default:""},iframeTitle:{default:"Markdown WYSIWYG editor"},atUserList:{default:()=>[]}},emits:["update:modelValue","change","ready","scroll","get-at-list","at-who","mention-click","file-save"],setup(o,{expose:i,emit:s}){const a=o,u=s,w=r.ref(null),k=r.getCurrentInstance(),I=()=>{var e;const t=(e=k==null?void 0:k.subTree)==null?void 0:e.el;w.value=t instanceof HTMLIFrameElement?t:null},l=r.ref(!1),P=r.ref(0),c=r.ref(0),m=r.ref(0),E=r.ref(a.modelValue??""),q=r.ref(a.filename??""),A=r.ref(a.path??""),C=r.computed(()=>O(a.atUserList)),L=r.computed(()=>a.viewMode?a.viewMode:a.readOnly?"readonly":"default"),h=r.computed(()=>b(a.runtimeUrl)),R=r.computed(()=>h.value[c.value]||"");let g=null;const f=()=>{g===null||typeof window>"u"||(window.clearTimeout(g),g=null)},T=()=>{f(),!(typeof window>"u")&&(l.value||c.value>=h.value.length-1||(g=window.setTimeout(()=>{l.value||c.value>=h.value.length-1||(l.value=!1,m.value=0,c.value+=1)},1200)))},v=t=>{var e,n;(n=(e=w.value)==null?void 0:e.contentWindow)==null||n.postMessage(t,"*")},M=(t,e)=>{if(typeof t=="string"){const y=t.trim();return{id:y||e,name:y,displayName:y,label:y,subtitle:"",keywords:[],searchTerms:[]}}const n=String(t.name||t.displayName||t.label||"").trim(),d=String(t.displayName||t.label||t.name||"").trim(),S=String(t.subtitle||"").trim();return{id:t.id??n??d??e,name:n||d,displayName:d||n,label:d||n,avatar:String(t.avatar||"").trim(),subtitle:S,keywords:Array.isArray(t.keywords)?[...t.keywords]:[],searchTerms:Array.isArray(t.searchTerms)?[...t.searchTerms]:[]}},O=(t=[])=>t.map((e,n)=>M(e,n)),N=()=>{const t=a.modelValue??"",e=a.filename??"",n=a.path??"";v({type:"load-content",content:t,filename:e,path:n}),E.value=t,q.value=e,A.value=n},V=()=>{v({type:"apply-settings",theme:a.theme,readOnly:L.value==="readonly",viewMode:L.value})},j=()=>{v({type:"set-host-mode",mode:"external"})},x=(t=m.value)=>{v({type:"set-at-list",requestId:t,users:C.value})},B=()=>{l.value&&(j(),N(),V(),x())},H=()=>{f(),l.value=!1,m.value=0,c.value=0,P.value+=1},z=t=>{if(w.value&&t.source!==w.value.contentWindow||!t.data||typeof t.data!="object")return;const e=t.data;if(e.type==="editor-ready"){f(),l.value=!0,u("ready"),B();return}if(e.type==="get-at-list"){const n=Number(e.requestId)||Date.now();m.value=n;const d={requestId:n,query:String(e.query||"")};u("get-at-list",d);return}if(e.type==="at-who"){if(!e.user)return;const n={requestId:Number(e.requestId)||m.value||Date.now(),value:String(e.value||""),user:M(e.user,0)};u("at-who",n);return}if(e.type==="mention-click"){if(!e.user)return;const n={value:String(e.value||""),user:M(e.user,0)};u("mention-click",n);return}if(e.type==="file-save"){const n={content:String(e.content??""),filename:String(e.filename??a.filename??""),path:String(e.path??a.path??"")};u("file-save",n);return}if(e.type==="content-change"){const n=e.content??"";E.value=n,u("update:modelValue",n),u("change",n);return}e.type==="scroll-position"&&u("scroll",Number(e.position)||0)};return r.watch(h,()=>{f(),c.value=0,l.value||T()},{deep:!0}),r.watch(R,()=>{R.value&&(f(),l.value=!1,m.value=0,T())}),r.watch(()=>[a.modelValue,a.filename,a.path],([t,e,n])=>{if(!l.value)return;const d=t??"",S=e??"",y=n??"";d===E.value&&S===q.value&&y===A.value||N()}),r.watch(()=>[a.readOnly,a.viewMode,a.theme],()=>{l.value&&V()}),r.watch(C,()=>{l.value&&x()},{deep:!0}),i({reload:H,postMessage:v}),r.onMounted(()=>{I(),window.addEventListener("message",z),T()}),r.onUpdated(()=>{I()}),r.onBeforeUnmount(()=>{f(),window.removeEventListener("message",z)}),(t,e)=>(r.openBlock(),r.createElementBlock("iframe",{key:P.value,src:R.value,title:o.iframeTitle,class:"markdown-editor-wysiwyg-frame",style:{display:"block",width:"100%",height:"100%",border:"0"}},null,8,$))}}),J={install(o){o.component("MarkdownEditorWysiwyg",_)}};exports.MarkdownEditorWysiwyg=_;exports.MarkdownEditorWysiwygPlugin=J;exports.default=_;exports.resolveEditorRuntimeUrl=Y;exports.resolveEditorRuntimeUrls=b;
package/dist/index.mjs CHANGED
@@ -1,21 +1,24 @@
1
- import { defineComponent as D, ref as u, getCurrentInstance as j, computed as k, watch as p, onMounted as G, onUpdated as K, onBeforeUnmount as Y, openBlock as $, createElementBlock as J } from "vue";
2
- const Q = "qzhuli-markdown-wysiwyg", X = "./editor/markdown-editor-wysiwyg.html", z = /\/node_modules\/\.vite\/deps\/[^/?#]*qzhuli-markdown-wysiwyg[^/?#]*\.js(?:[?#].*)?$/i, A = (r, o) => {
3
- const y = String(o || "").trim();
4
- !y || r.includes(y) || r.push(y);
5
- }, Z = () => new URL(
1
+ import { defineComponent as j, ref as d, getCurrentInstance as G, computed as k, watch as p, onMounted as K, onUpdated as Y, onBeforeUnmount as $, openBlock as J, createElementBlock as Q } from "vue";
2
+ const X = "qzhuli-markdown-wysiwyg", Z = "./editor/markdown-editor-wysiwyg.html", x = /\/node_modules\/\.vite\/deps\/[^/?#]*qzhuli-markdown-wysiwyg[^/?#]*\.js(?:[?#].*)?$/i, E = (r, l) => {
3
+ const i = String(l || "").trim();
4
+ !i || r.includes(i) || r.push(i);
5
+ }, W = () => new URL(
6
6
  /* @vite-ignore */
7
- X,
7
+ Z,
8
8
  import.meta.url
9
9
  ).href, ee = () => {
10
10
  const r = String(import.meta.url || "").trim();
11
- return !r || !z.test(r) ? "" : r.replace(
12
- z,
13
- `/node_modules/${Q}/dist/editor/markdown-editor-wysiwyg.html`
11
+ return !r || !x.test(r) ? "" : r.replace(
12
+ x,
13
+ `/node_modules/${X}/dist/editor/markdown-editor-wysiwyg.html`
14
14
  );
15
- }, W = (r) => {
16
- const o = [];
17
- return A(o, r), o.length > 0 || (A(o, Z()), A(o, ee())), o;
18
- }, re = (r) => W(r)[0] || "", te = ["src", "title"], ne = /* @__PURE__ */ D({
15
+ }, F = (r) => {
16
+ const l = [];
17
+ if (E(l, r), l.length > 0)
18
+ return l;
19
+ const i = ee();
20
+ return i ? (E(l, i), E(l, W()), l) : (E(l, W()), l);
21
+ }, re = (r) => F(r)[0] || "", te = ["src", "title"], ne = /* @__PURE__ */ j({
19
22
  name: "MarkdownEditorWysiwyg",
20
23
  __name: "MarkdownEditorWysiwyg",
21
24
  props: {
@@ -30,54 +33,54 @@ const Q = "qzhuli-markdown-wysiwyg", X = "./editor/markdown-editor-wysiwyg.html"
30
33
  atUserList: { default: () => [] }
31
34
  },
32
35
  emits: ["update:modelValue", "change", "ready", "scroll", "get-at-list", "at-who", "mention-click", "file-save"],
33
- setup(r, { expose: o, emit: y }) {
34
- const a = r, i = y, w = u(null), E = j(), _ = () => {
36
+ setup(r, { expose: l, emit: i }) {
37
+ const a = r, s = i, w = d(null), M = G(), R = () => {
35
38
  var e;
36
- const t = (e = E == null ? void 0 : E.subTree) == null ? void 0 : e.el;
39
+ const t = (e = M == null ? void 0 : M.subTree) == null ? void 0 : e.el;
37
40
  w.value = t instanceof HTMLIFrameElement ? t : null;
38
- }, l = u(!1), q = u(0), d = u(0), m = u(0), M = u(a.modelValue ?? ""), I = u(a.filename ?? ""), P = u(a.path ?? ""), R = k(() => F(a.atUserList)), N = k(() => a.viewMode ? a.viewMode : a.readOnly ? "readonly" : "default"), g = k(() => W(a.runtimeUrl)), T = k(() => g.value[d.value] || "");
41
+ }, o = d(!1), _ = d(0), m = d(0), c = d(0), T = d(a.modelValue ?? ""), q = d(a.filename ?? ""), I = d(a.path ?? ""), P = k(() => O(a.atUserList)), N = k(() => a.viewMode ? a.viewMode : a.readOnly ? "readonly" : "default"), g = k(() => F(a.runtimeUrl)), b = k(() => g.value[m.value] || "");
39
42
  let h = null;
40
- const c = () => {
43
+ const f = () => {
41
44
  h === null || typeof window > "u" || (window.clearTimeout(h), h = null);
42
- }, b = () => {
43
- c(), !(typeof window > "u") && (l.value || d.value >= g.value.length - 1 || (h = window.setTimeout(() => {
44
- l.value || d.value >= g.value.length - 1 || (l.value = !1, m.value = 0, d.value += 1);
45
+ }, U = () => {
46
+ f(), !(typeof window > "u") && (o.value || m.value >= g.value.length - 1 || (h = window.setTimeout(() => {
47
+ o.value || m.value >= g.value.length - 1 || (o.value = !1, c.value = 0, m.value += 1);
45
48
  }, 1200)));
46
49
  }, v = (t) => {
47
50
  var e, n;
48
51
  (n = (e = w.value) == null ? void 0 : e.contentWindow) == null || n.postMessage(t, "*");
49
52
  }, S = (t, e) => {
50
53
  if (typeof t == "string") {
51
- const f = t.trim();
54
+ const y = t.trim();
52
55
  return {
53
- id: f || e,
54
- name: f,
55
- displayName: f,
56
- label: f,
56
+ id: y || e,
57
+ name: y,
58
+ displayName: y,
59
+ label: y,
57
60
  subtitle: "",
58
61
  keywords: [],
59
62
  searchTerms: []
60
63
  };
61
64
  }
62
- const n = String(t.name || t.displayName || t.label || "").trim(), s = String(t.displayName || t.label || t.name || "").trim(), U = String(t.subtitle || "").trim();
65
+ const n = String(t.name || t.displayName || t.label || "").trim(), u = String(t.displayName || t.label || t.name || "").trim(), A = String(t.subtitle || "").trim();
63
66
  return {
64
- id: t.id ?? n ?? s ?? e,
65
- name: n || s,
66
- displayName: s || n,
67
- label: s || n,
67
+ id: t.id ?? n ?? u ?? e,
68
+ name: n || u,
69
+ displayName: u || n,
70
+ label: u || n,
68
71
  avatar: String(t.avatar || "").trim(),
69
- subtitle: U,
72
+ subtitle: A,
70
73
  keywords: Array.isArray(t.keywords) ? [...t.keywords] : [],
71
74
  searchTerms: Array.isArray(t.searchTerms) ? [...t.searchTerms] : []
72
75
  };
73
- }, F = (t = []) => t.map((e, n) => S(e, n)), C = () => {
76
+ }, O = (t = []) => t.map((e, n) => S(e, n)), C = () => {
74
77
  const t = a.modelValue ?? "", e = a.filename ?? "", n = a.path ?? "";
75
78
  v({
76
79
  type: "load-content",
77
80
  content: t,
78
81
  filename: e,
79
82
  path: n
80
- }), M.value = t, I.value = e, P.value = n;
83
+ }), T.value = t, q.value = e, I.value = n;
81
84
  }, L = () => {
82
85
  v({
83
86
  type: "apply-settings",
@@ -85,46 +88,46 @@ const Q = "qzhuli-markdown-wysiwyg", X = "./editor/markdown-editor-wysiwyg.html"
85
88
  readOnly: N.value === "readonly",
86
89
  viewMode: N.value
87
90
  });
88
- }, O = () => {
91
+ }, B = () => {
89
92
  v({
90
93
  type: "set-host-mode",
91
94
  mode: "external"
92
95
  });
93
- }, V = (t = m.value) => {
96
+ }, V = (t = c.value) => {
94
97
  v({
95
98
  type: "set-at-list",
96
99
  requestId: t,
97
- users: R.value
100
+ users: P.value
98
101
  });
99
- }, B = () => {
100
- l.value && (O(), C(), L(), V());
101
102
  }, H = () => {
102
- c(), l.value = !1, m.value = 0, d.value = 0, q.value += 1;
103
- }, x = (t) => {
103
+ o.value && (B(), C(), L(), V());
104
+ }, D = () => {
105
+ f(), o.value = !1, c.value = 0, m.value = 0, _.value += 1;
106
+ }, z = (t) => {
104
107
  if (w.value && t.source !== w.value.contentWindow || !t.data || typeof t.data != "object") return;
105
108
  const e = t.data;
106
109
  if (e.type === "editor-ready") {
107
- c(), l.value = !0, i("ready"), B();
110
+ f(), o.value = !0, s("ready"), H();
108
111
  return;
109
112
  }
110
113
  if (e.type === "get-at-list") {
111
114
  const n = Number(e.requestId) || Date.now();
112
- m.value = n;
113
- const s = {
115
+ c.value = n;
116
+ const u = {
114
117
  requestId: n,
115
118
  query: String(e.query || "")
116
119
  };
117
- i("get-at-list", s);
120
+ s("get-at-list", u);
118
121
  return;
119
122
  }
120
123
  if (e.type === "at-who") {
121
124
  if (!e.user) return;
122
125
  const n = {
123
- requestId: Number(e.requestId) || m.value || Date.now(),
126
+ requestId: Number(e.requestId) || c.value || Date.now(),
124
127
  value: String(e.value || ""),
125
128
  user: S(e.user, 0)
126
129
  };
127
- i("at-who", n);
130
+ s("at-who", n);
128
131
  return;
129
132
  }
130
133
  if (e.type === "mention-click") {
@@ -133,7 +136,7 @@ const Q = "qzhuli-markdown-wysiwyg", X = "./editor/markdown-editor-wysiwyg.html"
133
136
  value: String(e.value || ""),
134
137
  user: S(e.user, 0)
135
138
  };
136
- i("mention-click", n);
139
+ s("mention-click", n);
137
140
  return;
138
141
  }
139
142
  if (e.type === "file-save") {
@@ -142,57 +145,57 @@ const Q = "qzhuli-markdown-wysiwyg", X = "./editor/markdown-editor-wysiwyg.html"
142
145
  filename: String(e.filename ?? a.filename ?? ""),
143
146
  path: String(e.path ?? a.path ?? "")
144
147
  };
145
- i("file-save", n);
148
+ s("file-save", n);
146
149
  return;
147
150
  }
148
151
  if (e.type === "content-change") {
149
152
  const n = e.content ?? "";
150
- M.value = n, i("update:modelValue", n), i("change", n);
153
+ T.value = n, s("update:modelValue", n), s("change", n);
151
154
  return;
152
155
  }
153
- e.type === "scroll-position" && i("scroll", Number(e.position) || 0);
156
+ e.type === "scroll-position" && s("scroll", Number(e.position) || 0);
154
157
  };
155
158
  return p(
156
159
  g,
157
160
  () => {
158
- c(), d.value = 0, l.value || b();
161
+ f(), m.value = 0, o.value || U();
159
162
  },
160
163
  { deep: !0 }
161
164
  ), p(
162
- T,
165
+ b,
163
166
  () => {
164
- T.value && (c(), l.value = !1, m.value = 0, b());
167
+ b.value && (f(), o.value = !1, c.value = 0, U());
165
168
  }
166
169
  ), p(
167
170
  () => [a.modelValue, a.filename, a.path],
168
171
  ([t, e, n]) => {
169
- if (!l.value) return;
170
- const s = t ?? "", U = e ?? "", f = n ?? "";
171
- s === M.value && U === I.value && f === P.value || C();
172
+ if (!o.value) return;
173
+ const u = t ?? "", A = e ?? "", y = n ?? "";
174
+ u === T.value && A === q.value && y === I.value || C();
172
175
  }
173
176
  ), p(
174
177
  () => [a.readOnly, a.viewMode, a.theme],
175
178
  () => {
176
- l.value && L();
179
+ o.value && L();
177
180
  }
178
181
  ), p(
179
- R,
182
+ P,
180
183
  () => {
181
- l.value && V();
184
+ o.value && V();
182
185
  },
183
186
  { deep: !0 }
184
- ), o({
185
- reload: H,
187
+ ), l({
188
+ reload: D,
186
189
  postMessage: v
187
- }), G(() => {
188
- _(), window.addEventListener("message", x), b();
189
190
  }), K(() => {
190
- _();
191
+ R(), window.addEventListener("message", z), U();
191
192
  }), Y(() => {
192
- c(), window.removeEventListener("message", x);
193
- }), (t, e) => ($(), J("iframe", {
194
- key: q.value,
195
- src: T.value,
193
+ R();
194
+ }), $(() => {
195
+ f(), window.removeEventListener("message", z);
196
+ }), (t, e) => (J(), Q("iframe", {
197
+ key: _.value,
198
+ src: b.value,
196
199
  title: r.iframeTitle,
197
200
  class: "markdown-editor-wysiwyg-frame",
198
201
  style: { display: "block", width: "100%", height: "100%", border: "0" }
@@ -208,5 +211,5 @@ export {
208
211
  le as MarkdownEditorWysiwygPlugin,
209
212
  ne as default,
210
213
  re as resolveEditorRuntimeUrl,
211
- W as resolveEditorRuntimeUrls
214
+ F as resolveEditorRuntimeUrls
212
215
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qzhuli-markdown-wysiwyg",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "WYSIWYG Markdown editor packaged as a Vue-friendly JS library",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",