1.添加全局样式
.CodeMirror {
border: 1px solid #eee;
height: auto !important;
/*min-height: 100px;*/
}
.CodeMirror-scroll {
height: auto !important;
min-height: 100px;
/*overflow-y: hidden;*/
/*overflow-x: auto;*/
}
2.html
允许设置最小高度
<textarea id="xxx" style="min-height: 55px;"> </textarea>
3.js
配置随意
var elemenet= $('#xxx')[0];
var opt = {
mode: "text/x-sql",
lineNumbers: false,
extraKeys: {"Alt-/": "autocomplete"},
// smartIndent : true,
matchBrackets: true,
scrollbarStyle: null,
lineWrapping: true,
styleActiveLine: true,
}
var editor= CodeMirror.fromTextArea(elemenet, opt);