Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 2 additions & 33 deletions zeppelin-web/src/app/notebook/notebook.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl',
$scope.interpreterBindings = [];
$scope.isNoteDirty = null;
$scope.saveTimer = null;
$scope.paragraphClickFlag = 0;
$scope.alreadyclicked = false;
$scope.alreadyclickedTimeout = null;

var angularObjectRegistry = {};
var connectedOnce = false;
Expand Down Expand Up @@ -111,35 +108,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl',
}
};

var doc = angular.element(document);

$scope.mouseDownHandler = function(evt) {
doc.on('mouseup mousemove', function handler(evt) {
if (evt.type === 'mouseup') {
if ($scope.alreadyclicked) {
// double
if ($scope.alreadyclickedTimeout) {
clearTimeout($scope.alreadyclickedTimeout);
setTimeout(function() {
// can be a tripple click
$scope.alreadyclicked = false;
}, 300);
}
} else {
// single
$scope.alreadyclicked = true;
$scope.alreadyclickedTimeout = setTimeout(function() {
$scope.alreadyclicked = false;
$scope.focusParagraphOnClick(evt);
}, 300);
}
}
doc.off('mouseup mousemove', handler);
});
};

doc.on('mousedown', $scope.mouseDownHandler);

document.addEventListener('click', $scope.focusParagraphOnClick);

$scope.keyboardShortcut = function(keyEvent) {
// handle keyevent
Expand Down Expand Up @@ -300,7 +269,7 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl',
$scope.killSaveTimer();
$scope.saveNote();

doc.off('mousedown');
document.removeEventListener('click', $scope.focusParagraphOnClick);
document.removeEventListener('keydown', $scope.keyboardShortcut);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,8 @@ angular.module('zeppelinWebApp')
if ($scope.paragraph.id === paragraphId) {
// focus editor
if (!$scope.paragraph.config.editorHide) {
$scope.editor.focus();

if (!mouseEvent) {
$scope.editor.focus();
// move cursor to the first row (or the last row)
var row;
if (cursorPos >= 0) {
Expand Down