fix(muya): show the text cursor over the whole editable column (#5477) by Jocs · Pull Request #5478 · marktext/marktext · GitHub
Skip to content

fix(muya): show the text cursor over the whole editable column (#5477) - #5478

Merged
Jocs merged 1 commit into
developfrom
fix/5477-editor-text-cursor
Sep 21, 2026
Merged

Jocs merged 1 commit into
developfrom
fix/5477-editor-text-cursor

Conversation

@Jocs

@Jocs Jocs commented Sep 21, 2026

Copy link
Copy Markdown
Member

Fixes #5477.

Problem

Hovering the editor only turned the pointer into an I-beam over headings. Paragraphs, code blocks, blockquotes, lists and tables all kept the plain arrow.

Root cause

#2850 stated the affordance in two halves:

  • cursor: default on marktext's scrolling mount (.editor-component), so the margins around the text column read as chrome;
  • cursor: text on the text column itself — back then #ag-editor-id in src/muya/themes/default.css.

The muya rewrite carried the first half over (it still sits in editor.vue) but not the second: .mu-container, the new engine's text column and the direct analogue of #ag-editor-id, never got the rule. cursor inherits, so the mount's default reached every block, and .mu-container h1..h6 — which states a cursor: text of its own — was the lone survivor. That is exactly the reported symptom.

Verified in the packaged app before the fix:

default    .editor-component
default    .mu-container
text       .mu-container h1      ← the only exception
default    .mu-container p
default    .mu-container pre
default    .mu-container blockquote
default    .mu-container li
default    .mu-container table td

Fix

Put the missing declaration back on .mu-container and drop the heading rule, which is now redundant. Click targets inside the column (links, task checkboxes, the code-copy and copy-anchor buttons, image tools) all state cursor: pointer themselves, so they are unaffected — the added test pins that too. .editor-component keeps its arrow, so the gutters either side of the column still read as chrome, as #2850 intended.

Export output is untouched: exported HTML/PDF is styled by exportStyle.css, not blockSyntax.css.

Test

packages/desktop/test/e2e/issue-5477-editor-text-cursor.spec.ts opens a document with a heading, paragraph, fenced code block, blockquote, task list and table, and asserts for each block both the computed cursor and the cursor of whatever elementFromPoint hits at its centre — the element the pointer actually resolves against. It fails on develop (.mu-container p: expected text, received default) and passes with this change.

🤖 Generated with Claude Code

Only headings turned the pointer into an I-beam; paragraphs, code blocks,
quotes, lists and tables kept the arrow.

#2850 stated the affordance in two halves: `cursor: default` on marktext's
scrolling mount (`.editor-component`) so the margins around the column read
as chrome, and `cursor: text` on the text column itself (`#ag-editor-id`).
The muya rewrite carried over the first half but not the second, so the
inherited `default` reached every block — and `.mu-container h1..h6`, which
states `cursor: text` of its own, was the only survivor.

Put the declaration back where it belongs, on `.mu-container`, and drop the
heading rule that is now redundant. Links, task checkboxes and the other
click targets state `cursor: pointer` themselves, so they are unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

@Jocs
Jocs merged commit 9449bf7 into develop Sep 21, 2026
17 checks passed
@Jocs
Jocs deleted the fix/5477-editor-text-cursor branch September 21, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 编辑光标未正确显示

1 participant