From e10b52aafc46b3bafac9eda2dcb85b9dd1373880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Thu, 24 Sep 2020 23:50:02 +0200 Subject: [PATCH] fix bug --- packages/extension-link/index.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/extension-link/index.ts b/packages/extension-link/index.ts index 40b020a8..5b925d37 100644 --- a/packages/extension-link/index.ts +++ b/packages/extension-link/index.ts @@ -1,5 +1,5 @@ import { - Command, Mark, markPasteRule, getMarkAttrs, + Command, Mark, markPasteRule, } from '@tiptap/core' import { Plugin, PluginKey } from 'prosemirror-state' @@ -57,7 +57,7 @@ export default new Mark() .pasteRules(({ type }) => [ markPasteRule(pasteRegex, type, (url: string) => ({ href: url })), ]) - .plugins(({ options }) => { + .plugins(({ editor, options, name }) => { if (!options.openOnClick) { return [] } @@ -67,8 +67,7 @@ export default new Mark() key: new PluginKey('handleClick'), props: { handleClick: (view, pos, event) => { - const { schema } = view.state - const attrs = getMarkAttrs(view.state, schema.marks.link) + const attrs = editor.getMarkAttrs(name) if (attrs.href && event.target instanceof HTMLAnchorElement) { window.open(attrs.href, attrs.target)