mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
clean package.json and repair code style (#2411)
* clean package.json and repair code style * update css style * repair bug
This commit is contained in:
committed by
Daniel Pan
parent
3ab4cbff4f
commit
3a67d78016
@@ -52,7 +52,7 @@ class Node {
|
||||
return this.name;
|
||||
} else {
|
||||
let p = this.parent.path;
|
||||
return p === "/" ? (p + this.name) : (p + "/" + this.name);
|
||||
return p === '/' ? (p + this.name) : (p + '/' + this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,12 +65,12 @@ class Node {
|
||||
}
|
||||
|
||||
isMarkdown() {
|
||||
let index = this.name.lastIndexOf(".");
|
||||
let index = this.name.lastIndexOf('.');
|
||||
if (index == -1) {
|
||||
return false;
|
||||
} else {
|
||||
let type = this.name.substring(index).toLowerCase();
|
||||
if (type == ".md" || type == ".markdown") {
|
||||
if (type == '.md' || type == '.markdown') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -79,16 +79,16 @@ class Node {
|
||||
}
|
||||
|
||||
isDir() {
|
||||
return this.type == "dir";
|
||||
return this.type == 'dir';
|
||||
}
|
||||
|
||||
isImage() {
|
||||
let index = this.name.lastIndexOf(".");
|
||||
let index = this.name.lastIndexOf('.');
|
||||
if (index == -1) {
|
||||
return false;
|
||||
} else {
|
||||
let type = this.name.substring(index).toLowerCase();
|
||||
if (type == ".png" || type == ".jpg") {
|
||||
if (type == '.png' || type == '.jpg') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -97,7 +97,7 @@ class Node {
|
||||
}
|
||||
|
||||
serializeToJson() {
|
||||
var children = []
|
||||
var children = [];
|
||||
if (this.hasChildren()) {
|
||||
children = this.children.map(m => m.toJSON());
|
||||
}
|
||||
@@ -111,9 +111,9 @@ class Node {
|
||||
parent_path: this.parent_path,
|
||||
isExpanded: this.isExpanded,
|
||||
children: children
|
||||
}
|
||||
};
|
||||
|
||||
return object
|
||||
return object;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@ import MenuControl from '../menu-component/node-menu-control';
|
||||
import { permission } from '../constants';
|
||||
|
||||
function sortByType(a, b) {
|
||||
if (a.type == "dir" && b.type != "dir") {
|
||||
if (a.type == 'dir' && b.type != 'dir') {
|
||||
return -1;
|
||||
} else if (a.type != "dir" && b.type == "dir") {
|
||||
} else if (a.type != 'dir' && b.type == 'dir') {
|
||||
return 1;
|
||||
} else {
|
||||
return a.name.localeCompare(b.name);
|
||||
@@ -18,7 +18,7 @@ class TreeNodeView extends React.Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
isMenuIconShow: false
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
onClick = (e) => {
|
||||
@@ -31,7 +31,7 @@ class TreeNodeView extends React.Component {
|
||||
if (!this.props.isNodeItemFrezee) {
|
||||
this.setState({
|
||||
isMenuIconShow: true
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class TreeNodeView extends React.Component {
|
||||
if (!this.props.isNodeItemFrezee) {
|
||||
this.setState({
|
||||
isMenuIconShow: false
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ class TreeNodeView extends React.Component {
|
||||
onClick={this.onMenuControlClick}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -146,13 +146,13 @@ class TreeNodeView extends React.Component {
|
||||
icon = <i className="far fa-folder"/>;
|
||||
type = 'dir';
|
||||
} else {
|
||||
let index = node.name.lastIndexOf(".");
|
||||
let index = node.name.lastIndexOf('.');
|
||||
if (index === -1) {
|
||||
icon = <i className="far fa-file"/>;
|
||||
type = 'file';
|
||||
} else {
|
||||
type = node.name.substring(index).toLowerCase();
|
||||
if (type === ".png" || type === ".jpg") {
|
||||
if (type === '.png' || type === '.jpg') {
|
||||
icon = <i className="far fa-image"/>;
|
||||
type = 'image';
|
||||
} else {
|
||||
@@ -163,17 +163,15 @@ class TreeNodeView extends React.Component {
|
||||
}
|
||||
|
||||
return { type, icon };
|
||||
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
const styles = {};
|
||||
let node = this.props.node;
|
||||
let { type, icon } = this.getNodeTypeAndIcon();
|
||||
let hlClass = "";
|
||||
let hlClass = '';
|
||||
if (node.path === this.props.currentFilePath) {
|
||||
hlClass = "tree-node-hight-light";
|
||||
hlClass = 'tree-node-hight-light';
|
||||
}
|
||||
|
||||
return (
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import TreeNodeView from './tree-node-view';
|
||||
import editorUtilities from '../../utils/editor-utilties'
|
||||
import editorUtilities from '../../utils/editor-utilties';
|
||||
|
||||
class TreeView extends React.PureComponent {
|
||||
|
||||
@@ -17,8 +17,8 @@ class TreeView extends React.PureComponent {
|
||||
|
||||
onDragStart = (e, node) => {
|
||||
const url = editorUtilities.getFileURL(node);
|
||||
e.dataTransfer.setData("text/uri-list", url);
|
||||
e.dataTransfer.setData("text/plain", url);
|
||||
e.dataTransfer.setData('text/uri-list', url);
|
||||
e.dataTransfer.setData('text/plain', url);
|
||||
}
|
||||
|
||||
onNodeClick = (e, node) => {
|
||||
|
@@ -3,7 +3,7 @@ import moment from 'moment';
|
||||
import { bytesToSize } from '../utils';
|
||||
|
||||
const lang = window.app.config.lang;
|
||||
moment.locale(lang)
|
||||
moment.locale(lang);
|
||||
|
||||
class Tree {
|
||||
|
||||
@@ -201,7 +201,7 @@ class Tree {
|
||||
parseListToTree(nodeList) {
|
||||
|
||||
function getNodePath(parentPath, nodeName) {
|
||||
return parentPath === "/" ? (parentPath + nodeName) : (parentPath + "/" + nodeName);
|
||||
return parentPath === '/' ? (parentPath + nodeName) : (parentPath + '/' + nodeName);
|
||||
}
|
||||
|
||||
let root = new Node({name: '/', type: 'dir', isExpanded: true});
|
||||
@@ -230,7 +230,9 @@ class Tree {
|
||||
for (let node of treeNodeList) {
|
||||
let p = map.get(node.parent_path);
|
||||
if (p === undefined) {
|
||||
console.log("warning: node " + node.parent_path + " not exist");
|
||||
/* eslint-disable */
|
||||
console.log('warning: node ' + node.parent_path + ' not exist');
|
||||
/* eslint-enable */
|
||||
} else {
|
||||
this.addNodeToParent(node, p);
|
||||
}
|
||||
@@ -239,7 +241,7 @@ class Tree {
|
||||
}
|
||||
|
||||
parseNodeToTree(node) {
|
||||
var node = new Node({
|
||||
var newNode = new Node({
|
||||
name: node.name,
|
||||
type: node.type,
|
||||
size: bytesToSize(node.size),
|
||||
@@ -250,10 +252,10 @@ class Tree {
|
||||
});
|
||||
if (node.children instanceof Array) {
|
||||
for (let child of node.children) {
|
||||
this.addNodeToParent(this.parseNodeToTree(child), node);
|
||||
this.addNodeToParent(this.parseNodeToTree(child), newNode);
|
||||
}
|
||||
}
|
||||
return node;
|
||||
return newNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user