Skip to content
Closed
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
12 changes: 10 additions & 2 deletions zeppelin-web/src/app/notebook/notebook.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,23 @@ function NotebookCtrl ($scope, $route, $routeParams, $location, $rootScope,
// register mouseevent handler for focus paragraph
document.addEventListener('click', $scope.focusParagraphOnClick)

$scope.keyboardShortcut = function (keyEvent) {
let keyboardShortcut = function (keyEvent) {
// handle keyevent
if (!$scope.viewOnly && !$scope.revisionView) {
$scope.$broadcast('keyEvent', keyEvent)
}
}

$scope.keydownEvent = function (keyEvent) {
if ((keyEvent.ctrlKey || keyEvent.metaKey) && String.fromCharCode(keyEvent.which).toLowerCase() === 's') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this metaKey is Alt in Windows though, would this disable that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does alt + s have important behavior in windows / ubuntu?

keyEvent.preventDefault()
}

keyboardShortcut(keyEvent)
}

// register mouseevent handler for focus paragraph
document.addEventListener('keydown', $scope.keyboardShortcut)
document.addEventListener('keydown', $scope.keydownEvent)

$scope.paragraphOnDoubleClick = function (paragraphId) {
$scope.$broadcast('doubleClickParagraph', paragraphId)
Expand Down