update monaco-editor

dev_aliyun2
harry 5 years ago
parent afadd23dfd
commit 29d4501aab

@ -1,12 +1,10 @@
import React, { Component } from "react";
import { Input,Checkbox,Table, Pagination, Modal,Menu, Tooltip,Spin,Button,Form,Icon,message,Progress,notification} from "antd";
import { WordsBtn,on, off, trigger,markdownToHTML,getImageUrl} from 'educoder';
import { Modal, Spin, Button, Form, Icon, message, Progress, notification } from "antd";
import './myelearning.css'
import axios from 'axios';
import YslDetailCards from "./YslDetailCards.js";
import Jointheclass from '../../modals/Jointheclass';
import LoginDialog from "../../login/LoginDialog";
import NoneData from '../../../modules/courses/coursesPublic/NoneData'
//在线学习
class Elearning extends Component {
@ -229,7 +227,8 @@ class Elearning extends Component{
// message.success('重置成功,正在进入实训!');
// this.startshixunCombat();
}}
}
}
).catch((error) => {
this.setState({
isSpins: false,

@ -478,17 +478,16 @@ class LoginDialog extends Component {
}
render() {
let { qqlogin, login, isGoing, isGoingValue, disabled, bottonclass, Phonenumberisnotco,
let { login, isGoing, isGoingValue, disabled, Phonenumberisnotco,
dialogBox, isRender, weixinlogin } = this.state;
if (isRender === undefined) {
isRender = false
}
return (
<Modal visible={isRender} id="DialogID"
className="zindextest"
onClose={() => this.handleDialogClose()}
onCancel={() => this.handleDialogClose()}
footer={null}
>
<Notcompletedysl
modalsType={this.state.MyEduCoderModals}

@ -163,7 +163,7 @@ class MainContent extends Component {
<div style={{ display: (codeLoading ? 'block' : 'none'), textAlign: 'center' }}>
<span style={{ color: '#ddd', display: 'block' }}>正在加载中请稍后...</span>
</div>
<div style={{ display: (codeLoading ? 'none' : 'block') }}>
<div style={{ display: (codeLoading ? 'none' : 'block'), height: '100%' }}>
<CodeRepositoryViewContainer {...this.props} ></CodeRepositoryViewContainer>
</div>
</React.Fragment>

@ -68,7 +68,7 @@ class TPIMonaco extends Component {
render() {
const { repositoryCode, showSettingDrawer, shixun, isEditablePath, settingDrawerOpen, mirror_name } = this.props;
const { repositoryCode, showSettingDrawer, shixun, isEditablePath, settingDrawerOpen, mirror_name, onRepositoryCodeUpdate } = this.props;
const { cmFontSize, cmCodeMode } = this.state
const editorOptions = {
value: repositoryCode,

@ -78,6 +78,23 @@ export default ({
const editor = useRef({})
const [init, setInit] = useState(false)
function onLayout() {
if (window.ResizeObserver) {
const ro = new window.ResizeObserver(entries => {
for (let entry of entries) {
if (entry.target.offsetHeight > 0) {
editor.current.instance.layout()
}
}
})
ro.observe(editorEl.current.parentElement)
} else {
setTimeout(() => {
editor.current.instance.layout()
}, 100);
}
}
useEffect(() => {
editor.current.instance = monaco.editor.create(
editorEl.current, {
@ -98,6 +115,7 @@ export default ({
const resizeHandler = debounce(() => { editor.current.instance.layout() }, 100)
window.addEventListener('resize', resizeHandler)
onLayout()
return () => {
const el = editor.current.instance
el.dispose()

@ -479,7 +479,7 @@ class CodeRepositoryView extends Component {
</ul>
<div className="cl"></div>
<div id="codetab_con_1" style={{ display: 'block', flex: 'auto' }} style={tabIndex === 0 ? { display: 'block' } : { display: 'none' }}>
<div id="codetab_con_1" style={{ display: tabIndex === 0 ? 'block' : 'none', flex: 'auto', height: '100%' }} >
{this.props.readRepoTimeout === true ? <div className="readRepoFailed">
代码加载失败<a className="retry"
onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true, true)}>重试</a>

Loading…
Cancel
Save