|
1 | 1 | /* eslint-disable @typescript-eslint/no-namespace */
|
2 |
| -import { MarkdownView, Notice, WorkspaceLeaf } from "obsidian"; |
| 2 | +import { MarkdownView, Notice, WorkspaceLeaf, PaneType, SplitDirection, App } from "obsidian"; |
| 3 | +import { clipboard} from 'electron'; |
3 | 4 | import { InvioSettingTab } from "src/settings";
|
4 | 5 | import { Utils } from "src/utils/utils";
|
5 | 6 | import { ExportFile } from "./export-file";
|
6 | 7 | import { AssetHandler } from "./asset-handler";
|
7 |
| -import { TabManager } from "src/utils/tab-manager"; |
8 |
| -const { clipboard } = require('electron') |
9 | 8 | import { RenderLog } from "./render-log";
|
10 | 9 | import { StatsView } from "src/statsView";
|
11 |
| - |
| 10 | +import type InvioPlugin from "../main"; // unavoidable |
12 | 11 |
|
13 | 12 | export namespace MarkdownRenderer
|
14 | 13 | {
|
@@ -155,14 +154,19 @@ export namespace MarkdownRenderer
|
155 | 154 | element.textContent = element.value;
|
156 | 155 | });
|
157 | 156 | }
|
| 157 | + |
| 158 | + function newTab(app: App, navType: PaneType | boolean, splitDirection: SplitDirection = 'vertical'): WorkspaceLeaf { |
| 159 | + let leaf = navType === 'split' ? app.workspace.getLeaf(navType, splitDirection) : app.workspace.getLeaf(navType); |
| 160 | + return leaf; |
| 161 | + } |
158 | 162 |
|
159 |
| - export async function beginBatch() |
| 163 | + export async function beginBatch(plugin: InvioPlugin) |
160 | 164 | {
|
161 | 165 | problemLog = "";
|
162 | 166 | errorInBatch = false;
|
163 | 167 | cancelled = false;
|
164 | 168 |
|
165 |
| - renderLeaf = TabManager.openNewTab("window", "vertical"); |
| 169 | + renderLeaf = newTab(plugin.app, "window", "vertical"); |
166 | 170 | // @ts-ignore
|
167 | 171 | const parentFound = await Utils.waitUntil(() => renderLeaf && renderLeaf.parent, 2000, 10);
|
168 | 172 | if (!parentFound)
|
|
0 commit comments