fix: Clicking links when editor hasn't been focused should navigate

This commit is contained in:
Tom Moor
2022-02-17 20:08:04 -08:00
parent b23f7b0953
commit cbe65ddcd7
2 changed files with 8 additions and 2 deletions

View File

@@ -170,14 +170,14 @@ export default class Link extends Mark {
}
return false;
},
click: (view, event: MouseEvent) => {
mousedown: (view, event: MouseEvent) => {
if (!(event.target instanceof HTMLAnchorElement)) {
return false;
}
// clicking a link while editing should show the link toolbar,
// clicking in read-only will navigate
if (!view.editable) {
if (!view.editable || (view.editable && !view.hasFocus())) {
const href =
event.target.href ||
(event.target.parentNode instanceof HTMLAnchorElement