import { Plugin , Notice } from "obsidian" ; import { BigCalendar } from "./bigCalendar" ; import { CALENDAR_VIEW_TYPE } from "./data/constants" ; import { App } from "obsidian" ; import addIcons from "src/ui/customIcons" ; import { BigCalendarSettingTab , DEFAULT_SETTINGS , BigCalendarSettings } from './setting' ; declare global { interface Window { app : App ; plugin : BigCalendarPlugin ; } } export default class BigCalendarPlugin extends Plugin { public settings : BigCalendarSettings ; async onload ( ) { await this . loadSettings ( ) ; this . addSettingTab ( new BigCalendarSettingTab ( this . app , this ) ) ; this . registerView ( CALENDAR_VIEW_TYPE , ( leaf ) => new BigCalendar ( leaf , this ) ) ; addIcons ( ) ; this . addRibbonIcon ( 'changeTaskStatus' , 'Big Calendar' , ( ) => { new Notice ( 'Open Big Calendar Successfully' ) ; this . openCalendar ( ) ; } ) ; this . addCommand ( { id : "open-big-calendar" , name : "Open Big Calendar" , callback : ( ) => this . openCalendar ( ) , hotkeys : [ ] , } ) ; await this . loadSettings ( ) ; } public async loadSettings ( ) { this . settings = Object . assign ( { } , DEFAULT_SETTINGS , await this . loadData ( ) ) ; } async saveSettings ( ) { await this . saveData ( this . settings ) ; } onunload ( ) { this . app . workspace . detachLeavesOfType ( CALENDAR_VIEW_TYPE ) ; new Notice ( 'Close Big Calendar Successfully' ) ; } async openCalendar ( ) { const leaf = this . app . workspace . getLeaf ( true ) ; const neovisView = new BigCalendar ( leaf , this ) ; await leaf . open ( neovisView ) ; } }