fix bug
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Command, Mark, markPasteRule, getMarkAttrs,
|
Command, Mark, markPasteRule,
|
||||||
} from '@tiptap/core'
|
} from '@tiptap/core'
|
||||||
import { Plugin, PluginKey } from 'prosemirror-state'
|
import { Plugin, PluginKey } from 'prosemirror-state'
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ export default new Mark<LinkOptions>()
|
|||||||
.pasteRules(({ type }) => [
|
.pasteRules(({ type }) => [
|
||||||
markPasteRule(pasteRegex, type, (url: string) => ({ href: url })),
|
markPasteRule(pasteRegex, type, (url: string) => ({ href: url })),
|
||||||
])
|
])
|
||||||
.plugins(({ options }) => {
|
.plugins(({ editor, options, name }) => {
|
||||||
if (!options.openOnClick) {
|
if (!options.openOnClick) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,7 @@ export default new Mark<LinkOptions>()
|
|||||||
key: new PluginKey('handleClick'),
|
key: new PluginKey('handleClick'),
|
||||||
props: {
|
props: {
|
||||||
handleClick: (view, pos, event) => {
|
handleClick: (view, pos, event) => {
|
||||||
const { schema } = view.state
|
const attrs = editor.getMarkAttrs(name)
|
||||||
const attrs = getMarkAttrs(view.state, schema.marks.link)
|
|
||||||
|
|
||||||
if (attrs.href && event.target instanceof HTMLAnchorElement) {
|
if (attrs.href && event.target instanceof HTMLAnchorElement) {
|
||||||
window.open(attrs.href, attrs.target)
|
window.open(attrs.href, attrs.target)
|
||||||
|
|||||||
Reference in New Issue
Block a user