fix(core-plugins): doubao copy button not appearing and heading level conflict#7
Open
MarvGuo wants to merge 2 commits into
Open
fix(core-plugins): doubao copy button not appearing and heading level conflict#7MarvGuo wants to merge 2 commits into
MarvGuo wants to merge 2 commits into
Conversation
- Add fallback DOM selectors for copy button injection - Add floating copy button as 8s timeout safety net - Implement dynamic heading demotion: find highest heading level in content, shift all headings to nest strictly below ## level - Protect code fence content from heading demotion - Cap shifted heading level at 6 (max ATX level) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
89e18bc to
7ca81f1
Compare
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.
Summary
修复了 CtxPort 浏览器扩展在豆包(Doubao)平台上无法正常工作的问题,以及导出 Markdown 时的 headings 层级冲突。
修改内容
1. Copy button 不出现
doubao/plugin.ts:添加 3 个 fallback DOM 选择器,防止豆包页面 DOM 变更后按钮无法注入app.tsx:注入失败 8s 后自动显示浮层兜底按钮2. Headings 层级冲突
doubao/plugin.ts:实现动态 heading 降级策略 — 先扫描内容找到最高标题级别,计算偏移量,确保所有内容标题严格嵌套在## User/## Assistant下方#字符不受影响3. 测试覆盖
4. 文档
CHANGELOG.md:两条 fix 记录docs/others/doubao-heading-demotion.md:技术文档改动文件
packages/core-plugins/src/plugins/doubao/plugin.tspackages/core-plugins/src/plugins/doubao/__tests__/plugin.test.tsapps/browser-extension/src/components/app.tsxCHANGELOG.mddocs/others/doubao-heading-demotion.mdTest plan
pnpm --filter @ctxport/core-plugins test— 19 tests passpnpm lint— no errorspnpm typecheck— no errorspnpm build:ext— build succeeds🤖 Generated with Claude Code