Skip to content

Cannot copy and paste tsx code into code block #1210

@imaimai17468

Description

@imaimai17468

Describe the bug

I tried to copy and paste a tsx I wrote in VSCode into a code block and got the following error.

Uncaught (in promise) ShikiError: Language `typescriptreact` not found, you may need to load it first
    at Object.getLanguage (index.mjs:1773:13)
    at codeToTokensBase (index.mjs:840:29)
    at codeToTokens (index.mjs:1160:14)
    at Object.codeToTokens (index.mjs:1881:39)
    at parser (shiki.js:13:36)
    at parser (blocknote.js:6962:309)
    at eval (index.js:173:29)
    at Fragment.nodesBetween (index.js:105:31)
    at Node.nodesBetween (index.js:1238:22)
    at Fragment.nodesBetween (index.js:107:23)
    at Node.nodesBetween (index.js:1238:22)
    at Fragment.nodesBetween (index.js:107:23)
    at Node.nodesBetween (index.js:1238:22)
    at Node.descendants (index.js:1245:14)
    at calculateDecoration (index.js:162:7)
    at Plugin.apply (index.js:112:41)
    at EditorState.applyInner (index.js:851:45)
    at EditorState.applyTransaction (index.js:811:45)
    at EditorState.apply (index.js:787:21)
    at fe.dispatchTransaction (index.js:4575:34)
    at EditorView.dispatch (index.js:5698:33)
    at doPaste (index.js:3633:10)
    at EditorView.pasteHTML (index.js:5644:16)
    at fr (blocknote.js:10067:60)
    at Plugin.paste (blocknote.js:10094:24)
    at eval (index.js:3095:26)
    at EditorView.someProp (index.js:5498:50)
    at runCustomHandler (index.js:3093:17)
    at view.dom.addEventListener.view.input.eventHandlers.<computed> (index.js:3062:53)

To Reproduce

This bug can also be reproduced in the initial code of stackblitz, the template for this issue.
It can also be reproduced in the demo on the official Blocknote page (https://www.blocknotejs.org/).

2024-11-03.4.33.35.mov

Misc

  • Node version: -
  • Package manager: -
  • Browser:
    • Arc
    • version1.67.0 (55463)
    • Chromium Engine Version 130.0.6723.92
    • (The same problem occurs in Chrome.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions