fix(link): Do not convert link href to number or boolean (#5391)

This commit is contained in:
Stepan Yurtsiv 2024-08-11 19:48:54 +02:00 committed by GitHub
parent 84febb29c7
commit 08b4319215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/extension-link": fix
---
Fixes a bug where link `href` was converted to number or boolean during HTML parsing, leading to a crash in rendering.

View File

@ -164,6 +164,9 @@ export const Link = Mark.create<LinkOptions>({
return {
href: {
default: null,
parseHTML(element) {
return element.getAttribute('href')
},
},
target: {
default: this.options.HTMLAttributes.target,
@ -187,7 +190,7 @@ export const Link = Mark.create<LinkOptions>({
if (!href || !isAllowedUri(href)) {
return false
}
return { href }
return null
},
}]
},