2 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
3970260761 38f5c400d6 feat: 独立窗口固定停靠屏幕右侧 (v2.1.5)
- 窗口按钮打开的 popup 窗口贴屏幕右缘、占满可用高度、宽 440
- top=0 起始,排除任务栏高度(availHeight)
2026-11-10 21:09:09 +08:00
5 changed files with 60 additions and 11 deletions

No files matched your search

+14
View File
@@ -1,5 +1,19 @@
# Changelog # Changelog
## v2.2.0 (2026-10-23)
- ✨ **主界面停靠浏览器右侧(Side Panel)**:点扩展图标直接在浏览器右缘打开/收起侧栏,常驻停靠、随浏览器窗口走,可拖拽调宽
- 移除旧的气泡弹窗形态(default_popup → side_panel);保留「窗口」按钮用于桌面级右侧独立窗口
- 兼容:侧栏上下文中「窗口」按钮不再误关自己
---
## v2.1.5 (2026-10-23)
- ✨ 「窗口」按钮打开的独立窗口**固定停靠屏幕右侧**:贴右缘、占满可用高度(排除任务栏)、宽 440
---
## v2.1.4 (2026-10-23) ## v2.1.4 (2026-10-23)
- ✨ 设置内容全部**移出抽屉、内联到首页**(同步桥接状态/Token/地址、悬浮按钮、自建站点、历史入口直接可见) - ✨ 设置内容全部**移出抽屉、内联到首页**(同步桥接状态/Token/地址、悬浮按钮、自建站点、历史入口直接可见)
+8 -5
View File
@@ -2,15 +2,17 @@
"manifest_version": 3, "manifest_version": 3,
"name": "文章同步助手", "name": "文章同步助手",
"description": "一键同步文章到知乎、头条、掘金等 20+ 平台,支持公众号多账号保持在线", "description": "一键同步文章到知乎、头条、掘金等 20+ 平台,支持公众号多账号保持在线",
"version": "2.1.4", "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://*/*",
@@ -96,4 +99,4 @@
] ]
} }
] ]
} }
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@wechatsync/extension", "name": "@wechatsync/extension",
"version": "2.1.4", "version": "2.2.0",
"private": true, "private": true,
"description": "微信公众号同步助手 Chrome 扩展", "description": "微信公众号同步助手 Chrome 扩展",
"type": "module", "type": "module",
@@ -40,4 +40,4 @@
"vite": "^5.0.10", "vite": "^5.0.10",
"vitest": "^2.0.0" "vitest": "^2.0.0"
} }
} }
@@ -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 {
/* 忽略:无侧栏权限的老环境 */
}
})
})
/** /**
* 处理右键菜单点击 * 处理右键菜单点击
*/ */
+17 -4
View File
@@ -102,14 +102,27 @@ export function HomeNew() {
} }
// 在独立窗口打开扩展(popup 点外部会自动关闭,独立窗口可常驻保持打开) // 在独立窗口打开扩展(popup 点外部会自动关闭,独立窗口可常驻保持打开)
// 固定停靠屏幕右侧:贴右缘、占满可用高度(排除任务栏),宽度 440 便于阅读
const handleOpenInWindow = async () => { const handleOpenInWindow = async () => {
const width = 440
const height = screen.availHeight
const left = Math.max(0, screen.availWidth - width)
await chrome.windows.create({ await chrome.windows.create({
url: chrome.runtime.getURL('src/popup/index.html'), url: chrome.runtime.getURL('src/popup/index.html'),
type: 'popup', type: 'popup',
width: 420, width,
height: 720, height,
left,
top: 0,
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
@@ -165,7 +178,7 @@ export function HomeNew() {
<button <button
onClick={handleOpenInWindow} onClick={handleOpenInWindow}
className="flex flex-col items-center gap-0.5 px-2 py-1 rounded-lg hover:bg-muted transition-colors" className="flex flex-col items-center gap-0.5 px-2 py-1 rounded-lg hover:bg-muted transition-colors"
title="在独立窗口打开(常驻保持,不随点击关闭)" title="在右侧独立窗口打开(贴屏幕右缘常驻,不随点击关闭)"
> >
<Maximize2 className="w-3.5 h-3.5" /> <Maximize2 className="w-3.5 h-3.5" />
<span className="text-[10px] text-muted-foreground leading-none">窗口</span> <span className="text-[10px] text-muted-foreground leading-none">窗口</span>