diff --git a/plugins/index.json b/plugins/index.json index dee77db..6fcb515 100644 --- a/plugins/index.json +++ b/plugins/index.json @@ -44,9 +44,9 @@ "dir": "promptlib", "main": "main.js", "style": "styles.css", - "version": "1.9.0", + "version": "1.9.1", "files": { - "main.js": "317d52224dcec5850e2f8dd1d1193346f059595106211565bbe02f3ef7e74199", + "main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b", "styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa" } }, diff --git a/plugins/promptlib/main.js b/plugins/promptlib/main.js index d06dcf7..11e8302 100644 --- a/plugins/promptlib/main.js +++ b/plugins/promptlib/main.js @@ -1538,7 +1538,7 @@ var dirty = false openDialog({ key: 'edit', - title: isNew ? '新建提示词' : '编辑提示词', + title: isNew ? '新建词例' : '编辑词例', width: 880, height: 640, actions: [cancelBtn, saveBtn], onSaveKey: function () { doSave() }, @@ -1742,10 +1742,20 @@ var top = el('div', { class: 'iwb-row' }) var search = el('input', { class: 'iwb-input iwb-grow', placeholder: '搜索名称 / 内容 / 标签…', value: query }) search.addEventListener('input', function () { query = search.value; render(); var n = wrap.querySelector('input.iwb-input'); if (n) { n.focus(); try { n.setSelectionRange(n.value.length, n.value.length) } catch (e) { /* ignore */ } } }) - var newBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', title: '新建提示词', text: '+ 新建提示词' }) + // 2026-11-24:导入/新建都放搜索行,避免「导入分享」藏在设置里(用户反馈多绕一层)。 + var importBtn = el('button', { class: 'iwb-btn iwb-btn-sm', title: '从剪贴板导入别人分享的词例', text: '导入词例' }) + var newBtn = el('button', { class: 'iwb-btn iwb-btn-sm iwb-btn-primary', title: '新建词例', text: '+ 新建词例' }) + importBtn.addEventListener('click', function () { + importBtn.disabled = true + doImportShare().then(function (r) { + importBtn.disabled = false + if (r && r.ok === false && r.error === 'no-share') notify('剪贴板里没有可识别的词例分享', 'err') + else if (r && r.ok === false) notify('导入失败', 'err') + }).catch(function (e) { importBtn.disabled = false; notify('导入失败:' + ((e && e.message) || e), 'err') }) + }) newBtn.addEventListener('click', function () { openEditModal(null, true) }) - top.appendChild(search); top.appendChild(newBtn) + top.appendChild(search); top.appendChild(importBtn); top.appendChild(newBtn) fixed.appendChild(top) if (words().length) { @@ -1860,7 +1870,7 @@ global.IWBPluginHost.register({ id: 'promptlib', name: '提示词库', - version: '1.9.0', + version: '1.9.1', apiVersion: 1, capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'], data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 }, diff --git a/plugins/promptlib/manifest.json b/plugins/promptlib/manifest.json index 8c95451..0ea8e71 100644 --- a/plugins/promptlib/manifest.json +++ b/plugins/promptlib/manifest.json @@ -1,7 +1,7 @@ { "id": "promptlib", "name": "提示词库", - "version": "1.9.0", + "version": "1.9.1", "apiVersion": 1, "main": "main.js", "style": "styles.css", @@ -13,7 +13,7 @@ "提示词" ], "files": { - "main.js": "317d52224dcec5850e2f8dd1d1193346f059595106211565bbe02f3ef7e74199", + "main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b", "styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa" } }