@internal called to setup a trash drop zone if the user specifies it
()
| 2690 | |
| 2691 | /** @internal called to setup a trash drop zone if the user specifies it */ |
| 2692 | protected _setupRemoveDrop(): GridStack { |
| 2693 | if (typeof this.opts.removable !== 'string') return this; |
| 2694 | const trashEl = document.querySelector(this.opts.removable) as HTMLElement; |
| 2695 | if (!trashEl) return this; |
| 2696 | |
| 2697 | // only register ONE static drop-over/dropout callback for the 'trash', and it will |
| 2698 | // update the passed in item and parent grid because the '.trash' is a shared resource anyway, |
| 2699 | // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly) |
| 2700 | if (!this.opts.staticGrid && !dd.isDroppable(trashEl)) { |
| 2701 | dd.droppable(trashEl, this.opts.removableOptions) |
| 2702 | .on(trashEl, 'dropover', (event, el) => GridStack._itemRemoving(el, true)) |
| 2703 | .on(trashEl, 'dropout', (event, el) => GridStack._itemRemoving(el, false)); |
| 2704 | } |
| 2705 | return this; |
| 2706 | } |
| 2707 | |
| 2708 | /** |
| 2709 | * prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading |
no test coverage detected