mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-06-08 01:53:04 +08:00
fix(link): Do not convert link href
to number or boolean (#5391)
This commit is contained in:
parent
84febb29c7
commit
08b4319215
5
.changeset/link-href-parsing-fix.md
Normal file
5
.changeset/link-href-parsing-fix.md
Normal 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.
|
@ -164,6 +164,9 @@ export const Link = Mark.create<LinkOptions>({
|
|||||||
return {
|
return {
|
||||||
href: {
|
href: {
|
||||||
default: null,
|
default: null,
|
||||||
|
parseHTML(element) {
|
||||||
|
return element.getAttribute('href')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
target: {
|
target: {
|
||||||
default: this.options.HTMLAttributes.target,
|
default: this.options.HTMLAttributes.target,
|
||||||
@ -187,7 +190,7 @@ export const Link = Mark.create<LinkOptions>({
|
|||||||
if (!href || !isAllowedUri(href)) {
|
if (!href || !isAllowedUri(href)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return { href }
|
return null
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user