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