From f0568342b11d6f6753254d0bef3c799a6b402098 Mon Sep 17 00:00:00 2001 From: qiqi Date: Tue, 24 Nov 2026 14:25:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(promptlib):=20v1.10.1=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=B0=81=E9=9D=A2=E5=BC=80=E5=85=B3=20+=20?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=BA=95=E9=83=A8=E5=88=86=E4=BA=AB/?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E7=BB=84=E9=97=B4=E7=AB=96=E5=90=91=E5=88=86?= =?UTF-8?q?=E5=89=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- promptlib/package.json | 2 +- promptlib/src/index.js | 26 +++++++------------------- promptlib/styles.css | 5 +++++ promptlib/tools/harness.mjs | 20 ++++++++++++-------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/promptlib/package.json b/promptlib/package.json index b40b1b2..123468e 100644 --- a/promptlib/package.json +++ b/promptlib/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/promptlib", "private": true, - "version": "1.10.0", + "version": "1.10.1", "description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供", "ibwPlugin": { "id": "promptlib", diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 4a8034b..2d1f716 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -162,20 +162,8 @@ if (!item || typeof item.text !== 'string' || !item.text.trim()) return null return item } - // 分享是否附带封面图:后台设置页开关,默认带图(兼容老行为);关掉后分享文本只有文字,短很多。 - // 从 ctx.settings 读,manifest 里声明了 default:true —— 老客户端/未设置时也按“带图”走。 - function shareWithCover () { - var S = (PLP_CTX || {}).settings - return !S || typeof S.get !== 'function' || S.get('shareWithCover') !== false - } - function plpSharePayload (p) { - var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: detectVars(p.text || ''), group: p.group || '', tags: p.tags || [] } } - if (!shareWithCover()) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body)) - return plpCoverUrl(p).then(function (cv) { - if (cv && cv.length < 300000) body.sharing.cover = cv - return SHARE_TAG + '\n' + JSON.stringify(body) - }) - } + // v1.10.1:分享封面开关已移除——文本分享恒纯文字、文件分享恒带封面,不再有全局开关。 + // (旧的 shareWithCover() / plpSharePayload() 已删除;plpCoverUrl 仍供备份导出使用。) function renderPluginSettings () { var root = el('div', { class: 'iwb-plp-settings' }) @@ -1277,10 +1265,10 @@ // 分享格式刻意做成「可读的 JSON 文本」,直接粘到微信/QQ 也能看懂;导入时两种都认: // ① 带 IWB-PROMPT 头的整段文本 ② 直接是 {kind:'prompt-share'} 的 JSON // v1.10.0:withCover 显式传入——文本分享恒传 false(纯文字、短),文件分享传 true(封面放文件里不怕大)。 - // 不传时仍读后台 shareWithCover 开关(兼容旧调用/旧设置)。 + // v1.10.1:开关已删,只认显式布尔;未传一律按纯文字,不再回退读设置。 function sharePayload (p, withCover) { var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } } - var wantCover = (typeof withCover === 'boolean') ? withCover : shareWithCover() + var wantCover = withCover === true if (!wantCover) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body)) return coverToDataUrl(p).then(function (cv) { if (cv && cv.length < 300000) body.sharing.cover = cv @@ -1530,7 +1518,8 @@ } footEl.appendChild(del); footEl.appendChild(el('span', { class: 'iwb-drawer-spacer' })) footEl.appendChild(shareText); footEl.appendChild(shareFile) - footEl.appendChild(el('span', { style: 'display:inline-block;width:26px;flex:none' })) + // v1.10.1:分享组与插入组之间加竖向分割线(替代原来的 26px 空白)。 + footEl.appendChild(el('span', { class: 'iwb-plp-foot-vsep' })) footEl.appendChild(cp); if (insTpl) footEl.appendChild(insTpl) if (insImg) footEl.appendChild(insImg) footEl.appendChild(ins) @@ -1889,12 +1878,11 @@ global.IWBPluginHost.register({ id: 'promptlib', name: '提示词库', - version: '1.10.0', + version: '1.10.1', apiVersion: 1, capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'], data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 }, settings: { - shareWithCover: { type: 'boolean', label: '分享时附带封面图片(关闭后分享内容更短)', default: true }, panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings }, }, }, function (ctx) { diff --git a/promptlib/styles.css b/promptlib/styles.css index 4fea94d..017f51c 100644 --- a/promptlib/styles.css +++ b/promptlib/styles.css @@ -348,6 +348,11 @@ height: 1px; margin: 4px 6px; background: var(--iwb-border); flex: 0 0 auto; .iwb-promptlib .iwb-drawer-spacer { flex: 1 1 auto; } +/* v1.10.1:详情底部分享组(文本/文件分享)与插入组之间的竖向分割线 */ +.iwb-plp-dialog .iwb-plp-foot-vsep { +display: inline-block; width: 1px; height: 18px; flex: 0 0 auto; +align-self: center; margin: 0 13px; background: var(--iwb-border); +} .iwb-plp-dialog .iwb-section-sub { margin-top: 2px; } diff --git a/promptlib/tools/harness.mjs b/promptlib/tools/harness.mjs index ba9d65f..c6db906 100644 --- a/promptlib/tools/harness.mjs +++ b/promptlib/tools/harness.mjs @@ -2,6 +2,7 @@ // - v1.9.2:分享带封面开关 // - v1.9.3:编辑区变量浅主色底色(方案 C,只画色块不改输入) // - v1.10.0:文本分享 / 文件分享双路径 + 顶部三按钮 + 右键去分类 + 设置去导入入口 +// - v1.10.1:移除「分享时附带封面图片」开关 + 详情底部分享/插入组间竖向分割线 // 运行:node promptlib/tools/harness.mjs (退出码 0 = 全过) import fs from 'node:fs' import path from 'node:path' @@ -19,11 +20,13 @@ const ok = (name, cond) => { } // ---- 1) 版本 / manifest ---- -ok("manifest.version = 1.10.0", /version:\s*'1\.10\.0'/.test(src)) -ok('package.json version = 1.10.0', - JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version === '1.10.0') -ok('shareWithCover() 仍保留(兼容旧设置)', - /function shareWithCover \(\)[\s\S]{0,200}S\.get\('shareWithCover'\) !== false/.test(src)) +ok("manifest.version = 1.10.1", /version:\s*'1\.10\.1'/.test(src)) +ok('package.json version = 1.10.1', + JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).version === '1.10.1') +ok('manifest 已移除「分享时附带封面图片」开关声明', + !/shareWithCover:\s*\{\s*type:\s*'boolean'/.test(src)) +ok('源码不再定义/读取 shareWithCover 设置', + !/function shareWithCover \(\)/.test(src) && !/S\.get\('shareWithCover'\)/.test(src)) // ---- 2) sharePayload 两条显式分支 ---- const m = src.match(/ function sharePayload \(p, withCover\) \{[\s\S]*?\n \}\n function shareFileName/) @@ -33,7 +36,6 @@ const sandbox = { SHARE_TAG: 'IWB-PROMPT-SHARE', varsOf: () => [], coverToDataUrl: () => { throw new Error('不该读封面') }, - shareWithCover: () => true, Promise, JSON, String, Number, Array, Object, } vm.createContext(sandbox) @@ -71,8 +73,10 @@ ok('右键菜单含 文本分享 / 文件分享(iwb-ctx-item 项)', /iwb-ctx-item', text: '文本分享'[\s\S]{0,260}iwb-ctx-item', text: '文件分享'/.test(src)) ok('详情底部含 文本分享 / 文件分享 两按钮', /text: '文本分享'/.test(src) && /text: '文件分享'/.test(src)) -ok('详情底部分享组与插入组之间有间隔', - /width:26px;flex:none/.test(src)) +ok('详情底部分享组与插入组之间是竖向分割线(DOM 顺序:文件分享 → 竖线 → 复制全文)', + /footEl\.appendChild\(shareFile\)[\s\S]{0,240}iwb-plp-foot-vsep[\s\S]{0,160}footEl\.appendChild\(cp\)/.test(src)) +ok('竖线样式:1px 宽 / 18px 高 / 边框色 / 居中', + /\.iwb-plp-foot-vsep\s*\{[^}]*width:\s*1px[^}]*height:\s*18px[^}]*align-self:\s*center[^}]*background:\s*var\(--iwb-border\)/.test(css)) ok('设置面板不再有单条导入入口(impShareBtn 已移除)', !/impShareBtn/.test(src)) ok('旧的「分享…」按钮(带图完整版)已删除',