mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Allow iframe links to open on android through a parameter (#15063)
This commit is contained in:
parent
ccf15c7fb0
commit
8935dbac20
@ -80,6 +80,11 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let sandbox_user_params = "";
|
||||||
|
if (this._config.allow_open_top_navigation) {
|
||||||
|
sandbox_user_params += "allow-top-navigation-by-user-activation";
|
||||||
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card .header=${this._config.title}>
|
<ha-card .header=${this._config.title}>
|
||||||
<div
|
<div
|
||||||
@ -91,7 +96,7 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
|
|||||||
<iframe
|
<iframe
|
||||||
title=${ifDefined(this._config.title)}
|
title=${ifDefined(this._config.title)}
|
||||||
src=${this._config.url}
|
src=${this._config.url}
|
||||||
sandbox="allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"
|
sandbox="${sandbox_user_params} allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"
|
||||||
allow="fullscreen"
|
allow="fullscreen"
|
||||||
></iframe>
|
></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
@ -247,6 +247,7 @@ export interface HumidifierCardConfig extends LovelaceCardConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IframeCardConfig extends LovelaceCardConfig {
|
export interface IframeCardConfig extends LovelaceCardConfig {
|
||||||
|
allow_open_top_navigation?: boolean;
|
||||||
aspect_ratio?: string;
|
aspect_ratio?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import "../../../../components/ha-form/ha-form";
|
import "../../../../components/ha-form/ha-form";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import { html, LitElement, TemplateResult } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { assert, assign, object, optional, string } from "superstruct";
|
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||||
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
import type { SchemaUnion } from "../../../../components/ha-form/types";
|
||||||
import type { HomeAssistant } from "../../../../types";
|
import type { HomeAssistant } from "../../../../types";
|
||||||
@ -15,6 +15,7 @@ const cardConfigStruct = assign(
|
|||||||
title: optional(string()),
|
title: optional(string()),
|
||||||
url: optional(string()),
|
url: optional(string()),
|
||||||
aspect_ratio: optional(string()),
|
aspect_ratio: optional(string()),
|
||||||
|
allow_open_top_navigation: optional(boolean()),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user