Fix link classes duplicating on paste (#788)
This commit is contained in:
parent
552f9add70
commit
20fd286756
|
@ -6,6 +6,7 @@ import {
|
||||||
JSONContent,
|
JSONContent,
|
||||||
Content,
|
Content,
|
||||||
Editor,
|
Editor,
|
||||||
|
mergeAttributes,
|
||||||
} from '@tiptap/react'
|
} from '@tiptap/react'
|
||||||
import StarterKit from '@tiptap/starter-kit'
|
import StarterKit from '@tiptap/starter-kit'
|
||||||
import { Image } from '@tiptap/extension-image'
|
import { Image } from '@tiptap/extension-image'
|
||||||
|
@ -38,7 +39,16 @@ const DisplayImage = Image.configure({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const DisplayLink = Link.configure({
|
const DisplayLink = Link.extend({
|
||||||
|
renderHTML({ HTMLAttributes }) {
|
||||||
|
delete HTMLAttributes.class // only use our classes (don't duplicate on paste)
|
||||||
|
return [
|
||||||
|
'a',
|
||||||
|
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
|
||||||
|
0,
|
||||||
|
]
|
||||||
|
},
|
||||||
|
}).configure({
|
||||||
HTMLAttributes: {
|
HTMLAttributes: {
|
||||||
class: clsx('no-underline !text-indigo-700', linkClass),
|
class: clsx('no-underline !text-indigo-700', linkClass),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user