From dccd09dd89572f363e6f863a2a8d1e5291ea776e Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Thu, 9 Jun 2022 10:23:02 +0300 Subject: [PATCH 1/4] Web: Files: added prop 'id' for list items --- .../src/pages/Home/Section/Body/RowsView/FilesRowContainer.js | 1 + .../src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js | 2 ++ .../src/pages/Home/Section/Body/TableView/TableContainer.js | 1 + .../Client/src/pages/Home/Section/Body/TableView/TableRow.js | 2 ++ .../Client/src/pages/Home/Section/Body/TilesView/FileTile.js | 3 ++- .../pages/Home/Section/Body/TilesView/FilesTileContainer.js | 2 ++ 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js index 2ac612c471..89a991d15e 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/FilesRowContainer.js @@ -88,6 +88,7 @@ const FilesRowContainer = ({ > {filesList.map((item, index) => ( { isAdmin, getContextModel, showHotkeyBorder, + id, } = props; const withAccess = isAdmin || item.access === 0; @@ -231,6 +232,7 @@ const SimpleFilesRow = (props) => { return ( {filesList.map((item, index) => ( { getContextModel, showHotkeyBorder, tableColumns, + id, } = props; const { acceptBackground, background } = theme.dragAndDrop; @@ -341,6 +342,7 @@ const FilesTableRow = (props) => { return ( { onHideContextMenu, thumbSize, setSelection, + id, } = props; const temporaryExtension = @@ -59,7 +60,7 @@ const FileTile = (props) => { ); return ( -
+
{ {filesList.map((item, index) => { return index == 0 ? ( { /> ) : ( Date: Thu, 9 Jun 2022 10:24:00 +0300 Subject: [PATCH 2/4] Web: Files: fixed scroll to item for table view --- .../ASC.Files/Client/src/pages/Home/Section/Body/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 6ea093c544..f53be01ba4 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 @@ -74,9 +74,7 @@ const SectionBodyContent = (props) => { if (scrollToItem) { const { type, id } = scrollToItem; - const targetElement = document.querySelector( - `div[value='${type}_${id}_draggable']` - ); + const targetElement = document.getElementById(`${type}_${id}`); if (!targetElement) return; @@ -89,7 +87,7 @@ const SectionBodyContent = (props) => { const count = filesList.findIndex((elem) => elem.id === scrollToItem.id) * - (isMobileOnly ? 57 : 48); + (isMobileOnly ? 57 : viewAs === "table" ? 40 : 48); bodyScroll.scrollTo(0, count); } From 2aa0bc254a2795cf096bb313159ae0e2daa17ee0 Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Thu, 9 Jun 2022 11:03:06 +0300 Subject: [PATCH 3/4] Web: Files: fixed selector --- products/ASC.Files/Client/src/pages/Home/Section/Body/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 f53be01ba4..5bda4ba56b 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 @@ -82,7 +82,7 @@ const SectionBodyContent = (props) => { if (!isInViewport || viewAs === "table") { const bodyScroll = isMobileOnly - ? document.querySelector("#customScrollBar > div") + ? document.querySelector("#customScrollBar > .scroll-body") : document.querySelector(".section-scroll"); const count = From 67ec336b6067343241308a90275968213d74be00 Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Thu, 9 Jun 2022 13:05:29 +0300 Subject: [PATCH 4/4] Web: Files: changed setSelection to setBufferSelection when scroll to item --- .../Client/src/pages/Home/MediaViewer/index.js | 10 +++++----- products/ASC.Files/Client/src/store/FilesStore.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js b/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js index 2a55c9834d..20543cf271 100644 --- a/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js +++ b/products/ASC.Files/Client/src/pages/Home/MediaViewer/index.js @@ -31,7 +31,7 @@ const FilesMediaViewer = (props) => { expandedKeys, setScrollToItem, setCurrentId, - setSelection, + setBufferSelection, } = props; useEffect(() => { @@ -126,7 +126,7 @@ const FilesMediaViewer = (props) => { setIsLoading(false); setFirstLoad(false); setScrollToItem({ id: previewFile.id, type: "file" }); - setSelection([previewFile]); + setBufferSelection(previewFile); setToPreviewFile(null); }); } @@ -142,7 +142,7 @@ const FilesMediaViewer = (props) => { setScrollToItem({ id: currentMediaFileId, type: "file" }); const targetFile = files.find((item) => item.id === currentMediaFileId); - if (targetFile) setSelection([targetFile]); + if (targetFile) setBufferSelection(targetFile); window.history.replaceState(null, null, url); } @@ -189,7 +189,7 @@ export default inject( setIsLoading, setFirstLoad, setScrollToItem, - setSelection, + setBufferSelection, } = filesStore; const { visible, @@ -225,7 +225,7 @@ export default inject( expandedKeys, setScrollToItem, setCurrentId, - setSelection, + setBufferSelection, }; } )( diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 1395560144..71807481d1 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -681,7 +681,7 @@ class FilesStore { ); if (newItem) { - this.setSelection([newItem]); + this.setBufferSelection(newItem); this.setScrollToItem({ id: newItem.id, type: this.createdItem.type,