2
我試圖做到這一點,當你超過一定數量的文本,它達到了代碼鏡像的最大寬度,它會帶你到一個新的行,而不是隻是一個滾動條並讓你進一步走出去。CodeMirror自動換行
結帳示例! http://codeeplus.net/test.php
CSS:
<style>
.CodeMirror { height: 400px; width: 500px; border: 1px solid #ddd; }
.CodeMirror-scroll { max-height: 400px; width:500px; }
.CodeMirror pre { display:inline-block; padding-left: 7px; line-height: 1.25; }
#drawing { border: 1px solid #555555; float:left; display:inline-block; width:480px; height: 380px; }
</style>
多行文本:
<textarea align="left" style="display:inline-block;" id=demotext name="textarea">
JS:
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
lineNumbers: true,
lineWrapping: true,
mode: "text/html",
matchBrackets: true
});
</script>