Skip to content

Commit 3898e76

Browse files
committed
fix select all
1 parent ef9bb63 commit 3898e76

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

packages/learningmap/src/LearningMapEditor.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ export function LearningMapEditor({
309309
const addNewNode = useCallback(
310310
(type: "task" | "topic" | "image" | "text") => {
311311
// Use last mouse position if available, otherwise use center of screen
312-
const position = lastMousePosition
312+
const position = lastMousePosition
313313
? screenToFlowPosition(lastMousePosition)
314314
: screenToFlowPosition({ x: window.innerWidth / 2, y: window.innerHeight / 2 });
315-
315+
316316
if (type === "task") {
317317
const newNode: Node<NodeData> = {
318318
id: `node${nextNodeId}`,
@@ -686,7 +686,10 @@ export function LearningMapEditor({
686686
}, [setNodes, setEdges, setNextNodeId, setSaved, t]);
687687

688688
const handleSelectAll = useCallback(() => {
689-
setSelectedNodeIds(nodes.map(n => n.id));
689+
setNodes(nds => nds.map(n => ({
690+
...n,
691+
selected: true,
692+
})))
690693
}, [nodes, setSelectedNodeIds]);
691694

692695
const handleSelectionChange: OnSelectionChangeFunc = useCallback(

0 commit comments

Comments
 (0)