mirror of
https://github.com/haiwen/seahub.git
synced 2025-10-21 10:51:17 +00:00
optimize code (#6046)
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import io from 'socket.io-client';
|
import io from 'socket.io-client';
|
||||||
import { EXTERNAL_EVENTS, EventBus, MarkdownEditor as SeafileMarkdownEditor } from '@seafile/seafile-editor';
|
import {
|
||||||
|
EXTERNAL_EVENTS,
|
||||||
|
EventBus,
|
||||||
|
MarkdownEditor as SeafileMarkdownEditor,
|
||||||
|
MarkdownViewer as SeafileMarkdownViewer,
|
||||||
|
} from '@seafile/seafile-editor';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { gettext, mediaUrl } from '../../utils/constants';
|
import { gettext, mediaUrl } from '../../utils/constants';
|
||||||
@@ -422,7 +427,7 @@ class MarkdownEditor extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading, markdownContent, fileInfo, fileTagList } = this.state;
|
const { loading, markdownContent, fileInfo, fileTagList, isLocked } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
@@ -446,6 +451,7 @@ class MarkdownEditor extends React.Component {
|
|||||||
toggleLockFile={this.toggleLockFile}
|
toggleLockFile={this.toggleLockFile}
|
||||||
/>
|
/>
|
||||||
<div className='sf-md-viewer-content'>
|
<div className='sf-md-viewer-content'>
|
||||||
|
{!isLocked && (
|
||||||
<SeafileMarkdownEditor
|
<SeafileMarkdownEditor
|
||||||
ref={this.editorRef}
|
ref={this.editorRef}
|
||||||
isFetching={loading}
|
isFetching={loading}
|
||||||
@@ -459,6 +465,17 @@ class MarkdownEditor extends React.Component {
|
|||||||
>
|
>
|
||||||
<DetailListView fileInfo={fileInfo} fileTagList={fileTagList} onFileTagChanged={this.onFileTagChanged}/>
|
<DetailListView fileInfo={fileInfo} fileTagList={fileTagList} onFileTagChanged={this.onFileTagChanged}/>
|
||||||
</SeafileMarkdownEditor>
|
</SeafileMarkdownEditor>
|
||||||
|
)}
|
||||||
|
{isLocked && (
|
||||||
|
<SeafileMarkdownViewer
|
||||||
|
isFetching={loading}
|
||||||
|
value={markdownContent}
|
||||||
|
mathJaxSource={mediaUrl + 'js/mathjax/tex-svg.js'}
|
||||||
|
isSupportInsertSeafileImage={true}
|
||||||
|
isShowOutline={true}
|
||||||
|
>
|
||||||
|
</SeafileMarkdownViewer>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
{this.state.showMarkdownEditorDialog && (
|
{this.state.showMarkdownEditorDialog && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
Reference in New Issue
Block a user