Repository navigation
fix(ai-chat-turbo-engine): keep the peek on row menus, show the built version, and pass a soft break - #279
Merged
Conversation
The peek only knew the rail subtree and the popover selector. History row menus are portaled next to the panel with no role annotation, so walking onto one counted as leaving and the hide delay collapsed the panel mid gesture; the submenu that hangs off that menu lost it one level deeper. The peek now adopts the out-of-flow wrapper the pointer reaches straight from the panel, within a bounded 500ms hand-off measured from the last contact with the rail or an adopted layer, so a flyout the user walks into long afterwards still belongs to the page. Viewport-sized fixed shells are rejected so page content never pins the peek, and an adopted layer is dropped as soon as the site tears it down.
The panel subtitle read the version from GM_info through the userscript globals helper. This script runs with @grant none, so no manager API exists on the page and the 0.0.0 fallback rendered on every platform while the header declared 0.23.17. The build now passes the metadata version through esbuild define, the same source the header is rendered from, and lifecycle reads that constant. A build test pins the artifact to meta.ts and to the absence of both 0.0.0 and a leftover GM_info read; a HUD test pins the subtitle.
…uanbao The paragraph net on beforeinput cannot see modifier keys. A soft line break is inserted as insertParagraph, so the net took it for a bare Enter, sent, and called preventDefault after Quill had already committed the newline to its model. The DOM and the model then disagreed and the next typed character was inserted twice, which reproduced as a doubled punctuation mark. The keydown stage now remembers a Shift+Enter inside the composer and lets the paragraph insertion it causes through for 200ms. A bare Enter that bypasses keydown still sends, including once that window has passed.
Records the three repairs in the version log: the peek keeps a history row menu and its submenu inside the panel, the settings panel shows the version the header declares, and a Shift+Enter soft break no longer doubles the next punctuation on Yuanbao.
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.
问题
ai-chat-turbo-engine的三处缺陷,Closes #278。body或面板旁的定位包装里,多数没有role,探出只认导轨子树与 popover 选择器,指针一进菜单就当作离开,隐藏延时随即收回面板;再往下一层的子菜单同样丢失。0.0.0— 面板副标题通过GM_info取版本,而脚本以@grant none运行,页面上没有管理器 API,于是永远落到0.0.0,与头部声明的0.23.17不符。Shift + Enter后输入标点会重复 — 软换行产生的insertParagraph不带修饰键信息,被「裸 Enter 兜底发送」当成发送接管并preventDefault();站点 Quill 模型已按换行更新,DOM 与模型错位,随后第一个字符被插入两次。修复
sidebar-peek.ts:探出认领从面板直接走进的浮动盒(peekLayers)。交接窗口SIDEBAR_PEEK_HANDOFF_MS = 500,以「最后一次停在导轨或已认领层上」为基准计时,因此从已认领层离开的那一刻也能续上交接(子菜单常被 portal 到几像素外的兄弟包装里,命名事件来自两框之间的空隙)。视口级固定外壳(宽 ≥70% 且高 ≥60%)被拒绝,页面正文不会把面板钉住;层被站点拆除(isConnected为假)即从集合中丢弃。指针进入、离开、按下、点击四条路径统一按「导轨子树 ∪ 已认领层」判定归属。tools/build-lib.ts用 esbuilddefine把__SCRIPT_VERSION__注入成meta.ts的version,与头部@version同源;lifecycle.ts只读该常量,GM_info读取与0.0.0回退一并移除。新增src/build-constants.d.ts声明,测试由vitest.config.ts提供占位值。send.ts:keydown阶段记住输入框内的Shift + Enter,它引起的insertParagraph在 200ms 内直接放行;绕过keydown的裸 Enter 仍按原逻辑发送,窗口过期后也仍发送。边界
meta.ts仍是唯一来源。测试
pnpm check全绿:typecheck + 969 项测试 + 构建。0.0.0且无残留GM_info、面板副标题显示构建版本、Shift + Enter后段落放行与窗口过期后仍发送。