46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { App, PluginSettingTab, Setting } from "obsidian";
|
|
import TaskWeaverPlugin from "./main";
|
|
|
|
export class TaskWeaverSettingTab extends PluginSettingTab {
|
|
plugin: TaskWeaverPlugin;
|
|
|
|
constructor(app: App, plugin: TaskWeaverPlugin) {
|
|
super(app, plugin);
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
display(): void {
|
|
const { containerEl } = this;
|
|
containerEl.empty();
|
|
|
|
new Setting(containerEl)
|
|
.setName("Enable daily note logging")
|
|
.setDesc("Log completed tasks to your daily note")
|
|
.addToggle(toggle => toggle
|
|
.setValue(this.plugin.settings.enableDailyNoteLogging)
|
|
.onChange(async (value) => {
|
|
this.plugin.settings.enableDailyNoteLogging = value;
|
|
await this.plugin.saveSettings();
|
|
this.display();
|
|
}));
|
|
|
|
if (this.plugin.settings.enableDailyNoteLogging) {
|
|
containerEl.createEl("p", {
|
|
text: "Tasks will be logged to your daily note using the Daily Notes core plugin settings.",
|
|
cls: "setting-item-description"
|
|
});
|
|
|
|
new Setting(containerEl)
|
|
.setName("Daily note format")
|
|
.setDesc("Format for logging tasks. Available placeholders: {{title}}, {{duration}}, {{emoji}}, {{category}}")
|
|
.addTextArea(text => text
|
|
.setPlaceholder("- [x] {{title}} ({{duration}}) {{emoji}}")
|
|
.setValue(this.plugin.settings.dailyNoteFormat)
|
|
.onChange(async (value) => {
|
|
this.plugin.settings.dailyNoteFormat = value;
|
|
await this.plugin.saveSettings();
|
|
}));
|
|
}
|
|
}
|
|
}
|