mirror of
https://github.com/rerurate514/insert_ArknightsURL_banners.git
synced 2026-07-22 13:00:25 +00:00
41 lines
1,001 B
TypeScript
41 lines
1,001 B
TypeScript
import { DEFAULT_SETTINGS, IAUBPluginSettings } from 'lib/settings/settings';
|
|
import { IAUBSettingTab } from 'lib/settings/settings-tab';
|
|
import { ImageSelectModal } from 'lib/ui/modal/image_select_modal';
|
|
import { MarkdownView, Plugin } from 'obsidian';
|
|
|
|
export default class IAUBPlugin extends Plugin {
|
|
settings: IAUBPluginSettings;
|
|
|
|
async onload() {
|
|
await this.loadSettings();
|
|
|
|
this.addCommand({
|
|
id: 'select_insertURL_to_banners',
|
|
name: 'Select insert URL to banners',
|
|
checkCallback: (checking: boolean) => {
|
|
const markdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
|
|
if (markdownView) {
|
|
if (!checking) {
|
|
new ImageSelectModal(this.app, this).open();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
|
|
this.addSettingTab(new IAUBSettingTab(this.app, this));
|
|
}
|
|
|
|
onunload() {
|
|
|
|
}
|
|
|
|
async loadSettings() {
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
|
}
|
|
|
|
async saveSettings() {
|
|
await this.saveData(this.settings);
|
|
}
|
|
}
|