Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,39 @@ <h2>{{ title }}</h2>
<input
#editInput
[(ngModel)]="editingName"
(click)="$event.stopPropagation()"
(keydown.escape)="cancelEditItem(name)"
(keydown.enter)="saveEditedItem(name)"
(blur)="saveEditedItem(name)" />
</ng-template>
<ng-template #displayItem>
<span>{{ name }}</span>
<span
(dblclick)="$event.stopPropagation(); handleDoubleClick(name)"
style="cursor: text"
title="Double-click to edit {{ name }}"
>{{ name }}</span
>
</ng-template>

<span *ngIf="editMode">
<button mat-icon-button (click)="startEditItem(name)" title="Rename {{ name }}">
<button
*ngIf="editingOrgName !== name"
mat-icon-button
(click)="$event.stopPropagation(); startEditItem(name)"
title="Rename {{ name }}">
<mat-icon class="material-icons-outlined">edit</mat-icon>
</button>
<button mat-icon-button (click)="deleteListItem(name)" title="Delete {{ name }}">
<button
*ngIf="editingOrgName === name"
mat-icon-button
(click)="$event.stopPropagation(); saveEditedItem(name)"
title="Accept edit for {{ name }}">
<mat-icon class="material-icons-outlined">check</mat-icon>
</button>
<button
mat-icon-button
(click)="$event.stopPropagation(); deleteListItem(name)"
title="Delete {{ name }}">
<mat-icon class="material-icons-outlined">delete</mat-icon>
</button>
</span>
Expand Down
11 changes: 11 additions & 0 deletions src/app/component/teams-groups-editor/selectable-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ export class SelectableListComponent {
});
}

handleDoubleClick(name: string) {
if (!this.canEdit) {
return;
}
if (!this.editMode) {
this.editMode = true;
this.editModeChange.emit(this.editMode);
}
this.startEditItem(name);
}

cancelEditItem(oldName: string) {
console.log(`${perfNow()}: Cancel editing: ${oldName}`);
this.editingName = '';
Expand Down