mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Warn when punctuation is used in conversation trigger (#17119)
This commit is contained in:
parent
e5146512d5
commit
d6f8941098
@ -10,6 +10,8 @@ import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dial
|
||||
import { HomeAssistant } from "../../../../../types";
|
||||
import { TriggerElement } from "../ha-automation-trigger-row";
|
||||
|
||||
const PATTERN = "^[^.。,,?¿?؟!!;;::]+$";
|
||||
|
||||
@customElement("ha-automation-trigger-conversation")
|
||||
export class HaConversationTrigger
|
||||
extends LitElement
|
||||
@ -39,6 +41,12 @@ export class HaConversationTrigger
|
||||
iconTrailing
|
||||
.index=${index}
|
||||
.value=${option}
|
||||
.validationMessage=${this.hass.localize(
|
||||
"ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation"
|
||||
)}
|
||||
autoValidate
|
||||
validateOnInitialRender
|
||||
pattern=${PATTERN}
|
||||
@change=${this._updateOption}
|
||||
>
|
||||
<ha-icon-button
|
||||
@ -56,6 +64,11 @@ export class HaConversationTrigger
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.automation.editor.triggers.type.conversation.add_sentence"
|
||||
)}
|
||||
.validationMessage=${this.hass.localize(
|
||||
"ui.panel.config.automation.editor.triggers.type.conversation.no_punctuation"
|
||||
)}
|
||||
autoValidate
|
||||
pattern=${PATTERN}
|
||||
@keydown=${this._handleKeyAdd}
|
||||
@change=${this._addOption}
|
||||
></ha-textfield>`;
|
||||
|
@ -2382,6 +2382,7 @@
|
||||
},
|
||||
"conversation": {
|
||||
"label": "Sentence",
|
||||
"no_punctuation": "You should not use punctuation in your sentence",
|
||||
"add_sentence": "Add sentence",
|
||||
"delete": "Delete sentence",
|
||||
"confirm_delete": "Are you sure you want to delete this sentence?",
|
||||
|
Loading…
x
Reference in New Issue
Block a user