From e0f686c89a16322df82222480fe070ffec7c419d Mon Sep 17 00:00:00 2001 From: Luka van der Plas Date: Thu, 23 Nov 2023 15:16:48 +0100 Subject: [PATCH] reset tagging controls on document switch close #1324 --- .../app/tag/document-tags/document-tags.component.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/tag/document-tags/document-tags.component.ts b/frontend/src/app/tag/document-tags/document-tags.component.ts index 89a0682fc..2464b427f 100644 --- a/frontend/src/app/tag/document-tags/document-tags.component.ts +++ b/frontend/src/app/tag/document-tags/document-tags.component.ts @@ -1,7 +1,6 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; import { FoundDocument, Tag } from '../../models'; import { faPlus, faTimes } from '@fortawesome/free-solid-svg-icons'; -import { first, map, mergeMap } from 'rxjs/operators'; import * as _ from 'lodash'; @Component({ @@ -9,7 +8,7 @@ import * as _ from 'lodash'; templateUrl: './document-tags.component.html', styleUrls: ['./document-tags.component.scss'], }) -export class DocumentTagsComponent implements OnInit { +export class DocumentTagsComponent implements OnChanges { @Input() document: FoundDocument; faTimes = faTimes; @@ -19,7 +18,11 @@ export class DocumentTagsComponent implements OnInit { constructor() {} - ngOnInit(): void {} + ngOnChanges(changes: SimpleChanges): void { + if (changes.document) { + this.showAddNew = false; + } + } addTag(tag: Tag) { this.document.addTag(tag);