From 4155dfde5c961bb0eb3435bfa212a4117a88b95d Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 24 Nov 2021 14:17:11 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=2053418=20-=20Client.Files.Drag?= =?UTF-8?q?=E2=80=99n=E2=80=99drop.=20Fixed=20dragging=20file=20by=20filen?= =?UTF-8?q?ame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- products/ASC.Files/Client/src/HOCs/withFileActions.js | 2 +- .../ASC.Files/Client/src/pages/Home/Section/Body/index.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withFileActions.js b/products/ASC.Files/Client/src/HOCs/withFileActions.js index 47ecf0ec631..1a3efb444ba 100644 --- a/products/ASC.Files/Client/src/HOCs/withFileActions.js +++ b/products/ASC.Files/Client/src/HOCs/withFileActions.js @@ -89,7 +89,7 @@ export default function withFileActions(WrappedFileItem) { } e.preventDefault(); setTooltipPosition(e.pageX, e.pageY); - !isFileName && setStartDrag(true); + setStartDrag(true); !isActive && setBufferSelection(null); }; diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js index 83418019825..f363d7686d2 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js @@ -11,6 +11,7 @@ import TableView from "./TableView/TableContainer"; import { Consumer } from "@appserver/components/utils/context"; let currentDroppable = null; +let isDragActive = false; const SectionBodyContent = (props) => { const { @@ -80,6 +81,7 @@ const SectionBodyContent = (props) => { return false; } + isDragActive = true; if (!dragging) { document.body.classList.add("drag-cursor"); setDragging(true); @@ -135,9 +137,10 @@ const SectionBodyContent = (props) => { const elem = e.target.closest(".droppable"); const title = elem && elem.dataset.title; const value = elem && elem.getAttribute("value"); - if ((!value && !treeValue) || isRecycleBinFolder) { + if ((!value && !treeValue) || isRecycleBinFolder || !isDragActive) { setDragging(false); setStartDrag(false); + isDragActive = false; return; } @@ -146,6 +149,7 @@ const SectionBodyContent = (props) => { setStartDrag(false); setDragging(false); onMoveTo(folderId, title); + isDragActive = false; return; }; @@ -228,8 +232,6 @@ export default inject( fileActionId: fileActionStore.id, isEmptyFilesList, setDragging, - startDrag, - setStartDrag, folderId: selectedFolderStore.id, setTooltipPosition, isRecycleBinFolder: treeFoldersStore.isRecycleBinFolder,