diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 6231b9f..efb65b5 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -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'