Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections/geomap): fix editability

Elian Doran0f9a5296479e
diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsx
index dae07753d5..7a09d4eb6b 100644
--- a/apps/client/src/widgets/collections/geomap/index.tsx
+++ b/apps/client/src/widgets/collections/geomap/index.tsx
@@ -1,7 +1,7 @@
import Map from "./map";
import "./index.css";
import { ViewModeProps } from "../interface";
-import { useNoteLabel, useNoteProperty, useSpacedUpdate } from "../../react/hooks";
+import { useNoteLabel, useNoteLabelBoolean, useNoteProperty, useSpacedUpdate } from "../../react/hooks";
import { DEFAULT_MAP_LAYER_NAME } from "./map_layer";
import { divIcon, LatLng } from "leaflet";
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
@@ -26,7 +26,7 @@ interface MapData {
export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<MapData>) {
const [ layerName ] = useNoteLabel(note, "map:style");
- const [ isReadOnly ] = useNoteLabel(note, "readOnly");
+ const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly");
const [ notes, setNotes ] = useState<FNote[]>([]);
const spacedUpdate = useSpacedUpdate(() => {
if (viewConfig) {
@@ -85,7 +85,7 @@ function NoteMarker({ note, editable }: { note: FNote, editable: boolean }) {
icon={icon}
mouseDown={onMouseDown}
draggable={editable}
- dragged={onDragged}
+ dragged={editable ? onDragged : undefined}
/>
}
diff --git a/apps/client/src/widgets/collections/geomap/marker.tsx b/apps/client/src/widgets/collections/geomap/marker.tsx
index 53ec84ab89..5c250097bd 100644
--- a/apps/client/src/widgets/collections/geomap/marker.tsx
+++ b/apps/client/src/widgets/collections/geomap/marker.tsx
@@ -6,7 +6,7 @@ export interface MarkerProps {
coordinates: [ number, number ];
icon?: Icon | DivIcon;
mouseDown?: (e: MouseEvent) => void;
- dragged: ((newCoordinates: LatLng) => void)
+ dragged?: ((newCoordinates: LatLng) => void);
draggable?: boolean;
}