TypeCellOS / TypeCellOS/BlockNote

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

Offen
#3,005 3 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

needs-triage
Vorherrschende Sprache
TypeScript
Sterne
10.2k
Forks
772
Ø Merge
3 T. 11 Std.
Gemergte PRs (30 T.)
17

Beschreibung

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 💖

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
70/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.