mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-12 22:49:15 +00:00
get infos
This commit is contained in:
parent
0c75ced2ee
commit
ea5741351d
@ -13,6 +13,8 @@ import InsertRepoImageDialog from './components/dialog/insert-repo-image-dialog'
|
||||
import { serialize, deserialize } from '@seafile/seafile-editor/dist/utils/slate2markdown';
|
||||
import LocalDraftDialog from './components/dialog/local-draft-dialog';
|
||||
import MarkdownViewerToolbar from './components/toolbar/markdown-viewer-toolbar';
|
||||
import EditFileTagDialog from './components/dialog/edit-filetag-dialog';
|
||||
import RelatedFileDialogs from './components/dialog/related-file-dialogs';
|
||||
|
||||
import './css/markdown-viewer/markdown-editor.css';
|
||||
|
||||
@ -294,6 +296,11 @@ class MarkdownEditor extends React.Component {
|
||||
saving: false,
|
||||
isLocked: isLocked,
|
||||
lockedByMe: lockedByMe,
|
||||
relatedFiles: [],
|
||||
fileTagList: [],
|
||||
showRelatedFileDialog: false,
|
||||
showEditFileTagDialog: false,
|
||||
viewMode: 'list_related_file',
|
||||
};
|
||||
|
||||
if (this.state.collabServer) {
|
||||
@ -391,6 +398,8 @@ class MarkdownEditor extends React.Component {
|
||||
showShareLinkDialog: false,
|
||||
showInsertFileDialog: false,
|
||||
showInsertRepoImageDialog: false,
|
||||
showRelatedFileDialog: false,
|
||||
showEditFileTagDialog: false,
|
||||
});
|
||||
}
|
||||
|
||||
@ -485,6 +494,28 @@ class MarkdownEditor extends React.Component {
|
||||
showInsertRepoImageDialog: true,
|
||||
});
|
||||
break;
|
||||
case 'related_files':
|
||||
if (this.state.relatedFiles.length > 0) {
|
||||
this.setState({
|
||||
showRelatedFileDialog: true,
|
||||
showMarkdownEditorDialog: true,
|
||||
viewMode: 'list_related_file',
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.setState({
|
||||
showRelatedFileDialog: true,
|
||||
showMarkdownEditorDialog: true,
|
||||
viewMode: 'add_related_file',
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 'file_tags':
|
||||
this.setState({
|
||||
showEditFileTagDialog: true,
|
||||
showMarkdownEditorDialog: true,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -562,6 +593,8 @@ class MarkdownEditor extends React.Component {
|
||||
});
|
||||
}
|
||||
this.checkDraft();
|
||||
this.listRelatedFiles();
|
||||
this.listFileTags();
|
||||
|
||||
setTimeout(() => {
|
||||
let url = new URL(window.location.href);
|
||||
@ -571,6 +604,30 @@ class MarkdownEditor extends React.Component {
|
||||
}, 100);
|
||||
}
|
||||
|
||||
listRelatedFiles = () => {
|
||||
seafileAPI.listRelatedFiles(repoID, filePath).then(res => {
|
||||
this.setState({ relatedFiles: res.data.related_files });
|
||||
});
|
||||
}
|
||||
|
||||
listFileTags = () => {
|
||||
seafileAPI.listFileTags(repoID, filePath).then(res => {
|
||||
let fileTagList = res.data.file_tags;
|
||||
for (let i = 0; i < fileTagList.length; i++) {
|
||||
fileTagList[i].id = fileTagList[i].file_tag_id;
|
||||
}
|
||||
this.setState({ fileTagList: fileTagList });
|
||||
});
|
||||
}
|
||||
|
||||
onRelatedFileChange = () => {
|
||||
this.listRelatedFiles();
|
||||
}
|
||||
|
||||
onFileTagChanged = () => {
|
||||
this.listFileTags();
|
||||
}
|
||||
|
||||
setFileInfoMtime = (fileInfo) => {
|
||||
this.setState({
|
||||
fileInfo: Object.assign({}, this.state.fileInfo, { mtime: fileInfo.mtime, id: fileInfo.id, lastModifier: fileInfo.last_modifier_name })
|
||||
@ -736,6 +793,8 @@ class MarkdownEditor extends React.Component {
|
||||
onSaving={this.onSaving}
|
||||
contentChanged={this.state.contentChanged}
|
||||
saving={this.state.saving}
|
||||
fileTagList={this.state.fileTagList}
|
||||
relatedFiles={this.state.relatedFiles}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
@ -787,6 +846,30 @@ class MarkdownEditor extends React.Component {
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
{this.state.showEditFileTagDialog &&
|
||||
<ModalPortal>
|
||||
<EditFileTagDialog
|
||||
repoID={repoID}
|
||||
filePath={filePath}
|
||||
fileTagList={this.state.fileTagList}
|
||||
toggleCancel={this.toggleCancel}
|
||||
onFileTagChanged={this.onFileTagChanged}
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
{this.state.showRelatedFileDialog &&
|
||||
<ModalPortal>
|
||||
<RelatedFileDialogs
|
||||
repoID={repoID}
|
||||
filePath={filePath}
|
||||
relatedFiles={this.state.relatedFiles}
|
||||
toggleCancel={this.toggleCancel}
|
||||
onRelatedFileChange={this.onRelatedFileChange}
|
||||
dirent={this.state.fileInfo}
|
||||
viewMode={this.state.viewMode}
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
</React.Fragment>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
Loading…
Reference in New Issue
Block a user