();
@@ -55,6 +57,27 @@ export default class HaAutomationTrigger extends LitElement {
protected render() {
return html`
+ ${
+ this.reOrderMode && !this.nested
+ ? html`
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.re_order_mode.description_triggers"
+ )}
+
+ ${this.hass.localize(
+ "ui.panel.config.automation.editor.re_order_mode.exit"
+ )}
+
+
+ `
+ : null
+ }
${repeat(
this.triggers,
@@ -68,6 +91,7 @@ export default class HaAutomationTrigger extends LitElement {
@value-changed=${this._triggerChanged}
.hass=${this.hass}
.disabled=${this.disabled}
+ @re-order=${this._enterReOrderMode}
>
${this.reOrderMode
? html`
@@ -148,6 +172,16 @@ export default class HaAutomationTrigger extends LitElement {
}
}
+ private async _enterReOrderMode(ev: CustomEvent) {
+ if (this.nested) return;
+ ev.stopPropagation();
+ this.reOrderMode = true;
+ }
+
+ private async _exitReOrderMode() {
+ this.reOrderMode = false;
+ }
+
private async _createSortable() {
const Sortable = await loadSortable();
this._sortable = new Sortable(
@@ -283,6 +317,12 @@ export default class HaAutomationTrigger extends LitElement {
ha-svg-icon {
height: 20px;
}
+ ha-alert {
+ display: block;
+ margin-bottom: 16px;
+ border-radius: var(--ha-card-border-radius, 16px);
+ overflow: hidden;
+ }
.handle {
cursor: move;
padding: 12px;
diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts
index 4d8b4d12ff..167b0f6d95 100644
--- a/src/panels/config/script/ha-script-editor.ts
+++ b/src/panels/config/script/ha-script-editor.ts
@@ -7,7 +7,6 @@ import {
mdiDotsVertical,
mdiInformationOutline,
mdiPlay,
- mdiSort,
mdiTransitConnection,
} from "@mdi/js";
import "@polymer/app-layout/app-header/app-header";
@@ -62,7 +61,6 @@ import { documentationUrl } from "../../../util/documentation-url";
import { showToast } from "../../../util/toast";
import "./blueprint-script-editor";
import "./manual-script-editor";
-import type { HaManualScriptEditor } from "./manual-script-editor";
export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -93,9 +91,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
@query("ha-yaml-editor", true) private _yamlEditor?: HaYamlEditor;
- @query("manual-script-editor")
- private _manualEditor?: HaManualScriptEditor;
-
private _schema = memoizeOne(
(
hasID: boolean,
@@ -238,23 +233,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
`
: ""}
- ${this._config && !("use_blueprint" in this._config)
- ? html`
-
- ${this.hass.localize(
- "ui.panel.config.automation.editor.re_order"
- )}
-
-
- `
- : ""}
@@ -801,12 +779,6 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
this._mode = "yaml";
}
- private _toggleReOrderMode() {
- if (this._manualEditor) {
- this._manualEditor.reOrderMode = !this._manualEditor.reOrderMode;
- }
- }
-
private async _saveScript(): Promise {
if (this._idError) {
showToast(this, {
diff --git a/src/panels/config/script/manual-script-editor.ts b/src/panels/config/script/manual-script-editor.ts
index 172c93ed22..d7d7ced9cf 100644
--- a/src/panels/config/script/manual-script-editor.ts
+++ b/src/panels/config/script/manual-script-editor.ts
@@ -3,7 +3,6 @@ import { mdiHelpCircle } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../../common/dom/fire_event";
-import "../../../components/ha-alert";
import "../../../components/ha-card";
import "../../../components/ha-icon-button";
import { Action, ScriptConfig } from "../../../data/script";
@@ -24,9 +23,6 @@ export class HaManualScriptEditor extends LitElement {
@property({ attribute: false }) public config!: ScriptConfig;
- @property({ type: Boolean, reflect: true, attribute: "re-order-mode" })
- public reOrderMode = false;
-
protected render() {
return html`
${this.disabled
@@ -37,26 +33,6 @@ export class HaManualScriptEditor extends LitElement {
`
: ""}
- ${this.reOrderMode
- ? html`
-
- ${this.hass.localize(
- "ui.panel.config.automation.editor.re_order_mode.description"
- )}
-
- ${this.hass.localize(
- "ui.panel.config.automation.editor.re_order_mode.exit"
- )}
-
-
- `
- : ""}
-