Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉 適合新手
#3,211 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
88/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
react, typescript

研究方向

從 packages/core/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts 開始,比較 Code Block 的快捷鍵徽章與 packages/core/src/blocks/Quote/block.ts 中的 Quote 處理常式。接著檢查程式碼區塊的 CodeKeyboardShortcutsExtension 和現有測試,以找出相關的快捷鍵註冊與測試涵蓋範圍。完成的標準是 Ctrl+Alt+C 能將行內內容轉換成程式碼區塊,或斜線選單不再顯示該快捷鍵。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
TypeScript
星號
10.3k
分支
780
平均合併
2 天 20 小時
30 天內合併 PR
43

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TypeCellOS/BlockNote 的其他 Issue

查看 TypeCellOS/BlockNote 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。