Notes Markdown 编辑器的 4 项修复 - #3214
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9baa5f0f7d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (content) { | ||
| const trimmed = content.trim(); | ||
| if (trimmed.startsWith("$$") && trimmed.endsWith("$$") && trimmed.length >= 4) { | ||
| return true; | ||
| } | ||
| if (trimmed.startsWith("\\[") && trimmed.endsWith("\\]") && trimmed.length >= 4) { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Require an explicit math language before replacing code blocks
When a plain-text or unlabeled fenced block literally contains $$...$$ or \[...\]—for example, documentation showing Markdown syntax—this content-only fallback now classifies it as math. In preview, annotateMathFormulaBlocks consequently hides the CodeMirror block and its copy action and substitutes a KaTeX rendering, even though the user did not select latex or tex; keep formula rendering gated by an explicit math language.
Useful? React with 👍 / 👎.
| shell: "Shell", | ||
| sql: "SQL", | ||
| tex: "TeX", | ||
| toml: "TOML", |
There was a problem hiding this comment.
Keep the existing TeX language alias registered
Existing or imported notes can contain fenced tex blocks, and the surrounding detection and CSS still explicitly support tex, but removing it from NOTE_CODE_BLOCK_LANGUAGES means codeMirrorPlugin no longer recognizes or offers that language through its supported-language registry. Such blocks can therefore lose their CodeMirror editor/formula-preview path; retain the tex: "TeX" alias alongside latex for backward compatibility.
Useful? React with 👍 / 👎.
Summary
恢复了 index.css 中代码块包裹层(_codeMirrorWrapper_)、渲染态 <pre>、独立数学公式段落(p.netcatty-math-block-p)以及数学公式阅读模式预览容器(netcatty-math-formula-preview)的 1px solid hsl(var(--border) / 0.6) 边框底框,确保结构层次与边界清晰可见。在 index.css 中将 CodeMirror 的 .cm-tooltip、.cm-tooltip.cm-tooltip-autocomplete 以及子列表项配置为 hsl(var(--popover)) 实体不透明背景、明确的边框与阴影,并设置 opacity: 1 !important; z-index: 99999 !important;,保证在深色/浅色模式下均清晰可见且不透底。在 InlineMarkdownEditor.tsx 中引入 CodeMirror @codemirror/state 的 Prec.highest,将 tooltips({ parent: document.body }) 提升至最高优先级,覆盖 @mdxeditor/editor 内部 basicSetup 的默认挂载行为,使代码提示悬浮窗直接挂载至 document.body,不再受限于简短或行数较少的代码框高度和 overflow 范围。移除基于 hsl(var(--primary)) 混合的单色调语法高亮计算,改用独立的多色高对比度语法配色方案(浅色/深色主题下关键字采用红/珊瑚色、类型与属性采用经典蓝/天蓝色、字符串采用绿色、常量/数值采用橙色、变量与标识符采用清晰文字色),避免与选中文本、当前行高亮或主题色发生混淆重合。Type of Change
Related Issue (optional)
N/A
Changes Made
Screenshots / Demo
Testing
npm run dev)npm run lint)npm test)npm run generate:capability-tools)Checklist