Add a placeholder hint for template selector (#27297)

Add a placeholder for template selector
This commit is contained in:
karwosts
2025-10-02 22:38:58 -07:00
committed by GitHub
parent ad9e8d5a52
commit 428e7fb332
2 changed files with 7 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import type {
import { undo, undoDepth, redo, redoDepth } from "@codemirror/commands";
import type { Extension, TransactionSpec } from "@codemirror/state";
import type { EditorView, KeyBinding, ViewUpdate } from "@codemirror/view";
import { placeholder } from "@codemirror/view";
import {
mdiArrowExpand,
mdiArrowCollapse,
@@ -81,6 +82,8 @@ export class HaCodeEditor extends ReactiveElement {
@property({ type: Boolean, attribute: "has-toolbar" })
public hasToolbar = true;
@property({ type: String }) public placeholder?: string;
@state() private _value = "";
@state() private _isFullscreen = false;
@@ -264,6 +267,7 @@ export class HaCodeEditor extends ReactiveElement {
this._loadedCodeMirror.foldingCompartment.of(
this._getFoldingExtensions()
),
...(this.placeholder ? [placeholder(this.placeholder)] : []),
];
if (!this.readOnly) {