Skip to content

Commit

Permalink
fix: Remove ADFView from main.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
andymac4182 committed May 2, 2023
1 parent 6bc63b9 commit a21abbd
Showing 1 changed file with 1 addition and 60 deletions.
61 changes: 1 addition & 60 deletions packages/obsidian/src/main.ts
@@ -1,10 +1,4 @@
import {
Plugin,
Notice,
MarkdownView,
WorkspaceLeaf,
Workspace,
} from "obsidian";
import { Plugin, Notice, MarkdownView, Workspace } from "obsidian";
import {
ConfluenceUploadSettings,
Publisher,
Expand All @@ -15,7 +9,6 @@ import { ConfluenceSettingTab } from "./ConfluenceSettingTab";
import ObsidianAdaptor from "./adaptors/obsidian";
import { CompletedModal } from "./CompletedModal";
import { ObsidianConfluenceClient } from "./MyBaseClient";
import AdfView, { ADF_VIEW_TYPE } from "./AdfView";
import {
ConfluencePerPageForm,
ConfluencePerPageUIValues,
Expand All @@ -33,37 +26,6 @@ export default class ConfluencePlugin extends Plugin {
return workspace.getActiveViewOfType(MarkdownView)?.file.path;
}

activeLeafName(workspace: Workspace) {
return (
workspace.getActiveViewOfType(MarkdownView)?.getDisplayText() ?? ""
);
}

adfPreview() {
const fileInfo = {
path: this.activeLeafPath(this.workspace),
basename: this.activeLeafName(this.workspace),
};
this.initPreview(fileInfo);
}

async initPreview(fileInfo: {
path: string | undefined;
basename: string;
}) {
if (this.app.workspace.getLeavesOfType(ADF_VIEW_TYPE).length > 0) {
return;
}
const preview = this.app.workspace.getLeaf("split");
const mmPreview = new AdfView(
this.settings,
preview,
fileInfo,
this.adaptor
);
preview.open(mmPreview);
}

async init() {
await this.loadSettings();
const { vault, metadataCache, workspace } = this.app;
Expand Down Expand Up @@ -98,27 +60,6 @@ export default class ConfluencePlugin extends Plugin {
override async onload() {
await this.init();

this.registerView(
ADF_VIEW_TYPE,
(leaf: WorkspaceLeaf) =>
new AdfView(
this.settings,
leaf,
{
path: this.activeLeafPath(this.workspace),
basename: this.activeLeafName(this.workspace),
},
this.adaptor
)
);

this.addCommand({
id: "adf-preview",
name: "Preview the current note rendered to ADF",
callback: () => this.adfPreview(),
hotkeys: [],
});

this.addRibbonIcon("cloud", "Publish to Confluence", async () => {
if (this.isSyncing) {
new Notice("Syncing already on going");
Expand Down

0 comments on commit a21abbd

Please sign in to comment.