From 675ccf50168f31860e5136dcc4457d2f62b1f95c Mon Sep 17 00:00:00 2001 From: qiqi Date: Sun, 22 Nov 2026 20:17:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(promptlib):=201.6.9=20=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E8=99=9A=E6=8B=9F=E5=8D=A1=E7=89=87=E9=A2=84=E8=A7=88=EF=BC=88?= =?UTF-8?q?=E5=B0=81=E9=9D=A2+=E5=90=8D=E7=A7=B0+=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- promptlib/package.json | 2 +- promptlib/src/index.js | 20 +++++++++++++++++++- promptlib/styles.css | 7 +++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/promptlib/package.json b/promptlib/package.json index 728ced0..e518059 100644 --- a/promptlib/package.json +++ b/promptlib/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/promptlib", "private": true, - "version": "1.6.8", + "version": "1.6.9", "description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供", "ibwPlugin": { "id": "promptlib", diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 442dce0..0462d47 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -721,6 +721,21 @@ for (var i = 0; i < str.length; i++) h = (h * 31 + str.charCodeAt(i)) % 360 return 'linear-gradient(135deg, hsl(' + h + ' 52% 66%), hsl(' + ((h + 36) % 360) + ' 52% 44%))' } + // v1.6.9:拖拽时跟手的「虚拟卡片」——让用户明确看到拖拽已开始、会插入什么 + function makeDragGhost (p) { + var g = el('div', { class: 'iwb-plp-dragghost' }) + var url = coverOf(p) + if (url) g.appendChild(el('img', { class: 'iwb-plp-ghostcov', src: url, alt: '', draggable: 'false' })) + var box = el('div', { class: 'iwb-plp-ghosttxt' }) + box.appendChild(el('div', { class: 'iwb-plp-ghostname', text: p.name || '未命名' })) + var vd = varsOf(p) + box.appendChild(el('div', { class: 'iwb-plp-ghosthint', text: vd.length ? ('模板节点 · ' + vd.length + ' 个变量') : '文本节点' })) + g.appendChild(box) + g.style.position = 'fixed'; g.style.left = '-9999px'; g.style.top = '0' + document.body.appendChild(g) + return g + } + function openDetail (id) { view.mode = 'detail'; view.id = String(id || ''); render(); try { scrollBox.scrollTop = 0 } catch (e) { /* ignore */ } } function backToList () { view.mode = 'list'; view.id = ''; render() } @@ -1462,6 +1477,9 @@ }) card.addEventListener('dragstart', function (e) { card.classList.add('is-dragging') + var ghost = null + try { ghost = makeDragGhost(p); if (e.dataTransfer && e.dataTransfer.setDragImage) e.dataTransfer.setDragImage(ghost, 26, 26) } catch (err) { /* ignore */ } + setTimeout(function () { if (ghost && ghost.parentNode) ghost.parentNode.removeChild(ghost) }, 0) try { e.stopPropagation() var vd = varsOf(p) @@ -1515,7 +1533,7 @@ global.IWBPluginHost.register({ id: 'promptlib', name: '提示词库', - version: '1.6.8', + version: '1.6.9', apiVersion: 1, capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvasWrite'], data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 }, diff --git a/promptlib/styles.css b/promptlib/styles.css index bde037a..59d221c 100644 --- a/promptlib/styles.css +++ b/promptlib/styles.css @@ -362,3 +362,10 @@ box-shadow: 0 24px 60px rgba(0,0,0,.32); .iwb-plp-card:hover{transform:scale(1.03);box-shadow:0 8px 22px rgba(0,0,0,.14);z-index:2} .iwb-plp-card.is-pressed{border-color:var(--iwb-plp-accent,#7c4dff);box-shadow:0 0 0 2px color-mix(in srgb,var(--iwb-plp-accent,#7c4dff) 22%,transparent)} .iwb-plp-card.is-dragging{opacity:.55;transform:scale(.98)} + +/* v1.6.9:拖拽虚拟卡片(跟手预览) */ +.iwb-plp-dragghost{width:168px;display:flex;align-items:center;gap:8px;padding:8px 10px;background:var(--iwb-panel,#fff);border:2px solid var(--iwb-plp-accent,#7c4dff);border-radius:11px;box-shadow:0 12px 28px rgba(0,0,0,.22);font-size:12px;pointer-events:none;z-index:99999} +.iwb-plp-ghostcov{width:38px;height:38px;border-radius:8px;object-fit:cover;flex:0 0 auto;background:var(--iwb-plugin-inset,#eef0f2)} +.iwb-plp-ghosttxt{min-width:0;display:flex;flex-direction:column;gap:2px} +.iwb-plp-ghostname{font-weight:600;color:var(--iwb-text,#1c2333);overflow:hidden;text-overflow:ellipsis;white-space:nowrap} +.iwb-plp-ghosthint{font-size:10.5px;color:var(--iwb-plp-accent,#5a4bd0)}