fix: Clicking links when editor hasn't been focused should navigate
This commit is contained in:
@@ -548,6 +548,12 @@ const EditorStyles = styled.div<{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ProseMirror-focused {
|
||||
a {
|
||||
cursor: text;
|
||||
}
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: ${(props) => (props.readOnly ? "underline" : "none")};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user