diff --git a/src/components/md-deck/editor-panel/LayerEditorPanel.tsx b/src/components/md-deck/editor-panel/LayerEditorPanel.tsx index 0c6e33a..06a43ac 100644 --- a/src/components/md-deck/editor-panel/LayerEditorPanel.tsx +++ b/src/components/md-deck/editor-panel/LayerEditorPanel.tsx @@ -3,6 +3,7 @@ import { DragDropProvider, DragDropSensors, SortableProvider, + useDragDropContext, closestCenter, } from "@thisbeyond/solid-dnd"; import type { DeckStore } from "../hooks/deckStore"; @@ -24,6 +25,10 @@ function LayerEditorPanel(props: LayerEditorPanelProps) { side() === "front" ? store.state.frontLayerConfigs : store.state.backLayerConfigs; + + // Stable IDs for SortableProvider — simply the indices + const ids = createMemo(() => layers().map((_, i) => i)); + const updater = () => side() === "front" ? store.actions.updateFrontLayerConfig @@ -32,8 +37,7 @@ function LayerEditorPanel(props: LayerEditorPanelProps) { const availableFields = createMemo(() => { const cards = store.state.cards; if (!cards?.length) return []; - const used = new Set(layers().map((l) => l.prop)); - return Object.keys(cards[0]).filter((k) => k !== "label" && !used.has(k)); + return Object.keys(cards[0]).filter((k) => k !== "label"); }); const update = ( @@ -73,40 +77,37 @@ function LayerEditorPanel(props: LayerEditorPanelProps) { class="absolute top-full left-0 mt-1 w-full bg-white border border-gray-300 rounded shadow-lg z-20 max-h-48 overflow-y-auto" onClick={(e) => e.stopPropagation()} > - {availableFields().length === 0 ? ( -