From 9210628cb3a34749152de2154397eec2d9fc2ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=A1=BA=E5=BC=BA?= <978987373@qq.com> Date: Tue, 30 Apr 2024 08:23:27 +0800 Subject: [PATCH] optimize code (#6046) --- frontend/src/pages/markdown-editor/index.js | 47 ++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/frontend/src/pages/markdown-editor/index.js b/frontend/src/pages/markdown-editor/index.js index 496aa33b18..d8ea9d13ea 100644 --- a/frontend/src/pages/markdown-editor/index.js +++ b/frontend/src/pages/markdown-editor/index.js @@ -1,6 +1,11 @@ import React, { Fragment } from 'react'; 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 { seafileAPI } from '../../utils/seafile-api'; import { gettext, mediaUrl } from '../../utils/constants'; @@ -422,7 +427,7 @@ class MarkdownEditor extends React.Component { }; render() { - const { loading, markdownContent, fileInfo, fileTagList } = this.state; + const { loading, markdownContent, fileInfo, fileTagList, isLocked } = this.state; return ( @@ -446,19 +451,31 @@ class MarkdownEditor extends React.Component { toggleLockFile={this.toggleLockFile} />
- - - + {!isLocked && ( + + + + )} + {isLocked && ( + + + )}
{this.state.showMarkdownEditorDialog && (