generated from tpl/obsidian-sample-plugin
Add reload reading log command to load reading log from file
This commit is contained in:
parent
a1956078d8
commit
f3816a4a96
|
@ -0,0 +1,14 @@
|
|||
import type { ReadingLog } from "@utils/ReadingLog";
|
||||
import { Command } from "./Command";
|
||||
import { Notice } from "obsidian";
|
||||
|
||||
export class ReloadReadingLogCommand extends Command {
|
||||
constructor(private readonly readingLog: ReadingLog) {
|
||||
super("reload-reading-log", "Reload Reading Log From File");
|
||||
}
|
||||
|
||||
async callback() {
|
||||
await this.readingLog.load();
|
||||
new Notice("Reading log loaded from file.");
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ import { RestoreReadingLogBackupCommand } from "@commands/RestoreReadingLogBacku
|
|||
import { Goodreads } from "@data-sources/Goodreads";
|
||||
import { CreateBookFromGoodreadsUrlCommand } from "@commands/CreateBookFromGoodreadsUrlCommand";
|
||||
import { registerShelfCodeBlockProcessor } from "@ui/code-blocks/ShelfCodeBlock";
|
||||
import { ReloadReadingLogCommand } from "@commands/ReloadReadingLogCommand";
|
||||
|
||||
export default class BookTrackerPlugin extends Plugin {
|
||||
public settings: BookTrackerPluginSettings;
|
||||
|
@ -81,6 +82,7 @@ export default class BookTrackerPlugin extends Plugin {
|
|||
this.createEntry.bind(this)
|
||||
)
|
||||
);
|
||||
this.addCommand(new ReloadReadingLogCommand(this.readingLog));
|
||||
|
||||
this.addSettingTab(new BookTrackerSettingTab(this));
|
||||
|
||||
|
|
Loading…
Reference in New Issue