diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index a2c96ae0c..fdb18c7d2 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -476,7 +476,7 @@ ${getIconScript(servePath)} Protyle.flowchartRender(wysElement, "${servePath}stage/protyle"); Protyle.graphvizRender(wysElement, "${servePath}stage/protyle"); Protyle.chartRender(wysElement, "${servePath}stage/protyle"); - Protyle.mindmapRender(wysElement, "${servePath}stage/protyle"); + Protyle.mindmapRender(wysElement, "${servePath}stage/protyle", {zoom: false, pan: false}); Protyle.abcRender(wysElement, "${servePath}stage/protyle"); Protyle.htmlRender(wysElement); Protyle.plantumlRender(wysElement, "${servePath}stage/protyle"); @@ -775,7 +775,7 @@ ${getIconScript(servePath)} Protyle.flowchartRender(previewElement, "stage/protyle"); Protyle.graphvizRender(previewElement, "stage/protyle"); Protyle.chartRender(previewElement, "stage/protyle"); - Protyle.mindmapRender(previewElement, "stage/protyle"); + Protyle.mindmapRender(previewElement, "stage/protyle", {zoom: false, pan: false}); Protyle.abcRender(previewElement, "stage/protyle"); Protyle.htmlRender(previewElement); Protyle.plantumlRender(previewElement, "stage/protyle"); diff --git a/app/src/protyle/render/mindmapRender.ts b/app/src/protyle/render/mindmapRender.ts index 5734fc526..55e9eb1b3 100644 --- a/app/src/protyle/render/mindmapRender.ts +++ b/app/src/protyle/render/mindmapRender.ts @@ -3,7 +3,7 @@ import { Constants } from "../../constants"; import { hasClosestByClassName } from "../util/hasClosest"; import { genIconHTML } from "./util"; -export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN) => { +export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN, markmapOptions: {zoom?: boolean; pan?: boolean} = {}) => { let mindmapElements: Element[] = []; if (element.getAttribute("data-subtype") === "mindmap") { // 编辑器内代码块编辑渲染 @@ -124,9 +124,10 @@ export const mindmapRender = (element: Element, cdn = Constants.PROTYLE_CDN) => // prefer Markmap.create if available const MarkmapCtor = (mm && (mm.Markmap || mm.default || mm)) || (window as any).Markmap; - const options = { + // default options, allow overriding via markmapOptions (e.g. in export we can pass zoom/pan false) + const options = Object.assign({ duration: 0, // 🔥 禁用动画,设为0 - }; + }, markmapOptions || {}); // create and store markmap + transformer on the element so callers can update instead of re-creating if (MarkmapCtor && typeof MarkmapCtor.create === "function") { if (rootData) {