From 35207b8df0e4edc254795a9be347c1246c9cdb35 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 7 Feb 2025 22:03:00 +0200 Subject: [PATCH] feat(geo_map): middle click to open note in new tab --- src/public/app/widgets/type_widgets/geo_map.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/public/app/widgets/type_widgets/geo_map.ts b/src/public/app/widgets/type_widgets/geo_map.ts index fdca64cbc..11de0b2b3 100644 --- a/src/public/app/widgets/type_widgets/geo_map.ts +++ b/src/public/app/widgets/type_widgets/geo_map.ts @@ -12,6 +12,7 @@ import asset_path from "../../../../services/asset_path.js"; import openContextMenu from "./geo_map_context_menu.js"; import link from "../../services/link.js"; import note_tooltip from "../../services/note_tooltip.js"; +import appContext from "../../components/app_context.js"; const TPL = `\
@@ -229,7 +230,15 @@ export default class GeoMapTypeWidget extends TypeWidget { .on("moveend", e => { this.moveMarker(note.noteId, (e.target as Marker).getLatLng()); }); - + marker.on("mousedown", ({ originalEvent }) => { + // Middle click to open in new tab + if (originalEvent.button === 1) { + const hoistedNoteId = this.hoistedNoteId; + //@ts-ignore, fix once tab manager is ported. + appContext.tabManager.openInNewTab(note.noteId, hoistedNoteId); + return true; + } + }); marker.on("contextmenu", (e) => { openContextMenu(note.noteId, e.originalEvent); });