mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-13 15:05:30 +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 { serialize, deserialize } from '@seafile/seafile-editor/dist/utils/slate2markdown';
|
||||||
import LocalDraftDialog from './components/dialog/local-draft-dialog';
|
import LocalDraftDialog from './components/dialog/local-draft-dialog';
|
||||||
import MarkdownViewerToolbar from './components/toolbar/markdown-viewer-toolbar';
|
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';
|
import './css/markdown-viewer/markdown-editor.css';
|
||||||
|
|
||||||
@ -294,6 +296,11 @@ class MarkdownEditor extends React.Component {
|
|||||||
saving: false,
|
saving: false,
|
||||||
isLocked: isLocked,
|
isLocked: isLocked,
|
||||||
lockedByMe: lockedByMe,
|
lockedByMe: lockedByMe,
|
||||||
|
relatedFiles: [],
|
||||||
|
fileTagList: [],
|
||||||
|
showRelatedFileDialog: false,
|
||||||
|
showEditFileTagDialog: false,
|
||||||
|
viewMode: 'list_related_file',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.collabServer) {
|
if (this.state.collabServer) {
|
||||||
@ -391,6 +398,8 @@ class MarkdownEditor extends React.Component {
|
|||||||
showShareLinkDialog: false,
|
showShareLinkDialog: false,
|
||||||
showInsertFileDialog: false,
|
showInsertFileDialog: false,
|
||||||
showInsertRepoImageDialog: false,
|
showInsertRepoImageDialog: false,
|
||||||
|
showRelatedFileDialog: false,
|
||||||
|
showEditFileTagDialog: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,6 +494,28 @@ class MarkdownEditor extends React.Component {
|
|||||||
showInsertRepoImageDialog: true,
|
showInsertRepoImageDialog: true,
|
||||||
});
|
});
|
||||||
break;
|
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:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -562,6 +593,8 @@ class MarkdownEditor extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.checkDraft();
|
this.checkDraft();
|
||||||
|
this.listRelatedFiles();
|
||||||
|
this.listFileTags();
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let url = new URL(window.location.href);
|
let url = new URL(window.location.href);
|
||||||
@ -571,6 +604,30 @@ class MarkdownEditor extends React.Component {
|
|||||||
}, 100);
|
}, 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) => {
|
setFileInfoMtime = (fileInfo) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
fileInfo: Object.assign({}, this.state.fileInfo, { mtime: fileInfo.mtime, id: fileInfo.id, lastModifier: fileInfo.last_modifier_name })
|
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}
|
onSaving={this.onSaving}
|
||||||
contentChanged={this.state.contentChanged}
|
contentChanged={this.state.contentChanged}
|
||||||
saving={this.state.saving}
|
saving={this.state.saving}
|
||||||
|
fileTagList={this.state.fileTagList}
|
||||||
|
relatedFiles={this.state.relatedFiles}
|
||||||
/>
|
/>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
@ -787,6 +846,30 @@ class MarkdownEditor extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</ModalPortal>
|
</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>
|
||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
Loading…
Reference in New Issue
Block a user