From 4c6525d1c14f0f5727d5f7f2cc16b4b795e70d7a Mon Sep 17 00:00:00 2001 From: Renjith Kamath Date: Wed, 26 Apr 2017 22:24:01 +0530 Subject: [PATCH] ZEPPELIN-2459 Zeppelin Usability Improvement for new paragraph --- .../src/app/notebook/paragraph/paragraph.controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 1a921769f49..abbdc5d88a0 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -629,9 +629,18 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca $scope.editor.getSession().setUseWrapMode(true) $scope.editor.setTheme('ace/theme/chrome') $scope.editor.setReadOnly($scope.isRunning($scope.paragraph)) + if ($scope.paragraphFocused) { + let prefix = '%' + getInterpreterName($scope.paragraph.text) + let paragraphText = $scope.paragraph.text ? $scope.paragraph.text.trim() : '' + $scope.editor.focus() $scope.goToEnd($scope.editor) + if (prefix === paragraphText) { + $timeout(function () { + $scope.editor.gotoLine(2, 0) + }, 0) + } } autoAdjustEditorHeight(_editor)