refine: split paste-resolution desc into short text + info tooltip, remove re-enable suggestion

This commit is contained in:
Moy 2026-05-08 14:35:25 +08:00
parent 8e1b6058bd
commit a34ce4648a
2 changed files with 26 additions and 14 deletions

View file

@ -18,7 +18,7 @@ export type TranslationKey =
| 'strict-heading-match' | 'strict-heading-match-desc' | 'strict-heading-match' | 'strict-heading-match-desc'
| 'use-frontmatter-as-display' | 'use-frontmatter-as-display-desc' | 'frontmatter-key' | 'frontmatter-key-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' | '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' | 'copy-current-file-link' | 'file-link-copied'
| 'target' | 'customize-targets' | 'customize-targets-desc' | 'target' | 'customize-targets' | 'customize-targets-desc'
| 'enable-bold' | 'enable-bold-desc' | 'enable-bold' | 'enable-bold-desc'
@ -109,7 +109,8 @@ export const translations: Record<Language, Record<TranslationKey, string>> = {
'markdown-link': 'Markdown link', 'markdown-link': 'Markdown link',
'wiki-link': 'Wiki link', 'wiki-link': 'Wiki link',
'resolve-link-path-on-paste': 'Resolve link path on paste', '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': 'Customize targets',
'customize-targets-desc': 'Enable to customize which elements can be copied (disable to copy all elements)', 'customize-targets-desc': 'Enable to customize which elements can be copied (disable to copy all elements)',
'enable-inline-code': 'Enable inline code', 'enable-inline-code': 'Enable inline code',
@ -209,7 +210,8 @@ export const translations: Record<Language, Record<TranslationKey, string>> = {
'markdown-link': 'Markdown链接', 'markdown-link': 'Markdown链接',
'wiki-link': 'Wiki链接', 'wiki-link': 'Wiki链接',
'resolve-link-path-on-paste': '粘贴时解析链接路径', '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': '自定义复制对象',
'customize-targets-desc': '启用后可以自定义哪些元素可以被复制(不启用则默认可复制所有元素)', 'customize-targets-desc': '启用后可以自定义哪些元素可以被复制(不启用则默认可复制所有元素)',
'enable-inline-code': '启用行内代码', 'enable-inline-code': '启用行内代码',
@ -319,7 +321,8 @@ export const translations: Record<Language, Record<TranslationKey, string>> = {
'markdown-link': 'Markdown連結', 'markdown-link': 'Markdown連結',
'wiki-link': 'Wiki連結', 'wiki-link': 'Wiki連結',
'resolve-link-path-on-paste': '貼上時解析連結路徑', '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': '自定義複製對象',
'customize-targets-desc': '啟用後可以自定義哪些元素可以被複製(不啟用則默认可複製所有元素)', 'customize-targets-desc': '啟用後可以自定義哪些元素可以被複製(不啟用則默认可複製所有元素)',
'enable-inline-code': '啟用行內代碼', 'enable-inline-code': '啟用行內代碼',

View file

@ -126,16 +126,25 @@ export class EasyCopySettingTab extends PluginSettingTab {
// 解析器在粘贴时拦截事件,根据目标文件重新生成链接。 // 解析器在粘贴时拦截事件,根据目标文件重新生成链接。
// 「跟随 Obsidian 设置」时遵循 vault 的路径风格(最短/相对/绝对); // 「跟随 Obsidian 设置」时遵循 vault 的路径风格(最短/相对/绝对);
// 选择明确的 Wiki/Markdown 格式时仅使用最短唯一路径。 // 选择明确的 Wiki/Markdown 格式时仅使用最短唯一路径。
formatGroup.addSetting(setting => setting formatGroup.addSetting(setting => {
.setName(this.plugin.t('resolve-link-path-on-paste')) const descFragment = document.createDocumentFragment();
.setDesc(this.plugin.t('resolve-link-path-on-paste-desc')) descFragment.append(this.plugin.t('resolve-link-path-on-paste-desc') + ' ');
.addToggle(toggle => toggle const infoIcon = descFragment.createEl('span', {
.setValue(this.plugin.settings.resolveLinkPathOnPaste) attr: { 'aria-label': this.plugin.t('resolve-link-path-on-paste-tooltip'), class: 'clickable-icon setting-editor-extra-setting-button' },
.onChange(async (value) => { });
this.plugin.settings.resolveLinkPathOnPaste = value; infoIcon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';
await this.plugin.saveSettings();
this.plugin.syncPasteHandlerRegistration(); 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 formatGroup.addSetting(setting => setting
.setName(this.plugin.t('use-heading-as-display')) .setName(this.plugin.t('use-heading-as-display'))