mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Fix: correct tag removal button type, prevent dropdown open
This commit is contained in:
		| @@ -40,14 +40,14 @@ | ||||
|     <ng-template ng-label-tmp let-document="item"> | ||||
|       <div class="d-flex align-items-center"> | ||||
|         @if (!disabled) { | ||||
|           <button class="btn p-0 lh-1" (click)="unselect(document)" type="button" title="Remove link" i18n-title><i-bs name="x"></i-bs></button> | ||||
|           <button class="btn p-0 lh-1" (click)="unselect(document)" (mousedown)="$event.stopImmediatePropagation()" type="button" title="Remove link" i18n-title><i-bs name="x"></i-bs></button> | ||||
|         } | ||||
|         @if (document.title) { | ||||
|           <a routerLink="/documents/{{document.id}}" class="badge bg-light text-primary" (mousedown)="$event.stopImmediatePropagation();" title="Open link" i18n-title> | ||||
|             <i-bs width="0.9em" height="0.9em" name="file-text"></i-bs> <span>{{document.title}}</span> | ||||
|           </a> | ||||
|         } @else { | ||||
|           <span class="badge bg-light text-muted" (click)="unselect(document)" type="button" title="Remove link" i18n-title> | ||||
|           <span class="badge bg-light text-muted" (click)="unselect(document)" (mousedown)="$event.stopImmediatePropagation()" type="button" title="Remove link" i18n-title> | ||||
|             <i-bs width="0.9em" height="0.9em" name="exclamation-triangle-fill"></i-bs> <span i18n>Not found</span> | ||||
|           </span> | ||||
|         } | ||||
|   | ||||
| @@ -17,7 +17,7 @@ | ||||
|           (change)="onChange(value)"> | ||||
|  | ||||
|           <ng-template ng-label-tmp let-item="item"> | ||||
|             <button class="tag-wrap btn p-0 d-flex align-items-center" (click)="removeTag($event, item.id)" title="Remove tag" i18n-title> | ||||
|             <button class="tag-wrap btn p-0 d-flex align-items-center" (click)="removeTag(item.id)" (mousedown)="$event.stopImmediatePropagation()" type="button" title="Remove tag" i18n-title> | ||||
|               <i-bs name="x" style="margin-inline-end: 1px;"></i-bs> | ||||
|               @if (item.id && tags) { | ||||
|                 <pngx-tag style="background-color: none;" [tag]="getTag(item.id)"></pngx-tag> | ||||
|   | ||||
| @@ -154,11 +154,11 @@ describe('TagsComponent', () => { | ||||
|   it('support remove tags', () => { | ||||
|     component.tags = tags | ||||
|     component.value = [1, 2] | ||||
|     component.removeTag(new PointerEvent('point'), 2) | ||||
|     component.removeTag(2) | ||||
|     expect(component.value).toEqual([1]) | ||||
|  | ||||
|     component.disabled = true | ||||
|     component.removeTag(new PointerEvent('point'), 1) | ||||
|     component.removeTag(1) | ||||
|     expect(component.value).toEqual([1]) | ||||
|   }) | ||||
|  | ||||
|   | ||||
| @@ -118,13 +118,10 @@ export class TagsComponent implements OnInit, ControlValueAccessor { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   removeTag(event: PointerEvent, id: number) { | ||||
|   removeTag(tagID: number) { | ||||
|     if (this.disabled) return | ||||
|  | ||||
|     // prevent opening dropdown | ||||
|     event.stopImmediatePropagation() | ||||
|  | ||||
|     let index = this.value.indexOf(id) | ||||
|     let index = this.value.indexOf(tagID) | ||||
|     if (index > -1) { | ||||
|       let oldValue = this.value | ||||
|       oldValue.splice(index, 1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon