mirror of
https://github.com/jxpeng98/obsidian-to-NotionNext
synced 2026-07-29 16:35:57 +08:00
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
import {App, Editor, MarkdownView, Notice, Plugin, PluginSettingTab, Setting} from "obsidian";
|
|
import {addIcons} from 'src/ui/icon';
|
|
import {Upload2NotionGeneral} from "src/upload/upload_general/Upload2NotionGeneral";
|
|
import {Upload2NotionNext} from "src/upload/upload_next/Upload2NotionNext";
|
|
import {i18nConfig} from "src/lang/I18n";
|
|
import ribbonCommands from "src/commands/NotionCommands";
|
|
import { ObsidianSettingTab, PluginSettings, DEFAULT_SETTINGS } from "src/ui/settingTabs";
|
|
|
|
// Remember to rename these classes and interfaces!
|
|
|
|
|
|
export default class ObsidianSyncNotionPlugin extends Plugin {
|
|
settings: PluginSettings;
|
|
commands: ribbonCommands;
|
|
app: App;
|
|
|
|
async onload() {
|
|
await this.loadSettings();
|
|
this.commands = new ribbonCommands(this);
|
|
|
|
addIcons();
|
|
// This creates an icon in the left ribbon.
|
|
const ribbonIconEl = this.addRibbonIcon(
|
|
"notion-logo",
|
|
i18nConfig.ribbonIcon,
|
|
async (evt: MouseEvent) => {
|
|
// Called when the user clicks the icon.
|
|
// await this.uploadCommand();
|
|
this.commands.ribbonDisplay();
|
|
}
|
|
);
|
|
|
|
// This adds a status bar item to the bottom of the app. Does not work on mobile apps.
|
|
|
|
// const statusBarItemEl = this.addStatusBarItem();
|
|
// // statusBarItemEl.setText("share to notion");
|
|
|
|
// This adds a settings tab so the user can configure various aspects of the plugin
|
|
this.addSettingTab(new ObsidianSettingTab(this.app, this));
|
|
|
|
}
|
|
|
|
onunload() {
|
|
}
|
|
|
|
async loadSettings() {
|
|
this.settings = Object.assign(
|
|
{},
|
|
DEFAULT_SETTINGS,
|
|
await this.loadData()
|
|
);
|
|
}
|
|
|
|
async saveSettings() {
|
|
await this.saveData(this.settings);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|