1 Commits
Author SHA1 Message Date
3970260761 35284395b3 feat: 主界面停靠浏览器右侧 Side Panel (v2.2.0)
- 点扩展图标直接打开/收起右侧停靠栏(sidePanel),常驻随浏览器窗口走
- manifest: default_popup 移除,新增 side_panel + sidePanel 权限
- background: setPanelBehavior(openPanelOnActionClick) + onClicked 手动开栏兜底
- 首页「窗口」按钮仅在气泡上下文 self-close,侧栏里不再误关
2026-11-10 21:27:21 +08:00
5 changed files with 42 additions and 6 deletions

No files matched your search

+8
View File
@@ -1,5 +1,13 @@
# Changelog # Changelog
## v2.2.0 (2026-10-23)
- ✨ **主界面停靠浏览器右侧(Side Panel)**:点扩展图标直接在浏览器右缘打开/收起侧栏,常驻停靠、随浏览器窗口走,可拖拽调宽
- 移除旧的气泡弹窗形态(default_popup → side_panel);保留「窗口」按钮用于桌面级右侧独立窗口
- 兼容:侧栏上下文中「窗口」按钮不再误关自己
---
## v2.1.5 (2026-10-23) ## v2.1.5 (2026-10-23)
- ✨ 「窗口」按钮打开的独立窗口**固定停靠屏幕右侧**:贴右缘、占满可用高度(排除任务栏)、宽 440 - ✨ 「窗口」按钮打开的独立窗口**固定停靠屏幕右侧**:贴右缘、占满可用高度(排除任务栏)、宽 440
+7 -4
View File
@@ -2,15 +2,17 @@
"manifest_version": 3, "manifest_version": 3,
"name": "文章同步助手", "name": "文章同步助手",
"description": "一键同步文章到知乎、头条、掘金等 20+ 平台,支持公众号多账号保持在线", "description": "一键同步文章到知乎、头条、掘金等 20+ 平台,支持公众号多账号保持在线",
"version": "2.1.5", "version": "2.2.0",
"icons": { "icons": {
"16": "assets/icon-16.png", "16": "assets/icon-16.png",
"48": "assets/icon-48.png", "48": "assets/icon-48.png",
"128": "assets/icon-128.png" "128": "assets/icon-128.png"
}, },
"action": { "action": {
"default_icon": "assets/icon-48.png", "default_icon": "assets/icon-48.png"
"default_popup": "src/popup/index.html" },
"side_panel": {
"default_path": "src/popup/index.html"
}, },
"permissions": [ "permissions": [
"storage", "storage",
@@ -22,7 +24,8 @@
"tabs", "tabs",
"alarms", "alarms",
"contextMenus", "contextMenus",
"downloads" "downloads",
"sidePanel"
], ],
"host_permissions": [ "host_permissions": [
"http://*/*", "http://*/*",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@wechatsync/extension", "name": "@wechatsync/extension",
"version": "2.1.5", "version": "2.2.0",
"private": true, "private": true,
"description": "微信公众号同步助手 Chrome 扩展", "description": "微信公众号同步助手 Chrome 扩展",
"type": "module", "type": "module",
@@ -1147,6 +1147,25 @@ function getCmsIcon(type: string): string {
} }
} }
/**
* 扩展主界面停靠浏览器右侧(sidePanel)
* - 点扩展图标直接在浏览器右缘打开/收起侧栏(常驻停靠,随浏览器窗口走)
* - setPanelBehavior 不可用时回退:图标点击手动开侧栏
*/
chrome.sidePanel
.setPanelBehavior({ openPanelOnActionClick: true })
.catch(() => {
chrome.action.onClicked.addListener(async (tab) => {
if (!tab.id) return
try {
await chrome.sidePanel.setOptions({ tabId: tab.id, enabled: true })
await chrome.sidePanel.open({ tabId: tab.id })
} catch {
/* 忽略:无侧栏权限的老环境 */
}
})
})
/** /**
* 处理右键菜单点击 * 处理右键菜单点击
*/ */
@@ -116,7 +116,13 @@ export function HomeNew() {
top: 0, top: 0,
focused: true, focused: true,
}) })
window.close() // 仅在扩展气泡上下文才关自己;侧栏(sidePanel)里 window.close 无效
try {
const ctx: any = await (chrome.runtime as any).getContext?.()
if (ctx?.contextType === 'POPUP') window.close()
} catch {
/* 忽略 */
}
} }
// Start sync with rate-limit check // Start sync with rate-limit check