mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix: do not use window.open for links in readonly mode (#4073)
* fix: do not use window.open for links in readonly mode When `contenteditable` is `true`, the browser doesn't allow direct link opens on clicking the `a` element. This is why we need to call `window.open` to open our links. However, when `contenteditable` is `false`, the default browser mechanism for opening links works and there is no need for using `window.open`. * fix: linting errors
This commit is contained in:
parent
3053865475
commit
4bca77e4e9
@ -22,7 +22,9 @@ export function clickHandler(options: ClickHandlerOptions): Plugin {
|
|||||||
const target = link?.target ?? attrs.target
|
const target = link?.target ?? attrs.target
|
||||||
|
|
||||||
if (link && href) {
|
if (link && href) {
|
||||||
window.open(href, target)
|
if (view.editable) {
|
||||||
|
window.open(href, target)
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user