@@ -120,9 +120,12 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
120120 }
121121 } )
122122 . on ( this . el , 'dropover' , ( event , el : GridItemHTMLElement ) => {
123- // ignore dropping on ourself, and prevent parent from receiving event
123+ // ignore drop enter on ourself, and prevent parent from receiving event
124124 let node = el . gridstackNode || { } ;
125- if ( node . grid === this ) { return false ; }
125+ if ( node . grid === this ) {
126+ delete node . _added ; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)
127+ return false ;
128+ }
126129
127130 // see if we already have a node with widget/height and check for attributes
128131 if ( el . getAttribute && ( ! node . width || ! node . height ) ) {
@@ -151,12 +154,18 @@ GridStack.prototype._setupAcceptWidget = function(): GridStack {
151154 return false ; // prevent parent from receiving msg (which may be grid as well)
152155 } )
153156 . on ( this . el , 'dropout' , ( event , el : GridItemHTMLElement ) => {
157+ let node = el . gridstackNode ;
158+ if ( ! node ) { return ; }
159+
160+ // clear any added flag now that we are leaving #1484
161+ delete node . _added ;
162+
154163 // jquery-ui bug. Must verify widget is being dropped out
155164 // check node variable that gets set when widget is out of grid
156- let node = el . gridstackNode ;
157- if ( ! node || ! node . _isOutOfGrid ) {
165+ if ( ! node . _isOutOfGrid ) {
158166 return ;
159167 }
168+
160169 GridStackDD . get ( ) . off ( el , 'drag' ) ;
161170 node . el = null ;
162171 this . engine . removeNode ( node ) ;
0 commit comments