TypeCellOS / TypeCellOS/BlockNote

Typing ``` then Enter throws "Language is not supported" and corrupts cursor/deletion

Open
#3,005 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
TypeScript
Stars
10.2k
Forks
772
Avg merge
3d 11h
Merged PRs (30d)
17

Description

What’s broken?

Typing ``` (with no language name) and pressing Enter creates a code block whose language is an empty string. The highlighter then throws Uncaught Error: Language is not supported. After that, the cursor position is wrong, and Backspace/Delete no longer behave correctly in that block.

What did you expect to happen?

Typing ``` and pressing Enter should create a normal code block with the default language (e.g. text), without throwing. The cursor should land inside the block, and Backspace/Delete should work as usual.

Steps to reproduce
  1. Open any BlockNote editor with @blocknote/code-block enabled (the official code-block example is enough).
  2. In an empty paragraph, type ``` (three backticks, no language name).
  3. Press Enter.

Result: the console throws Uncaught Error: Language is not supported. After that, the cursor is in the wrong place, and Backspace/Delete in that block are also wrong.

```js then Enter does not reproduce this.

BlockNote version

v0.54.0

Environment

No response

Additional context

No response

Contribution
  • I'd be interested in contributing a fix for this issue
Sponsor
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @blocknote/code-block entry point and reproduce the issue in the official code-block example using ``` followed by Enter. Trace how an empty language is handled, then verify that the block uses a default language, no error occurs, the cursor lands inside it, and Backspace/Delete behave normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.