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
平均合并
3 天 11 小时
30 天内合并 PR
44

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TypeCellOS/BlockNote 的其他 Issue

查看 TypeCellOS/BlockNote 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。