mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +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 {
|
||||
// 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()!;
|
||||
selection.removeAllRanges();
|
||||
|
||||
const copyElement = this.shadowRoot?.querySelector(
|
||||
"ha-card"
|
||||
let copyElement = this.shadowRoot?.querySelector(
|
||||
".card-header-text"
|
||||
) 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);
|
||||
selection.addRange(range);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user