mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
parent
35682d1322
commit
c0e5398685
5
.changeset/shy-otters-tap.md
Normal file
5
.changeset/shy-otters-tap.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/extension-link": patch
|
||||
---
|
||||
|
||||
Links were opening twive when the editor was not editable and openOnclick was true, now openOnClick setting will check if it is editable before trying to open programmatically resolves #4877
|
@ -1,9 +1,10 @@
|
||||
import { getAttributes } from '@tiptap/core'
|
||||
import { Editor, getAttributes } from '@tiptap/core'
|
||||
import { MarkType } from '@tiptap/pm/model'
|
||||
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
||||
|
||||
type ClickHandlerOptions = {
|
||||
type: MarkType
|
||||
type: MarkType;
|
||||
editor: Editor;
|
||||
}
|
||||
|
||||
export function clickHandler(options: ClickHandlerOptions): Plugin {
|
||||
@ -15,6 +16,10 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
|
||||
return false
|
||||
}
|
||||
|
||||
if (!options.editor.isEditable) {
|
||||
return false
|
||||
}
|
||||
|
||||
let a = event.target as HTMLElement
|
||||
const els = []
|
||||
|
||||
|
@ -277,6 +277,7 @@ export const Link = Mark.create<LinkOptions>({
|
||||
plugins.push(
|
||||
clickHandler({
|
||||
type: this.type,
|
||||
editor: this.editor,
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user