From f1f0a2d36a119012b07f4d40271e3f09fe3486ce Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 19 Jun 2023 17:47:30 +0800 Subject: [PATCH] feat: add date format configuration for filename variable --- src/main.ts | 26 +++++++++++++++++++++++++- src/settings/index.ts | 2 ++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index dd19336..7d252d5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -653,12 +653,36 @@ class OmnivoreSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); }) ); + + new Setting(containerEl) + .setName("Filename Date Format") + .setDesc( + createFragment((fragment) => { + fragment.append( + "Enter the format date for use in rendered filename. Format ", + fragment.createEl("a", { + text: "reference", + href: "https://moment.github.io/luxon/#/formatting?id=table-of-tokens", + }) + ); + }) + ) + .addText((text) => + text + .setPlaceholder("yyyy-MM-dd") + .setValue(this.plugin.settings.filenameDateFormat) + .onChange(async (value) => { + this.plugin.settings.filenameDateFormat = value; + await this.plugin.saveSettings(); + }) + ); + new Setting(containerEl) .setName("Folder Date Format") .setDesc( createFragment((fragment) => { fragment.append( - "Enter the format date for use in rendered template. Format ", + "Enter the format date for use in rendered folder name. Format ", fragment.createEl("a", { text: "reference", href: "https://moment.github.io/luxon/#/formatting?id=table-of-tokens", diff --git a/src/settings/index.ts b/src/settings/index.ts index e77b80b..e7452c1 100644 --- a/src/settings/index.ts +++ b/src/settings/index.ts @@ -33,6 +33,7 @@ export const DEFAULT_SETTINGS: OmnivoreSettings = { folderDateFormat: "yyyy-MM-dd", endpoint: "https://api-prod.omnivore.app/api/graphql", filename: "{{{title}}}", + filenameDateFormat: "yyyy-MM-dd", attachmentFolder: "Omnivore/attachments", version: "0.0.0", isSingleFile: false, @@ -74,4 +75,5 @@ export interface OmnivoreSettings { intervalId: number; frontMatterVariables: string[]; frontMatterTemplate: string; + filenameDateFormat: string; }