From ef40690fd62a5ce4684a0d324fbe9a9809ae8cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Wed, 3 Sep 2025 09:11:11 +0800 Subject: [PATCH] =?UTF-8?q?md=E5=92=8C=E6=80=9D=E7=BB=B4=E5=AF=BC=E5=9B=BE?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2,=E6=90=9C=E7=B4=A2=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E7=AD=89=E5=9C=BA=E6=99=AF=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=98=AF=E5=90=A6=E6=98=AF=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/main.js | 5 ++++- plugin/ob/Menus.js | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/plugin/main.js b/plugin/main.js index 5064983..e037792 100644 --- a/plugin/main.js +++ b/plugin/main.js @@ -272,7 +272,10 @@ export default class SimpleMindMapPlugin extends Plugin { return file && file === curFilePath }) if (existLeaf) { - if (existLeaf.view.jumpToNodeByUid) { + if ( + existLeaf.view instanceof SmmEditView && + existLeaf.view.jumpToNodeByUid + ) { existLeaf.view.jumpToNodeByUid(uid) } else { self.fileToSubpathMap[curFilePath] = uid diff --git a/plugin/ob/Menus.js b/plugin/ob/Menus.js index 8e78345..4dcb5b3 100644 --- a/plugin/ob/Menus.js +++ b/plugin/ob/Menus.js @@ -9,6 +9,7 @@ import LZString from 'lz-string' import { SMM_VIEW_TYPE, SMM_TAG } from './constant.js' import { around } from 'monkey-around' import markdown from 'simple-mind-map/src/parse/markdown.js' +import SmmEditView from '../SmmEditView.js' export default class Menus { constructor(plugin) { @@ -103,8 +104,10 @@ export default class Menus { const markdownLeafs = this.app.workspace.getLeavesOfType(SMM_VIEW_TYPE) for (const leaf of markdownLeafs) { - if (leaf.view.file.path === renamedFile.path) { - leaf.view.isActive = false + if ( + leaf.view instanceof SmmEditView && + leaf.view.file.path === renamedFile.path + ) { leaf.detach() break } @@ -230,7 +233,10 @@ export default class Menus { const markdownLeafs = this.app.workspace.getLeavesOfType('markdown') for (const leaf of markdownLeafs) { - if (leaf.view.file.path === renamedFile.path) { + if ( + leaf.view instanceof MarkdownView && + leaf.view.file.path === renamedFile.path + ) { leaf.detach() break }