mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +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 = [
|
||||||
...items,
|
...items,
|
||||||
{ title: "----" },
|
{ 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,
|
x: e.originalEvent.pageX,
|
||||||
y: e.originalEvent.pageY,
|
y: e.originalEvent.pageY,
|
||||||
items,
|
items,
|
||||||
selectMenuItemHandler: ({ command }) => {
|
selectMenuItemHandler: () => {
|
||||||
switch (command) {
|
// Nothing to do, as the commands handle themselves.
|
||||||
case "addNoteToMap":
|
|
||||||
createNewNote(noteId, e);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@ import note_tooltip from "../../../services/note_tooltip.js";
|
|||||||
import openContextMenu from "./context_menu.js";
|
import openContextMenu from "./context_menu.js";
|
||||||
import server from "../../../services/server.js";
|
import server from "../../../services/server.js";
|
||||||
import { moveMarker } from "./editing.js";
|
import { moveMarker } from "./editing.js";
|
||||||
|
import appContext from "../../../components/app_context.js";
|
||||||
|
import L from "leaflet";
|
||||||
|
|
||||||
let gpxLoaded = false;
|
let gpxLoaded = false;
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ export default function processNoteWithMarker(map: Map, note: FNote, location: s
|
|||||||
newMarker.on("mousedown", ({ originalEvent }) => {
|
newMarker.on("mousedown", ({ originalEvent }) => {
|
||||||
// Middle click to open in new tab
|
// Middle click to open in new tab
|
||||||
if (originalEvent.button === 1) {
|
if (originalEvent.button === 1) {
|
||||||
const hoistedNoteId = this.hoistedNoteId;
|
const hoistedNoteId = appContext.tabManager.getActiveContext()?.hoistedNoteId;
|
||||||
//@ts-ignore, fix once tab manager is ported.
|
//@ts-ignore, fix once tab manager is ported.
|
||||||
appContext.tabManager.openInNewTab(note.noteId, hoistedNoteId);
|
appContext.tabManager.openInNewTab(note.noteId, hoistedNoteId);
|
||||||
return true;
|
return true;
|
||||||
@ -51,7 +53,7 @@ export default function processNoteWithMarker(map: Map, note: FNote, location: s
|
|||||||
|
|
||||||
export async function processNoteWithGpxTrack(map: Map, note: FNote) {
|
export async function processNoteWithGpxTrack(map: Map, note: FNote) {
|
||||||
if (!gpxLoaded) {
|
if (!gpxLoaded) {
|
||||||
await import("leaflet-gpx");
|
const GPX = await import("leaflet-gpx");
|
||||||
gpxLoaded = true;
|
gpxLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user