Only admins can launch quick bar (#7388)

Co-authored-by: Zack Barett <zackbarett@hey.com>
This commit is contained in:
Donnie 2020-10-20 13:24:48 -07:00 committed by GitHub
parent 6f2a759ba3
commit af2250835a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,14 @@ export default <T extends Constructor<HassElement>>(superClass: T) =>
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);
this._registerShortcut();
}
private _registerShortcut() {
document.addEventListener("keydown", (e: KeyboardEvent) => {
if (!this.hass?.user?.is_admin) {
return;
}
if (this.isOSCtrlKey(e) && e.code === "KeyP") {
e.preventDefault();
const eventParams: QuickBarParams = {};