feat(promptlib): 1.6.9 拖拽虚拟卡片预览(封面+名称+节点类型)

This commit is contained in:
qiqi committed 2026-11-22 20:17:59 +08:00
1 parent f65f037cff
commit 675ccf5016
3 files changed
+27 -2

No files matched your search

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