From ff556aeb4fc6165a5f532fa92293dba369350030 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 30 May 2024 15:01:27 +0200 Subject: [PATCH] add resetMultiselect --- .../workspace/src/lib/components/file-explorer.tsx | 7 +++++++ .../workspace/src/lib/components/flat-tree-drop.tsx | 1 + libs/remix-ui/workspace/src/lib/components/flat-tree.tsx | 2 ++ libs/remix-ui/workspace/src/lib/types/index.ts | 1 + 4 files changed, 11 insertions(+) diff --git a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx index 3d421830a1..10dea83d97 100644 --- a/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx +++ b/libs/remix-ui/workspace/src/lib/components/file-explorer.tsx @@ -315,6 +315,12 @@ export const FileExplorer = (props: FileExplorerProps) => { } } + const resetMultiselect = () => { + setState((prevState) => { + return { ...prevState, ctrlKey: false } + }) + } + /** * This offers the ability to move a folder to a new location * without showing a modal dialong to the user. @@ -420,6 +426,7 @@ export const FileExplorer = (props: FileExplorerProps) => { warnMovingItems={warnMovingItems} moveFolderSilently={moveFolderSilently} moveFileSilently={moveFileSilently} + resetMultiselect={resetMultiselect} setFilesSelected={setFilesSelected} handleClickFolder={handleClickFolder} createNewFile={props.createNewFile} diff --git a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx index 75697137b2..d049a2bb6c 100644 --- a/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx +++ b/libs/remix-ui/workspace/src/lib/components/flat-tree-drop.tsx @@ -86,6 +86,7 @@ export const FlatTreeDrop = (props: FlatTreeDropProps) => { } }) await Promise.all(promises) + props.resetMultiselect() } return (
void moveFolderSilently: (dest: string, src: string) => Promise moveFileSilently: (dest: string, src: string) => Promise + resetMultiselect: () => void setFilesSelected: Dispatch> fileState: fileDecoration[] createNewFile?: any @@ -263,6 +264,7 @@ export const FlatTree = (props: FlatTreeProps) => { warnMovingItems={warnMovingItems} moveFolderSilently={moveFolderSilently} moveFileSilently={moveFileSilently} + resetMultiselect={props.resetMultiselect} setFilesSelected={setFilesSelected} handleClickFolder={handleClickFolder} expandPath={expandPath} diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index af6f5d95ac..684bf80046 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -346,6 +346,7 @@ export type Actions = {[A in keyof ActionPayloadTypes]: Action}[keyof ActionP export type WorkspaceElement = 'folder' | 'file' | 'workspace' export interface FlatTreeDropProps { + resetMultiselect: () => void moveFolderSilently: (dest: string, src: string) => Promise moveFileSilently: (dest: string, src: string) => Promise setFilesSelected: Dispatch>