Repository navigation
feat: 仅在侧栏打开时启用划词浮窗 - #3
Merged
Merged
Conversation
- 侧栏打开时通过长连接向 background 登记所属标签页,关闭即注销 - background 维护打开状态集合并向内容脚本推送 YIDU_PANEL_STATE - 内容脚本默认关闭划词浮窗,仅在收到打开状态后响应选中 - 顺带修正 release 测试对截图文件名的硬编码,README 验证数更新为 34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题:content.js 作为静态 content script 常驻所有页面,侧栏未打开时划线也会弹出三功能浮窗,造成打扰。
方案:
chrome.runtime.connect登记yidu-panel-open:<tabId>,关闭时端口自动断开panelOpenTabs,向对应标签页推送YIDU_PANEL_STATE;并响应YIDU_PANEL_STATE_QUERY(覆盖内容脚本晚注入的场景)panelOpen = false,未打开侧栏时不渲染浮窗并隐藏已有浮窗验证:npm test 34/34 通过,npm run check 通过;新增结构测试锁定该门控行为。