Et2SelectEmail: Update for recent Et2Select changes, move draggable into its own method

This commit is contained in:
nathan 2023-11-23 15:28:32 -07:00
parent c111303abd
commit 47d97d1367

View File

@ -120,9 +120,21 @@ export class Et2SelectEmail extends Et2Select
// Make tags draggable // Make tags draggable
if(!this.readonly && this.allowFreeEntries && this.allowDragAndDrop) if(!this.readonly && this.allowFreeEntries && this.allowDragAndDrop)
{
this._makeDraggable();
}
}
/**
* Make the tags draggable
* @protected
*/
protected _makeDraggable()
{
this.select.updateComplete.then(() =>
{ {
let dragTranslate = {x: 0, y: 0}; let dragTranslate = {x: 0, y: 0};
const tags = Array.from(this.shadowRoot.querySelectorAll(".select__tags et2-email-tag")); const tags = Array.from(this.select.shadowRoot.querySelectorAll(".select__tags et2-email-tag"));
let draggable = interact(tags).draggable({ let draggable = interact(tags).draggable({
startAxis: 'xy', startAxis: 'xy',
listeners: { listeners: {
@ -147,7 +159,7 @@ export class Et2SelectEmail extends Et2Select
}); });
// set parent_node with widget context in order to make it accessible after drop // set parent_node with widget context in order to make it accessible after drop
draggable.parent_node = this; draggable.parent_node = this;
} });
} }
protected _bindListeners() protected _bindListeners()