Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复编译问题 #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export default class SamplePlugin extends Plugin {
callback: () => {
const modal = new FileSelectionModal(this.app);
modal.setHandler(this, this.newMindMapFile);
modal.setDefaults(this.settings);
modal.setDefaults(this.settings as any);
modal.open();
}
});
Expand Down Expand Up @@ -436,7 +436,7 @@ export default class SamplePlugin extends Plugin {
this.app,
folderPath,
this.manifest.version,
initData?initData:this.settings.defaultInitData,
initData?initData:(this.settings.defaultInitData) as any,
fileName
);

Expand Down
36 changes: 18 additions & 18 deletions src/mindmap-edit-view.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {TextFileView} from "obsidian";
import {createApp, App as VueApp} from "vue";
import {TextFileView, WorkspaceLeaf} from "obsidian";
import {App, createApp, App as VueApp} from "vue";
// import SimpleMindMap from "./mindmapvue/simple-mind-map.vue";
import SimpleMindMap from "./mindmapvue/Main.vue";
import MindMap from "simple-mind-map";
Expand Down Expand Up @@ -29,7 +29,7 @@ export class MufengMindMapView extends TextFileView {

private mindApp: {};

private leaf: WorkspaceLeaf;
// private leaf: WorkspaceLeaf;


constructor(leaf: WorkspaceLeaf, pluginId: string, pluginVersion: string) {
Expand Down Expand Up @@ -97,7 +97,7 @@ export class MufengMindMapView extends TextFileView {
// const vm = this.mindApp.mount(newDiv);
// this.markMind = vm.mindMap

this.markMind= this.mindApp.mount(newDiv);
this.markMind= ((this.mindApp as VueApp).mount(newDiv)) as any;


}, 200);
Expand All @@ -118,8 +118,8 @@ export class MufengMindMapView extends TextFileView {
//clear为true,说明正在打开另一个文件
if (clear) {
if (this.mindApp) {
console.log("卸载myapp")
this.mindApp.unmount();
console.log("卸载myapp");
(this.mindApp as VueApp).unmount();
this.markMind=null;
this.onClose();
}
Expand All @@ -141,22 +141,22 @@ export class MufengMindMapView extends TextFileView {
}

async onClose() {
console.log('mindmap-edit-vue onClose')
this.mindApp.unmount();
console.log('mindmap-edit-vue onClose');
(this.mindApp as VueApp).unmount();
// this.markMind=null;
this.markMind = null;
this.contentEl.empty();
//重要:这个监听不销毁,会导致每次打开新的思维导图产生的vue实例无法销毁
this.app.workspace.off(EVENT_APP_MIND_REFRESH);
this.app.workspace.off(EVENT_APP_MIND_EMBEDDED_RESIZE);
this.app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE)
this.app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE)
this.app.workspace.off(EVENT_APP_MIND_NODE_PRIORITY)
this.app.workspace.off(EVENT_APP_MIND_EXPORT)
this.app.workspace.off(EVENT_APP_RESIZE);
this.app.workspace.off(EVENT_APP_CSS_CHANGE);
this.app.workspace.off(EVENT_APP_QUICK_PREVIEW)
this.app.workspace.off(EVENT_APP_LEAF_CHANGE_ACTIVE)
this.app.workspace.off(EVENT_APP_MIND_REFRESH,()=>{});
this.app.workspace.off(EVENT_APP_MIND_EMBEDDED_RESIZE,()=>{});
this.app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE,()=>{})
this.app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE,()=>{})
this.app.workspace.off(EVENT_APP_MIND_NODE_PRIORITY,()=>{})
this.app.workspace.off(EVENT_APP_MIND_EXPORT,()=>{})
this.app.workspace.off(EVENT_APP_RESIZE,()=>{});
this.app.workspace.off(EVENT_APP_CSS_CHANGE,()=>{});
this.app.workspace.off(EVENT_APP_QUICK_PREVIEW,()=>{})
this.app.workspace.off(EVENT_APP_LEAF_CHANGE_ACTIVE,()=>{})
}


