fix: fix a bug in link click handler, where we can’t click on text selections. fix #263
This commit is contained in:
@@ -103,14 +103,15 @@ export const Link = Mark.create<LinkOptions>({
|
|||||||
props: {
|
props: {
|
||||||
handleClick: (view, pos, event) => {
|
handleClick: (view, pos, event) => {
|
||||||
const attrs = this.editor.getMarkAttributes('link')
|
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)
|
window.open(attrs.href, attrs.target)
|
||||||
|
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user