forked from Gitlink/forgeplus-react
FIX react-codeMirror bug
This commit is contained in:
parent
636d2ee36b
commit
a017c6f84d
|
|
@ -4,7 +4,7 @@ import { Popconfirm, Result } from 'antd';
|
|||
import './list.css';
|
||||
import axios from 'axios';
|
||||
|
||||
import CodeMirror from 'react-codeMirror';
|
||||
import CodeMirror from 'react-codemirror';
|
||||
require('codemirror/lib/codemirror.css');
|
||||
require('codemirror/mode/javascript/javascript');
|
||||
require('codemirror/mode/xml/xml');
|
||||
|
|
@ -46,7 +46,7 @@ class CoderRootFileDetail extends Component{
|
|||
}
|
||||
|
||||
// 编辑文件
|
||||
|
||||
|
||||
changeMmirror=(e,e1,value)=>{
|
||||
this.setState({
|
||||
value
|
||||
|
|
@ -166,4 +166,4 @@ class CoderRootFileDetail extends Component{
|
|||
}
|
||||
}
|
||||
|
||||
export default CoderRootFileDetail;
|
||||
export default CoderRootFileDetail;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import Tree, { TreeNode } from 'rc-tree';
|
|||
import 'rc-tree/assets/index.css';
|
||||
|
||||
import classNames from 'classnames'
|
||||
// import CodeMirror from 'react-codeMirror'
|
||||
// import CodeMirror from 'react-codemirror'
|
||||
|
||||
import axios from 'axios'
|
||||
import _ from 'lodash'
|
||||
|
|
@ -52,12 +52,12 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
const { game, challenge, hide_code, tabIndex, } = this.props
|
||||
|
||||
|
||||
if ( // 初始化 或者 game切换
|
||||
!this.treeExpanded && challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 ||
|
||||
game && (!prevProps.game
|
||||
!this.treeExpanded && challenge.path && challenge.path.length && this.state.expandedKeys.length === 0 ||
|
||||
game && (!prevProps.game
|
||||
|| prevProps.game.identifier !== this.props.game.identifier) ) {
|
||||
|
||||
|
||||
if (!this.treeExpanded) {
|
||||
this.treeExpanded = true
|
||||
const _path = challenge.multiPath ? challenge.path[0] : challenge.path;
|
||||
|
|
@ -77,8 +77,8 @@ class CodeRepositoryView extends Component {
|
|||
})
|
||||
}
|
||||
|
||||
if (game && (!prevProps.game
|
||||
|| prevProps.game.identifier !== this.props.game.identifier)) {
|
||||
if (game && (!prevProps.game
|
||||
|| prevProps.game.identifier !== this.props.game.identifier)) {
|
||||
// 切换关卡时切换到第一个tab
|
||||
// 如果隐藏code tab,就只有一个ssh tab了
|
||||
if (hide_code == true) {
|
||||
|
|
@ -90,12 +90,12 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
componentDidMount() {
|
||||
// 隐藏code tab,则显示ssh tab(81)
|
||||
if (this.props.hide_code === true) {
|
||||
this.tabIndexChange(81)
|
||||
}
|
||||
|
||||
|
||||
//显示所有代码文件
|
||||
$(".code-file-tab").hover(function(){
|
||||
// var ulwidth=$("#blacktab_nav").width();
|
||||
|
|
@ -119,22 +119,22 @@ class CodeRepositoryView extends Component {
|
|||
const expandedKeys = this.state.expandedKeys.slice(0)
|
||||
const _index = expandedKeys.indexOf(selectedKeys[0]);
|
||||
if (_index == -1) {
|
||||
expandedKeys.push(selectedKeys[0])
|
||||
expandedKeys.push(selectedKeys[0])
|
||||
} else {
|
||||
expandedKeys.splice( _index, 1)
|
||||
}
|
||||
this.setState({ expandedKeys })
|
||||
}
|
||||
|
||||
|
||||
this.props.onTreeSelect(selectedKeys, info)
|
||||
}
|
||||
}
|
||||
buildTree() {
|
||||
// TODO http://localhost:3007/tasks/xgffnuomytpj 这个实训没有文件树
|
||||
const { fileTreeData, onLoadData, fileTreeSelectedKeys } = this.props;
|
||||
if (!fileTreeData || fileTreeData.length === 0) {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
const loop = (data) => {
|
||||
return data.map((item) => {
|
||||
|
|
@ -147,8 +147,8 @@ class CodeRepositoryView extends Component {
|
|||
});
|
||||
};
|
||||
const treeNodes = loop(fileTreeData);
|
||||
|
||||
|
||||
|
||||
|
||||
// selectable={false}
|
||||
return (
|
||||
<Tree
|
||||
|
|
@ -190,15 +190,15 @@ class CodeRepositoryView extends Component {
|
|||
var domArray = [];
|
||||
const pathArray = path.forEach ? path : [path]
|
||||
pathArray.forEach( (item, index) => {
|
||||
domArray.push(
|
||||
domArray.push(
|
||||
<p key={index} className={classNames({'blue-line': pathIndex == index})} onClick={ () => this.onPathChange(index, true) } >
|
||||
{item}
|
||||
{item}
|
||||
</p> )
|
||||
})
|
||||
|
||||
|
||||
return (
|
||||
<div className="codefile-all pl10">
|
||||
{domArray}
|
||||
{domArray}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -209,11 +209,11 @@ class CodeRepositoryView extends Component {
|
|||
axios.get(url,
|
||||
{
|
||||
// withCredentials: true
|
||||
}
|
||||
).then((response) => {
|
||||
}
|
||||
).then((response) => {
|
||||
tabIndex && $(`#codetab_con_${tabIndex}`).html('') // 清空 ‘正在连接命令行服务...’
|
||||
|
||||
if (response.data.game_id) {
|
||||
if (response.data.game_id) {
|
||||
// 重置ssh状态
|
||||
this.setSSHClosed(false);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ class CodeRepositoryView extends Component {
|
|||
var line_h = (navigator.userAgent.indexOf('Chrome') >= 0 ? 18 : 19);
|
||||
var rows = Math.round(h / line_h);
|
||||
var cols = parseInt(w / 9.9);
|
||||
|
||||
|
||||
response.data.width = w;
|
||||
response.data.height = h;
|
||||
response.data.line_h = line_h;
|
||||
|
|
@ -237,7 +237,7 @@ class CodeRepositoryView extends Component {
|
|||
// this.loadSshInIframe( response.data, tabIndex )
|
||||
|
||||
this.loadSshNormal(response.data, tabIndex, isReInit)
|
||||
|
||||
|
||||
}
|
||||
// console.log(response)
|
||||
}).catch((error) => {
|
||||
|
|
@ -257,7 +257,7 @@ class CodeRepositoryView extends Component {
|
|||
// $(".game_webssh").css({"min-height":h, "max-height":h});
|
||||
const container = $(`#codetab_con_${tabIndex}`);
|
||||
// ReactDOM.unmountComponentAtNode(container)
|
||||
// ReactDOM.render(<Webssh {...data}
|
||||
// ReactDOM.render(<Webssh {...data}
|
||||
// ></Webssh>, container);
|
||||
// this.setState({
|
||||
// sshData: data
|
||||
|
|
@ -273,7 +273,7 @@ class CodeRepositoryView extends Component {
|
|||
, height, width, line_h, rows, cols, } = data
|
||||
|
||||
let _domain = webssh_url || 'https://webssh.educoder.net';
|
||||
// window.location.host === "www.educoder.net" ?
|
||||
// window.location.host === "www.educoder.net" ?
|
||||
// 'https://webssh.educoder.net'
|
||||
// : 'https://testwebssh.educoder.net'
|
||||
const html = `<iframe src="${_domain}/?Host=${host}&Port=${port}&Username=${username}&Password=${password}&Gameid=${game_id}&Rows=${rows}&Tab=81&Columns=${cols}&Width=${width}&Height=${height}" style="width: 100%; border: 0px; min-height: 454px; max-height: 454px; " scrolling="no" id="game_webssh" class="game_webssh"></iframe>`
|
||||
|
|
@ -286,9 +286,9 @@ class CodeRepositoryView extends Component {
|
|||
if ($(`#codetab_con_${index} .terminal.xterm`).length === 1) { // 已经初始化过了
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.initSsh($, index);
|
||||
|
||||
|
||||
}
|
||||
/** multi ssh */
|
||||
setSSHClosed = (isClose) => {
|
||||
|
|
@ -318,7 +318,7 @@ class CodeRepositoryView extends Component {
|
|||
close_ssh_cocket_iframe = (id) => {
|
||||
/*
|
||||
关闭连接,清空tab content
|
||||
*/
|
||||
*/
|
||||
let _w = $(`.game_webssh_${id}`)[0].contentWindow
|
||||
_w && _w.postMessage({tp: 'close_ssh_cocket'}, "*");
|
||||
$(`#codetab_con_${id}`).html('')
|
||||
|
|
@ -326,7 +326,7 @@ class CodeRepositoryView extends Component {
|
|||
close_ssh_cocket_normal = (id) => {
|
||||
/*
|
||||
关闭连接,清空tab content
|
||||
*/
|
||||
*/
|
||||
// let _w = $(`.game_webssh_${id}`)[0].contentWindow
|
||||
// _w && _w.postMessage({tp: 'close_ssh_cocket'}, "*");
|
||||
// $(`#codetab_con_${id}`).html('')
|
||||
|
|
@ -338,7 +338,7 @@ class CodeRepositoryView extends Component {
|
|||
this.tabIndexChange(STABLE_SSH_TAB_ID)
|
||||
this.setState({ addtionalSSHArray })
|
||||
// game_webssh_${tabIndex} TODO
|
||||
|
||||
|
||||
this.close_ssh_cocket_normal(id)
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
|
@ -379,7 +379,7 @@ class CodeRepositoryView extends Component {
|
|||
|
||||
width={300}
|
||||
open={drawerOpen}
|
||||
|
||||
|
||||
onClose={() => showFilesDrawer( false )}
|
||||
>
|
||||
{ loadingFirstRepoFiles ? (
|
||||
|
|
@ -390,7 +390,7 @@ class CodeRepositoryView extends Component {
|
|||
</Drawer>
|
||||
|
||||
<ul id="blacktab_nav" className="">
|
||||
|
||||
|
||||
{ hide_code === false && <li id="codetab_nav_1" className={classNames('code-file-tab', 'eud-pointer', 'pr', 'blacktab_nomal', {'blacktab_hover':tabIndex===0 })} onClick={() => tabIndexChange(0)}>
|
||||
<a href="javascript:void(0);" className={classNames('tab_type', 'tab_color', {'fl': challenge.pathIndex === -1 || challenge.multiPath === true } )}>代码文件</a>
|
||||
|
||||
|
|
@ -402,23 +402,23 @@ class CodeRepositoryView extends Component {
|
|||
</div>
|
||||
</React.Fragment>
|
||||
: "" }
|
||||
|
||||
|
||||
</li> }
|
||||
|
||||
{shixun.webssh !== 0 &&
|
||||
<li id="codetab_nav_2" data-tab="2" className={classNames('add-webssh', 'blacktab_nomal', {'blacktab_hover':tabIndex===STABLE_SSH_TAB_ID })}
|
||||
{shixun.webssh !== 0 &&
|
||||
<li id="codetab_nav_2" data-tab="2" className={classNames('add-webssh', 'blacktab_nomal', {'blacktab_hover':tabIndex===STABLE_SSH_TAB_ID })}
|
||||
onClick={() => this.tabIndexChange(STABLE_SSH_TAB_ID)}>
|
||||
<a href="javascript:void(0);" className="tab_type tab_color">命令行</a>
|
||||
</li> }
|
||||
{
|
||||
{
|
||||
addtionalSSHArray.map( (item, index) => {
|
||||
return (<li id={`codetab_nav_${item}`} data-tab={item}
|
||||
className={classNames('add-webssh', 'blacktab_nomal', {'blacktab_hover':tabIndex===item })}
|
||||
return (<li id={`codetab_nav_${item}`} data-tab={item}
|
||||
className={classNames('add-webssh', 'blacktab_nomal', {'blacktab_hover':tabIndex===item })}
|
||||
onClick={() => this.tabIndexChange(item)}>
|
||||
<a href="javascript:void(0);" className="tab_type tab_color">命令行{index + 1}</a>
|
||||
<Tooltip title={ "关闭该命令行窗口"} disableFocusListener={true}>
|
||||
<i class="anticon anticon-close ant-tabs-close-x" onClick={(e) => this.onSSHTabClose(item, e)}>
|
||||
<svg viewBox="64 64 896 896" class="" data-icon="close" width="1em" height="1em"
|
||||
<svg viewBox="64 64 896 896" class="" data-icon="close" width="1em" height="1em"
|
||||
fill="currentColor" aria-hidden="true">
|
||||
<path d="M563.8 512l262.5-312.9c4.4-5.2.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9A7.95 7.95 0 0 0 203 838h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"></path>
|
||||
</svg>
|
||||
|
|
@ -429,7 +429,7 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
|
||||
{/* */}
|
||||
{ shixun.webssh !== 0 && shixun.multi_webssh == true && addtionalSSHArray.length < totalAddtionalTabCount
|
||||
{ shixun.webssh !== 0 && shixun.multi_webssh == true && addtionalSSHArray.length < totalAddtionalTabCount
|
||||
&& sshIsClosed === false && <li id="codetab_nav_add" className="c_white" style={{paddingLeft:'10px'}}>
|
||||
<Tooltip title={ "新开命令行窗口"} disableFocusListener={true}>
|
||||
<a href="javascript:void(0);" className="tab_type tab_color"
|
||||
|
|
@ -437,32 +437,32 @@ class CodeRepositoryView extends Component {
|
|||
>+</a>
|
||||
</Tooltip>
|
||||
</li> }
|
||||
|
||||
|
||||
{ tabIndex === 0 && <h3 id="save_status" className="ml15 mt7 fl color-grey font-14" style={{fontWeight: 'normal'}}>
|
||||
{codeStatus === 0 ? '已修改' : (codeStatus === 1 ? '保存中...' : '已保存' ) }
|
||||
</h3> }
|
||||
<div className="fr -horizontal">
|
||||
|
||||
{ /**/ }
|
||||
{
|
||||
<WebSSHTimer game={game} showTimerProp={this.isSSHTabIndex()}
|
||||
{
|
||||
<WebSSHTimer game={game} showTimerProp={this.isSSHTabIndex()}
|
||||
reInitSsh={this.initSsh} setSSHClosed={this.setSSHClosed}></WebSSHTimer>
|
||||
}
|
||||
|
||||
{ showUpdateButton &&
|
||||
<React.Fragment>
|
||||
|
||||
|
||||
<a className="iconButton" onClick={()=>{ onShowUpdateDialog() }}>
|
||||
<Tooltip title={ "更新通知"} disableFocusListener={true}>
|
||||
<i className="iconfont icon-gonggao font-20 "></i>
|
||||
</Tooltip>
|
||||
</a>
|
||||
|
||||
|
||||
<span className="dot"></span>
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
{ !shixun.code_hidden && tabIndex === 0 &&
|
||||
{ !shixun.code_hidden && tabIndex === 0 &&
|
||||
<a className="iconButton" onClick={showFilesDrawer.bind(this, true)} >
|
||||
<Tooltip title={ "文件目录"} disableFocusListener={true}>
|
||||
<i className="iconfont icon-wenjian font-18 "></i>
|
||||
|
|
@ -471,10 +471,10 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
|
||||
<span id="return_last_code">
|
||||
</span>
|
||||
</span>
|
||||
|
||||
{ challenge.pathIndex !== -1 && game.status === 2 && tabIndex === 0 &&
|
||||
this.props.readRepoTimeout !== true &&
|
||||
{ challenge.pathIndex !== -1 && game.status === 2 && tabIndex === 0 &&
|
||||
this.props.readRepoTimeout !== true &&
|
||||
<a href="javascript:void(0);" className="iconButton" id="reset_success_game_code" onClick={showResetPassedCodeDialog}>
|
||||
<Tooltip title={ "加载上次通过的代码"} disableFocusListener={true}>
|
||||
<i className="iconfont icon-fanhuishangcidaima font-20 "></i>
|
||||
|
|
@ -483,7 +483,7 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
|
||||
{
|
||||
challenge.pathIndex !== -1 && tabIndex === 0 && this.props.readRepoTimeout !== true &&
|
||||
challenge.pathIndex !== -1 && tabIndex === 0 && this.props.readRepoTimeout !== true &&
|
||||
<a href="javascript:void(0);" className="iconButton" id="reset_game_code" onClick={showResetCodeDialog}>
|
||||
<Tooltip title={ "恢复初始代码"} disableFocusListener={true}>
|
||||
<i className="iconfont icon-zhongzhi font-20 "></i>
|
||||
|
|
@ -492,41 +492,41 @@ class CodeRepositoryView extends Component {
|
|||
}
|
||||
|
||||
{
|
||||
tabIndex === 0 && this.props.readRepoTimeout !== true &&
|
||||
tabIndex === 0 && this.props.readRepoTimeout !== true &&
|
||||
<a href="javascript:void(0);" className="iconButton" id="setting" onClick={() => showSettingDrawer(true)}>
|
||||
<Tooltip title={ "设置"} disableFocusListener={true}>
|
||||
<i className="iconfont icon-shezhi " style={{fontSize: '19px'}}></i>
|
||||
</Tooltip>
|
||||
</a>
|
||||
}
|
||||
|
||||
|
||||
<a href="javascript:void(0);" className="mr15 iconButton" onClick={onRepositoryViewExpand} id="extend_and_zoom">
|
||||
<Tooltip id="tooltip-icon-expand" title={ evaluateViewExpanded ? "收起" : "展开"}>
|
||||
{/*<i className="fa font-16 fa-expand"></i>*/}
|
||||
<i className={ evaluateViewExpanded ? "font-18 iconfont icon-shousuo" : "iconfont icon-zhankai font-18" }></i>
|
||||
</Tooltip>
|
||||
</a>
|
||||
|
||||
|
||||
</div>
|
||||
<div className="cl"></div>
|
||||
</ul>
|
||||
<div className="cl"></div>
|
||||
|
||||
|
||||
<div id="codetab_con_1" style={{display: 'block', flex: 'auto'}} style={ tabIndex === 0 ? {display: 'block'} : {display: 'none'} }>
|
||||
{/* 没必要显示这个,注释掉了 */}
|
||||
{/* { !isEditablePath &&
|
||||
{/* { !isEditablePath &&
|
||||
<Tooltip title={ "当前文件路径(只读)"}>
|
||||
<div className="codePath">
|
||||
{currentPath}
|
||||
</div>
|
||||
</div>
|
||||
</Tooltip>
|
||||
} */}
|
||||
{this.props.readRepoTimeout === true ? <div className="readRepoFailed">
|
||||
代码加载失败,<a className="retry"
|
||||
代码加载失败,<a className="retry"
|
||||
onClick={() => this.props.fetchRepositoryCode(this.props, null, null, true, true)}>重试</a>
|
||||
</div> :
|
||||
<React.Fragment>
|
||||
<div className="codemirrorBackground"
|
||||
<div className="codemirrorBackground"
|
||||
style={{ backgroundImage: `url('${notEditablePathImg}')`
|
||||
, display: (isEditablePath || this.props.shixun && this.props.shixun.code_edit_permission ? 'none' : 'block') }}></div>
|
||||
{/*<textarea className = "" id="extend-challenge-file-edit" name="content">{repositoryCode}</textarea>*/}
|
||||
|
|
@ -536,17 +536,17 @@ class CodeRepositoryView extends Component {
|
|||
</React.Fragment>
|
||||
}
|
||||
</div>
|
||||
<div id="codetab_con_81" className="undis -relative"
|
||||
<div id="codetab_con_81" className="undis -relative"
|
||||
style={ { color: '#fff', display: tabIndex === STABLE_SSH_TAB_ID ? 'block' : 'none', 'marginLeft': '2px'} }>
|
||||
{/* { tabIndex === STABLE_SSH_TAB_ID && this.state.sshData && <Webssh {...this.state.sshData} ></Webssh> } */}
|
||||
</div>
|
||||
<div id="codetab_con_82" className="undis -relative"
|
||||
<div id="codetab_con_82" className="undis -relative"
|
||||
style={ { color: '#fff', display: tabIndex === 82 ? 'block' : 'none', 'marginLeft': '2px', 'paddingBottom': '30px' } }>
|
||||
</div>
|
||||
<div id="codetab_con_83" className="undis -relative"
|
||||
<div id="codetab_con_83" className="undis -relative"
|
||||
style={ { color: '#fff', display: tabIndex === 83 ? 'block' : 'none', 'marginLeft': '2px', 'paddingBottom': '30px'} }>
|
||||
</div>
|
||||
<div id="codetab_con_84" className="undis -relative"
|
||||
<div id="codetab_con_84" className="undis -relative"
|
||||
style={ { color: '#fff', display: tabIndex === 84 ? 'block' : 'none', 'marginLeft': '2px', 'paddingBottom': '30px'} }>
|
||||
</div>
|
||||
<div id="codetab_con_3" className="undis -relative" style={{display: 'none'}}></div>
|
||||
|
|
@ -554,13 +554,13 @@ class CodeRepositoryView extends Component {
|
|||
);
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
<%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %>
|
||||
, overflow: 'scroll' ref="editor"
|
||||
, overflow: 'scroll' ref="editor"
|
||||
<CodeMirror style={{height: '100%'}} value={repositoryCode} onChange={onRepositoryCodeUpdate} options={cmOptions} />
|
||||
|
||||
<iframe src="https://testwebssh.educoder.net/?Host=10.9.81.28&Port=44940&Username=root&Password=123123&Gameid=2618&Rows=24&Tab=2"
|
||||
<iframe src="https://testwebssh.educoder.net/?Host=10.9.81.28&Port=44940&Username=root&Password=123123&Gameid=2618&Rows=24&Tab=2"
|
||||
style={{width: '100%', border: '0px', minHeight: '440px', maxHeight: '440px'}} scrolling="no" id="game_webssh" className="game_webssh"></iframe>
|
||||
*/
|
||||
|
||||
export default CodeRepositoryView;
|
||||
export default CodeRepositoryView;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import React, { Component } from 'react';
|
||||
|
||||
import CodeMirror from 'react-codeMirror'
|
||||
import CodeMirror from 'react-codemirror'
|
||||
|
||||
require('codemirror/lib/codemirror.css');
|
||||
require('codemirror/mode/javascript/javascript');
|
||||
|
|
@ -28,13 +28,13 @@ class TestCodeMirror extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
var readOnlyLines = [0,1,2,3,8];
|
||||
|
||||
|
||||
this.refs.editor.getCodeMirror().on('beforeChange',function(cm,change) {
|
||||
console.log('change.from.line', change.from.line)
|
||||
if ( readOnlyLines.indexOf(change.from.line) !== -1
|
||||
if ( readOnlyLines.indexOf(change.from.line) !== -1
|
||||
// 有问题:如果用回车将有内容的行挤到不可编辑的行,那么无法删除掉不可编辑行里的内容了
|
||||
// 解决办法:将所需的行数固定写好,禁用掉回车键。
|
||||
// || change.from.line > ( readOnlyLines[readOnlyLines.length -1] + 1 )
|
||||
// || change.from.line > ( readOnlyLines[readOnlyLines.length -1] + 1 )
|
||||
) {
|
||||
change.cancel();
|
||||
}
|
||||
|
|
@ -60,4 +60,4 @@ class TestCodeMirror extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
export default TestCodeMirror;
|
||||
export default TestCodeMirror;
|
||||
|
|
|
|||
Loading…
Reference in New Issue