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 (this.needScroll) {
console.log("this.needScroll", this.needScroll);
if (item.parentId.toString() === parentId.toString()) {
if (index === this.child) {
if (item.parentId.toString() === parentId?.toString()) {
if (index === this.childLength) {
this.props.setIsLoadingNodes(false);
const selectedNode = document.getElementsByClassName(
"rc-tree-node-selected"
)[0];
if (selectedNode) {
this.needScroll = false;
document
.querySelector("#folder-tree-scroll-bar > .scroll-body")
.scrollTo(0, selectedNode.offsetTop + index * 36);
@ -343,11 +343,11 @@ class TreeFolders extends React.Component {
};
getNewTreeData(treeData, curId, child, pos) {
this.child = null;
this.childLength = null;
!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.child = child.length - 1;
this.childLength = child.length - 1;
}
this.loop(treeData, child, pos);
this.setLeaf(treeData, curId, 10);