fix(tiptap): properly interpret Markdown on paste#1459
Open
Conversation
d40b153 to
cba9cb4
Compare
* use a simple heuristic (rollback). Not perfect but simple and "good enough" * use marked instance in tiptap editor instead of the separate marked package * disable paste rules in order to correctly handle extensions callback already handling paste (e.g. HeadingExtension) * Also handle drop * New HeadingExtension handling headings realignment in `transformPastedHTML` callback. Now even copy-pasted HTML content gets its headings realigned * Use transformPasted callback in ImageImportPlugin to strip pasted images out (from HTML, meaning also after Markdown parsed into HTML
cba9cb4 to
5a8ec54
Compare
benoitdequick
approved these changes
Apr 2, 2026
bellangerq
approved these changes
Apr 3, 2026
Collaborator
bellangerq
left a comment
There was a problem hiding this comment.
Ça fonctionne nickel, bravo 👏🏼
| function getHeadingLevel(el: Element) { | ||
| const tag = el.tagName; // e.g. "H1", "H2" | ||
| if (/^H[1-6]$/.test(tag)) { | ||
| return parseInt(tag[1], 10); |
Collaborator
There was a problem hiding this comment.
Préférence personnelle mais je trouve :
Number(tag[1])un poil plus clair.
| private handleDrop( | ||
| view: EditorView, | ||
| dragEvent: DragEvent, | ||
| _slice: Slice, |
Collaborator
There was a problem hiding this comment.
Ce paramètre n'a pas l'air d'être utilisé.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
transformPastedHTMLcallback. Now even copy-pasted HTML content gets its headings realignedcloses #1439
Avant de merger la pull request, s’assurer que :