diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph-results.html b/zeppelin-web/src/app/notebook/paragraph/paragraph-results.html index 7fb40ac56de..77d74519795 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph-results.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph-results.html @@ -23,9 +23,20 @@ ng-bind-html="paragraph.result.comment"> -
+
+
+
+
+
').text(lines[i])); } } + if ($scope.keepScrollDown) { + var doc = angular.element('#p' + $scope.paragraph.id + '_text'); + doc[0].scrollTop = doc[0].scrollHeight; + } }; @@ -2077,4 +2086,33 @@ angular.module('zeppelinWebApp') var redirectToUrl = location.protocol + '//' + location.host + location.pathname + '#/notebook/' + noteId + '/paragraph/' + $scope.paragraph.id+'?asIframe'; $window.open(redirectToUrl); }; + + $scope.showScrollDownIcon = function(){ + var doc = angular.element('#p' + $scope.paragraph.id + '_text'); + if(doc[0]){ + return doc[0].scrollHeight > doc.innerHeight(); + } + return false; + }; + + $scope.scrollParagraphDown = function() { + var doc = angular.element('#p' + $scope.paragraph.id + '_text'); + doc.animate({scrollTop: doc[0].scrollHeight}, 500); + $scope.keepScrollDown = true; + }; + + $scope.showScrollUpIcon = function(){ + if(angular.element('#p' + $scope.paragraph.id + '_text')[0]){ + return angular.element('#p' + $scope.paragraph.id + '_text')[0].scrollTop != 0; + } + return false; + + }; + + $scope.scrollParagraphUp = function() { + var doc = angular.element('#p' + $scope.paragraph.id + '_text'); + doc.animate({scrollTop: 0}, 500); + $scope.keepScrollDown = false; + }; + }); diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.css b/zeppelin-web/src/app/notebook/paragraph/paragraph.css index b73ecd9c0ec..3b56c2aff8b 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.css +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.css @@ -411,3 +411,17 @@ table.table-striped { border-top: 1px solid #ddd; margin-top: 20px; } + +.scroll-paragraph-down { + position: absolute; + right: 10px; + cursor: pointer; +} + + +.scroll-paragraph-up { + bottom: 5px; + cursor: pointer; + position: absolute; + right: 15px; +} diff --git a/zeppelin-web/src/components/resizable/resizable.directive.js b/zeppelin-web/src/components/resizable/resizable.directive.js index 53b9ac8adc4..2dcfe0a66d3 100644 --- a/zeppelin-web/src/components/resizable/resizable.directive.js +++ b/zeppelin-web/src/components/resizable/resizable.directive.js @@ -35,7 +35,7 @@ angular.module('zeppelinWebApp').directive('resizable', function() { var colStep = window.innerWidth / 12; elem.off('resizestop'); var conf = angular.copy(resizableConfig); - if (resize.graphType === 'TABLE') { + if (resize.graphType === 'TABLE' || resize.graphType === 'TEXT') { conf.grid = [colStep, 10]; conf.minHeight = 100; } else {