Initial commit
This commit is contained in:
51
settings.ts
Normal file
51
settings.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
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) {
|
||||
new Setting(containerEl)
|
||||
.setName("Daily note path")
|
||||
.setDesc("Path to your daily notes folder (e.g., 'Daily Notes' or leave empty for root)")
|
||||
.addText(text => text
|
||||
.setPlaceholder("Daily Notes")
|
||||
.setValue(this.plugin.settings.dailyNotePath)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.dailyNotePath = value;
|
||||
await this.plugin.saveSettings();
|
||||
}));
|
||||
|
||||
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();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user