From 33c30c0d6df66190fd1d5073ccc43b1020b517f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sun, 11 Apr 2021 18:59:07 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20fix=20a=20bug=20in=20link=20click=20hand?= =?UTF-8?q?ler,=20where=20we=20can=E2=80=99t=20click=20on=20text=20selecti?= =?UTF-8?q?ons.=20fix=20#263?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/extension-link/src/link.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/extension-link/src/link.ts b/packages/extension-link/src/link.ts index 9ca3e80cf..92b4f0f66 100644 --- a/packages/extension-link/src/link.ts +++ b/packages/extension-link/src/link.ts @@ -103,14 +103,15 @@ export const Link = Mark.create({ 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 }, }, }),