feat(promptlib): 1.5.7 拖拽按变量分流(有变量→模板节点)+ 去掉紫色角标

This commit is contained in:
qiqi committed 2026-11-22 17:05:05 +08:00
1 parent 2fb6372252
commit 8b72967381
1 file changed
+7 -3
+7 -3
View File
@@ -931,13 +931,17 @@
var card = el('div', { class: 'iwb-plp-card' + (p.cover ? ' has-cover' : ' no-cover'), draggable: 'true', title: '单击查看详情 · 拖到画布插入 · 右键移动到分组' })
card.style.background = coverUrl ? 'var(--iwb-plugin-inset)' : gradOf(p)
if (coverUrl) card.appendChild(el('img', { class: 'iwb-plp-cover', src: coverUrl, alt: '', draggable: 'false' }))
// 紫色小点:表示这条是带变量的模板(不喧宾夺主,鼠标悬停看数量)
if (varsOf(p).length) card.appendChild(el('i', { class: 'iwb-plp-vdot', title: varsOf(p).length + ' 个变量' }))
card.appendChild(el('div', { class: 'iwb-plp-t', text: p.name || '未命名' }))
card.addEventListener('dragstart', function (e) {
try {
e.stopPropagation()
e.dataTransfer.setData('application/x-iwb-prompt', JSON.stringify({ text: p.text || '', name: p.name || '' }))
var vd = varsOf(p)
e.dataTransfer.setData('application/x-iwb-prompt', JSON.stringify({
text: p.text || '', name: p.name || '',
vars: vd.map(function (v) { return v.key }),
vdefs: vd,
cover: p.cover || '',
}))
e.dataTransfer.setData('application/x-iwb-promptid', p.id)
e.dataTransfer.setData('text/plain', (p.text || '').slice(0, 200))
e.dataTransfer.effectAllowed = 'copy'