mirror of
https://github.com/oen/liquid-template.git
synced 2026-07-22 05:40:24 +00:00
improve settings panel
This commit is contained in:
parent
f45ab5003f
commit
b28c74a64d
1 changed files with 40 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
import LiquidTemplates from "./main";
|
||||
import { format } from 'date-fns';
|
||||
|
||||
export interface LiquidTemplatesSettings {
|
||||
templatesFolder: string;
|
||||
|
|
@ -12,8 +13,8 @@ export interface LiquidTemplatesSettings {
|
|||
export const DEFAULT_SETTINGS: LiquidTemplatesSettings = {
|
||||
templatesFolder: 'templates',
|
||||
excludeFolders: "",
|
||||
dateFormat: '%Y-%m-%d',
|
||||
timeFormat: '%H:%M',
|
||||
dateFormat: 'yyyy-MM-dd',
|
||||
timeFormat: 'k:m',
|
||||
autocompleteTrigger: ';;'
|
||||
};
|
||||
|
||||
|
|
@ -59,9 +60,26 @@ export class LiquidTemplatesSettingsTab extends PluginSettingTab {
|
|||
})
|
||||
);
|
||||
|
||||
const dateFormatDesc = document.createDocumentFragment();
|
||||
dateFormatDesc.append(
|
||||
'Output format for render dates.',
|
||||
dateFormatDesc.createEl('br'),
|
||||
'For more syntax, refer to ',
|
||||
dateFormatDesc.createEl("a", {
|
||||
href: "https://date-fns.org/v2.21.3/docs/format",
|
||||
text: "format reference",
|
||||
}),
|
||||
dateFormatDesc.createEl('br'),
|
||||
'current format: ',
|
||||
dateFormatDesc.createEl('b', {
|
||||
cls: 'u-pop',
|
||||
text: format(new Date, this.plugin.settings.dateFormat)
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Date format')
|
||||
.setDesc('Output format for render dates')
|
||||
.setDesc(dateFormatDesc)
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder(DEFAULT_SETTINGS.dateFormat)
|
||||
|
|
@ -72,9 +90,27 @@ export class LiquidTemplatesSettingsTab extends PluginSettingTab {
|
|||
})
|
||||
);
|
||||
|
||||
|
||||
const timeFormatDesc = document.createDocumentFragment();
|
||||
timeFormatDesc.append(
|
||||
'Output format for render time.',
|
||||
timeFormatDesc.createEl('br'),
|
||||
'For more syntax, refer to ',
|
||||
timeFormatDesc.createEl("a", {
|
||||
href: "https://date-fns.org/v2.21.3/docs/format",
|
||||
text: "format reference",
|
||||
}),
|
||||
timeFormatDesc.createEl('br'),
|
||||
'current format: ',
|
||||
timeFormatDesc.createEl('b', {
|
||||
cls: 'u-pop',
|
||||
text: format(new Date, this.plugin.settings.timeFormat)
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName('Time format')
|
||||
.setDesc('Output format for render time')
|
||||
.setDesc(timeFormatDesc)
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder(DEFAULT_SETTINGS.timeFormat)
|
||||
|
|
|
|||
Loading…
Reference in a new issue