if (!selection.isCollapsed) return;
var anchorNode = selection.anchorNode;
// Is selection still inside a node?
- if (!$(anchorNode).closest('[x-node]')) return;
+ if (!$(anchorNode).closest('[x-node]').length) return;
self.singleClick = true;
setTimeout(function() {
var modal = $(this);
modal.data('target-input', input);
var imglist = modal.find('.modal-body');
+ imglist.html('');
$.each(self.doc.galleryImages, (i, imgItem) => {
img = $("<img>").attr("src", imgItem.thumb).attr('title', imgItem.url).data('url', imgItem.url).on('click', function() {
imglist.find('img').removeClass('active');