From 0f9a5296479ea544e9f62a52d49619f90f2f7f80 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 4 Sep 2025 16:47:38 +0300 Subject: [PATCH] chore(react/collections/geomap): fix editability --- apps/client/src/widgets/collections/geomap/index.tsx | 6 +++--- apps/client/src/widgets/collections/geomap/marker.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsx index dae07753d..7a09d4eb6 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) { const [ layerName ] = useNoteLabel(note, "map:style"); - const [ isReadOnly ] = useNoteLabel(note, "readOnly"); + const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly"); const [ notes, setNotes ] = useState([]); 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 53ec84ab8..5c250097b 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; }