diff --git a/src/ui/settingTabs.ts b/src/ui/settingTabs.ts index 0cb5975..7b7147f 100644 --- a/src/ui/settingTabs.ts +++ b/src/ui/settingTabs.ts @@ -14,6 +14,7 @@ export interface PluginSettings { bannerUrl: string; notionUser: string; NotionLinkDisplay: boolean; + autoCopyNotionLink: boolean; autoSync: boolean; autoSyncDelay: number; autoSyncFrontmatterKey: string; @@ -53,6 +54,7 @@ export const DEFAULT_SETTINGS: PluginSettings = { bannerUrl: "", notionUser: "", NotionLinkDisplay: true, + autoCopyNotionLink: true, autoSync: false, autoSyncDelay: 5, autoSyncFrontmatterKey: DEFAULT_AUTO_SYNC_DATABASE_KEY, @@ -95,6 +97,8 @@ export class ObsidianSettingTab extends PluginSettingTab { this.createSettingEl(containerEl, i18nConfig.NotionLinkDisplay, i18nConfig.NotionLinkDisplayDesc, 'toggle', i18nConfig.NotionLinkDisplay, this.plugin.settings.NotionLinkDisplay, 'NotionLinkDisplay') + this.createSettingEl(containerEl, i18nConfig.AutoCopyNotionLink, i18nConfig.AutoCopyNotionLinkDesc, 'toggle', i18nConfig.AutoCopyNotionLink, this.plugin.settings.autoCopyNotionLink, 'autoCopyNotionLink') + this.createSettingEl(containerEl, i18nConfig.AutoSync, i18nConfig.AutoSyncDesc, 'toggle', i18nConfig.AutoSync, this.plugin.settings.autoSync, 'autoSync') new Setting(containerEl) diff --git a/src/upload/updateYaml.ts b/src/upload/updateYaml.ts index 4545c3e..85cf579 100644 --- a/src/upload/updateYaml.ts +++ b/src/upload/updateYaml.ts @@ -43,10 +43,13 @@ export async function updateYamlInfo( ); }); - try { - await navigator.clipboard.writeText(url) - } catch (error) { - console.log(error) - new Notice(`${i18nConfig.CopyErrorMessage}`); + // copy url to clipboard only if autoCopyNotionLink is enabled + if (plugin.settings.autoCopyNotionLink) { + try { + await navigator.clipboard.writeText(url); + } catch (error) { + console.log(error); + new Notice(`${i18nConfig.CopyErrorMessage}`); + } } }