mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-03 19:19:01 +08:00
fix: fix a bug in link click handler, where we can’t click on text selections. fix #263
This commit is contained in:
parent
703afe91c0
commit
33c30c0d6d
@ -103,14 +103,15 @@ export const Link = Mark.create<LinkOptions>({
|
||||
props: {
|
||||
handleClick: (view, pos, event) => {
|
||||
const attrs = this.editor.getMarkAttributes('link')
|
||||
const link = (event.target as HTMLElement)?.closest('a')
|
||||
|
||||
if (attrs.href && event.target instanceof HTMLAnchorElement) {
|
||||
if (link && attrs.href) {
|
||||
window.open(attrs.href, attrs.target)
|
||||
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
return false
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user