Explorar o código

HUE-2761 [notebook] Snippet resize can get stuck

When pasting content that resizes a snippet editor the element that is used to resize the editor can get out of position. The jQuery draggable plugin sets an inline style on the element once it's dragged, giving it a fixed top value which put the element out of position when the editor height changed. To solve this the inline style is cleared on drag stop.

This commit also fixes a related issue with an incorrect start position of the draggable element on drag start. This was caused by the codemirrorSize observable being out of sync with the editor height after paste, the codemirrorSize is used to determine the drag start position on the draggable element.
Johan Ahlen %!s(int64=10) %!d(string=hai) anos
pai
achega
d896a94
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      apps/spark/src/spark/templates/editor.mako

+ 2 - 1
apps/spark/src/spark/templates/editor.mako

@@ -1159,8 +1159,8 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
           }
           if (editor.lineCount() >= 30){
             editor.setSize("100%", "400px");
-            snippet.codemirrorSize(400);
           }
+          snippet.codemirrorSize($(editor.getWrapperElement()).height());
           redrawFixedHeaders();
         }, 400);
       });
@@ -1693,6 +1693,7 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
           $(".jHueTableExtenderClonedContainer").show();
           draggableHelper($(this), e, ui, true);
           redrawFixedHeaders();
+          ui.helper.first().removeAttr("style");
         },
         containment: [0, minY, 4000, minY + 400]
       }