+
{ this.props.isViewFileState && {
const downLoadUrl = res.data;
@@ -70,20 +71,20 @@ class Wiki extends Component {
this.setState({
content: res.data,
isFileLoading: false
- })
- })
+ });
+ });
});
- })
+ });
let fileUrl = serviceUrl + '/wiki/lib/' + repoID + filePath;
window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
}
}, () => {
- console.log("failed to load files");
+ console.log('failed to load files');
this.setState({
isLoadFailed: true
- })
- })
+ });
+ });
}
initMainPanelData(filePath) {
@@ -97,7 +98,7 @@ class Wiki extends Component {
lastModified: moment.unix(mtime).fromNow(),
permission: permission,
filePath: filePath,
- })
+ });
seafileAPI.getFileDownloadLink(repoID, filePath).then((res) => {
const downLoadUrl = res.data;
@@ -105,29 +106,29 @@ class Wiki extends Component {
this.setState({
content: res.data,
isFileLoading: false
- })
+ });
});
- })
- })
+ });
+ });
- let fileUrl = serviceUrl + '/wiki/lib/' + repoID + filePath;
- window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
+ let fileUrl = serviceUrl + '/wiki/lib/' + repoID + filePath;
+ window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
}
switchViewMode = (mode) => {
let dirPath;
- let tree = this.state.tree_data
- let node = tree.getNodeByPath(this.state.filePath)
+ let tree = this.state.tree_data;
+ let node = tree.getNodeByPath(this.state.filePath);
if (node.isDir()) {
- dirPath = this.state.filePath
+ dirPath = this.state.filePath;
} else {
const index = this.state.filePath.lastIndexOf('/');
dirPath = this.state.filePath.substring(0, index);
}
- cookie.save("view_mode", mode, { path: '/' })
+ cookie.save('view_mode', mode, { path: '/' });
- window.location.href = serviceUrl + "/#common/lib/" + repoID + dirPath;
+ window.location.href = serviceUrl + '/#common/lib/' + repoID + dirPath;
}
onLinkClick = (event) => {
@@ -220,25 +221,25 @@ class Wiki extends Component {
onMenuClick = () => {
this.setState({
closeSideBar: !this.state.closeSideBar,
- })
+ });
}
onCloseSide = () => {
this.setState({
closeSideBar: !this.state.closeSideBar,
- })
+ });
}
onAddFolderNode = (dirPath) => {
editorUtilities.createDir(dirPath).then(res => {
let tree = this.state.tree_data.clone();
let name = this.getFileNameByPath(dirPath);
- let index = dirPath.lastIndexOf("/");
+ let index = dirPath.lastIndexOf('/');
let parentPath = dirPath.substring(0, index);
if (!parentPath) {
- parentPath = "/";
+ parentPath = '/';
}
- let node = this.buildNewNode(name, "dir");
+ let node = this.buildNewNode(name, 'dir');
let parentNode = tree.getNodeByPath(parentPath);
tree.addNodeToParent(node, parentNode);
if (this.state.isViewFileState) {
@@ -246,23 +247,23 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: node
- })
+ });
} else {
this.exitViewFileState(tree, parentNode);
}
- })
+ });
}
onAddFileNode = (filePath) => {
editorUtilities.createFile(filePath).then(res => {
let tree = this.state.tree_data.clone();
let name = this.getFileNameByPath(filePath);
- let index = filePath.lastIndexOf("/");
+ let index = filePath.lastIndexOf('/');
let parentPath = filePath.substring(0, index);
if (!parentPath) {
- parentPath = "/";
+ parentPath = '/';
}
- let node = this.buildNewNode(name, "file");
+ let node = this.buildNewNode(name, 'file');
let parentNode = tree.getNodeByPath(parentPath);
tree.addNodeToParent(node, parentNode);
if (this.state.isViewFileState) {
@@ -270,11 +271,11 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: node
- })
+ });
} else {
this.exitViewFileState(tree, parentNode);
}
- })
+ });
}
onRenameNode = (node, newName) => {
@@ -284,10 +285,10 @@ class Wiki extends Component {
editorUtilities.renameFile(filePath, newName).then(res => {
let cloneNode = node.clone();
- tree.updateNodeParam(node, "name", newName);
+ tree.updateNodeParam(node, 'name', newName);
node.name = newName;
let date = new Date().getTime()/1000;
- tree.updateNodeParam(node, "last_update_time", moment.unix(date).fromNow());
+ tree.updateNodeParam(node, 'last_update_time', moment.unix(date).fromNow());
node.last_update_time = moment.unix(date).fromNow();
if (this.state.isViewFileState) {
@@ -308,7 +309,7 @@ class Wiki extends Component {
changedNode: parentNode
});
}
- })
+ });
} else if (node.isDir()) {
editorUtilities.renameDir(filePath, newName).then(res => {
@@ -316,10 +317,10 @@ class Wiki extends Component {
let currentFileNode = tree.getNodeByPath(currentFilePath);
let nodePath = node.path;
- tree.updateNodeParam(node, "name", newName);
+ tree.updateNodeParam(node, 'name', newName);
node.name = newName;
let date = new Date().getTime()/1000;
- tree.updateNodeParam(node, "last_update_time", moment.unix(date).fromNow());
+ tree.updateNodeParam(node, 'last_update_time', moment.unix(date).fromNow());
node.last_update_time = moment.unix(date).fromNow();
if (this.state.isViewFileState) {
@@ -344,7 +345,7 @@ class Wiki extends Component {
this.setState({tree_data: tree});
}
}
- })
+ });
}
}
@@ -374,10 +375,10 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: homeNode
- })
+ });
this.initMainPanelData(homeNode.path);
} else {
- this.setState({tree_data: tree})
+ this.setState({tree_data: tree});
}
} else {
let parentNode = tree.getNodeByPath(this.state.filePath);
@@ -413,26 +414,26 @@ class Wiki extends Component {
}
getFileNameByPath(path) {
- let index = path.lastIndexOf("/");
+ let index = path.lastIndexOf('/');
if (index === -1) {
- return "";
+ return '';
}
return path.slice(index+1);
}
getHomeNode(treeData) {
- return treeData.getNodeByPath("/home.md");
+ return treeData.getNodeByPath('/home.md');
}
buildNewNode(name, type) {
let date = new Date().getTime()/1000;
let node = new Node({
- name : name,
- type: type,
- size: '0',
- last_update_time: moment.unix(date).fromNow(),
- isExpanded: false,
- children: []
+ name : name,
+ type: type,
+ size: '0',
+ last_update_time: moment.unix(date).fromNow(),
+ isExpanded: false,
+ children: []
});
return node;
}
@@ -454,12 +455,12 @@ class Wiki extends Component {
}
isMarkdownFile(filePath) {
- let index = filePath.lastIndexOf(".");
+ let index = filePath.lastIndexOf('.');
if (index === -1) {
return false;
} else {
let type = filePath.substring(index).toLowerCase();
- if (type === ".md" || type === ".markdown") {
+ if (type === '.md' || type === '.markdown') {
return true;
} else {
return false;
@@ -478,23 +479,23 @@ class Wiki extends Component {
}
getPathFromInternalMarkdownLink(url) {
- var re = new RegExp(serviceUrl + '/lib/' + repoID + '/file' + "(.*\.md)");
+ var re = new RegExp(serviceUrl + '/lib/' + repoID + '/file' + '(.*\.md)');
var array = re.exec(url);
var path = decodeURIComponent(array[1]);
return path;
}
getPathFromInternalDirLink(url) {
- var re = new RegExp(serviceUrl + '/#[a-z\-]*?/lib/' + repoID + "(/.*)");
+ var re = new RegExp(serviceUrl + '/#[a-z\-]*?/lib/' + repoID + '(/.*)');
var array = re.exec(url);
var path = decodeURIComponent(array[1]);
var dirPath = path.substring(1);
- var re = new RegExp("(^/.*)");
+ re = new RegExp('(^/.*)');
if (re.test(dirPath)) {
path = dirPath;
} else {
- path = '/' + dirPath
+ path = '/' + dirPath;
}
return path;
diff --git a/frontend/src/wiki.js b/frontend/src/wiki.js
index aa1ad77b3f..e25b82ca2e 100644
--- a/frontend/src/wiki.js
+++ b/frontend/src/wiki.js
@@ -5,14 +5,15 @@ import MainPanel from './pages/wiki/main-panel';
import moment from 'moment';
import { slug, repoID, serviceUrl, initialFilePath } from './components/constants';
import editorUtilities from './utils/editor-utilties';
-import Node from './components/tree-view/node'
-import Tree from './components/tree-view/tree'
+import Node from './components/tree-view/node';
+import Tree from './components/tree-view/tree';
import 'seafile-ui';
import './assets/css/fa-solid.css';
import './assets/css/fa-regular.css';
import './assets/css/fontawesome.css';
import './css/side-panel.css';
import './css/wiki.css';
+import './css/toolbar.css';
import './css/search.css';
class Wiki extends Component {
@@ -60,18 +61,17 @@ class Wiki extends Component {
permission: res.data.permission,
filePath: filePath,
isFileLoading: false
- })
+ });
});
const hash = window.location.hash;
let fileUrl = serviceUrl + '/wikis/' + slug + filePath + hash;
window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
}
}, () => {
- console.log("failed to load files");
this.setState({
isLoadFailed: true
- })
- })
+ });
+ });
}
initMainPanelData(filePath){
@@ -85,12 +85,12 @@ class Wiki extends Component {
permission: res.data.permission,
filePath: filePath,
isFileLoading: false
- })
- })
+ });
+ });
- const hash = window.location.hash;
- let fileUrl = serviceUrl + '/wikis/' + slug + filePath + hash;
- window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
+ const hash = window.location.hash;
+ let fileUrl = serviceUrl + '/wikis/' + slug + filePath + hash;
+ window.history.pushState({urlPath: fileUrl, filePath: filePath}, filePath, fileUrl);
}
onLinkClick = (event) => {
@@ -183,25 +183,25 @@ class Wiki extends Component {
onMenuClick = () => {
this.setState({
closeSideBar: !this.state.closeSideBar,
- })
+ });
}
onCloseSide = () => {
this.setState({
closeSideBar: !this.state.closeSideBar,
- })
+ });
}
onAddFolderNode = (dirPath) => {
editorUtilities.createDir(dirPath).then(res => {
let tree = this.state.tree_data.clone();
let name = this.getFileNameByPath(dirPath);
- let index = dirPath.lastIndexOf("/");
+ let index = dirPath.lastIndexOf('/');
let parentPath = dirPath.substring(0, index);
if (!parentPath) {
- parentPath = "/";
+ parentPath = '/';
}
- let node = this.buildNewNode(name, "dir");
+ let node = this.buildNewNode(name, 'dir');
let parentNode = tree.getNodeByPath(parentPath);
tree.addNodeToParent(node, parentNode);
if (this.state.isViewFileState) {
@@ -209,23 +209,23 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: node
- })
+ });
} else {
this.exitViewFileState(tree, parentNode);
}
- })
+ });
}
onAddFileNode = (filePath) => {
editorUtilities.createFile(filePath).then(res => {
let tree = this.state.tree_data.clone();
let name = this.getFileNameByPath(filePath);
- let index = filePath.lastIndexOf("/");
+ let index = filePath.lastIndexOf('/');
let parentPath = filePath.substring(0, index);
if (!parentPath) {
- parentPath = "/";
+ parentPath = '/';
}
- let node = this.buildNewNode(name, "file");
+ let node = this.buildNewNode(name, 'file');
let parentNode = tree.getNodeByPath(parentPath);
tree.addNodeToParent(node, parentNode);
if (this.state.isViewFileState) {
@@ -233,11 +233,11 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: node
- })
+ });
} else {
this.exitViewFileState(tree, parentNode);
}
- })
+ });
}
onRenameNode = (node, newName) => {
@@ -247,10 +247,10 @@ class Wiki extends Component {
editorUtilities.renameFile(filePath, newName).then(res => {
let cloneNode = node.clone();
- tree.updateNodeParam(node, "name", newName);
+ tree.updateNodeParam(node, 'name', newName);
node.name = newName;
let date = new Date().getTime()/1000;
- tree.updateNodeParam(node, "last_update_time", moment.unix(date).fromNow());
+ tree.updateNodeParam(node, 'last_update_time', moment.unix(date).fromNow());
node.last_update_time = moment.unix(date).fromNow();
if (this.state.isViewFileState) {
@@ -271,7 +271,7 @@ class Wiki extends Component {
changedNode: parentNode
});
}
- })
+ });
} else if (node.isDir()) {
editorUtilities.renameDir(filePath, newName).then(res => {
@@ -279,10 +279,10 @@ class Wiki extends Component {
let currentFileNode = tree.getNodeByPath(currentFilePath);
let nodePath = node.path;
- tree.updateNodeParam(node, "name", newName);
+ tree.updateNodeParam(node, 'name', newName);
node.name = newName;
let date = new Date().getTime()/1000;
- tree.updateNodeParam(node, "last_update_time", moment.unix(date).fromNow());
+ tree.updateNodeParam(node, 'last_update_time', moment.unix(date).fromNow());
node.last_update_time = moment.unix(date).fromNow();
if (this.state.isViewFileState) {
@@ -307,7 +307,7 @@ class Wiki extends Component {
this.setState({tree_data: tree});
}
}
- })
+ });
}
}
@@ -337,10 +337,10 @@ class Wiki extends Component {
this.setState({
tree_data: tree,
changedNode: homeNode
- })
+ });
this.initMainPanelData(homeNode.path);
} else {
- this.setState({tree_data: tree})
+ this.setState({tree_data: tree});
}
} else {
let parentNode = tree.getNodeByPath(this.state.filePath);
@@ -376,26 +376,26 @@ class Wiki extends Component {
}
getFileNameByPath(path) {
- let index = path.lastIndexOf("/");
+ let index = path.lastIndexOf('/');
if (index === -1) {
- return "";
+ return '';
}
return path.slice(index+1);
}
getHomeNode(treeData) {
- return treeData.getNodeByPath("/home.md");
+ return treeData.getNodeByPath('/home.md');
}
buildNewNode(name, type) {
let date = new Date().getTime()/1000;
let node = new Node({
- name : name,
- type: type,
- size: '0',
- last_update_time: moment.unix(date).fromNow(),
- isExpanded: false,
- children: []
+ name : name,
+ type: type,
+ size: '0',
+ last_update_time: moment.unix(date).fromNow(),
+ isExpanded: false,
+ children: []
});
return node;
}
@@ -417,12 +417,12 @@ class Wiki extends Component {
}
isMarkdownFile(filePath) {
- let index = filePath.lastIndexOf(".");
+ let index = filePath.lastIndexOf('.');
if (index === -1) {
return false;
} else {
let type = filePath.substring(index).toLowerCase();
- if (type === ".md" || type === ".markdown") {
+ if (type === '.md' || type === '.markdown') {
return true;
} else {
return false;
@@ -441,23 +441,23 @@ class Wiki extends Component {
}
getPathFromInternalMarkdownLink(url) {
- var re = new RegExp(serviceUrl + '/lib/' + repoID + '/file' + "(.*\.md)");
+ var re = new RegExp(serviceUrl + '/lib/' + repoID + '/file' + '(.*\.md)');
var array = re.exec(url);
var path = decodeURIComponent(array[1]);
return path;
}
getPathFromInternalDirLink(url) {
- var re = new RegExp(serviceUrl + '/#[a-z\-]*?/lib/' + repoID + "(/.*)");
+ var re = new RegExp(serviceUrl + '/#[a-z\-]*?/lib/' + repoID + '(/.*)');
var array = re.exec(url);
var path = decodeURIComponent(array[1]);
var dirPath = path.substring(1);
- var re = new RegExp("(^/.*)");
+ re = new RegExp('(^/.*)');
if (re.test(dirPath)) {
path = dirPath;
} else {
- path = '/' + dirPath
+ path = '/' + dirPath;
}
return path;
@@ -495,11 +495,11 @@ class Wiki extends Component {
onMainNodeClick={this.onMainNodeClick}
/>
- )
+ );
}
}
ReactDOM.render (
,
document.getElementById('wrapper')
-)
+);
diff --git a/media/css/seahub.css b/media/css/seahub.css
index c7005e29f8..9a21e39e27 100644
--- a/media/css/seahub.css
+++ b/media/css/seahub.css
@@ -162,7 +162,6 @@
.sf2-icon-organization:before { content:"\e010"; }
.sf2-icon-share:before { content:"\e011"; }
.sf2-icon-star:before { content:"\e012"; }
-.sf2-icon-wiki:before { content:"\e013"; }
.sf2-icon-history:before { content:"\e014"; }
.sf2-icon-cog1:before { content:"\e015"; }
.sf2-icon-trash:before { content:"\e016"; }
@@ -180,9 +179,11 @@
.sf2-icon-msgs2:before { content:"\e021"; }
/*.sf2-icon-group-settings:before { content:"\e022"; }*/
.sf2-icon-comment:before { content:"\e023"; }
+.sf2-icon-wiki:before { content:"\e013"; }
.sf2-icon-wiki2:before { content:"\e024"; }
.sf2-icon-grid-view:before { content:"\e025"; }
.sf2-icon-list-view:before { content:"\e026"; }
+.sf2-icon-wiki-view:before { content:"\e013"; }
.sf2-icon-plus:before { content: "\e027"; }
.sf2-icon-copy:before { content: "\e028"; }
.sf2-icon-move:before { content: "\e029"; }
@@ -1856,7 +1857,7 @@ button.sf-dropdown-toggle:focus {
}
/**** custom magnificPopup ****/
.mfp-bottom-bar {
- position:relative;
+ position:relative;
}
.mfp-title {
min-width:230px;
@@ -2067,6 +2068,9 @@ button.sf-dropdown-toggle:focus {
background:#fff;
line-height:17px;
}
+.btn-white {
+ height: 30px;
+}
.cur-view-toolbar .btn-white {
min-width: 55px;
}
@@ -4167,6 +4171,7 @@ img.thumbnail {
/* view mode */
.switch-mode {
margin-left:15px;
+ font-size: 0;
}
.wiki-view-icon-btn,
.grid-view-icon-btn,
@@ -4180,14 +4185,27 @@ img.thumbnail {
color:#aaa;
cursor:pointer;
border-radius:0;
+ margin-left: -1px;
}
+.list-view-icon-btn {
+ margin-left: 0;
+}
+
+.wiki-view-icon-btn.active,
.grid-view-icon-btn.active,
.list-view-icon-btn.active {
color:#fff;
background:#ccc;
cursor:default;
}
+
+.view-btn:hover,
+.view-btn:focus,
+.view-btn:active {
+ position: relative;
+ z-index: 1;
+}
/* grid view */
.grid-item {
display:inline-block;
diff --git a/media/css/seahub_react.css b/media/css/seahub_react.css
index e7c21ec715..64e5b0df43 100644
--- a/media/css/seahub_react.css
+++ b/media/css/seahub_react.css
@@ -14,7 +14,6 @@
* loading
* popover
* op-icon
- * path
* account
* quota
* side-tabnav
@@ -59,10 +58,13 @@
.sf2-icon-monitor:before { content:"\e007"; }
.sf2-icon-wrench:before { content:"\e001"; }
.sf2-icon-bell:before { content:"\e003"; }
-.sf2-icon-x3:before { content:"\e035"; }
+.sf2-icon-close:before { content:"\e035"; }
.sf2-icon-grid-view:before { content:"\e025"; }
.sf2-icon-list-view:before { content:"\e026"; }
+.sf2-icon-wiki-view:before { content:"\e013"; }
.sf2-icon-edit:before { content:"\e018"; }
+.sf2-icon-history:before { content:"\e014"; }
+.sf2-icon-trash:before { content:"\e016"; }
/* common class and element style*/
a { color:#eb8205; }
@@ -98,13 +100,6 @@ ul,ol,li {
/* UI Widget */
-/**** topbar button ****/
-.btn-topbar {
- padding: 0.25rem 0.5rem;
- line-height: 1.6;
- font-weight: normal;
-}
-
/**** caret ****/
.outer-caret,
.inner-caret {
@@ -197,24 +192,9 @@ ul,ol,li {
vertical-align:middle;
}
-
-/**** path ****/
-.path-containter { /* for the real path */
- font-size:16px;
- word-break: break-all;
-}
-.path-split {
- display:inline-block;
- padding:0 5px;
- color:#818a91;
-}
-
-/* specific elements */
-
/** Account info **/
#account {
position:relative;
- margin-left:32px;
}
#my-info {
@@ -527,10 +507,6 @@ a.op-icon:focus {
user-select: none;
}
-.common-toolbar {
- margin-left:auto;
- display:flex;
-}
#notifications {
position:relative;
width: 32px;
diff --git a/seahub/templates/home_base.html b/seahub/templates/home_base.html
index 8018b98fee..c6b7fd7570 100644
--- a/seahub/templates/home_base.html
+++ b/seahub/templates/home_base.html
@@ -76,6 +76,7 @@
{% endif %}
+
{% trans "Drafts" %}
{% endblock %}
diff --git a/seahub/templates/js/templates.html b/seahub/templates/js/templates.html
index 9c768c0497..94eaa642ba 100644
--- a/seahub/templates/js/templates.html
+++ b/seahub/templates/js/templates.html
@@ -495,9 +495,10 @@