diff --git a/src/GitHub/upload.ts b/src/GitHub/upload.ts index bf46f24c..9a00ca6b 100644 --- a/src/GitHub/upload.ts +++ b/src/GitHub/upload.ts @@ -458,7 +458,8 @@ export default class Publisher { properties.frontmatter.prop ); if (this.settings.github.dryRun.enable) { - const folderName = this.settings.github.dryRun.folderName + const originalFolderName = this.settings.github.dryRun.folderName.trim().length > 0 ? this.settings.github.dryRun.folderName : "enveloppe"; + const folderName = originalFolderName .replace("{{repo}}", prop.repo) .replace("{{branch}}", prop.branch) .replace("{{owner}}", prop.owner); diff --git a/src/settings.ts b/src/settings.ts index dc997069..8b3e31bc 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -331,16 +331,24 @@ export class EnveloppeSettingsTab extends PluginSettingTab { }) ); + const defaultFolderName = githubSettings.dryRun.folderName.trim().length > 0 ? githubSettings.dryRun.folderName :"enveloppe"; + new Setting(this.settingsPage) .setName(i18next.t("settings.github.dryRun.folder.title")) .setDesc(i18next.t("settings.github.dryRun.folder.desc")) .addText((text) => text .setPlaceholder("enveloppe") - .setValue(githubSettings.dryRun.folderName) + .setValue(defaultFolderName) .onChange(async (value) => { githubSettings.dryRun.folderName = value.trim(); - await this.plugin.saveSettings(); + if (value.trim().length === 0) { + new Notice(i18next.t("settings.github.dryRun.folder.error")); + text.inputEl.addClass("error"); + } else { + text.inputEl.removeClass("error"); + await this.plugin.saveSettings(); + } }) ); diff --git a/src/styles.css b/src/styles.css index 324c907e..7cba57e4 100644 --- a/src/styles.css +++ b/src/styles.css @@ -367,7 +367,7 @@ span.enveloppe.icons { border-left: 3px solid var(--color-orange); padding-left: 5px; } - +.enveloppe input.error, .enveloppe .error input { border: 1px solid var(--text-error); } @@ -376,6 +376,12 @@ span.enveloppe.icons { width: 100%; } +.enveloppe input.error:active, +.enveloppe input.error:focus { + border: 2px solid var(--text-error); + box-shadow: none !important; +} + .enveloppe .display-none .setting-item-info { display: none; }