mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 01:36:49 +00:00
Allow opening conversation dialog via URL (#14868)
* Allow opening conversation dialog via URL * Update URL
This commit is contained in:
parent
3199319830
commit
526c34993c
@ -38,9 +38,11 @@ import { fireEvent } from "../../common/dom/fire_event";
|
|||||||
import scrollToTarget from "../../common/dom/scroll-to-target";
|
import scrollToTarget from "../../common/dom/scroll-to-target";
|
||||||
import { shouldHandleRequestSelectedEvent } from "../../common/mwc/handle-request-selected-event";
|
import { shouldHandleRequestSelectedEvent } from "../../common/mwc/handle-request-selected-event";
|
||||||
import { navigate } from "../../common/navigate";
|
import { navigate } from "../../common/navigate";
|
||||||
|
import { constructUrlCurrentPath } from "../../common/url/construct-url";
|
||||||
import {
|
import {
|
||||||
addSearchParam,
|
addSearchParam,
|
||||||
extractSearchParam,
|
extractSearchParamsObject,
|
||||||
|
removeSearchParam,
|
||||||
} from "../../common/url/search-params";
|
} from "../../common/url/search-params";
|
||||||
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
import { computeRTLDirection } from "../../common/util/compute_rtl";
|
||||||
import { debounce } from "../../common/util/debounce";
|
import { debounce } from "../../common/util/debounce";
|
||||||
@ -556,8 +558,16 @@ class HUIRoot extends LitElement {
|
|||||||
|
|
||||||
protected firstUpdated() {
|
protected firstUpdated() {
|
||||||
// Check for requested edit mode
|
// Check for requested edit mode
|
||||||
if (extractSearchParam("edit") === "1") {
|
const searchParams = extractSearchParamsObject();
|
||||||
|
if (searchParams.edit === "1") {
|
||||||
this.lovelace!.setEditMode(true);
|
this.lovelace!.setEditMode(true);
|
||||||
|
} else if (searchParams.conversation === "1") {
|
||||||
|
showVoiceCommandDialog(this);
|
||||||
|
window.history.replaceState(
|
||||||
|
null,
|
||||||
|
"",
|
||||||
|
constructUrlCurrentPath(removeSearchParam("conversation"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user