chore(plugin): 同步 gallery 1.6.1(移除搜索框)

This commit is contained in:
qiqi committed 2026-11-20 14:56:47 +08:00
1 parent f8ecb2cfba
commit 440c4d6590
5 files changed
+11 -36

No files matched your search

+2 -11
View File
@@ -83,18 +83,9 @@
var picked = {}
var gridW = 320
var raf = 0
var query = '' // v1.6.0:搜索(名称/标签),不持久化,重开面板即清空
var failed = {} // v1.6.0:缩略图仍失败的 name 集合(据此显示「N 张失败」+ 全部重试)
var head = el('div', { class: 'iwb-gal-head' })
var searchIn = el('input', { class: 'iwb-input iwb-gal-search', placeholder: '搜索图片名…', value: '' })
var searchTimer = 0
searchIn.addEventListener('input', function () {
query = searchIn.value
clearTimeout(searchTimer)
searchTimer = setTimeout(function () { limit = 100; load() }, 220)
})
head.appendChild(searchIn)
var actions = el('div', { class: 'iwb-gal-actions' })
head.appendChild(actions)
@@ -429,7 +420,7 @@
function load (force) {
if (force) setStatus('刷新中…')
return Promise.resolve(ctx.gallery.list({ query: query, range: cfg.range, limit: limit })).then(function (r) {
return Promise.resolve(ctx.gallery.list({ range: cfg.range, limit: limit })).then(function (r) {
items = (r && r.items) || []
total = (r && r.total) || items.length
lastLoadAt = Date.now()
@@ -492,7 +483,7 @@
global.IWBPluginHost.register({
id: 'gallery',
name: '图库',
version: '1.6.0',
version: '1.6.1',
apiVersion: 1,
capabilities: ['panels', 'gallery'],
data: { schemaVersion: 1, maxBytes: 65536 },
+3 -3
View File
@@ -1,7 +1,7 @@
{
"id": "gallery",
"name": "图库",
"version": "1.6.0",
"version": "1.6.1",
"apiVersion": 1,
"main": "main.js",
"style": "styles.css",
@@ -13,7 +13,7 @@
"图库"
],
"files": {
"main.js": "f8bb08df4ab051ebc21e4b8107c9980078396ab5bd5f7feda9a530f298c02c59",
"styles.css": "3d715b72321497afe23d9f34b2f6461e0b854012bb632b8f62ccd6da642e07c8"
"main.js": "6d16259327ea048cda59bf7db480acd112efaa2ee60ede5ea3462f7c7b76d1fd",
"styles.css": "5d1a2a72e9dd7468284ab0143e15b0b340b0f29061c93e108037e3fa812a39e5"
}
}
+1 -2
View File
@@ -67,9 +67,8 @@
.iwb-history-more { display: flex; justify-content: center; padding: 4px 0 2px; }
/* 只作用于图库自己的空态提示:不加前缀会泄漏到设置页等使用 .iwb-hint 的地方(文字被居中) */
.iwb-history-embedded .iwb-hint { font-size: 11px; color: var(--iwb-text2); text-align: center; padding: 12px 6px; }
/* ---- v1.6.0:搜索框 / 失败统计 / 右键菜单标题 ---- */
/* ---- v1.6.0:失败统计 / 右键菜单标题(v1.6.1 去掉搜索框)---- */
.iwb-gal-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.iwb-gal-search { flex: 1 1 90px; min-width: 60px; height: 24px; font-size: 12px; }
.iwb-gal-fail {
font-size: 11px; color: var(--iwb-err); cursor: pointer; white-space: nowrap;
text-decoration: underline dotted; text-underline-offset: 2px;
+3 -3
View File
@@ -22,10 +22,10 @@
"dir": "gallery",
"main": "main.js",
"style": "styles.css",
"version": "1.6.0",
"version": "1.6.1",
"files": {
"main.js": "f8bb08df4ab051ebc21e4b8107c9980078396ab5bd5f7feda9a530f298c02c59",
"styles.css": "3d715b72321497afe23d9f34b2f6461e0b854012bb632b8f62ccd6da642e07c8"
"main.js": "6d16259327ea048cda59bf7db480acd112efaa2ee60ede5ea3462f7c7b76d1fd",
"styles.css": "5d1a2a72e9dd7468284ab0143e15b0b340b0f29061c93e108037e3fa812a39e5"
}
},
{
+2 -17
View File
@@ -52,22 +52,7 @@ async function boot (opts) {
}
;(async () => {
// ---------- ① 搜索:输入 → 带 query 重新拉列表 ----------
{
const env = await boot({
items: [{ name: 'a.png', w: 200, h: 300 }, { name: 'b.png', w: 200, h: 120 }],
thumb: () => GOOD,
})
assert.strictEqual(env.calls.list.length, 1, '初次应拉一次')
assert.strictEqual(env.calls.list[0].query, '', '初次 query 应为空')
const search = env.host.querySelector('.iwb-gal-search')
assert.ok(search, '应有搜索框')
search.value = 'a.'
search.dispatchEvent(new env.window.Event('input', { bubbles: true }))
await wait(320) // 防抖 220ms
assert.strictEqual(env.calls.list.length, 2, '输入后应重新拉列表,实际 ' + env.calls.list.length)
assert.strictEqual(env.calls.list[1].query, 'a.', '应把搜索词传给宿主')
}
// v1.6.1:搜索框已移除(用户反馈没意义)——只守失败统计/右键菜单/多选拖拽
// ---------- ② 失败统计 + 全部重试 ----------
{
@@ -150,5 +135,5 @@ async function boot (opts) {
assert.strictEqual(env.calls.insert[0][0].length, 2, '批量插入应含 2 张,实际 ' + env.calls.insert[0][0].length)
}
console.log('gallery ux checks passed(搜索 query / 失败统计+全部重试 / 右键菜单 5 项 / 多选拖拽批量插入)')
console.log('gallery ux checks passed(失败统计+全部重试 / 右键菜单 5 项 / 多选拖拽批量插入)')
})().catch((e) => { console.error(e); process.exit(1) })