From 910bdaa484761ded7cfd4d23341034db00343023 Mon Sep 17 00:00:00 2001 From: Michael An <37589122+Michael18811380328@users.noreply.github.com> Date: Mon, 21 Jan 2019 16:55:35 +0800 Subject: [PATCH] [fix] related-dailog (#2863) --- .../dialog/add-related-file-dialog.js | 1 + frontend/src/css/dirent-detail.css | 2 +- frontend/src/markdown-editor.js | 25 +------------------ 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/dialog/add-related-file-dialog.js b/frontend/src/components/dialog/add-related-file-dialog.js index 04a8f10748..8bf097d9ea 100644 --- a/frontend/src/components/dialog/add-related-file-dialog.js +++ b/frontend/src/components/dialog/add-related-file-dialog.js @@ -5,6 +5,7 @@ import { gettext } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import { Utils } from '../../utils/utils'; import FileChooser from '../file-chooser/file-chooser'; +import '../../css/dirent-detail.css'; const propTypes = { repoID: PropTypes.string.isRequired, diff --git a/frontend/src/css/dirent-detail.css b/frontend/src/css/dirent-detail.css index c8a0171b77..fd440dc20e 100644 --- a/frontend/src/css/dirent-detail.css +++ b/frontend/src/css/dirent-detail.css @@ -159,5 +159,5 @@ } .sf-add-related-file .related-file-subtitle { - margin-bottom: 10px; + margin-bottom: 4px; } \ No newline at end of file diff --git a/frontend/src/markdown-editor.js b/frontend/src/markdown-editor.js index d3e6311c0b..f2c5d7a2e5 100644 --- a/frontend/src/markdown-editor.js +++ b/frontend/src/markdown-editor.js @@ -301,7 +301,6 @@ class MarkdownEditor extends React.Component { collabServer: seafileCollabServer ? seafileCollabServer : null, relatedFiles: [], fileTagList: [], - dirent: {}, showRelatedFileDialog: false, showEditFileTagDialog: false, showAddRelatedFileDialog: false, @@ -382,7 +381,6 @@ class MarkdownEditor extends React.Component { }); this.listRelatedFiles(); this.listFileTags(); - this.listDirent(); } listRelatedFiles = () => { @@ -405,27 +403,6 @@ class MarkdownEditor extends React.Component { }); } - listDirent = () => { - seafileAPI.listDir(repoID, dirPath).then(res => { - let direntList = []; - res.data.forEach(item => { - if (this.props.isShowFile === true) { - let dirent = new Dirent(item); - direntList.push(dirent); - } else { - if (item.type === 'dir') { - let dirent = new Dirent(item); - direntList.push(dirent); - } - } - }); - direntList = Utils.sortDirents(direntList, 'name', 'asc'); - this.setState({ - dirent: direntList[0] - }); - }); - } - onRelatedFileChange = () => { this.listRelatedFiles(); } @@ -494,7 +471,7 @@ class MarkdownEditor extends React.Component { repoID={repoID} filePath={filePath} toggleCancel={this.closeAddRelatedFileDialog} - dirent={this.state.dirent} + dirent={this.state.fileInfo} onRelatedFileChange={this.onRelatedFileChange} /> }