feat(promptlib): 1.9.1 面板顶部加「导入词例」与「+ 新建词例」
validate / validate (push) Canceled after 0s

This commit is contained in:
qiqi committed 2026-11-24 11:16:22 +08:00
1 parent 352cac6031
commit 9ed18827a8
2 files changed
+15 -5

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@iwb-plugin/promptlib",
"private": true,
"version": "1.9.0",
"version": "1.9.1",
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
"ibwPlugin": {
"id": "promptlib",
+14 -4
View File
@@ -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 },