fix setAutoScrollEditorIntoView and use in demo page

This commit is contained in:
nightwing 2013-03-24 22:13:11 +04:00
commit 7f76f0b81c
3 changed files with 13 additions and 5 deletions

View file

@ -7,9 +7,12 @@ $(function() {
editor.container.style.opacity = ""; editor.container.style.opacity = "";
embedded_editor = ace.edit("embedded_ace_code"); embedded_editor = ace.edit("embedded_ace_code");
embedded_editor.container.style.opacity = ""; embedded_editor.container.style.opacity = "";
editor.getSession().setMode("ace/mode/javascript"); editor.session.setMode("ace/mode/javascript");
editor.getSession().setMode("ace/mode/javascript"); editor.session.setMode("ace/mode/javascript");
embedded_editor.getSession().setMode("ace/mode/html"); embedded_editor.session.setMode("ace/mode/html");
embedded_editor.setAutoScrollEditorIntoView(true);
editor.setAutoScrollEditorIntoView(true);
$("ul.menu-list li").click(function(e) { $("ul.menu-list li").click(function(e) {
if (e.target.tagName === "LI") { if (e.target.tagName === "LI") {

View file

@ -944,6 +944,11 @@ oop.inherits(FoldMode, BaseFoldMode);
style="position: relative; left: 3px; width: 96px;top: -12px;"> style="position: relative; left: 3px; width: 96px;top: -12px;">
<a href="http://slimtext.org/">Slim Text</a> <a href="http://slimtext.org/">Slim Text</a>
</li> </li>
<li>
<img src="https://www.decor-tab-creator.com/_files/decor_logo_white_new.png"
style="position: relative; left: -5px; width: 111px;top: 15px;">
<a href="https://www.decor-tab-creator.com">Decor</a>
</li>
<li> <li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a> <a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li> </li>

View file

@ -2136,7 +2136,7 @@ var Editor = function(renderer, session) {
* @param {Boolean} enable default true * @param {Boolean} enable default true
**/ **/
this.setAutoScrollEditorIntoView = function(enable) { this.setAutoScrollEditorIntoView = function(enable) {
if (enable === true) if (enable === false)
return; return;
var rect; var rect;
var self = this; var self = this;
@ -2178,7 +2178,7 @@ var Editor = function(renderer, session) {
} }
}); });
this.setAutoScrollEditorIntoView = function(enable) { this.setAutoScrollEditorIntoView = function(enable) {
if (enable === false) if (enable === true)
return; return;
delete this.setAutoScrollEditorIntoView; delete this.setAutoScrollEditorIntoView;
this.removeEventListener("changeSelection", onChangeSelection); this.removeEventListener("changeSelection", onChangeSelection);