Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow Scrolling on Ace Text Editor For Mobile Touch Screen Devices

I'm trying to get The JavaScript code editor ACE to work on a mobile device.

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

You can find the full code here

The vertical scrolling does not seem to respond at all for any mobile device and it's lagging a lot. How can I make it more responsive?

like image 779
DriverBoy Avatar asked Nov 28 '12 19:11

DriverBoy


1 Answers

As far as I'm aware, codemirror hasn't had any performance issues for ages, so try to use that. Here's your jsfiddle but with codemirror instead: 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

like image 147
Joel Ellis Avatar answered Sep 19 '22 17:09

Joel Ellis