File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
frontend/src/app/common/directives Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export class InputEditDirective implements OnInit {
3333
3434 @HostListener ( 'blur' )
3535 onBlur ( ) {
36+ this . validateInput ( )
3637 if ( this . disableOnBlur ) {
3738 this . disableEdit ( )
3839 }
@@ -43,18 +44,7 @@ export class InputEditDirective implements OnInit {
4344 if ( this . disableKeyboard ) {
4445 return
4546 }
46- if ( ! this . elementRef . nativeElement . value ) {
47- this . setIncorrectForm ( )
48- } else {
49- if ( this . elementRef . nativeElement . value === this . inputObject [ this . inputField ] ) {
50- this . setCorrectForm ( )
51- this . disableEdit ( )
52- } else {
53- this . setCorrectForm ( )
54- this . updateObject . next ( { object : this . inputObject , name : this . elementRef . nativeElement . value } )
55- this . disableEdit ( )
56- }
57- }
47+ this . validateInput ( )
5848 }
5949
6050 @HostListener ( 'keyup.esc' )
@@ -93,6 +83,21 @@ export class InputEditDirective implements OnInit {
9383 this . renderer . setStyle ( this . elementRef . nativeElement , 'border-color' , this . primaryColor )
9484 }
9585
86+ private validateInput ( ) {
87+ if ( ! this . elementRef . nativeElement . value ) {
88+ this . setIncorrectForm ( )
89+ } else {
90+ if ( this . elementRef . nativeElement . value === this . inputObject [ this . inputField ] ) {
91+ this . setCorrectForm ( )
92+ this . disableEdit ( )
93+ } else {
94+ this . setCorrectForm ( )
95+ this . updateObject . next ( { object : this . inputObject , name : this . elementRef . nativeElement . value } )
96+ this . disableEdit ( )
97+ }
98+ }
99+ }
100+
96101 private disableEdit ( ) {
97102 this . setParentDraggable ( 'true' )
98103 this . renamingInProgress . emit ( false )
You can’t perform that action at this time.
0 commit comments