|
|
|
@ -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()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|