mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 22:36:14 +08:00
fix(extension-link): Click handler opens selected link instead of clicked link (#3732)
This commit is contained in:
parent
a81019a6b7
commit
6997bcad6b
@ -14,8 +14,11 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
|
||||
const attrs = getAttributes(view.state, options.type.name)
|
||||
const link = (event.target as HTMLElement)?.closest('a')
|
||||
|
||||
if (link && attrs.href) {
|
||||
window.open(attrs.href, attrs.target)
|
||||
const href = link?.href ?? attrs.href
|
||||
const target = link?.target ?? attrs.target
|
||||
|
||||
if (link && href) {
|
||||
window.open(href, target)
|
||||
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user