From 47d97d1367f68363da898355883d7d6834cdbd8c Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 23 Nov 2023 15:28:32 -0700 Subject: [PATCH] Et2SelectEmail: Update for recent Et2Select changes, move draggable into its own method --- .../Et2Select/Select/Et2SelectEmail.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts b/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts index 52f3dada47..6f04d5aa77 100644 --- a/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts +++ b/api/js/etemplate/Et2Select/Select/Et2SelectEmail.ts @@ -117,12 +117,24 @@ export class Et2SelectEmail extends Et2Select updated(changedProperties : Map) { super.updated(changedProperties); - + // Make tags draggable 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}; - 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({ startAxis: 'xy', listeners: { @@ -147,7 +159,7 @@ export class Et2SelectEmail extends Et2Select }); // set parent_node with widget context in order to make it accessible after drop draggable.parent_node = this; - } + }); } protected _bindListeners()