diff --git a/assets/3rdparty/wdt-emoji/wdt-emoji-bundle.js b/assets/3rdparty/wdt-emoji/wdt-emoji-bundle.js index 56c0e45c..4bd8136e 100644 --- a/assets/3rdparty/wdt-emoji/wdt-emoji-bundle.js +++ b/assets/3rdparty/wdt-emoji/wdt-emoji-bundle.js @@ -289,6 +289,20 @@ addClass(this, 'wdt-emoji-picker-open'); //this.innerHTML = wdtEmojiBundle.emoji.replace_colons(':sunglasses:'); //COMUNIC - EDIT + + + //COMUNIC EDIT + //Make the picker close automatically if the parent element is removed + var interval = setInterval(function(){ + if(!parent.isConnected){ + wdtEmojiBundle.close(); + clearInterval(interval); + } + + }, 2500); + //END COMUNIC EDIT + + }; /** diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js index 2c2a1405..b00225c7 100644 --- a/assets/js/common/utils.js +++ b/assets/js/common/utils.js @@ -445,4 +445,24 @@ window.location.changed = function(e){}; window.location.changed(window.location); } }, 900); -})(); \ No newline at end of file +})(); + + +/** + * jQuery special event that detects the deletion + * of a DOM element + * + * @source StackOverFlow answer from mtkopone + */ +(function($){ + + $.event.special.destroyed = { + + remove: function(o){ + if(o.handler) + o.handler(); + } + + } + +})(jQuery); \ No newline at end of file