state/editing? outlives the editor's textarea

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

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Sôi nổi
Lĩnh vực
backend

Hướng nghiên cứu

Read the :editor/editing? state and state/get-input callers, then trace the editor component lifecycle and the shortcut and CodeMirror paths described in the issue. Compare the two proposed meanings of editing? and identify which callers need each; done means maintainers have chosen a consistent state contract that prevents stale textarea access.

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

Mô tả

state/editing? outlives the editor's textarea

state/editing? (:editor/editing?) can stay true for a moment after the block editor's textarea has left the DOM: the block was just deleted, the editor closed, a re-render replaced it. In that window state/get-input returns nil while everything that asks editing? still treats the user as editing. Code that trusts editing? and then reads the textarea throws.

A local key fuzzer that records uncaught page errors found this through several entry points:

  • block-editing shortcuts (Alt+E, Alt+A, Alt+U, Alt+K, the word movement and word delete shortcuts): fixed for the whole shortcut group in #13865 by requiring a live input in the group's gate;
  • Up/Down at the edge of a code block (CodeMirror's own key handler, outside the shortcut gate): get-prev-block-non-collapsed got a nil block (also in #13865);
  • earlier, cursor helpers and paste handlers reached through other paths.

#13865 removes the crashes but leaves the state as it is: any new code that checks editing? and reads the textarea can hit the same thing.

The design question

Should editing? mean "a block editor textarea is mounted"? Options:

  • clear :editor/editing? when the editor component that set it unmounts without another taking over (care is needed for re-renders that unmount and remount the same editor);
  • or define editing? as (some? (get-input)) for callers that act on the textarea, and keep the current flag for callers that only need "a block is being edited".

This touches editing state everywhere, so it is a question for the maintainers rather than a patch.

Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
29
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 logseq/db-test

Tất cả issue của logseq/db-test

Issue tương tự

Thêm issue về Backend & API Design

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.