From 02731e73c5422dfb57d4417ccc88c45c57aec660 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 14 Oct 2023 09:29:08 -0400 Subject: [PATCH] fix: Hover cards appearing on embeds, change to allow-list approach --- shared/editor/marks/Link.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared/editor/marks/Link.tsx b/shared/editor/marks/Link.tsx index c1476673b..dbcbaf2ef 100644 --- a/shared/editor/marks/Link.tsx +++ b/shared/editor/marks/Link.tsx @@ -85,8 +85,9 @@ export default class Link extends Mark { toDOM: (node) => [ "a", { - ...node.attrs, + title: node.attrs.title, href: sanitizeUrl(node.attrs.href), + class: "text-link", rel: "noopener noreferrer nofollow", }, 0, @@ -209,8 +210,8 @@ export default class Link extends Mark { const target = (event.target as HTMLElement)?.closest("a"); if ( target instanceof HTMLAnchorElement && + target.className.includes("text-link") && this.editor.elementRef.current?.contains(target) && - !target.className.includes("ProseMirror-widget") && (!view.editable || (view.editable && !view.hasFocus())) ) { if (this.options.onHoverLink) {