You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2015/11/19 14:36:06 UTC
incubator-zeppelin git commit: ZEPPELIN-437 Improvement Autoscroll
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master c7633afdb -> ea995b116
ZEPPELIN-437 Improvement Autoscroll
https://issues.apache.org/jira/browse/ZEPPELIN-437
This PR changes
* Autoscroll to cursor on paragraph status change, only when cursor is on the last paragraph (to tail the notebook)
* When tail the notebook, waits for sometime to output is rendered and then fire autoscroll event.
Author: Lee moon soo <mo...@apache.org>
Closes #445 from Leemoonsoo/ZEPPELIN-437 and squashes the following commits:
3d94d9e [Lee moon soo] single quote
1641de1 [Lee moon soo] $ to angular.element
03943f1 [Lee moon soo] More strict rule to trigger autoscroll after paragraph status change
aa1f18d [Lee moon soo] Force top position 0 when key input after focus change by key up/down
453e084 [Lee moon soo] Autoscroll on Paragraph status change, only when cursor is on the last paragraph
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/ea995b11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/ea995b11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/ea995b11
Branch: refs/heads/master
Commit: ea995b116bc3b4dacbe1ccb9dd09641d9611dacb
Parents: c7633af
Author: Lee moon soo <mo...@apache.org>
Authored: Wed Nov 18 23:38:17 2015 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Thu Nov 19 22:36:36 2015 +0900
----------------------------------------------------------------------
.../notebook/paragraph/paragraph.controller.js | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/ea995b11/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index 2fea151..d323757 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -227,7 +227,13 @@ angular.module('zeppelinWebApp')
if (statusChanged || resultRefreshed) {
// when last paragraph runs, zeppelin automatically appends new paragraph.
// this broadcast will focus to the newly inserted paragraph
- $rootScope.$broadcast('scrollToCursor');
+ var paragraphs = angular.element('div[id$="_paragraphColumn_main"');
+ if (paragraphs.length >= 2 && paragraphs[paragraphs.length-2].id.startsWith($scope.paragraph.id)) {
+ // rendering output can took some time. So delay scrolling event firing for sometime.
+ setTimeout(function() {
+ $rootScope.$broadcast('scrollToCursor');
+ }, 500);
+ }
}
}
@@ -595,6 +601,9 @@ angular.module('zeppelinWebApp')
$scope.editor.keyBinding.onCommandKey = function(e, hashId, keyCode) {
if ($scope.editor.completer && $scope.editor.completer.activated) { // if autocompleter is active
} else {
+ // fix ace editor focus issue in chrome (textarea element goes to top: -1000px after focused by cursor move)
+ angular.element('#' + $scope.paragraph.id + '_editor > textarea').css('top', 0);
+
var numRows;
var currentRow;
@@ -632,7 +641,11 @@ angular.module('zeppelinWebApp')
};
$rootScope.$on('scrollToCursor', function(event) {
- $scope.scrollToCursor($scope.paragraph.id, 0);
+ // scroll on 'scrollToCursor' event only when cursor is in the last paragraph
+ var paragraphs = angular.element('div[id$="_paragraphColumn_main"');
+ if (paragraphs[paragraphs.length-1].id.startsWith($scope.paragraph.id)) {
+ $scope.scrollToCursor($scope.paragraph.id, 0);
+ }
});
/** scrollToCursor if it is necessary
@@ -732,7 +745,6 @@ angular.module('zeppelinWebApp')
row = $scope.editor.session.getLength() - 1;
$scope.editor.gotoLine(row + 1, 0);
}
-
$scope.scrollToCursor($scope.paragraph.id, 0);
}
});