fix(gallery): 删除后不残留「图片已丢失」格子(deleteOutputs 返回 Promise + 插件本地先摘除)v3.25.55
- deleteOutputs 返回 Promise(删除+refreshOutputs 完成才 resolve) - capability.remove 等删除完成再返回 - gallery 1.2.1:先本地摘除重排,250ms 后重拉校正 - 回归测试增加删除场景
This commit is contained in:
1 parent
5c378c3d73
commit
d5449e8b71
10 files changed
+54
-15
No files matched your search
+13
-2
@@ -95,7 +95,18 @@
|
||||
actions.appendChild(btn('删除', '删除选中的图片(不可恢复)', function () {
|
||||
var C = global.IWBUIConfirm
|
||||
var ask = C && C.askOrNative ? C.askOrNative('删除选中的 ' + n + ' 张图片?不可恢复。', { title: '删除图片', okText: '删除' }) : Promise.resolve(global.confirm('删除选中的 ' + n + ' 张图片?'))
|
||||
ask.then(function (ok) { if (!ok) return; return ctx.gallery.remove(pickedNames()) }).then(function () { picked = {}; load() }).catch(function () {})
|
||||
var names = pickedNames()
|
||||
ask.then(function (ok) {
|
||||
if (!ok) return
|
||||
// 先本地摘掉,避免删除后还渲染一格「图片已丢失」;随后再向宿主重拉(等它删完+刷新)
|
||||
items = items.filter(function (x) { return names.indexOf(x.name) < 0 })
|
||||
total = Math.max(0, total - names.length)
|
||||
picked = {}
|
||||
render()
|
||||
return Promise.resolve(ctx.gallery.remove(names)).then(function () {
|
||||
setTimeout(load, 250)
|
||||
})
|
||||
}).catch(function () {})
|
||||
}, true, true))
|
||||
|
||||
function field (key, options, label) {
|
||||
@@ -260,7 +271,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'gallery',
|
||||
name: '图库',
|
||||
version: '1.2.0',
|
||||
version: '1.2.1',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'gallery'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
Reference in new issue
Block a user