Skip to content

Commit

Permalink
fix: fix a bug in link click handler, where we can’t click on text se…
Browse files Browse the repository at this point in the history
…lections. fix #263
  • Loading branch information
philippkuehn committed Apr 11, 2021
1 parent 703afe9 commit 33c30c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/extension-link/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
}),
Expand Down

0 comments on commit 33c30c0

Please sign in to comment.