feat: 重写公式解析与转换逻辑,完整支持所有内容块(包括表格),一个更加接近Notion 风格的按钮,版本号改为v3.3.1#9
Merged
skyance merged 14 commits intoskyance:mainfrom May 8, 2026
Merged
feat: 重写公式解析与转换逻辑,完整支持所有内容块(包括表格),一个更加接近Notion 风格的按钮,版本号改为v3.3.1#9skyance merged 14 commits intoskyance:mainfrom
skyance merged 14 commits intoskyance:mainfrom
Conversation
公式解析 - 废弃正则整体匹配,改用字符级逐字扫描,解决歧义和越界问题 - 完整支持 $、$$、\(...\)、\[...\] 四种公式格式 - 新增转义字符检测(isEscaped)、行内公式有效性校验 - Token 携带 start/end/lineStart/lineEnd/standaloneBlock 等精确位置信息 行内公式转换 - 通过 getTextSegments + resolveTextPosition 精确映射跨文本节点的选区 - 新增 waitForInlineInput 机制,确认公式输入框已打开再写入, 避免误替换正文内容 - 修复行内公式在新版 Notion 界面下因输入框未就绪导致的失败问题 块公式转换 - 非独立行的块公式自动降级为行内公式(添加 \displaystyle) - 采用 waitForCondition 轮询替代固定 sleep,大幅缩短等待时间 - 移除表格内公式的特殊处理逻辑;getEditableEditors 直接过滤表格单元格 - 删除 retryFailedBlockEquations 重试逻辑,由前置检测保证可靠性 性能与稳定性 - 引入两阶段转换:先处理全部行内公式,再处理块公式,避免位置漂移 - 关键等待时间从数百 ms 降至 10-40 ms 量级 - simulateKey / simulateShortcut 新增 target 参数,事件派发更精准 - 新增 DEBUG_MODE 开关,便于调试时输出详细日志
Co-authored-by: Copilot <copilot@github.com>
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.
PixPin_2026-05-06_19-05-38.mp4