BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

feat: markdown pasting & custom paste handlers

Open nperez0111 opened this issue 11 months ago • 3 comments

This implements markdown pasting, and custom paste handlers.

Adds

  • editor.pasteText which will paste text content into the editor
  • editor.pasteHTML which will convert HTML into BlockNote HTML and then paste that into the editor
  • editor.pasteMarkdown which will convert the markdown into BlockNote HTML and then paste that into the editor
  • editorOptions.pasteHandler for allowing the developer the ability to customize how content is pasted into the editor while still allowing the default paste behavior.

nperez0111 avatar Mar 04 '25 20:03 nperez0111

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote 🛑 Canceled (Inspect) Mar 31, 2025 3:37pm
blocknote-website ✅ Ready (Inspect) Visit Preview Mar 31, 2025 3:37pm

vercel[bot] avatar Mar 04 '25 20:03 vercel[bot]

@nperez0111 didn't review yet; but I just noticed (working on sth unrelated) that actually inline content markdown gets parsed. try pasting xx \*\*hello world\*\*. Did you know this / know where this is done? Tiptap feature?

YousefED avatar Mar 24 '25 20:03 YousefED

@nperez0111 didn't review yet; but I just noticed (working on sth unrelated) that actually inline content markdown gets parsed. try pasting xx \*\*hello world\*\*. Did you know this / know where this is done? Tiptap feature?

https://github.com/ueberdosis/tiptap/blob/dd0a25f5b48867992dd68d3effd5c98ddafcab69/packages/extension-bold/src/bold.tsx#L134-L145

Bold already has a paste rule set up. As well as a number of other Tiptap extensions. What does not work (in blocknote) though would be things across paragraphs or code blocks for example

nperez0111 avatar Mar 25 '25 11:03 nperez0111