From acca65fa2659b8aa5439b62319d17b05e4a914de Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Wed, 4 Sep 2019 16:33:42 +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 --- .../modules/page/component/monaco/TPIMonaco.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/page/component/monaco/TPIMonaco.js b/public/react/src/modules/page/component/monaco/TPIMonaco.js index c16889db2..83d55915e 100644 --- a/public/react/src/modules/page/component/monaco/TPIMonaco.js +++ b/public/react/src/modules/page/component/monaco/TPIMonaco.js @@ -188,6 +188,19 @@ function getLanguageByMirrorName(mirror_name) { } let notCallCodeMirrorOnChangeFlag = false; + +/** + props : + mirror_name 决定语言 + isEditablePath + repositoryCode + + codemirrorDidMount + + shixun.forbid_copy + + showSettingDrawer, settingDrawerOpen +*/ class TPIMonaco extends Component { constructor(props) { @@ -201,7 +214,7 @@ class TPIMonaco extends Component { } componentDidUpdate(prevProps, prevState, snapshot) { - const { game, mirror_name } = this.props + const { mirror_name } = this.props const editor_monaco = this.editor_monaco; if (editor_monaco && !_.isEqual(prevProps.mirror_name, mirror_name)) { // TODO 后期考虑加入,根据文件类型的不同,使用不同的lang @@ -294,7 +307,7 @@ class TPIMonaco extends Component { }) this.props.codemirrorDidMount && this.props.codemirrorDidMount() - if(this.props.shixun.forbid_copy == true) { + if(this.props.shixun && this.props.shixun.forbid_copy == true) { // 禁用粘贴 // https://github.com/Microsoft/monaco-editor/issues/100 window.editor_monaco.onDidPaste( (a, b, c) => { window.__pastePosition = a })