This commit is contained in:
1 parent
b89b181173
commit
59588ef4cc
2 files changed
+10
-6
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/promptlib",
|
||||
"private": true,
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
|
||||
"ibwPlugin": {
|
||||
"id": "promptlib",
|
||||
|
||||
@@ -430,7 +430,8 @@
|
||||
var coverPending = {}
|
||||
function coverOf (p) {
|
||||
if (!p || !p.cover) return ''
|
||||
var key = p.id + '|' + p.cover
|
||||
var ck = (p.cover && typeof p.cover === 'object') ? ('b:' + String(p.cover.__blob || p.cover.__cache || 'obj')) : ('s:' + String(p.cover).slice(-32))
|
||||
var key = p.id + '|' + ck
|
||||
var hit = coverCache[key]
|
||||
if (hit) return hit
|
||||
// 只缓存成功结果;失败/未解析的下一帧会再试(之前缓存空串导致封面永远不刷新)
|
||||
@@ -568,7 +569,7 @@
|
||||
|
||||
function paintCoverInto (node, p) {
|
||||
node.textContent = ''
|
||||
var url = coverOf(p)
|
||||
var url = p && p._coverUrl ? p._coverUrl : coverOf(p)
|
||||
node.style.background = url ? 'var(--iwb-plugin-inset)' : gradOf(p)
|
||||
if (url) node.appendChild(el('img', { class: 'iwb-plp-cover', src: url, alt: '' }))
|
||||
}
|
||||
@@ -638,8 +639,11 @@
|
||||
dirty = true
|
||||
Object.keys(coverCache).forEach(function (k) { if (k.indexOf(draft.id + '|') === 0) delete coverCache[k] })
|
||||
Promise.resolve(api.coverUrl(r.ref)).then(function (u) {
|
||||
if (u && u.url) coverCache[draft.id + '|' + r.ref] = u.url
|
||||
repaint(); notify('封面已更新')
|
||||
if (u && u.url) {
|
||||
draft._coverUrl = u.url
|
||||
coverCache[draft.id + '|s:' + String(r.ref).slice(-32)] = u.url
|
||||
}
|
||||
repaint(); render(); notify('封面已更新')
|
||||
})
|
||||
}).catch(function () { notify('封面上传失败', 'err') })
|
||||
}
|
||||
@@ -833,7 +837,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.2.1',
|
||||
version: '1.3.0',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
Reference in new issue
Block a user