Merge pull request #806 from webrecorder/frontend-update-copy-button

This commit is contained in:
Henry Wilkinson 2023-05-01 15:38:22 -04:00 committed by GitHub
commit 624e7083cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,12 +40,15 @@ export class CopyButton extends LitElement {
render() { render() {
return html` return html`
<sl-button <sl-tooltip content=${this.isCopied ? msg("Copied to clipboard!") : msg("Copy")}>
size="small" <sl-icon-button
@click=${this.onClick} size="small"
?disabled=${!this.value && !this.getValue} name=${this.isCopied ? "check-lg" : "files"}
>${this.isCopied ? msg("Copied") : msg("Copy")}</sl-button label=${msg("Copy to clipboard")}
> @click=${this.onClick}
?disabled=${!this.value && !this.getValue}
></sl-icon-button>
</sl-tooltip>
`; `;
} }
@ -59,6 +62,8 @@ export class CopyButton extends LitElement {
this.timeoutId = window.setTimeout(() => { this.timeoutId = window.setTimeout(() => {
this.isCopied = false; this.isCopied = false;
const button = this.shadowRoot?.querySelector('sl-icon-button');
button?.blur(); // Remove focus from the button to set it back to its default state
}, 3000); }, 3000);
} }
} }