【问题标题】:Slow Scrolling on Ace Text Editor For Mobile Touch Screen Devices用于移动触摸屏设备的 Ace 文本编辑器上的慢速滚动
【发布时间】:2012-11-16 17:49:54
【问题描述】:

我正在尝试让 JavaScript 代码编辑器 ACE 在移动设备上工作。

var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.getSession().setMode("ace/mode/css");

你可以找到完整的代码here

垂直滚动似乎对任何移动设备都没有响应,而且滞后很多。如何让它更具响应性?

【问题讨论】:

标签: javascript mobile ace-editor


【解决方案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>

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

【讨论】:

  • 问题是针对 Ace 的。用 CodeMirror 交换 Ace 可能有优势,但它与问题无关,而且将一个编辑器换成另一个也不简单。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多