This commit is contained in:
Zef Hemel
2023-01-13 16:33:36 +01:00
parent a56e14bff1
commit a170d9c2d7
3 changed files with 42 additions and 33 deletions
+23
View File
@@ -623,6 +623,29 @@ export class Editor {
}
touchCount = 0;
},
mousedown: (event: MouseEvent, view: EditorView) => {
// Make sure <a> tags are clicked without moving the cursor there
if (!event.altKey && event.target instanceof Element) {
const parentA = event.target.closest("a");
if (parentA) {
event.stopPropagation();
event.preventDefault();
const clickEvent: ClickEvent = {
page: pageName,
ctrlKey: event.ctrlKey,
metaKey: event.metaKey,
altKey: event.altKey,
pos: view.posAtCoords({
x: event.x,
y: event.y,
})!,
};
this.dispatchAppEvent("page:click", clickEvent).catch(
console.error,
);
}
}
},
click: (event: MouseEvent, view: EditorView) => {
safeRun(async () => {
const clickEvent: ClickEvent = {