mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
refactor(views/geomap): solve type errors
This commit is contained in:
parent
c1a5808f37
commit
242a576548
@ -47,7 +47,11 @@ export function openMapContextMenu(noteId: string, e: LeafletMouseEvent, isEdita
|
||||
items = [
|
||||
...items,
|
||||
{ title: "----" },
|
||||
{ title: t("geo-map-context.add-note"), command: "addNoteToMap", uiIcon: "bx bx-plus" }
|
||||
{
|
||||
title: t("geo-map-context.add-note"),
|
||||
handler: () => createNewNote(noteId, e),
|
||||
uiIcon: "bx bx-plus"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -55,14 +59,8 @@ export function openMapContextMenu(noteId: string, e: LeafletMouseEvent, isEdita
|
||||
x: e.originalEvent.pageX,
|
||||
y: e.originalEvent.pageY,
|
||||
items,
|
||||
selectMenuItemHandler: ({ command }) => {
|
||||
switch (command) {
|
||||
case "addNoteToMap":
|
||||
createNewNote(noteId, e);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
selectMenuItemHandler: () => {
|
||||
// Nothing to do, as the commands handle themselves.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import note_tooltip from "../../../services/note_tooltip.js";
|
||||
import openContextMenu from "./context_menu.js";
|
||||
import server from "../../../services/server.js";
|
||||
import { moveMarker } from "./editing.js";
|
||||
import appContext from "../../../components/app_context.js";
|
||||
import L from "leaflet";
|
||||
|
||||
let gpxLoaded = false;
|
||||
|
||||
@ -29,7 +31,7 @@ export default function processNoteWithMarker(map: Map, note: FNote, location: s
|
||||
newMarker.on("mousedown", ({ originalEvent }) => {
|
||||
// Middle click to open in new tab
|
||||
if (originalEvent.button === 1) {
|
||||
const hoistedNoteId = this.hoistedNoteId;
|
||||
const hoistedNoteId = appContext.tabManager.getActiveContext()?.hoistedNoteId;
|
||||
//@ts-ignore, fix once tab manager is ported.
|
||||
appContext.tabManager.openInNewTab(note.noteId, hoistedNoteId);
|
||||
return true;
|
||||
@ -51,7 +53,7 @@ export default function processNoteWithMarker(map: Map, note: FNote, location: s
|
||||
|
||||
export async function processNoteWithGpxTrack(map: Map, note: FNote) {
|
||||
if (!gpxLoaded) {
|
||||
await import("leaflet-gpx");
|
||||
const GPX = await import("leaflet-gpx");
|
||||
gpxLoaded = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user