diff options
author | Julius Härtl <jus@bitgrid.net> | 2021-02-04 12:58:57 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2021-03-11 16:53:44 +0300 |
commit | 4b46b810f43daa3480ffdefe36b58621ec575485 (patch) | |
tree | 9169a3fdfcda33e1aa2fe3c2ff932ea1110038c0 /src | |
parent | 2eb11fea6db7284a18eaab6ca90c3038b729bfa3 (diff) |
Fix clicking links with color annotations
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/marks/index.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/marks/index.js b/src/marks/index.js index 1b71307d9..a3de1a486 100644 --- a/src/marks/index.js +++ b/src/marks/index.js @@ -117,9 +117,11 @@ class Link extends TipTapLink { const { schema } = view.state const attrs = getMarkAttrs(view.state, schema.marks.link) - if (attrs.href && event.target instanceof HTMLAnchorElement) { + const isLink = event.target instanceof HTMLAnchorElement || event.target.parentElement instanceof HTMLAnchorElement + if (attrs.href && isLink) { + const linkElement = event.target.parentElement instanceof HTMLAnchorElement ? event.target.parentElement : event.target event.stopPropagation() - const htmlHref = event.target.href + const htmlHref = linkElement.href if (event.button === 0 && !event.ctrlKey && htmlHref.startsWith(window.location.origin)) { const query = OC.parseQueryString(htmlHref) const fragment = OC.parseQueryString(htmlHref.split('#').pop()) |