mirror of https://gitee.com/bigwinds/arangodb
issue #446: added resizability for JS Shell
This commit is contained in:
parent
8131c57ce0
commit
d66e959e62
|
@ -2,6 +2,8 @@
|
||||||
/*global require, exports, Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
|
/*global require, exports, Backbone, EJS, $, window, ace, jqconsole, handler, help, location*/
|
||||||
|
|
||||||
var shellView = Backbone.View.extend({
|
var shellView = Backbone.View.extend({
|
||||||
|
resizing: false,
|
||||||
|
|
||||||
el: '#content',
|
el: '#content',
|
||||||
events: {
|
events: {
|
||||||
'click #editor-run' : 'submitEditor',
|
'click #editor-run' : 'submitEditor',
|
||||||
|
@ -16,19 +18,33 @@ var shellView = Backbone.View.extend({
|
||||||
this.replShell();
|
this.replShell();
|
||||||
this.editor();
|
this.editor();
|
||||||
|
|
||||||
var windowHeight = $(window).height() - 200;
|
|
||||||
$('#shell_workspace').height(windowHeight);
|
|
||||||
|
|
||||||
$("#shell_workspace").splitter({
|
$("#shell_workspace").splitter({
|
||||||
dock: true
|
dock: true
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#shell_workspace").trigger("resize", [ 200 ]);
|
|
||||||
$('.vsplitbar').append('<div id="editor-run"><img src="img/right_icon.png"></img></div>');
|
$('.vsplitbar').append('<div id="editor-run"><img src="img/right_icon.png"></img></div>');
|
||||||
|
this.resize();
|
||||||
$.gritter.removeAll();
|
$.gritter.removeAll();
|
||||||
|
|
||||||
|
// evil: the resize event is globally bound to window, but there is
|
||||||
|
// no elegant alternative... (is there?)
|
||||||
|
var self = this;
|
||||||
|
$(window).resize(function () {
|
||||||
|
self.resize();
|
||||||
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
resize: function () {
|
||||||
|
// prevent endless recursion
|
||||||
|
if (! this.resizing) {
|
||||||
|
this.resizing = true;
|
||||||
|
var windowHeight = $(window).height() - 200;
|
||||||
|
$('#shell_workspace').height(windowHeight);
|
||||||
|
$("#shell_workspace").trigger("resize", [ 200 ]);
|
||||||
|
this.resizing = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
renderEditor: function () {
|
renderEditor: function () {
|
||||||
var editor = ace.edit("editor");
|
var editor = ace.edit("editor");
|
||||||
editor.resize();
|
editor.resize();
|
||||||
|
|
Loading…
Reference in New Issue