Selection toolbar does not follow scrolling inside the WYSIWYG editor

Đang mở
#1,450 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Start by reproducing the issue in the Playground using WYSIWYG mode and the .g-md-wysiwyg-editor__editor scroll container described in the steps. Trace how the selection toolbar tracks the selected text while the editor scrolls, comparing that behavior with page scrolling. Done when the toolbar follows the selection during editor scrolling without breaking the page-scroll behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

On main, the selection formatting toolbar stays at its old position when scrolling inside the WYSIWYG editor. Scrolling the page moves the toolbar correctly.

Environment

  • Branch: main, commit b6334207f0eca9f565aecce987cf6bd1cbe0fd36.
  • Editor: 15.50.0; UIkit: 7.39.0, using the committed lockfile.
  • Chromium 152.0.7977.169 on macOS; viewport: 1100 × 560 CSS pixels.
  • Clean checkout; no editor source changes.

Steps to reproduce

  1. Install dependencies and start the demo:
    pnpm install --frozen-lockfile
    pnpm exec nx build-deps @markdown-editor/demo
    pnpm start
    
  2. Open Playground in WYSIWYG mode and replace the content with 30 paragraphs of plain text. The recording uses numbered copies of:

    Paragraph 01. Select this sentence to open the formatting toolbar, then scroll inside the editor.

  3. In the story frame's DevTools console, limit the editor's scroll container:
    document.querySelector('.g-md-wysiwyg-editor__editor').style.maxHeight = '300px';
    
  4. Double-click a word in paragraph 5 to open the selection toolbar.
  5. Keep the pointer over the editor and scroll down by approximately 100 px with the mouse wheel or trackpad.

Expected

The selection toolbar follows the selected text as the editor scrolls.

Actual

The selected text moves up, while the toolbar stays at its original screen position.

The reproduction used browser wheel input. Measurements are in CSS pixels:

State Editor scroll Page scroll Selection top Toolbar top
Before scrolling 0 0 340 362.5
After editor scrolling 100 0 240 362.5
Page-scroll control, editor reset 0 100 240 262.5

Recording

Recorded on the main checkout above. The video scrolls the editor down, returns it to the top, then scrolls the page.

https://github.com/user-attachments/assets/213dd821-8428-428c-af2f-84f721d58eb9

Screenshots

Before scrolling: the toolbar is directly below the selected word.

Before scrolling

Editor scrolled by 100 px: the selection moved up; the toolbar stayed in place.

After scrolling inside the editor

Page-scroll control: after resetting the editor scroll, scrolling the page by 100 px moves both the selection and toolbar together.

Page-scroll control

Ngôn ngữ chính
TypeScript
Star
428
Fork
48
Merge trung bình
5 ngày 15 giờ
Pull request đã merge (30 ngày)
47

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gravity-ui/markdown-editor

Tất cả issue của gravity-ui/markdown-editor

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.