mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Get rid of the unwanted tooltip copying (#7408)
This commit is contained in:
parent
174f8f5823
commit
edc2a03d1c
@ -128,14 +128,24 @@ class SystemHealthCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _copyInfo(): void {
|
private _copyInfo(): void {
|
||||||
|
// We have to copy title text and content separately, because
|
||||||
|
// copying the whole <ha-card> would also copy the tooltip text.
|
||||||
const selection = window.getSelection()!;
|
const selection = window.getSelection()!;
|
||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
|
|
||||||
const copyElement = this.shadowRoot?.querySelector(
|
let copyElement = this.shadowRoot?.querySelector(
|
||||||
"ha-card"
|
".card-header-text"
|
||||||
) as HTMLElement;
|
) as HTMLElement;
|
||||||
|
|
||||||
const range = document.createRange();
|
let range = document.createRange();
|
||||||
|
range.selectNodeContents(copyElement);
|
||||||
|
selection.addRange(range);
|
||||||
|
|
||||||
|
copyElement = this.shadowRoot?.querySelector(
|
||||||
|
".card-content"
|
||||||
|
) as HTMLElement;
|
||||||
|
|
||||||
|
range = document.createRange();
|
||||||
range.selectNodeContents(copyElement);
|
range.selectNodeContents(copyElement);
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user