mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
17 lines
No EOL
632 B
TypeScript
17 lines
No EOL
632 B
TypeScript
import type VaultkeeperAIPlugin from "main";
|
|
import { Resolve } from "./DependencyService";
|
|
import { Services } from "./Services";
|
|
import type { TFile, WorkspaceLeaf } from "obsidian";
|
|
|
|
export class WorkSpaceService {
|
|
private readonly plugin: VaultkeeperAIPlugin = Resolve<VaultkeeperAIPlugin>(Services.VaultkeeperAIPlugin);
|
|
|
|
public async openNote(noteName: string) {
|
|
const file: TFile | null = this.plugin.app.metadataCache.getFirstLinkpathDest(noteName, "");
|
|
const leaf: WorkspaceLeaf = this.plugin.app.workspace.getLeaf(false);
|
|
|
|
if (file) {
|
|
await leaf.openFile(file);
|
|
}
|
|
}
|
|
} |