在移动触摸屏设备的Ace文本编辑器上慢速滚动

Dri*_*Boy 47 javascript mobile ace-editor

我正在尝试让JavaScript代码编辑器ACE在移动设备上运行.

var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.getSession().setMode("ace/mode/css");
Run Code Online (Sandbox Code Playgroud)

你可以在这里找到完整的代码

对于任何移动设备,垂直滚动似乎根本没有响应,并且它已经滞后了很多.我怎样才能让它更具响应性?

Joe*_*lis 1

据我所知,codemirror 已经很长时间没有出现任何性能问题了,所以尝试使用它。这是你的 jsfiddle,但用 codemirror 代替:https ://jsfiddle.net/DerpMarine/j54gfecL/16/

<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/codemirror.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.39.2/mode/css/css.js"></script>
</body>
<script>

var myCodeMirror = CodeMirror(function(elt) {
  document.getElementById('editor').parentNode.replaceChild(elt, document.getElementById('editor'));
},{
  mode:  "css",
  theme: "custom", // https://codemirror.net/doc/manual.html#option_theme and https://codemirror.net/theme/
  value: document.getElementById('editor').value
});
</script>
Run Code Online (Sandbox Code Playgroud)

https://codemirror.net/doc/manual.html