imzbf / md-editor-v3

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
https://imzbf.github.io/md-editor-v3
MIT License
1.69k stars 162 forks source link

Cursor position becomes fixed when scrolling #685

Closed Procrustes5 closed 1 month ago

Procrustes5 commented 2 months ago

Description

When using the text editor library, the cursor's position becomes fixed (like position: fixed in CSS) when scrolling the page. This causes the cursor to appear in an incorrect position relative to the text, rather than staying aligned with the actual text position.

Steps to Reproduce

  1. Open the text editor
  2. Place the cursor at any position within the text
  3. Scroll the page up or down
  4. Observe that the cursor remains fixed on the screen instead of moving with the text

Expected Behavior

The cursor should remain aligned with its position in the text, moving along with the text as the page is scrolled.

Actual Behavior

The cursor remains fixed in its screen position, becoming misaligned with its actual position in the text.

Environment

Additional Information

https://github.com/user-attachments/assets/b5b41656-8eff-4461-b60b-86f4db741d68

Possible Causes

This issue might be related to how the cursor positioning is calculated or updated during scroll events. It appears that the cursor's position is not being properly recalculated relative to the scrolled content.

Procedure version

4.18.1

Reproduction link

No response

imzbf commented 2 months ago

Can you reproduce this issue on your browser and on this page? If not, I need you to provide an example that fully replicates the problem.

Procrustes5 commented 2 months ago

@imzbf Thank you for reply!

I apologize, this might not be directly related to the library. I was able to reproduce this bug when setting max-height with CSS on the editor component. Are there any other ways to specify max-height?

imzbf commented 2 months ago

Hmm there are no other ways to set it up