mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-01 13:37:47 +00:00
Lint and tab
This commit is contained in:
parent
d76ffd343e
commit
13aa0568a6
@ -1,6 +1,6 @@
|
||||
import CodeMirror from "codemirror";
|
||||
import * as CodeMirror from "codemirror";
|
||||
import "codemirror/mode/yaml/yaml";
|
||||
// tslint:disable-next-line
|
||||
// @ts-ignore
|
||||
import codeMirrorCSS from "codemirror/lib/codemirror.css";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
declare global {
|
||||
@ -51,6 +51,12 @@ export class HuiYamlEditor extends HTMLElement {
|
||||
mode: "yaml",
|
||||
tabSize: 2,
|
||||
autofocus: true,
|
||||
extraKeys: {
|
||||
Tab: (cm: CodeMirror) => {
|
||||
const spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
||||
cm.replaceSelection(spaces);
|
||||
},
|
||||
},
|
||||
});
|
||||
fireEvent(this, "yaml-changed", { value: this._value });
|
||||
this.codemirror.on("changes", () => this._onChange());
|
||||
|
@ -84,7 +84,7 @@ class LovelaceFullConfigEditor extends LitElement {
|
||||
return;
|
||||
}
|
||||
});
|
||||
yamlEditor.addEventListener("yaml-changed", (e) => {
|
||||
yamlEditor.addEventListener("yaml-changed", () => {
|
||||
this._hash = this._hashAdded || this.yamlEditor.value.includes("#");
|
||||
if (this._changed) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user