Cleanup linkifyjs when the editor is destroyed (#3316)

This commit is contained in:
Eduard Castellano 2022-10-17 12:58:04 +02:00 committed by GitHub
parent a966059dc0
commit 1c493f3593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core' import { Mark, markPasteRule, mergeAttributes } from '@tiptap/core'
import { find, registerCustomProtocol } from 'linkifyjs' import { find, registerCustomProtocol, reset } from 'linkifyjs'
import { Plugin } from 'prosemirror-state' import { Plugin } from 'prosemirror-state'
import { autolink } from './helpers/autolink' import { autolink } from './helpers/autolink'
@ -65,6 +65,10 @@ export const Link = Mark.create<LinkOptions>({
this.options.protocols.forEach(registerCustomProtocol) this.options.protocols.forEach(registerCustomProtocol)
}, },
onDestroy() {
reset()
},
inclusive() { inclusive() {
return this.options.autolink return this.options.autolink
}, },