From a102d6ee84afc99806eafd224d32dfd3ce362dd5 Mon Sep 17 00:00:00 2001 From: Jiean Yang Date: Tue, 27 Aug 2024 19:58:17 +0200 Subject: [PATCH] Create src/component/SampleModal.ts --- main.ts | 23 ++++------------------- src/component/SampleModal.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 src/component/SampleModal.ts diff --git a/main.ts b/main.ts index 09a9b05..00cf1f4 100644 --- a/main.ts +++ b/main.ts @@ -1,5 +1,6 @@ -import { App, Editor, MarkdownView, Modal, Notice, Plugin } from "obsidian"; +import { Editor, MarkdownView, Notice, Plugin } from "obsidian"; import { SampleSettingTab } from "./src/page/SampleSettingTab"; +import { SampleModal } from "./src/component/SampleModal"; // Remember to rename these classes and interfaces! @@ -24,7 +25,7 @@ export default class MyPlugin extends Plugin { (evt: MouseEvent) => { // Called when the user clicks the icon. new Notice("This is a notice!"); - }, + } ); // Perform additional things with the ribbon ribbonIconEl.addClass("my-plugin-ribbon-class"); @@ -82,7 +83,7 @@ export default class MyPlugin extends Plugin { // When registering intervals, this function will automatically clear the interval when the plugin is disabled. this.registerInterval( - window.setInterval(() => console.log("setInterval"), 5 * 60 * 1000), + window.setInterval(() => console.log("setInterval"), 5 * 60 * 1000) ); } @@ -96,19 +97,3 @@ export default class MyPlugin extends Plugin { await this.saveData(this.settings); } } - -class SampleModal extends Modal { - constructor(app: App) { - super(app); - } - - onOpen() { - const { contentEl } = this; - contentEl.setText("Woah!"); - } - - onClose() { - const { contentEl } = this; - contentEl.empty(); - } -} diff --git a/src/component/SampleModal.ts b/src/component/SampleModal.ts new file mode 100644 index 0000000..8ed941d --- /dev/null +++ b/src/component/SampleModal.ts @@ -0,0 +1,17 @@ +import { Modal, App } from "obsidian"; + +export class SampleModal extends Modal { + constructor(app: App) { + super(app); + } + + onOpen() { + const { contentEl } = this; + contentEl.setText("Woah!"); + } + + onClose() { + const { contentEl } = this; + contentEl.empty(); + } +}