diff --git a/src/ui-settings-sections.js b/src/ui-settings-sections.js index 0e358b2..7fc5f5c 100644 --- a/src/ui-settings-sections.js +++ b/src/ui-settings-sections.js @@ -59,6 +59,8 @@ const label = busy === p.id ? '处理中…' : (!have ? '安装' : (need ? '更新' : '移除外部副本')) const kind = !have || need ? 'install' : 'uninstall' const reg = (pluginItems || []).find((x) => x && x.id === p.id) + // 内置已提供同版本 ⇒ 无需再装外部副本(避免「安装」一个本来就有的插件) + const builtinSame = !have && reg && reg.version === p.version return el('div', { key: p.id, className: 'iwb-plugin-row' }, el('label', { className: 'iwb-label iwb-grow' }, reg ? el('input', { @@ -70,7 +72,9 @@ p.desc ? el('div', { className: 'iwb-hint' }, p.desc) : null, ), reg ? el('button', { className: 'iwb-btn iwb-btn-sm', onClick: () => setTab('plugin:' + p.id) }, '设置') : null, - el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act(kind, p.id) }, label), + builtinSame + ? el('span', { className: 'iwb-hint' }, '内置已提供') + : el('button', { className: 'iwb-btn iwb-btn-sm', disabled: !!busy, onClick: () => act(kind, p.id) }, label), ) }), msg ? el('div', { className: 'iwb-hint' }, msg) : null,