-
-
Notifications
You must be signed in to change notification settings - Fork 539
Paste in code block don't work properly #1594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Any update on this? @jdauphant-dinum Facing the same issue! Is there any workaround for now? (Absolutely love the product btw) |
Just a heads-up for anyone facing similar issues — I found a workaround for pasting code by implementing a custom pasteHandler. In my case, the clipboard content wasn’t being detected as "text/markdown", so I switched to checking for "text/plain" instead. Everything else remains the same and works as expected. If "text/markdown" works for you, feel free to adjust the condition. Here’s the snippet:
Hope this helps! |
By default, BlockNote will attempt to parse In order to disable parsing const editor = useCreateBlockNote({
pasteHandler: ({ defaultPasteHandler }) =>
defaultPasteHandler({
plainTextAsMarkdown: false,
}),
}); In cases where there is |
@matthewlipski I think there is something to be said here about having a more context-aware default paste handler. Like if we currently are within a code-block, it should only ever paste the |
@nperez0111 ah that's a good point actually. Imo makes sense to force pasting plain text for probably code, quote, table, and custom blocks. Meanwhile paragraphs, headings, and list items would accept rich clipboard content. Wdyt? |
I'd probably only special case The others are more about whether multi-line content is accepted which I think is separate than this. |
Describe the bug
I copy a code, I create a code block, I paste : only the first line is in the code block, the rest is outside the code block.
To Reproduce
Bug.TypeCell.mp4
I have tested on the website and on docs.numerique.gouv.fr .
Misc
The text was updated successfully, but these errors were encountered: