Create src/component/SampleModal.ts

This commit is contained in:
Jiean Yang 2024-08-27 19:58:17 +02:00
parent 46d9b512d2
commit a102d6ee84
2 changed files with 21 additions and 19 deletions

23
main.ts
View File

@ -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();
}
}

View File

@ -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();
}
}