Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
feat(frontend:files): add keyboard shortcuts to open, rename and delete files
johavena3ba5c14af94
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.tsindex deb97468..16ff31b0 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts@@ -947,6 +947,37 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroyreturn true}+ private handleKeyboardAction(ev: KeyboardEvent): boolean {+ if (ev.repeat || ev.ctrlKey || ev.metaKey || ev.altKey || ev.shiftKey) {+ return false+ }+ let action: (() => void) | undefined+ switch (ev.key) {+ case 'Enter':+ if (this.selection.length === 1) {+ action = () => this.browse(this.selection[0])+ }+ break+ case 'F2':+ if (this.selection.length === 1 && !this.isTrashRepo && !this.inSharesList) {+ action = () => this.shortcutRename()+ }+ break+ case 'Delete':+ if (this.selection.length && !this.inSharesList) {+ action = () => this.openTrashDialog(this.isTrashRepo)+ }+ break+ }+ if (!action) {+ return false+ }+ ev.preventDefault()+ ev.stopPropagation()+ this.zone.run(action)+ return true+ }+private isEditableKeyboardTarget(target: EventTarget | null): boolean {return target instanceof Element && !!target.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])')}@@ -1079,6 +1110,9 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroyif (this.handleKeyboardShortcut(ev)) {return}+ if (this.handleKeyboardAction(ev)) {+ return+ }if (!keyboardNavigationKeys.has(ev.key)) {return}