md-editor-v3 5.4.0-0 → 5.4.0-2

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.
@@ -1,3 +1,17 @@
1
+ import { p as prefix } from "./config.mjs";
2
+ const iconMaps = {
3
+ copy: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy ${prefix}-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,
4
+ "collapse-tips": `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-chevron-left ${prefix}-icon"><circle cx="12" cy="12" r="10"/><path d="m14 16-4-4 4-4"/></svg>`,
5
+ pin: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>`,
6
+ "pin-off": `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin-off"><path d="M12 17v5"/><path d="M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"/><path d="m2 2 20 20"/><path d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/></svg>`
7
+ };
8
+ const StrIcon = (name, customIcon) => {
9
+ if (typeof customIcon[name] === "string") {
10
+ return customIcon[name];
11
+ }
12
+ return iconMaps[name];
13
+ };
14
+ const StrIcon$1 = StrIcon;
1
15
  const keyMove = (trigger, moveHandler) => {
2
16
  const triggerMouseDown = (mdown) => {
3
17
  const parent = trigger.parentElement || document.body;
@@ -68,7 +82,8 @@ const createHTMLElement = (tagName, attributes) => {
68
82
  const zoomMermaid = /* @__PURE__ */ (() => {
69
83
  const addEvent = (container) => {
70
84
  if (!container) {
71
- return;
85
+ return () => {
86
+ };
72
87
  }
73
88
  const content = container.firstChild;
74
89
  let scale = 1;
@@ -81,101 +96,141 @@ const zoomMermaid = /* @__PURE__ */ (() => {
81
96
  const updateTransform = () => {
82
97
  content.style.transform = `translate(${posX}px, ${posY}px) scale(${scale})`;
83
98
  };
84
- container.addEventListener(
85
- "touchstart",
86
- (event) => {
87
- if (event.touches.length === 1) {
88
- isDragging = true;
89
- startX = event.touches[0].clientX - posX;
90
- startY = event.touches[0].clientY - posY;
91
- } else if (event.touches.length === 2) {
92
- initialDistance = Math.hypot(
93
- event.touches[0].clientX - event.touches[1].clientX,
94
- event.touches[0].clientY - event.touches[1].clientY
95
- );
96
- initialScale = scale;
97
- }
98
- },
99
- { passive: false }
100
- );
101
- container.addEventListener(
102
- "touchmove",
103
- (event) => {
104
- event.preventDefault();
105
- if (isDragging && event.touches.length === 1) {
106
- posX = event.touches[0].clientX - startX;
107
- posY = event.touches[0].clientY - startY;
108
- updateTransform();
109
- } else if (event.touches.length === 2) {
110
- const newDistance = Math.hypot(
111
- event.touches[0].clientX - event.touches[1].clientX,
112
- event.touches[0].clientY - event.touches[1].clientY
113
- );
114
- const scaleChange = newDistance / initialDistance;
115
- const previousScale = scale;
116
- scale = initialScale * (1 + (scaleChange - 1));
117
- const centerX = (event.touches[0].clientX + event.touches[1].clientX) / 2;
118
- const centerY = (event.touches[0].clientY + event.touches[1].clientY) / 2;
119
- const rect = content.getBoundingClientRect();
120
- const relativeX = (centerX - rect.left) / previousScale;
121
- const relativeY = (centerY - rect.top) / previousScale;
122
- posX -= relativeX * (scale - previousScale);
123
- posY -= relativeY * (scale - previousScale);
124
- updateTransform();
125
- }
126
- },
127
- { passive: false }
128
- );
129
- container.addEventListener("touchend", () => {
130
- isDragging = false;
131
- });
132
- container.addEventListener(
133
- "wheel",
134
- (event) => {
135
- event.preventDefault();
136
- const scaleAmount = 0.02;
99
+ const onTouchStart = (event) => {
100
+ if (event.touches.length === 1) {
101
+ isDragging = true;
102
+ startX = event.touches[0].clientX - posX;
103
+ startY = event.touches[0].clientY - posY;
104
+ } else if (event.touches.length === 2) {
105
+ initialDistance = Math.hypot(
106
+ event.touches[0].clientX - event.touches[1].clientX,
107
+ event.touches[0].clientY - event.touches[1].clientY
108
+ );
109
+ initialScale = scale;
110
+ }
111
+ };
112
+ const onTouchMove = (event) => {
113
+ event.preventDefault();
114
+ if (isDragging && event.touches.length === 1) {
115
+ posX = event.touches[0].clientX - startX;
116
+ posY = event.touches[0].clientY - startY;
117
+ updateTransform();
118
+ } else if (event.touches.length === 2) {
119
+ const newDistance = Math.hypot(
120
+ event.touches[0].clientX - event.touches[1].clientX,
121
+ event.touches[0].clientY - event.touches[1].clientY
122
+ );
123
+ const scaleChange = newDistance / initialDistance;
137
124
  const previousScale = scale;
138
- if (event.deltaY < 0) {
139
- scale += scaleAmount;
140
- } else {
141
- scale = Math.max(0.1, scale - scaleAmount);
142
- }
125
+ scale = initialScale * (1 + (scaleChange - 1));
126
+ const centerX = (event.touches[0].clientX + event.touches[1].clientX) / 2;
127
+ const centerY = (event.touches[0].clientY + event.touches[1].clientY) / 2;
143
128
  const rect = content.getBoundingClientRect();
144
- const mouseX = event.clientX - rect.left;
145
- const mouseY = event.clientY - rect.top;
146
- posX -= mouseX / previousScale * (scale - previousScale);
147
- posY -= mouseY / previousScale * (scale - previousScale);
129
+ const relativeX = (centerX - rect.left) / previousScale;
130
+ const relativeY = (centerY - rect.top) / previousScale;
131
+ posX -= relativeX * (scale - previousScale);
132
+ posY -= relativeY * (scale - previousScale);
148
133
  updateTransform();
149
- },
150
- { passive: false }
151
- );
152
- container.addEventListener("mousedown", (event) => {
134
+ }
135
+ };
136
+ const onTouchEnd = () => {
137
+ isDragging = false;
138
+ };
139
+ const onWheel = (event) => {
140
+ event.preventDefault();
141
+ const scaleAmount = 0.02;
142
+ const previousScale = scale;
143
+ if (event.deltaY < 0) {
144
+ scale += scaleAmount;
145
+ } else {
146
+ scale = Math.max(0.1, scale - scaleAmount);
147
+ }
148
+ const rect = content.getBoundingClientRect();
149
+ const mouseX = event.clientX - rect.left;
150
+ const mouseY = event.clientY - rect.top;
151
+ posX -= mouseX / previousScale * (scale - previousScale);
152
+ posY -= mouseY / previousScale * (scale - previousScale);
153
+ updateTransform();
154
+ };
155
+ const onMouseDown = (event) => {
153
156
  isDragging = true;
154
157
  startX = event.clientX - posX;
155
158
  startY = event.clientY - posY;
156
- });
157
- container.addEventListener("mousemove", (event) => {
159
+ };
160
+ const onMouseMove = (event) => {
158
161
  if (isDragging) {
159
162
  posX = event.clientX - startX;
160
163
  posY = event.clientY - startY;
161
164
  updateTransform();
162
165
  }
163
- });
164
- container.addEventListener("mouseup", () => {
166
+ };
167
+ const onMouseUp = () => {
165
168
  isDragging = false;
166
- });
167
- container.addEventListener("mouseleave", () => {
169
+ };
170
+ const onMouseLeave = () => {
168
171
  isDragging = false;
169
- });
172
+ };
173
+ container.addEventListener("touchstart", onTouchStart, { passive: false });
174
+ container.addEventListener("touchmove", onTouchMove, { passive: false });
175
+ container.addEventListener("touchend", onTouchEnd);
176
+ container.addEventListener("wheel", onWheel, { passive: false });
177
+ container.addEventListener("mousedown", onMouseDown);
178
+ container.addEventListener("mousemove", onMouseMove);
179
+ container.addEventListener("mouseup", onMouseUp);
180
+ container.addEventListener("mouseleave", onMouseLeave);
181
+ return () => {
182
+ container.removeEventListener("touchstart", onTouchStart);
183
+ container.removeEventListener("touchmove", onTouchMove);
184
+ container.removeEventListener("touchend", onTouchEnd);
185
+ container.removeEventListener("wheel", onWheel);
186
+ container.removeEventListener("mousedown", onMouseDown);
187
+ container.removeEventListener("mousemove", onMouseMove);
188
+ container.removeEventListener("mouseup", onMouseUp);
189
+ container.removeEventListener("mouseleave", onMouseLeave);
190
+ };
170
191
  };
171
- const handler = (containers) => {
192
+ const handler = (containers, options) => {
193
+ const removeEventsMap = /* @__PURE__ */ new Map();
172
194
  containers == null ? void 0 : containers.forEach((mm) => {
173
- addEvent(mm);
195
+ let actionDiv = mm.querySelector(`.${prefix}-mermaid-action`);
196
+ if (!actionDiv) {
197
+ mm.insertAdjacentHTML(
198
+ "beforeend",
199
+ `<div class="${prefix}-mermaid-action">${StrIcon$1("pin-off", options.customIcon)}</div>`
200
+ );
201
+ actionDiv = mm.querySelector(`.${prefix}-mermaid-action`);
202
+ }
203
+ const onClick = () => {
204
+ const current = removeEventsMap.get(mm);
205
+ if (current == null ? void 0 : current.removeEvent) {
206
+ current.removeEvent();
207
+ mm.removeAttribute("data-grab");
208
+ removeEventsMap.set(mm, { removeClick: current.removeClick });
209
+ actionDiv.innerHTML = StrIcon$1("pin-off", options.customIcon);
210
+ } else {
211
+ const removeEvent = addEvent(mm);
212
+ mm.setAttribute("data-grab", "");
213
+ removeEventsMap.set(mm, { removeEvent, removeClick: current == null ? void 0 : current.removeClick });
214
+ actionDiv.innerHTML = StrIcon$1("pin", options.customIcon);
215
+ }
216
+ };
217
+ actionDiv.addEventListener("click", onClick);
218
+ removeEventsMap.set(mm, {
219
+ removeClick: () => actionDiv.removeEventListener("click", onClick)
220
+ });
174
221
  });
222
+ return () => {
223
+ removeEventsMap.forEach(({ removeEvent, removeClick }) => {
224
+ if (removeEvent) removeEvent();
225
+ if (removeClick) removeClick();
226
+ });
227
+ removeEventsMap.clear();
228
+ };
175
229
  };
176
230
  return handler;
177
231
  })();
178
232
  export {
233
+ StrIcon$1 as S,
179
234
  appendHandler as a,
180
235
  keyMove as k,
181
236
  updateHandler as u,
@@ -2,8 +2,9 @@ import { inject, onMounted, watch, toRef, nextTick, shallowRef, ref, computed, o
2
2
  import { p as prefix, d as configOption, f as codeCss, s as staticTextDefault, a as allToolbar, b as allFooter } from "./config.mjs";
3
3
  import { b as bus, g as CATALOG_CHANGED, P as PUSH_CATALOG, h as RERENDER, B as BUILD_FINISHED, T as TASK_STATE_CHANGED, c as ON_SAVE, E as ERROR_CATCHER, U as UPLOAD_IMAGE, a as CHANGE_CATALOG_VISIBLE, i as PAGE_FULL_SCREEN_CHANGED, F as FULL_SCREEN_CHANGED, j as PREVIEW_CHANGED, k as PREVIEW_ONLY_CHANGED, H as HTML_PREVIEW_CHANGED, l as CATALOG_VISIBLE_CHANGED, R as REPLACE, C as CHANGE_FULL_SCREEN, f as EVENT_LISTENER } from "./event-name.mjs";
4
4
  import { debounce, randomId, deepMerge, deepClone } from "@vavt/util";
5
- import { a as appendHandler, u as updateHandler, z as zoomMermaid } from "./dom.mjs";
5
+ import { a as appendHandler, u as updateHandler, S as StrIcon, z as zoomMermaid } from "./dom.mjs";
6
6
  import mediumZoom from "medium-zoom";
7
+ import copy2clipboard from "@vavt/copy2clipboard";
7
8
  import mdit from "markdown-it";
8
9
  import ImageFiguresPlugin from "markdown-it-image-figures";
9
10
  import SubPlugin from "markdown-it-sub";
@@ -48,28 +49,6 @@ const userZoom = (props, html) => {
48
49
  }
49
50
  });
50
51
  };
51
- const copy2Clipboard = async (text) => {
52
- if (typeof text !== "string") return;
53
- if (window.isSecureContext && navigator.clipboard) {
54
- return await navigator.clipboard.writeText(text);
55
- } else {
56
- const textarea = document.createElement("textarea");
57
- let successed = false;
58
- textarea.value = text;
59
- textarea.style.position = "fixed";
60
- textarea.style.opacity = 0;
61
- textarea.style.zIndex = "-10000";
62
- textarea.style.top = "-10000";
63
- document.body.appendChild(textarea);
64
- textarea.select();
65
- successed = document.execCommand("copy");
66
- document.body.removeChild(textarea);
67
- if (successed) {
68
- return;
69
- }
70
- throw new Error('Failed to copy content via "execCommand"!');
71
- }
72
- };
73
52
  const useCopyCode = (props, html, key) => {
74
53
  const editorId = inject("editorId");
75
54
  const rootRef = inject("rootRef");
@@ -88,7 +67,7 @@ const useCopyCode = (props, html, key) => {
88
67
  const codeText = activeCode.textContent;
89
68
  const { text, successTips, failTips } = ult.value.copyCode;
90
69
  let msg = successTips;
91
- copy2Clipboard(props.formatCopiedText(codeText)).catch(() => {
70
+ copy2clipboard(props.formatCopiedText(codeText)).catch(() => {
92
71
  msg = failTips;
93
72
  }).finally(() => {
94
73
  if (copyButton.dataset.isIcon) {
@@ -168,10 +147,9 @@ const useMermaid = (props) => {
168
147
  const theme = inject("theme");
169
148
  const rootRef = inject("rootRef");
170
149
  const { editorExtensions, editorExtensionsAttrs, mermaidConfig } = configOption;
171
- const mermaidRef = shallowRef(editorExtensions.mermaid.instance);
150
+ let mermaid = editorExtensions.mermaid.instance;
172
151
  const reRenderRef = shallowRef(-1);
173
152
  const configMermaid = () => {
174
- const mermaid = mermaidRef.value;
175
153
  if (!props.noMermaid && mermaid) {
176
154
  mermaid.initialize(
177
155
  mermaidConfig({
@@ -191,7 +169,7 @@ const useMermaid = (props) => {
191
169
  );
192
170
  onMounted(() => {
193
171
  var _a, _b;
194
- if (props.noMermaid || mermaidRef.value) {
172
+ if (props.noMermaid || mermaid) {
195
173
  return;
196
174
  }
197
175
  const jsSrc = editorExtensions.mermaid.js;
@@ -207,7 +185,7 @@ const useMermaid = (props) => {
207
185
  /* webpackIgnore: true */
208
186
  jsSrc
209
187
  ).then((module) => {
210
- mermaidRef.value = module.default;
188
+ mermaid = module.default;
211
189
  configMermaid();
212
190
  });
213
191
  } else {
@@ -218,7 +196,7 @@ const useMermaid = (props) => {
218
196
  src: jsSrc,
219
197
  id: CDN_IDS.mermaid,
220
198
  onload() {
221
- mermaidRef.value = window.mermaid;
199
+ mermaid = window.mermaid;
222
200
  configMermaid();
223
201
  }
224
202
  },
@@ -227,7 +205,7 @@ const useMermaid = (props) => {
227
205
  }
228
206
  });
229
207
  const replaceMermaid = async () => {
230
- if (!props.noMermaid && mermaidRef.value) {
208
+ if (!props.noMermaid && mermaid) {
231
209
  const mermaidSourceEles = rootRef.value.querySelectorAll(
232
210
  `div.${prefix}-mermaid`
233
211
  );
@@ -247,23 +225,20 @@ const useMermaid = (props) => {
247
225
  Array.from(mermaidSourceEles).map((ele) => {
248
226
  const handler = async (item) => {
249
227
  var _a;
250
- let mermaidHtml = mermaidCache.get(item.innerText);
228
+ const code = item.dataset.code;
229
+ let mermaidHtml = mermaidCache.get(code);
251
230
  if (!mermaidHtml) {
252
231
  const idRand = randomId();
253
232
  let result = { svg: "" };
254
233
  try {
255
- result = await mermaidRef.value.render(
256
- idRand,
257
- item.innerText,
258
- svgContainingElement
259
- );
234
+ result = await mermaid.render(idRand, code, svgContainingElement);
260
235
  mermaidHtml = await props.sanitizeMermaid(result.svg);
261
236
  const p = document.createElement("p");
262
237
  p.className = `${prefix}-mermaid`;
263
238
  p.setAttribute("data-processed", "");
264
239
  p.innerHTML = mermaidHtml;
265
240
  (_a = p.children[0]) == null ? void 0 : _a.removeAttribute("height");
266
- mermaidCache.set(item.innerText, p.innerHTML);
241
+ mermaidCache.set(code, p.innerHTML);
267
242
  if (item.dataset.line !== void 0) {
268
243
  p.dataset.line = item.dataset.line;
269
244
  }
@@ -280,7 +255,7 @@ const useMermaid = (props) => {
280
255
  );
281
256
  }
282
257
  };
283
- return { mermaidRef, reRenderRef, replaceMermaid };
258
+ return { reRenderRef, replaceMermaid };
284
259
  };
285
260
  const useKatex = (props) => {
286
261
  const katex = shallowRef(configOption.editorExtensions.katex.instance);
@@ -323,7 +298,7 @@ const MermaidPlugin = (md, options) => {
323
298
  if (mermaidHtml) {
324
299
  return `<p class="${prefix}-mermaid" ${line !== void 0 ? "data-line=" + line : ""} data-processed>${mermaidHtml}</p>`;
325
300
  }
326
- return `<div class="${prefix}-mermaid" ${line !== void 0 ? "data-line=" + line : ""} data-mermaid-theme=${options.themeRef.value}>${code}</div>`;
301
+ return `<div class="${prefix}-mermaid" ${line !== void 0 ? "data-line=" + line : ""} data-mermaid-theme=${options.themeRef.value} data-code="${code}">${code}</div>`;
327
302
  }
328
303
  return temp(tokens, idx, ops, env, slf);
329
304
  };
@@ -622,17 +597,6 @@ const HeadingPlugin = (md, options) => {
622
597
  return self.renderToken(tokens, idx, opts);
623
598
  };
624
599
  };
625
- const iconMaps = {
626
- copy: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy ${prefix}-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,
627
- "collapse-tips": `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-chevron-left ${prefix}-icon"><circle cx="12" cy="12" r="10"/><path d="m14 16-4-4 4-4"/></svg>`
628
- };
629
- const StrIcon = (name, customIcon) => {
630
- if (typeof customIcon[name] === "string") {
631
- return customIcon[name];
632
- }
633
- return iconMaps[name];
634
- };
635
- const StrIcon$1 = StrIcon;
636
600
  const codetabs = (md, _opts) => {
637
601
  const defaultRender = md.renderer.rules.fence, unescapeAll = md.utils.unescapeAll, re = /\[(\w*)(?::([\w ]*))?\]/, mandatoryRe = /::(open|close)/;
638
602
  const getInfo = (token) => {
@@ -660,7 +624,7 @@ const codetabs = (md, _opts) => {
660
624
  const codeCodeText = (_a = _opts.usedLanguageTextRef.value) == null ? void 0 : _a.copyCode.text;
661
625
  const copyBtnHtml = _opts.customIconRef.value.copy || codeCodeText;
662
626
  const isIcon = !!_opts.customIconRef.value.copy;
663
- const collapseTips = `<span class="${prefix}-collapse-tips">${StrIcon$1("collapse-tips", _opts.customIconRef.value)}</span>`;
627
+ const collapseTips = `<span class="${prefix}-collapse-tips">${StrIcon("collapse-tips", _opts.customIconRef.value)}</span>`;
664
628
  const [GROUP] = getGroupAndTab(tokens[idx]);
665
629
  if (GROUP === null) {
666
630
  const { open: open2, tagContainer: tagContainer2, tagHeader: tagHeader2 } = getTagType(tokens[idx]);
@@ -865,7 +829,7 @@ const initLineNumber = (md) => {
865
829
  });
866
830
  };
867
831
  const useMarkdownIt = (props, previewOnly) => {
868
- const { editorConfig, markdownItConfig, markdownItPlugins } = configOption;
832
+ const { editorConfig, markdownItConfig, markdownItPlugins, editorExtensions } = configOption;
869
833
  const editorId = inject("editorId");
870
834
  const languageRef = inject("language");
871
835
  const usedLanguageTextRef = inject(
@@ -876,6 +840,8 @@ const useMarkdownIt = (props, previewOnly) => {
876
840
  const customIconRef = inject("customIcon");
877
841
  const rootRef = inject("rootRef");
878
842
  const headsRef = ref([]);
843
+ let clearMermaidEvents = () => {
844
+ };
879
845
  const hljsRef = useHighlight(props);
880
846
  const katexRef = useKatex(props);
881
847
  const { reRenderRef, replaceMermaid } = useMermaid(props);
@@ -990,8 +956,16 @@ const useMarkdownIt = (props, previewOnly) => {
990
956
  bus.emit(editorId, CATALOG_CHANGED, headsRef.value);
991
957
  nextTick(() => {
992
958
  replaceMermaid().then(() => {
993
- var _a;
994
- zoomMermaid((_a = rootRef.value) == null ? void 0 : _a.querySelectorAll(`#${editorId} .${prefix}-mermaid`));
959
+ var _a, _b;
960
+ if ((_a = editorExtensions.mermaid) == null ? void 0 : _a.enableZoom) {
961
+ clearMermaidEvents();
962
+ clearMermaidEvents = zoomMermaid(
963
+ (_b = rootRef.value) == null ? void 0 : _b.querySelectorAll(`#${editorId} p.${prefix}-mermaid`),
964
+ {
965
+ customIcon: customIconRef.value
966
+ }
967
+ );
968
+ }
995
969
  });
996
970
  });
997
971
  };
@@ -1018,10 +992,16 @@ const useMarkdownIt = (props, previewOnly) => {
1018
992
  if (props.setting.preview) {
1019
993
  nextTick(() => {
1020
994
  replaceMermaid().then(() => {
1021
- var _a;
1022
- zoomMermaid(
1023
- (_a = rootRef.value) == null ? void 0 : _a.querySelectorAll(`#${editorId} .${prefix}-mermaid`)
1024
- );
995
+ var _a, _b;
996
+ if ((_a = editorExtensions.mermaid) == null ? void 0 : _a.enableZoom) {
997
+ clearMermaidEvents();
998
+ clearMermaidEvents = zoomMermaid(
999
+ (_b = rootRef.value) == null ? void 0 : _b.querySelectorAll(`#${editorId} p.${prefix}-mermaid`),
1000
+ {
1001
+ customIcon: customIconRef.value
1002
+ }
1003
+ );
1004
+ }
1025
1005
  });
1026
1006
  bus.emit(editorId, CATALOG_CHANGED, headsRef.value);
1027
1007
  });
@@ -1045,6 +1025,7 @@ const useMarkdownIt = (props, previewOnly) => {
1045
1025
  });
1046
1026
  });
1047
1027
  onBeforeUnmount(() => {
1028
+ clearMermaidEvents();
1048
1029
  clearTimeout(timer);
1049
1030
  });
1050
1031
  return { html, key };
@@ -2342,7 +2323,6 @@ MdPreview.install = (app) => {
2342
2323
  export {
2343
2324
  CDN_IDS as C,
2344
2325
  MdPreview as M,
2345
- StrIcon$1 as S,
2346
2326
  ContentPreview as a,
2347
2327
  editorEmits as b,
2348
2328
  contentProps as c,
package/lib/es/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  import { default as default2 } from "./MdEditor.mjs";
2
2
  import { C as CDN_IDS } from "./chunks/index.mjs";
3
- import { M, S } from "./chunks/index.mjs";
3
+ import { M } from "./chunks/index.mjs";
4
4
  import { default as default3 } from "./NormalToolbar.mjs";
5
5
  import { D } from "./chunks/index2.mjs";
6
6
  import { default as default4 } from "./ModalToolbar.mjs";
7
7
  import { M as M2 } from "./chunks/index3.mjs";
8
8
  import { M as M3 } from "./chunks/index4.mjs";
9
+ import { S } from "./chunks/dom.mjs";
9
10
  import { defineComponent, createVNode } from "vue";
10
11
  import { g as getSlot } from "./chunks/vue-tsx.mjs";
11
12
  import { p as prefix } from "./chunks/config.mjs";