mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
chore(react/collections/geomap): fix editability
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import Map from "./map";
|
import Map from "./map";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
import { ViewModeProps } from "../interface";
|
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 { DEFAULT_MAP_LAYER_NAME } from "./map_layer";
|
||||||
import { divIcon, LatLng } from "leaflet";
|
import { divIcon, LatLng } from "leaflet";
|
||||||
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
|
import { useCallback, useEffect, useMemo, useState } from "preact/hooks";
|
||||||
@@ -26,7 +26,7 @@ interface MapData {
|
|||||||
|
|
||||||
export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<MapData>) {
|
export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<MapData>) {
|
||||||
const [ layerName ] = useNoteLabel(note, "map:style");
|
const [ layerName ] = useNoteLabel(note, "map:style");
|
||||||
const [ isReadOnly ] = useNoteLabel(note, "readOnly");
|
const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly");
|
||||||
const [ notes, setNotes ] = useState<FNote[]>([]);
|
const [ notes, setNotes ] = useState<FNote[]>([]);
|
||||||
const spacedUpdate = useSpacedUpdate(() => {
|
const spacedUpdate = useSpacedUpdate(() => {
|
||||||
if (viewConfig) {
|
if (viewConfig) {
|
||||||
@@ -85,7 +85,7 @@ function NoteMarker({ note, editable }: { note: FNote, editable: boolean }) {
|
|||||||
icon={icon}
|
icon={icon}
|
||||||
mouseDown={onMouseDown}
|
mouseDown={onMouseDown}
|
||||||
draggable={editable}
|
draggable={editable}
|
||||||
dragged={onDragged}
|
dragged={editable ? onDragged : undefined}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export interface MarkerProps {
|
|||||||
coordinates: [ number, number ];
|
coordinates: [ number, number ];
|
||||||
icon?: Icon | DivIcon;
|
icon?: Icon | DivIcon;
|
||||||
mouseDown?: (e: MouseEvent) => void;
|
mouseDown?: (e: MouseEvent) => void;
|
||||||
dragged: ((newCoordinates: LatLng) => void)
|
dragged?: ((newCoordinates: LatLng) => void);
|
||||||
draggable?: boolean;
|
draggable?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user