fix: fix a bug in link click handler, where we can’t click on text selections. fix #263

This commit is contained in:
Philipp Kühn 2021-04-11 18:59:07 +02:00
parent 703afe91c0
commit 33c30c0d6d

View File

@ -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
},
},
}),