Catch navigator.clipboard errors (#7942)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Philip Allgaier
2021-01-04 14:04:54 +01:00
committed by GitHub
parent 6fb206853c
commit 05057ade05
6 changed files with 38 additions and 43 deletions

View File

@@ -544,9 +544,12 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
return this._config;
}
private async _copyYaml() {
private async _copyYaml(): Promise<void> {
if (this._editor?.yaml) {
copyToClipboard(this._editor.yaml);
await copyToClipboard(this._editor.yaml);
showToast(this, {
message: this.hass.localize("ui.common.copied_clipboard"),
});
}
}