git commit -m "fix: Station öffnen im Kontextmenü für POIs deaktiviert"
This commit is contained in:
@@ -38,6 +38,7 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
|
||||
text: "Station öffnen (Tab)",
|
||||
icon: "/img/screen_new.png",
|
||||
callback: (e) => {
|
||||
const editMode = localStorage.getItem("editMode") === "true";
|
||||
const clickedElement = e.relatedTarget;
|
||||
|
||||
if (!clickedElement) {
|
||||
@@ -45,12 +46,18 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
|
||||
return;
|
||||
}
|
||||
|
||||
// Prüfen, ob es ein POI ist (POIs haben idPoi in den Optionen)
|
||||
if (clickedElement instanceof L.Marker && clickedElement.options?.idPoi) {
|
||||
console.log("POI erkannt - Station öffnen deaktiviert.");
|
||||
return; // Keine Aktion ausführen
|
||||
}
|
||||
|
||||
try {
|
||||
if (clickedElement instanceof L.Marker || clickedElement?.options?.link) {
|
||||
const link = "http://" + window.location.hostname + "/talas5/devices/" + clickedElement.options.link;
|
||||
if (link) {
|
||||
console.log("Opening link in a new tab:", link);
|
||||
window.open(link, "_blank");
|
||||
//window.open(link, "_blank"); POI-Link öffnen in neuem Tab
|
||||
} else {
|
||||
console.error("No link found in the Marker options.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user