浏览代码

HUE-3446 [editor] Limit the height growth of the SQL textarea

Enrico Berti 9 年之前
父节点
当前提交
773a33fa14
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 3 - 2
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1372,11 +1372,12 @@
       var autoExpandTimeout = window.setInterval(function () {
       var autoExpandTimeout = window.setInterval(function () {
         var chunks = Math.floor((Math.max(ace().session.getLength(), 4) - lastEditorHeight) / 4);
         var chunks = Math.floor((Math.max(ace().session.getLength(), 4) - lastEditorHeight) / 4);
         if (chunks !== 0) {
         if (chunks !== 0) {
-          if (ace().session.getLength() < 2000) {
+          var maxAutoLines = Math.floor(($(window).height() - 200) / 16);
+          if (ace().session.getLength() < maxAutoLines) {
             $target.height($target.height() + 64 * chunks);
             $target.height($target.height() + 64 * chunks);
           }
           }
           else {
           else {
-            $target.height(2000 * 16); // height of 2000 lines
+            $target.height(maxAutoLines * 16); // height of maxAutoLines
           }
           }
           ace().resize();
           ace().resize();
           lastEditorHeight += 4 * chunks;
           lastEditorHeight += 4 * chunks;