Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to set Ace editor blockScrolling?

When I use ace (with jquery-ace) to change a textarea to ace-editor, it shows this warning on the console:

Automatically scrolling cursor into view after selection change 
this will be disabled in the next version 
set editor.$blockScrolling = Infinity to disable this message

Where to set that editor.$blockScrolling variable to remove those warnings?

var aces = el.find('textarea.code.json');
var aceInit = function() {
 //window.ace.$blockScrolling = Infinity; // no effect
 //$.ace.$blockScrolling = Infinity; // no effect
 //window.jQueryAce.AceDecorator.$blockScrolling = Infinity; // no effect
 //window.jQueryAce.BaseEditor.$blockScrolling = Infinity; // no effect
 //window.jQueryAce.TextAreaEditor.$blockScrolling = Infinity; // no effect
 aces.ace({theme: 'eclipse', lang: 'json'}).each(function (idx, editor) {
  var el = $(editor);
  var editor = el.data('ace').editor;
  //editor.$blockScrolling = Infinity; // no effect
  var ace = editor.ace;
  //ace.$blockScrolling = Infinity; // no effect, even this the correct one
  ace.setReadOnly(el.prop('disabled'));
  ace.setOption("maxLines", 10);
  ace.setOption("minLines", 2);
 });
}; // this function called when ace.js, mode-json.js and jquery-ace.js loaded
like image 228
Kokizzu Avatar asked Mar 09 '15 06:03

Kokizzu


1 Answers

The correct one would be:

var el = $(the_element);
var editor = el.data('ace').editor;
editor.$blockScrolling = Infinity;
like image 117
Kokizzu Avatar answered Oct 11 '22 04:10

Kokizzu