Fix drag & drop interfered with mouse selection when editing tag

This commit is contained in:
nathan 2023-12-19 13:44:29 -07:00
parent cdaa16bae2
commit c99404e993
2 changed files with 8 additions and 3 deletions

View File

@ -297,7 +297,6 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
pull: pull,
put: !(this.readonly || this.disabled)
},
// filter: "[isEditing],.et2-no-drag",
onEnd: this.handleSortEnd
});
}
@ -935,6 +934,7 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
{
const readonly = (this.readonly);
const isEditable = !readonly;
const isValid = this.validateAddress(value);
return html`
<et2-email-tag
@ -943,6 +943,7 @@ export class Et2Email extends Et2InputWidget(LitElement) implements SearchMixinI
class=${classMap({
"et2-select-draggable": !this.readonly && this.allowDragAndDrop,
})}
variant=${this.isValid ? nothing : "danger"}
.fullEmail=${this.fullEmail}
.onlyEmail=${this.onlyEmail}
.value=${live(value)}

View File

@ -200,10 +200,14 @@ export class Et2Tag extends Et2Widget(SlTag)
}
this.getRootNode().host.hide()
this.isEditing = true;
this.setAttribute("isEditing", "");
this.setAttribute("contenteditable", "true");
this.requestUpdate();
this.updateComplete.then(() =>
{
// This stops drag and drop from interfereing with mouse edits
this._editNode.input.setAttribute("contenteditable", "true");
this._editNode.focus();
})
}
@ -211,7 +215,7 @@ export class Et2Tag extends Et2Widget(SlTag)
stopEdit()
{
this.isEditing = false;
this.removeAttribute("isEditing");
this.removeAttribute("contenteditable");
let event = new Event("change", {
bubbles: true
});