Web: Files: Scroll down is removed if you selected a folder. Renaming a variable.

This commit is contained in:
Tatiana Lopaeva 2022-05-19 09:32:37 +03:00
parent 89b607240e
commit 79f79a252a

View File

@ -237,14 +237,14 @@ class TreeFolders extends React.Component {
if (dragging) value = `${item.id} dragging ${provider}`; if (dragging) value = `${item.id} dragging ${provider}`;
if (this.needScroll) { if (this.needScroll) {
console.log("this.needScroll", this.needScroll); if (item.parentId.toString() === parentId?.toString()) {
if (item.parentId.toString() === parentId.toString()) { if (index === this.childLength) {
if (index === this.child) {
this.props.setIsLoadingNodes(false); this.props.setIsLoadingNodes(false);
const selectedNode = document.getElementsByClassName( const selectedNode = document.getElementsByClassName(
"rc-tree-node-selected" "rc-tree-node-selected"
)[0]; )[0];
if (selectedNode) { if (selectedNode) {
this.needScroll = false;
document document
.querySelector("#folder-tree-scroll-bar > .scroll-body") .querySelector("#folder-tree-scroll-bar > .scroll-body")
.scrollTo(0, selectedNode.offsetTop + index * 36); .scrollTo(0, selectedNode.offsetTop + index * 36);
@ -343,11 +343,11 @@ class TreeFolders extends React.Component {
}; };
getNewTreeData(treeData, curId, child, pos) { getNewTreeData(treeData, curId, child, pos) {
this.child = null; this.childLength = null;
!this.expand && this.props.setIsLoadingNodes(true); !this.expand && this.props.setIsLoadingNodes(true);
if (!this.expand && curId.toString() === this.props.parentId.toString()) { if (!this.expand && curId.toString() === this.props.parentId?.toString()) {
this.needScroll = true; this.needScroll = true;
this.child = child.length - 1; this.childLength = child.length - 1;
} }
this.loop(treeData, child, pos); this.loop(treeData, child, pos);
this.setLeaf(treeData, curId, 10); this.setLeaf(treeData, curId, 10);