mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Only admins can launch quick bar (#7388)
Co-authored-by: Zack Barett <zackbarett@hey.com>
This commit is contained in:
parent
6f2a759ba3
commit
af2250835a
@ -18,7 +18,14 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
|
|||||||
protected firstUpdated(changedProps: PropertyValues) {
|
protected firstUpdated(changedProps: PropertyValues) {
|
||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
|
|
||||||
|
this._registerShortcut();
|
||||||
|
}
|
||||||
|
|
||||||
|
private _registerShortcut() {
|
||||||
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
document.addEventListener("keydown", (e: KeyboardEvent) => {
|
||||||
|
if (!this.hass?.user?.is_admin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.isOSCtrlKey(e) && e.code === "KeyP") {
|
if (this.isOSCtrlKey(e) && e.code === "KeyP") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const eventParams: QuickBarParams = {};
|
const eventParams: QuickBarParams = {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user