Fixes #627
This commit is contained in:
@@ -141,6 +141,10 @@ export class MarkdownWidget extends WidgetType {
|
||||
const el = el_ as HTMLElement;
|
||||
// Override default click behavior with a local navigate (faster)
|
||||
el.addEventListener("click", (e) => {
|
||||
if (e.ctrlKey || e.metaKey) {
|
||||
// Don't do anything special for ctrl/meta clicks
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const [pageName, pos] = el.dataset.ref!.split(/[$@]/);
|
||||
|
||||
@@ -31,6 +31,9 @@ export class LinkWidget extends WidgetType {
|
||||
|
||||
// Mouse handling
|
||||
anchor.addEventListener("mousedown", (e) => {
|
||||
if (e.button !== 0) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
this.options.callback(e);
|
||||
|
||||
+7
-4
@@ -298,11 +298,14 @@ export function createEditorState(
|
||||
},
|
||||
|
||||
mousedown: (event: MouseEvent, view: EditorView) => {
|
||||
const pos = view.posAtCoords(event);
|
||||
if (event.button !== 0) {
|
||||
return;
|
||||
}
|
||||
if (!pos) {
|
||||
return;
|
||||
}
|
||||
safeRun(async () => {
|
||||
const pos = view.posAtCoords(event);
|
||||
if (!pos) {
|
||||
return;
|
||||
}
|
||||
const potentialClickEvent: ClickEvent = {
|
||||
page: pageName,
|
||||
ctrlKey: event.ctrlKey,
|
||||
|
||||
Reference in New Issue
Block a user