From a34ce4648ae220092015cbd485dc40af4813fc55 Mon Sep 17 00:00:00 2001 From: Moy Date: Fri, 8 May 2026 14:35:25 +0800 Subject: [PATCH] refine: split paste-resolution desc into short text + info tooltip, remove re-enable suggestion --- src/i18n.ts | 11 +++++++---- src/settingTab.ts | 29 +++++++++++++++++++---------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/i18n.ts b/src/i18n.ts index 379bb59..af6960b 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -18,7 +18,7 @@ export type TranslationKey = | 'strict-heading-match' | 'strict-heading-match-desc' | 'use-frontmatter-as-display' | 'use-frontmatter-as-display-desc' | 'frontmatter-key' | 'frontmatter-key-desc' | 'link-format'| 'link-format-desc' | 'link-format-obsidian' | 'markdown-link' | 'wiki-link' | 'contextual-copy' - | 'resolve-link-path-on-paste' | 'resolve-link-path-on-paste-desc' + | 'resolve-link-path-on-paste' | 'resolve-link-path-on-paste-desc' | 'resolve-link-path-on-paste-tooltip' | 'copy-current-file-link' | 'file-link-copied' | 'target' | 'customize-targets' | 'customize-targets-desc' | 'enable-bold' | 'enable-bold-desc' @@ -109,7 +109,8 @@ export const translations: Record> = { 'markdown-link': 'Markdown link', 'wiki-link': 'Wiki link', 'resolve-link-path-on-paste': 'Resolve link path on paste', - 'resolve-link-path-on-paste-desc': 'Regenerate the link path at paste time based on the destination file. Under "Follow Obsidian settings", uses your vault\'s path style (shortest/relative/absolute); otherwise uses shortest-unique paths only. Note: plugins loaded earlier take priority for paste handling. If another plugin (e.g. Linter) intercepts paste first, this feature will be bypassed — disable and re-enable Easy Copy to adjust load order.', + 'resolve-link-path-on-paste-desc': 'Regenerate the link path at paste time based on the destination file. Under "Follow Obsidian settings", uses your vault\'s path style (shortest/relative/absolute); otherwise uses shortest-unique paths only.', + 'resolve-link-path-on-paste-tooltip': 'Plugins loaded earlier take priority for paste handling. If another plugin (e.g. Linter) intercepts paste first, this feature will be bypassed.', 'customize-targets': 'Customize targets', 'customize-targets-desc': 'Enable to customize which elements can be copied (disable to copy all elements)', 'enable-inline-code': 'Enable inline code', @@ -209,7 +210,8 @@ export const translations: Record> = { 'markdown-link': 'Markdown链接', 'wiki-link': 'Wiki链接', 'resolve-link-path-on-paste': '粘贴时解析链接路径', - 'resolve-link-path-on-paste-desc': '粘贴时根据目标文件重新生成链接路径。使用"跟随 Obsidian 设置"时,会沿用软件设置中的路径风格(最短/相对/绝对);否则,仅使用最短唯一路径。注:越早加载的插件越先处理粘贴事件。若其他插件(如 Linter)抢先处理,本功能会被跳过——可先禁用再启用 Easy Copy 来调整加载顺序。', + 'resolve-link-path-on-paste-desc': '粘贴时根据目标文件重新生成链接路径。使用"跟随 Obsidian 设置"时,会沿用软件设置中的路径风格(最短/相对/绝对);否则,仅使用最短唯一路径。', + 'resolve-link-path-on-paste-tooltip': '越早加载的插件越先处理粘贴事件。若其他插件(如 Linter)抢先处理,本功能会被跳过。', 'customize-targets': '自定义复制对象', 'customize-targets-desc': '启用后可以自定义哪些元素可以被复制(不启用则默认可复制所有元素)', 'enable-inline-code': '启用行内代码', @@ -319,7 +321,8 @@ export const translations: Record> = { 'markdown-link': 'Markdown連結', 'wiki-link': 'Wiki連結', 'resolve-link-path-on-paste': '貼上時解析連結路徑', - 'resolve-link-path-on-paste-desc': '貼上時根據目標檔案重新生成連結路徑。使用「跟隨 Obsidian 設定」時,會沿用軟體設定中的路徑風格(最短/相對/絕對);否則,僅使用最短唯一路徑。注:越早載入的外掛越先處理貼上事件。若其他外掛(如 Linter)搶先處理,本功能會被略過——可先停用再啟用 Easy Copy 來調整載入順序。', + 'resolve-link-path-on-paste-desc': '貼上時根據目標檔案重新生成連結路徑。使用「跟隨 Obsidian 設定」時,會沿用軟體設定中的路徑風格(最短/相對/絕對);否則,僅使用最短唯一路徑。', + 'resolve-link-path-on-paste-tooltip': '越早載入的外掛越先處理貼上事件。若其他外掛(如 Linter)搶先處理,本功能會被略過。', 'customize-targets': '自定義複製對象', 'customize-targets-desc': '啟用後可以自定義哪些元素可以被複製(不啟用則默认可複製所有元素)', 'enable-inline-code': '啟用行內代碼', diff --git a/src/settingTab.ts b/src/settingTab.ts index 1a9be29..26a55be 100644 --- a/src/settingTab.ts +++ b/src/settingTab.ts @@ -126,16 +126,25 @@ export class EasyCopySettingTab extends PluginSettingTab { // 解析器在粘贴时拦截事件,根据目标文件重新生成链接。 // 「跟随 Obsidian 设置」时遵循 vault 的路径风格(最短/相对/绝对); // 选择明确的 Wiki/Markdown 格式时仅使用最短唯一路径。 - formatGroup.addSetting(setting => setting - .setName(this.plugin.t('resolve-link-path-on-paste')) - .setDesc(this.plugin.t('resolve-link-path-on-paste-desc')) - .addToggle(toggle => toggle - .setValue(this.plugin.settings.resolveLinkPathOnPaste) - .onChange(async (value) => { - this.plugin.settings.resolveLinkPathOnPaste = value; - await this.plugin.saveSettings(); - this.plugin.syncPasteHandlerRegistration(); - }))); + formatGroup.addSetting(setting => { + const descFragment = document.createDocumentFragment(); + descFragment.append(this.plugin.t('resolve-link-path-on-paste-desc') + ' '); + const infoIcon = descFragment.createEl('span', { + attr: { 'aria-label': this.plugin.t('resolve-link-path-on-paste-tooltip'), class: 'clickable-icon setting-editor-extra-setting-button' }, + }); + infoIcon.innerHTML = ''; + + setting + .setName(this.plugin.t('resolve-link-path-on-paste')) + .setDesc(descFragment) + .addToggle(toggle => toggle + .setValue(this.plugin.settings.resolveLinkPathOnPaste) + .onChange(async (value) => { + this.plugin.settings.resolveLinkPathOnPaste = value; + await this.plugin.saveSettings(); + this.plugin.syncPasteHandlerRegistration(); + })); + }); formatGroup.addSetting(setting => setting .setName(this.plugin.t('use-heading-as-display'))