Skip to content

Commit

Permalink
add dash before custom action if dragged from layout actions list
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerwyn committed Aug 28, 2024
1 parent 71ac4f1 commit c2a7aa5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/universal-remote-card.min.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions src/universal-remote-card-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ export class UniversalRemoteCardEditor extends LitElement {
}
}

handleLayoutActionListItemDragStart(e: DragEvent) {
e.stopPropagation();
if (e.isTrusted && e.dataTransfer) {
e.dataTransfer.setData(
'text/plain',
'- ' + (e.currentTarget as HTMLInputElement).value,
);
}
}

addEntry(e: CustomEvent) {
const i = e.detail.index as number;
let entries: IElementConfig[] | IIconConfig[];
Expand Down Expand Up @@ -1690,6 +1700,8 @@ export class UniversalRemoteCardEditor extends LitElement {
value="${entry.name}"
@click=${this
.handleLayoutActionListItemClick}
@dragstart=${this
.handleLayoutActionListItemDragStart}
/>
</li>`;
},
Expand Down Expand Up @@ -1724,6 +1736,8 @@ export class UniversalRemoteCardEditor extends LitElement {
value="${entry.name}"
@click=${this
.handleLayoutActionListItemClick}
@dragstart=${this
.handleLayoutActionListItemDragStart}
/>
</li>`;
})}
Expand Down Expand Up @@ -1758,6 +1772,8 @@ export class UniversalRemoteCardEditor extends LitElement {
value="${entry.name}"
@click=${this
.handleLayoutActionListItemClick}
@dragstart=${this
.handleLayoutActionListItemDragStart}
/>
</li>`;
})}
Expand Down

0 comments on commit c2a7aa5

Please sign in to comment.