fix(clipboard): hide clipboard button when clipboard is blocked

This commit is contained in:
Colin Darie 2024-02-21 10:55:24 +01:00
parent 5a8859cd28
commit bda8d66047
No known key found for this signature in database
GPG key ID: 8C76CADD40253590

View file

@ -14,6 +14,13 @@ export class ClipboardController extends Controller {
#timer?: ReturnType<typeof setTimeout>;
connect(): void {
// some extensions or browsers block clipboard
if (!navigator.clipboard) {
this.element.classList.add('hidden');
}
}
disconnect(): void {
clearTimeout(this.#timer);
}