From 6852b93b425ddf083a77f205f7665f2faa712cc4 Mon Sep 17 00:00:00 2001 From: Kodai Nakamura Date: Sun, 16 Feb 2025 14:13:54 +0900 Subject: [PATCH] feat: add JIRA URL formatting settings to plugin configuration - Introduce toggle for formatting JIRA URLs on save - Add text area for configuring multiple JIRA domain URLs - Enable users to customize JIRA URL formatting behavior --- src/settings/settings.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/settings/settings.ts b/src/settings/settings.ts index ea0b4ef..23f8c69 100644 --- a/src/settings/settings.ts +++ b/src/settings/settings.ts @@ -158,5 +158,43 @@ export class AutomaticLinkerPluginSettingsTab extends PluginSettingTab { text.inputEl.rows = 4; text.inputEl.cols = 50; }); + + // Toggle for formatting JIRA URLs on save + new Setting(containerEl) + .setName("Format JIRA URLs on Save") + .setDesc( + "When enabled, JIRA URLs will be formatted when saving the file.", + ) + .addToggle((toggle) => { + toggle + .setValue(this.plugin.settings.formatJiraURLs) + .onChange(async (value) => { + this.plugin.settings.formatJiraURLs = value; + await this.plugin.saveData(this.plugin.settings); + }); + }); + + // Add JIRA URLs setting + new Setting(containerEl) + .setName("JIRA URLs") + .setDesc( + "Enter JIRA URLs (one per line). Example: jira.enterprise.com", + ) + .addTextArea((text) => { + text.setPlaceholder("jira.enterprise.com\njira.company.com") + .setValue(this.plugin.settings.jiraURLs.join("\n")) + .onChange(async (value) => { + // Split by newlines and filter out empty lines + const urls = value + .split("\n") + .map((url) => url.trim()) + .filter(Boolean); + this.plugin.settings.jiraURLs = urls; + await this.plugin.saveData(this.plugin.settings); + }); + // Make the text area taller + text.inputEl.rows = 4; + text.inputEl.cols = 50; + }); } }