mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-06 15:03:20 +00:00
WebView: Switch templateHTML to a static method.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
@@ -53,14 +53,14 @@ export default class WebView {
|
|||||||
)!.classList;
|
)!.classList;
|
||||||
}
|
}
|
||||||
|
|
||||||
templateHTML(): HTML {
|
static templateHTML(props: WebViewProps): HTML {
|
||||||
return html`
|
return html`
|
||||||
<webview
|
<webview
|
||||||
data-tab-id="${this.props.tabIndex}"
|
data-tab-id="${props.tabIndex}"
|
||||||
src="${this.props.url}"
|
src="${props.url}"
|
||||||
${this.props.preload === undefined
|
${props.preload === undefined
|
||||||
? html``
|
? html``
|
||||||
: html`preload="${this.props.preload}"`}
|
: html`preload="${props.preload}"`}
|
||||||
partition="persist:webviewsession"
|
partition="persist:webviewsession"
|
||||||
webpreferences="
|
webpreferences="
|
||||||
contextIsolation,
|
contextIsolation,
|
||||||
@@ -75,7 +75,9 @@ export default class WebView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(): void {
|
init(): void {
|
||||||
this.$el = generateNodeFromHTML(this.templateHTML()) as Electron.WebviewTag;
|
this.$el = generateNodeFromHTML(
|
||||||
|
WebView.templateHTML(this.props),
|
||||||
|
) as Electron.WebviewTag;
|
||||||
this.whenAttached = new Promise((resolve) => {
|
this.whenAttached = new Promise((resolve) => {
|
||||||
this.$el!.addEventListener(
|
this.$el!.addEventListener(
|
||||||
"did-attach",
|
"did-attach",
|
||||||
|
|||||||
Reference in New Issue
Block a user