From 5784a10f1dbd84468a1e8c31186a1ba8d85e91cf Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Tue, 5 Nov 2019 13:51:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/page/component/monaco/TPIMonaco.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/react/src/modules/page/component/monaco/TPIMonaco.js b/public/react/src/modules/page/component/monaco/TPIMonaco.js index b814ecb44..59cb5ce35 100644 --- a/public/react/src/modules/page/component/monaco/TPIMonaco.js +++ b/public/react/src/modules/page/component/monaco/TPIMonaco.js @@ -226,6 +226,7 @@ class TPIMonaco extends Component { // https://github.com/Microsoft/monaco-editor/issues/539 window.monaco.editor.setModelLanguage(editor_monaco.getModel(), lang) } else if (prevProps.isEditablePath != this.props.isEditablePath) { + // 当前文件是否可编辑 if (this.props.isEditablePath || this.props.shixun && this.props.shixun.code_edit_permission == true) { editor_monaco.updateOptions({readOnly: false}) } else { @@ -250,6 +251,7 @@ class TPIMonaco extends Component { } } componentWillUnmount() { + // 注意销毁,不然会出现不能编辑的bug this.editor_monaco && this.editor_monaco.dispose() }