Do not allow to drag an invalid email address in compose

This commit is contained in:
Hadi Nategh 2015-05-22 15:26:50 +00:00
parent 5f9e72e668
commit dda439f3c7

View File

@ -4039,10 +4039,17 @@ app.classes.mail = AppJS.extend(
set_dragging_dndCompose: function () set_dragging_dndCompose: function ()
{ {
var zIndex = 100; var zIndex = 100;
var dragItem = jQuery('div.ms-sel-item:not(div.ui-draggable)'); var dragItems = jQuery('div.ms-sel-item:not(div.ui-draggable)');
if (dragItem.length > 0) dragItems.each(function(i,item){
var $isErr = jQuery(item).find('.ui-state-error');
if ($isErr.length > 0)
{
delete dragItems.splice(i,1);
}
});
if (dragItems.length > 0)
{ {
dragItem.draggable({ dragItems.draggable({
appendTo:'body', appendTo:'body',
//Performance wise better to not add ui-draggable class to items since we are not using that class //Performance wise better to not add ui-draggable class to items since we are not using that class
containment:'document', containment:'document',
@ -4089,7 +4096,7 @@ app.classes.mail = AppJS.extend(
}).draggable('disable'); }).draggable('disable');
window.setTimeout(function(){ window.setTimeout(function(){
if(dragItem && dragItem.data() && typeof dragItem.data()['uiDraggable'] !== 'undefined') dragItem.draggable('enable'); if(dragItems && dragItems.data() && typeof dragItems.data()['uiDraggable'] !== 'undefined') dragItems.draggable('enable');
},100); },100);
} }
@ -4155,9 +4162,17 @@ app.classes.mail = AppJS.extend(
.removeClass('mailCompose_copyEmail') .removeClass('mailCompose_copyEmail')
.css('cursor','move'); .css('cursor','move');
} }
var dragItems = jQuery('div.ms-sel-item');
dragItems.each(function(i,item){
var $isErr = jQuery(item).find('.ui-state-error');
if ($isErr.length > 0)
{
delete dragItems.splice(i,1);
}
});
//Destroy draggables after dropping, we need to enable them again //Destroy draggables after dropping, we need to enable them again
jQuery('div.ms-sel-item').draggable('destroy'); dragItems.draggable('destroy');
} }
} }
}); });