mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Add ctrl/cmd +s support back to editor (#2694)
* Add ctrl/cmd +s support back to editor * Update hui-yaml-editor.ts
This commit is contained in:
parent
102cb06d28
commit
8938ad8f8d
@ -9,6 +9,7 @@ declare global {
|
|||||||
"yaml-changed": {
|
"yaml-changed": {
|
||||||
value: string;
|
value: string;
|
||||||
};
|
};
|
||||||
|
"yaml-save": undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +19,9 @@ export class HuiYamlEditor extends HTMLElement {
|
|||||||
|
|
||||||
public constructor() {
|
public constructor() {
|
||||||
super();
|
super();
|
||||||
|
CodeMirror.commands.save = (cm: CodeMirror) => {
|
||||||
|
fireEvent(cm.getWrapperElement(), "yaml-save");
|
||||||
|
};
|
||||||
this._value = "";
|
this._value = "";
|
||||||
const shadowRoot = this.attachShadow({ mode: "open" });
|
const shadowRoot = this.attachShadow({ mode: "open" });
|
||||||
shadowRoot.innerHTML = `
|
shadowRoot.innerHTML = `
|
||||||
|
@ -121,6 +121,7 @@ export class HuiEditCard extends LitElement {
|
|||||||
<hui-yaml-editor
|
<hui-yaml-editor
|
||||||
.value="${this._configValue!.value}"
|
.value="${this._configValue!.value}"
|
||||||
@yaml-changed="${this._handleYamlChanged}"
|
@yaml-changed="${this._handleYamlChanged}"
|
||||||
|
@yaml-save="${this._save}"
|
||||||
></hui-yaml-editor>
|
></hui-yaml-editor>
|
||||||
`}
|
`}
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +61,10 @@ class LovelaceFullConfigEditor extends LitElement {
|
|||||||
</app-toolbar>
|
</app-toolbar>
|
||||||
</app-header>
|
</app-header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<hui-yaml-editor @yaml-changed="${this._yamlChanged}">
|
<hui-yaml-editor
|
||||||
|
@yaml-changed="${this._yamlChanged}"
|
||||||
|
@yaml-save="${this._handleSave}"
|
||||||
|
>
|
||||||
</hui-yaml-editor>
|
</hui-yaml-editor>
|
||||||
</div>
|
</div>
|
||||||
</app-header-layout>
|
</app-header-layout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user