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)