Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Slash menu shows Ctrl+Alt+C (Mod-Alt-c) for "Code Block", but the shortcut is not registered

Đang mở Phù hợp với người mới
#3,211 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/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

Hướng nghiên cứu

Bắt đầu với packages/core/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts và so sánh huy hiệu phím tắt của Code Block với trình xử lý Quote trong packages/core/src/blocks/Quote/block.ts. Sau đó, kiểm tra CodeKeyboardShortcutsExtension của khối mã và các bài kiểm thử hiện có để tìm đăng ký phím tắt liên quan và phạm vi kiểm thử. Công việc được xem là hoàn tất khi Ctrl+Alt+C chuyển nội dung nội tuyến thành khối mã hoặc menu slash không còn hiển thị phím tắt đó.

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

Mô tả

What's broken?

The "Code Block" item of the default slash menu displays the Mod-Alt-c keyboard shortcut (Ctrl+Alt+C, or ⌘+Alt+C on macOS) as its badge, but pressing it does nothing: no block spec registers this shortcut.

The badge is set in getDefaultSlashMenuItems.ts. The other badges in the same menu have a matching handler, e.g. Mod-Alt-q in Quote/block.ts, Mod-Alt-0 in the paragraph block and Mod-Alt-<level> in the heading block. The code block's CodeKeyboardShortcutsExtension only handles Delete, Tab, Enter and Shift-Enter, plus the ``` input rule.

What did you expect to happen?

Pressing Ctrl+Alt+C (⌘+Alt+C on macOS) in a block with inline content turns it into a code block, like Ctrl+Alt+Q turns it into a quote. Alternatively, if the shortcut is not meant to exist, the slash menu should not display it.

Steps to reproduce
  1. Open the minimal example: https://www.blocknotejs.org/examples/basic/minimal
  2. Type /code and notice the "CTRL-ALT-C" shortcut displayed next to "Code Block".
  3. Press Escape, type some text in the paragraph and press Ctrl+Alt+C (⌘+Alt+C on macOS).
  4. The paragraph is not turned into a code block. Ctrl+Alt+Q, by comparison, does turn it into a quote.
BlockNote version

0.55.0 and 0.56.0 (still the case on main at 8e0485c)

Environment

Chromium on Linux, React 19 (not environment specific: the handler is missing from the code)

Additional context

We work around it in XWiki by adding a Mod-Alt-c keyboard shortcut extension to the code block spec, modelled on the quote block's shortcut.

Ngôn ngữ chính
TypeScript
Star
10.3k
Fork
780
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
44

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

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 TypeCellOS/BlockNote

Tất cả issue của TypeCellOS/BlockNote

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.