Expand Down
32 changes: 16 additions & 16 deletions src/mindmap-embedded-view.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {PluginValue, ViewPlugin, ViewUpdate} from "@codemirror/view";

// import {loadEmbeddedMindApps} from "./embedded/embedded-app-manager";
import {App} from "obsidian";
import {createApp} from "vue";
import {App, WorkspaceLeaf, MarkdownView} from "obsidian";
import {createApp, App as VueApp} from "vue";
import {
EVENT_APP_CSS_CHANGE,
EVENT_APP_MIND_EMBEDDED_RESIZE,
Expand Down Expand Up @@ -51,24 +51,24 @@ export default function PreviewPlugin(
console.log("embedded destory")
if (this.mindAppList.length > 0) {
for (const item of this.mindAppList) {
console.log("embedded destory unmount")
item.unmount();
console.log("embedded destory unmount");
(item as VueApp).unmount();
}
}

app.workspace.off(EVENT_APP_RESIZE);
app.workspace.off(EVENT_APP_CSS_CHANGE)
app.workspace.off(EVENT_APP_QUICK_PREVIEW)
app.workspace.off(EVENT_APP_LEAF_CHANGE_ACTIVE)
app.workspace.off(EVENT_APP_RESIZE,()=>{});
app.workspace.off(EVENT_APP_CSS_CHANGE,()=>{})
app.workspace.off(EVENT_APP_QUICK_PREVIEW,()=>{})
app.workspace.off(EVENT_APP_LEAF_CHANGE_ACTIVE,()=>{})

app.workspace.off(EVENT_APP_MIND_REFRESH);
app.workspace.off(EVENT_APP_MIND_EMBEDDED_RESIZE);
app.workspace.off(EVENT_APP_MIND_NODE_REMARK_PREVIEW)
app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE)
app.workspace.off(EVENT_APP_MIND_NODE_PRIORITY)
app.workspace.off(EVENT_APP_MIND_EXPORT)
app.workspace.off(EVENT_APP_MIND_REFRESH,()=>{});
app.workspace.off(EVENT_APP_MIND_EMBEDDED_RESIZE,()=>{});
app.workspace.off(EVENT_APP_MIND_NODE_REMARK_PREVIEW,()=>{})
app.workspace.off(EVENT_APP_MIND_NODE_REMARK_INPUT_ACTIVE,()=>{})
app.workspace.off(EVENT_APP_MIND_NODE_PRIORITY,()=>{})
app.workspace.off(EVENT_APP_MIND_EXPORT,()=>{})

app.workspace.off(EVENT_MIND_NODE_ACTIVE)
app.workspace.off(EVENT_MIND_NODE_ACTIVE,()=>{})
}


Expand Down Expand Up @@ -192,7 +192,7 @@ export default function PreviewPlugin(
contentEl: containerEl
})
mindApp.mount(containerEl);
this.mindAppList.push(mindApp);
this.mindAppList.push(mindApp as never);
}


Expand Down
2 changes: 1 addition & 1 deletion src/utils/file-operations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, TFolder ,normalizePath} from "obsidian";
import { App, TFolder ,normalizePath, Notice} from "obsidian";
import { splitFileExtension } from "./utils";
import {DEFAULT_FILE_NAME, FILE_EXTENSION} from "../constants/constant";

Expand Down
10 changes: 5 additions & 5 deletions src/utils/mind-content-util.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

export const MARKMIND_DEFAULT_FULL_DATA = {
"layout":"mindMap",
"root":MARKMIND_DEFAULT_REAL_DATA
}

export const MARKMIND_DEFAULT_REAL_DATA = {
"data":
{"text": "根节点"},
"children": []
}

export const MARKMIND_DEFAULT_FULL_DATA = {
"layout":"mindMap",
"root":MARKMIND_DEFAULT_REAL_DATA
}