reset input when comment added
This commit is contained in:
parent
6dab0374f4
commit
3828c0bee3
@ -1,23 +1,27 @@
|
||||
import { Component, HostBinding, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input, ViewChild } from '@angular/core';
|
||||
import { Comment } from '@redaction/red-ui-http';
|
||||
import { ManualAnnotationService } from '../../services/manual-annotation.service';
|
||||
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { InputWithActionComponent } from '@iqser/common-ui';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-comments',
|
||||
templateUrl: './comments.component.html',
|
||||
styleUrls: ['./comments.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class CommentsComponent {
|
||||
@Input() annotation: AnnotationWrapper;
|
||||
@HostBinding('class.hidden') private _hidden = true;
|
||||
@ViewChild(InputWithActionComponent) private readonly _input: InputWithActionComponent;
|
||||
|
||||
constructor(
|
||||
readonly permissionsService: PermissionsService,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _manualAnnotationService: ManualAnnotationService,
|
||||
private readonly _changeDetectorRef: ChangeDetectorRef,
|
||||
) {}
|
||||
|
||||
addComment(value: string): void {
|
||||
@ -33,6 +37,8 @@ export class CommentsComponent {
|
||||
id: parseInt(commentResponse.commentId, 10),
|
||||
user: this._userService.currentUser.id,
|
||||
});
|
||||
this._input.reset();
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
|
||||
@ -50,6 +56,7 @@ export class CommentsComponent {
|
||||
if (!this.annotation.comments.length) {
|
||||
this._hidden = true;
|
||||
}
|
||||
this._changeDetectorRef.markForCheck();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit c16328aa38adcbe68fd20cda2512308ccb8f36f0
|
||||
Subproject commit f7d8b556d3eb926f8f5fbdfd6663518afc298c9e
|
||||
Loading…
x
Reference in New Issue
Block a user