This repository was archived by the owner on Mar 7, 2026. It is now read-only.
Merged
Conversation
There was a problem hiding this comment.
PR Summary
This PR fixes a critical paste functionality bug by implementing proper handling of non-media content through the Markdown extension, ensuring text content is correctly converted into editor blocks.
- Added
BlockNoteEditorparameter tocreateMarkdownExtensionin/src/lib/blocknote/core/BlockNoteExtensions.tsfor proper node creation - Implemented markdown-to-blocks conversion in
/src/lib/blocknote/core/extensions/Markdown/MarkdownExtension.tsfor non-video content - Added security check in paste handler to prevent code block injection when pasting into code blocks
- Fixed potential XSS vulnerability by properly sanitizing pasted HTML content before processing lists
2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
Comment on lines
70
to
+71
| // @ts-ignore | ||
| createMarkdownExtension(), | ||
| createMarkdownExtension(opts.editor), |
There was a problem hiding this comment.
style: Remove @ts-ignore by properly typing the createMarkdownExtension function parameters
Comment on lines
+118
to
+126
| bnEditor.markdownToBlocks(pastedText).then((organizedBlocks: any) => { | ||
| const blockInfo = getBlockInfoFromPos(state.doc, selection.from) | ||
| bnEditor.replaceBlocks( | ||
| [blockInfo.node.attrs.id], | ||
| // @ts-ignore | ||
| organizedBlocks, | ||
| ) | ||
| BlockUtils.setGroupTypes(bnEditor._tiptapEditor, organizedBlocks) | ||
| }) |
There was a problem hiding this comment.
logic: Potential race condition - state.doc and selection might change before the async markdownToBlocks promise resolves
Comment on lines
+122
to
+123
| // @ts-ignore | ||
| organizedBlocks, |
There was a problem hiding this comment.
style: Type safety issue with @ts-ignore - organizedBlocks should be properly typed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed a bug on pasting non-media content. Originally, would not paste content but now it does.