mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-31 22:54:11 +00:00
feat: sf metadata display (#6249)
* feat: sf metadata display * feat: update code * feat: update code * feat: lock react version * feat: bug * feat: optimize code * feat: update transalte * feat: update transalte * feat: rebase code * Feat: update code * Feat: update code --------- Co-authored-by: 杨国璇 <ygx@192.168.1.5> Co-authored-by: 杨国璇 <ygx@Hello-word.local> Co-authored-by: 杨国璇 <ygx@192.168.1.13>
This commit is contained in:
@@ -461,6 +461,14 @@ class LibContentView extends React.Component {
|
||||
window.history.pushState({url: url, path: filePath}, filePath, url);
|
||||
};
|
||||
|
||||
showFileMetadata = (filePath) => {
|
||||
const repoID = this.props.repoID;
|
||||
this.setState({ path: filePath, isViewFile: true, isFileLoading: false, isFileLoadedErr: false, content: '__sf-metadata' });
|
||||
const repoInfo = this.state.currentRepoInfo;
|
||||
const url = siteRoot + 'library/' + repoID + '/' + encodeURIComponent(repoInfo.repo_name);
|
||||
window.history.pushState({url: url, path: ''}, '', url);
|
||||
};
|
||||
|
||||
loadDirentList = (path) => {
|
||||
let repoID = this.props.repoID;
|
||||
seafileAPI.listDir(repoID, path, {'with_thumbnail': true}).then(res => {
|
||||
@@ -1649,6 +1657,7 @@ class LibContentView extends React.Component {
|
||||
onTreeNodeClick = (node) => {
|
||||
this.resetSelected();
|
||||
let repoID = this.props.repoID;
|
||||
|
||||
if (!this.state.pathExist) {
|
||||
this.setState({pathExist: true});
|
||||
}
|
||||
@@ -1680,7 +1689,7 @@ class LibContentView extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
if (node.path === this.state.path ) {
|
||||
if (node.path === this.state.path) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1691,6 +1700,10 @@ class LibContentView extends React.Component {
|
||||
if (node.path !== this.state.path) {
|
||||
this.showColumnMarkdownFile(node.path);
|
||||
}
|
||||
} else if (Utils.isFileMetadata(node?.object?.type)) {
|
||||
if (node.path !== this.state.path) {
|
||||
this.showFileMetadata(node.path);
|
||||
}
|
||||
} else {
|
||||
let url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(node.path);
|
||||
let dirent = node.object;
|
||||
|
Reference in New Issue
Block a user