فهرست منبع

HUE-4279 [editor] Shrink back the editor if the query is not big enough and it hasn't been resized manually

Enrico Berti 10 سال پیش
والد
کامیت
76008b0
1فایلهای تغییر یافته به همراه8 افزوده شده و 0 حذف شده
  1. 8 0
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 8 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1449,6 +1449,7 @@
       ace().on('change', function () {
       ace().on('change', function () {
         if (autoExpand) {
         if (autoExpand) {
           var maxAutoLines = Math.floor((($(window).height() - 80) / 2) / 16);
           var maxAutoLines = Math.floor((($(window).height() - 80) / 2) / 16);
+          var resized = false;
           if (ace().session.getLength() > editorHeight) {
           if (ace().session.getLength() > editorHeight) {
             if (ace().session.getLength() < maxAutoLines) {
             if (ace().session.getLength() < maxAutoLines) {
               $target.height((ace().session.getLength() + 1) * 16);
               $target.height((ace().session.getLength() + 1) * 16);
@@ -1456,6 +1457,13 @@
             else {
             else {
               $target.height(maxAutoLines * 16); // height of maxAutoLines
               $target.height(maxAutoLines * 16); // height of maxAutoLines
             }
             }
+            resized = true;
+          }
+          else if (ace().session.getLength() > 8) {
+            $target.height((ace().session.getLength()) * 16);
+            resized = true;
+          }
+          if (resized) {
             ace().resize();
             ace().resize();
             editorHeight = ace().session.getLength();
             editorHeight = ace().session.getLength();
             huePubSub.publish('redraw.fixed.headers');
             huePubSub.publish('redraw.fixed.headers');