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): select filename without extension when renaming files
johaven163b5c9592c7
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.html b/frontend/src/app/applications/spaces/components/spaces-browser.component.htmlindex 682a750b..a560b13d 100644--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.html+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.html@@ -328,6 +328,7 @@@if (f.isRenamed) {<input appInputEdit[inputObject]="f"+ [selectFileNameWithoutExtension]="!f.isDir"[fullWidth]="true"[textCenter]="true"(renamingInProgress)="setRenamingInProgress($event)"@@ -401,6 +402,7 @@(renamingInProgress)="setRenamingInProgress($event)"(updateObject)="renameFile($event)"[inputObject]="f"+ [selectFileNameWithoutExtension]="!f.isDir"requiredtype="text">} @else {diff --git a/frontend/src/app/common/directives/input-edit.directive.ts b/frontend/src/app/common/directives/input-edit.directive.tsindex 7054c42c..c6df44f4 100644--- a/frontend/src/app/common/directives/input-edit.directive.ts+++ b/frontend/src/app/common/directives/input-edit.directive.ts@@ -1,4 +1,4 @@-import { Directive, ElementRef, EventEmitter, HostListener, inject, Input, OnInit, Output, Renderer2 } from '@angular/core'+import { booleanAttribute, Directive, ElementRef, EventEmitter, HostListener, inject, Input, OnInit, Output, Renderer2 } from '@angular/core'@Directive({selector: '[appInputEdit]'@@ -11,6 +11,7 @@ export class InputEditDirective implements OnInit {@Input() disableOnBlur = true@Input() disableFocus = false@Input() disableKeyboard = false+ @Input({ transform: booleanAttribute }) selectFileNameWithoutExtension = false@Output() updateObject = new EventEmitter<{ object: any; name: string }>(true)@Output() renamingInProgress = new EventEmitter<boolean>(true)private readonly elementRef = inject(ElementRef)@@ -26,7 +27,7 @@ export class InputEditDirective implements OnInit {this.setParentDraggable('false')if (!this.disableFocus) {this.elementRef.nativeElement.focus()- this.elementRef.nativeElement.select()+ this.selectInputValue()}}, 5)}@@ -97,6 +98,15 @@ export class InputEditDirective implements OnInit {}}+ private selectInputValue() {+ if (!this.selectFileNameWithoutExtension) {+ this.elementRef.nativeElement.select()+ return+ }+ const pos = this.elementRef.nativeElement.value.lastIndexOf('.')+ this.elementRef.nativeElement.setSelectionRange(0, pos > 0 ? pos : this.elementRef.nativeElement.value.length)+ }+private disableEdit() {this.setParentDraggable('true')this.renamingInProgress.emit(false)