Add a tagged template function for HTML supporting HTML interpolation.

This allows better Prettier integration: Prettier recognizes and
reformats tagged template literals with a tag named ‘html’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-03-31 18:43:14 -07:00
parent 2c40843306
commit ce9a680333
17 changed files with 116 additions and 86 deletions

View File

@@ -1,7 +1,7 @@
import {ipcRenderer} from 'electron';
import {htmlEscape} from 'escape-goat';
import type {HTML} from '../../../common/html';
import {html} from '../../../common/html';
import * as SystemUtil from '../utils/system-util';
import type {TabProps} from './tab';
@@ -15,8 +15,8 @@ export default class ServerTab extends Tab {
this.init();
}
templateHTML(): string {
return htmlEscape`
templateHTML(): HTML {
return html`
<div class="tab" data-tab-id="${this.props.tabIndex}">
<div class="server-tooltip" style="display:none">${this.props.name}</div>
<div class="server-tab-badge"></div>