1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 03:47:09 +00:00

Fix eslint warnings (#5635)

* 01 fix eslint warnings

* fix code warnings

* fix code warnings

* fix code warnings

* fix code warnings

* fix code warnings
This commit is contained in:
Michael An
2023-09-13 08:40:50 +08:00
committed by GitHub
parent d829ba5b23
commit 14ce391007
520 changed files with 4774 additions and 3438 deletions

View File

@@ -68,13 +68,13 @@ class IndexContentViewer extends React.Component {
this.links.forEach(link => {
link.addEventListener('click', this.onLinkClick);
});
}
};
removeClickEvent = () => {
this.links.forEach(link => {
link.removeEventListener('click', this.onLinkClick);
});
}
};
onLinkClick = (event) => {
event.preventDefault();
@@ -86,7 +86,7 @@ class IndexContentViewer extends React.Component {
}
const link = this.getLink(event.target);
if (link) this.props.onLinkClick(link);
}
};
getLink = (node) => {
const tagName = node.tagName;
@@ -96,7 +96,7 @@ class IndexContentViewer extends React.Component {
} else {
return this.getLink(node.parentNode);
}
}
};
changeInlineNode = (item) => {
if (item.type == 'link' || item.type === 'image') {
@@ -145,30 +145,30 @@ class IndexContentViewer extends React.Component {
}
return item;
}
};
getRootNode = () => {
let value = deserialize(this.props.indexContent);
const newNodes = Utils.changeMarkdownNodes(value, this.changeInlineNode);
newNodes.map((node) => {
newNodes.forEach((node) => {
if (node.type === 'unordered_list' || node.type === 'ordered_list') {
let treeRoot = this.transSlateToTree(node.children, this.treeRoot);
this.setNodePath(treeRoot, '/');
this.treeRoot = treeRoot;
}
});
}
};
setNodePath = (node, parentNodePath) => {
let name = node.name;
let path = parentNodePath === '/' ? parentNodePath + name : parentNodePath + '/' + name;
node.path = path;
if (node.children.length > 0) {
node.children.map(child => {
node.children.forEach(child => {
this.setNodePath(child, path);
});
}
}
};
// slateNodes is list items of an unordered list or ordered list, translate them to treeNode and add to parentTreeNode
transSlateToTree = (slateNodes, parentTreeNode) => {
@@ -194,7 +194,7 @@ class IndexContentViewer extends React.Component {
});
parentTreeNode.addChildren(treeNodes);
return parentTreeNode;
}
};
// translate slate_paragraph_node to treeNode
transParagraph = (paragraphNode) => {
@@ -214,7 +214,7 @@ class IndexContentViewer extends React.Component {
treeNode = new TreeNode({ name: '', href: '' });
}
return treeNode;
}
};
render() {
return (
@@ -246,7 +246,7 @@ class FolderItem extends React.Component {
this.setState({ expanded: !this.state.expanded }, () => {
if (this.state.expanded) this.props.bindClickEvent();
});
}
};
renderLink = ({ href, name, path }) => {
const className = `wiki-nav-content ${path === this.props.currentPath ? 'wiki-nav-content-highlight' : ''}`;
@@ -257,7 +257,7 @@ class FolderItem extends React.Component {
} else {
return null;
}
}
};
componentDidMount() {
if (this.props.node && !this.props.node.parentNode) {