mirror of
https://github.com/prncc/obsidian-repeat-plugin.git
synced 2026-07-22 06:50:25 +00:00
41 lines
938 B
TypeScript
41 lines
938 B
TypeScript
import { App, Modal, Setting } from 'obsidian';
|
|
|
|
class RepeatNoteSetupModal extends Modal {
|
|
result: string;
|
|
onSubmit: (result: string) => void;
|
|
|
|
constructor(app: App, onSubmit: (result: string) => void) {
|
|
super(app);
|
|
this.onSubmit = onSubmit;
|
|
}
|
|
|
|
onOpen() {
|
|
const { contentEl } = this;
|
|
contentEl.createEl('h1', { text: 'Set Up Repetition for This Note' });
|
|
|
|
// TODO: Implement repeat choice menu.
|
|
new Setting(contentEl)
|
|
.setName('Repeat frequency')
|
|
.addText((text) =>
|
|
text.onChange((value) => {
|
|
this.result = value
|
|
}));
|
|
|
|
new Setting(contentEl)
|
|
.addButton((btn) =>
|
|
btn
|
|
.setButtonText('Submit')
|
|
.setCta()
|
|
.onClick(() => {
|
|
this.close();
|
|
this.onSubmit(this.result);
|
|
}));
|
|
}
|
|
|
|
onClose() {
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
}
|
|
}
|
|
|
|
export default RepeatNoteSetupModal;
|