Improve two view pane

This commit is contained in:
Johannes Zellner
2022-08-25 12:23:38 +02:00
parent 2a69b3d523
commit ba9530eb32
5 changed files with 76 additions and 46 deletions
+18 -2
View File
@@ -6,7 +6,8 @@
angular.module('Application').component('filetree', {
bindings: {
backendId: '<',
backendType: '<'
backendType: '<',
view: '<'
},
templateUrl: 'components/filetree.html?<%= revision %>',
controller: [ '$scope', '$translate', '$timeout', 'Client', FileTreeController ]
@@ -15,6 +16,7 @@ angular.module('Application').component('filetree', {
function FileTreeController($scope, $translate, $timeout, Client) {
$scope.backendId = this.backendId;
$scope.backendType = this.backendType;
$scope.view = this.view;
$scope.busy = true;
$scope.client = Client;
@@ -26,7 +28,6 @@ function FileTreeController($scope, $translate, $timeout, Client) {
$scope.clipboard = []; // holds cut or copied entries
$scope.clipboardCut = false; // if action is cut or copy
$scope.dropToBody = false;
$scope.view = 'fileTree';
$scope.applicationLink = '';
$scope.owners = [
@@ -968,4 +969,19 @@ function FileTreeController($scope, $translate, $timeout, Client) {
}
openPath('.');
// handle save shortcuts
window.addEventListener('keydown', function (event) {
if ($scope.$parent.activeView !== $scope.view || $scope.$parent.viewerOpen) return;
if (event.key === 'ArrowDown') {
$scope.$apply(selectNext);
} else if (event.key === 'ArrowUp') {
$scope.$apply(selectPrev);
} else if (event.key === 'Enter') {
$scope.$apply(openSelected);
} else if (event.key === 'Backspace') {
if ($scope.view === 'fileTree') $scope.goDirectoryUp();
}
});
}