From 70b50dc654800e546a47bdc143ad8e5474ee9515 Mon Sep 17 00:00:00 2001 From: qiqi Date: Fri, 20 Nov 2026 12:13:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(gallery):=20=E5=88=A0=E9=99=A4=E5=90=8E?= =?UTF-8?q?=E5=85=88=E6=9C=AC=E5=9C=B0=E6=91=98=E9=99=A4=E5=86=8D=E9=87=8D?= =?UTF-8?q?=E6=8B=89=EF=BC=8C=E9=81=BF=E5=85=8D=E6=AE=8B=E7=95=99=E3=80=8C?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=B7=B2=E4=B8=A2=E5=A4=B1=E3=80=8D=E6=A0=BC?= =?UTF-8?q?=E5=AD=90=20v1.2.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gallery/package.json | 2 +- gallery/src/index.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gallery/package.json b/gallery/package.json index a1735b1..99fd0d9 100644 --- a/gallery/package.json +++ b/gallery/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/gallery", "private": true, - "version": "1.2.0", + "version": "1.2.1", "description": "图库:右栏图片墙(筛选/多选/预览/插入画布/下载/删除),数据由宿主 gallery 能力提供", "ibwPlugin": { "id": "gallery", diff --git a/gallery/src/index.js b/gallery/src/index.js index 2fd50ff..371c7e1 100644 --- a/gallery/src/index.js +++ b/gallery/src/index.js @@ -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 },