Repository navigation
🐛 fix(code-editor): align highlight layer with textarea layout - #643
Conversation
|
@CrazyBucket is attempting to deploy a commit to the LobeHub OSS Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6fdeb8355
ℹ️ 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".
| /* Token emphasis must not change glyph metrics relative to the textarea. */ | ||
| span { | ||
| font-weight: inherit !important; | ||
| font-style: normal !important; |
There was a problem hiding this comment.
Inherit the editor's font style in the mirror
When CodeEditor is placed in an italicized container or receives style={{ fontStyle: 'italic' }}, the textarea inherits that style while every highlighted span is now forced to normal. This changes the highlighted glyph metrics relative to the caret and selection layer, reintroducing the alignment problem this change addresses; override token italics by inheriting the mirror's base font style instead.
Useful? React with 👍 / 👎.
## [5.40.2](v5.40.1...v5.40.2) (2026-09-08) ### 🎫 Chores * **deps**: Upgrade @base-ui/react to 1.8.0, closes [#644](#644) [mui/base-ui#5442](mui/base-ui#5442) ([ca25fd6](ca25fd6)) * **release**: [email protected] [skip ci] ([930f623](930f623)) ### 🐛 Bug Fixes * **code-editor**: Align highlight layer with textarea layout, closes [#643](#643) ([384b444](384b444))
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
修复 CodeEditor 多行编辑时光标、选区与高亮文本错位的问题。
高亮镜像层原有的 flex 行布局会引入额外间距并折叠空行,导致其与 textarea 的文本位置不一致。本次仅调整 CodeEditor 内部样式:
保留语法高亮颜色,不影响 SyntaxHighlighter 的公共展示样式。
📝 补充信息 | Additional Information
关联 Issue:#534
已验证多行及空行、Enter 换行、鼠标拖选、Shift + 方向键选择和长文本自动换行。
Before
After