when clicking ribbon open the new leaf/view

This commit is contained in:
Dian 2025-01-31 22:15:50 +08:00
parent d2ff2fa9fd
commit 2b4d11068d

11
main.ts
View file

@ -30,6 +30,12 @@ const DEFAULT_SETTINGS: MyPluginSettings = {
export default class NemesisPlugin extends Plugin {
settings: MyPluginSettings;
async testFunction() {
const { workspace } = this.app;
// let a = await workspace.ensureSideLeaf(VIEW_TYPE_EXAMPLE, "right");
// console.log(a);
}
async activateView() {
const { workspace } = this.app;
let leaf: WorkspaceLeaf | null = null;
@ -47,6 +53,10 @@ export default class NemesisPlugin extends Plugin {
});
}
}
if (leaf) {
workspace.revealLeaf(leaf);
workspace.setActiveLeaf(leaf);
}
}
async onload() {
@ -67,6 +77,7 @@ export default class NemesisPlugin extends Plugin {
new Notice("This is a notice!");
console.log("click");
this.activateView();
this.testFunction();
// console.log(`My openai key: ${this.settings.openAiKey}`);
}
);