Skip to content

Commit 37c6e64

Browse files
committed
fix copy commands
1 parent 02fd631 commit 37c6e64

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

rubberduckvba.client/src/app/routes/indenter/indenter.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,9 @@ <h4 class="card-title">Looking for a programmatic approach?</h4>
419419
</div>
420420

421421
<div class="card-footer">
422-
<button id="copy-template" class="btn btn-secondary mx-1" type="button">
422+
<button id="copy-template" class="btn mx-1" [ngClass]="wasCopied ? 'btn-success' : 'btn-secondary'" type="button">
423423
<span><i class="fa fa-clipboard"></i>&nbsp;Copy</span>
424+
<span><fa-icon [icon]="wasTemplateCopied ? 'check' : 'clipboard'"></fa-icon>&nbsp;{{wasTemplateCopied ? 'Copied!' : 'Copy'}}</span>
424425
</button>
425426
</div>
426427
</div>
@@ -444,7 +445,7 @@ <h4>Try it right here!</h4>
444445
<span id="indent-button-text">Indent</span>
445446
</button>
446447
<button id="copy-code" class="btn mx-1" [ngClass]="wasCopied ? 'btn-success' : 'btn-secondary'" type="button" [disabled]="model.code.length == 0" (click)="copy()">
447-
<span><fa-icon [icon]="'clipboard'"></fa-icon>&nbsp;{{wasCopied ? 'Copied!' : 'Copy'}}</span>
448+
<span><fa-icon [icon]="wasCopied ? 'check' : 'clipboard'"></fa-icon>&nbsp;{{wasCopied ? 'Copied!' : 'Copy'}}</span>
448449
</button>
449450
</div>
450451
</div>

rubberduckvba.client/src/app/routes/indenter/indenter.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { ApiClientService } from "../../services/api-client.service";
1111
export class IndenterComponent implements OnInit {
1212
private _model!: IndenterViewModel;
1313
public wasCopied: boolean = false;
14+
public wasTemplateCopied: boolean = false;
1415

1516

1617
constructor(fa: FaIconLibrary, private service: ApiClientService) {
@@ -49,16 +50,23 @@ export class IndenterComponent implements OnInit {
4950
this.model.indentedCode = vm.indentedCode;
5051
this.model.code = vm.indentedCode;
5152
this.isIndenterBusy = false;
53+
this.wasCopied = false;
54+
this.wasTemplateCopied = false;
5255
});
5356
}
5457

5558
public clear(): void {
5659
this.model.code = '';
60+
this.wasCopied = false;
61+
this.wasTemplateCopied = false;
5762
}
5863

5964
public copy(): void {
6065
navigator.clipboard.writeText(this.model.code).then(e => this.wasCopied = true);
6166
}
67+
public copyTemplate(): void {
68+
navigator.clipboard.writeText(this.asJson).then(e => this.wasTemplateCopied = true);
69+
}
6270

6371
public onModelChanged(code: string): void {
6472
this.model.code = code;

0 commit comments

Comments
 (0)