Web UI: ConfigEditorModal — preserve CodeMirror undo history and cursor across New/Revert/Save As

Đang mở
#147 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/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ệ
python, typescript
Lĩnh vực
desktop, frontend

Hướng nghiên cứu

Start with ConfigEditorModal.tsx:414-459 and trace the view effect's [open, load] dependencies, then read the New, Revert, and Save As flows at lines 738-761. Check how CodeMirror dispatches document changes and how loadedTextRef and baselineHashRef are updated. Done means those actions update the document without losing undo history, cursor, or scroll position.

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

Mô tả

code-quality frontend

Problem

The view effect depends on [open, load] (ConfigEditorModal.tsx:414-459), so any setLoad destroys and recreates the CodeMirror view: after New, Revert, and after Save As (markSaved, lines 738-761, whose anchorChanged branch deliberately bumps load). The comments already acknowledge the hazard ("the remount would rebuild the view…"), and plain Save works around it — but the Save-As/New/Revert remounts reset undo history, cursor and scroll position.

Suggested fix

Create the view once per open session and swap content via dispatch({ changes: { insert: text, from: 0, to: doc.length } }) (which also keeps a sensible undo entry), updating loadedTextRef/baselineHashRef as today.

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
55

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 falbany/ProFiles

Tất cả issue của falbany/ProFiles

Issue tương tự

Thêm issue về Python

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.