fix double load of UI in compose after adding attachments caused by errors in mail app.js compose_resize handler

This commit is contained in:
Ralf Becker 2015-10-27 11:44:54 +00:00
parent b01ac97b7e
commit b8f2902e80

View File

@ -255,7 +255,7 @@ app.classes.mail = AppJS.extend(
} }
else else
{ {
this.compose_fieldExpander(); that.compose_fieldExpander();
} }
}); });
@ -3907,49 +3907,54 @@ app.classes.mail = AppJS.extend(
// very limited resources and slow proccessor. // very limited resources and slow proccessor.
if (egwIsMobile()) return; if (egwIsMobile()) return;
var bodyH = egw_getWindowInnerHeight(); try {
var textArea = this.et2.getWidgetById('mail_plaintext'); var bodyH = egw_getWindowInnerHeight();
var $headerSec = jQuery('.mailComposeHeaderSection'); var textArea = this.et2.getWidgetById('mail_plaintext');
var attachments = this.et2.getWidgetById('attachments'); var $headerSec = jQuery('.mailComposeHeaderSection');
var content = this.et2.getArrayMgr('content').data; var attachments = this.et2.getWidgetById('attachments');
var content = this.et2.getArrayMgr('content').data;
// @var arrbitary int represents px // @var arrbitary int represents px
// Visible height of attachment progress // Visible height of attachment progress
var prgV_H = 150; var prgV_H = 150;
// @var arrbitary int represents px // @var arrbitary int represents px
// Visible height of attchements list // Visible height of attchements list
var attchV_H = 68; var attchV_H = 68;
if (typeof textArea != 'undefined' && textArea != null) if (typeof textArea != 'undefined' && textArea != null)
{
if (textArea.getParent().disabled)
{ {
textArea = this.et2.getWidgetById('mail_htmltext'); if (textArea.getParent().disabled)
} {
// Tolerate values base on plain text or html, in order to calculate freespaces textArea = this.et2.getWidgetById('mail_htmltext');
var textAreaDelta = textArea.id == "mail_htmltext"?20:40; }
// Tolerate values base on plain text or html, in order to calculate freespaces
var textAreaDelta = textArea.id == "mail_htmltext"?20:40;
// while attachments are in progress take progress visiblity into account // while attachments are in progress take progress visiblity into account
// otherwise the attachment progress is finished and consider attachments list // otherwise the attachment progress is finished and consider attachments list
var delta = (attachments.table.find('li').length>0 && attachments.table.height() > 0)? prgV_H: (content.attachments? attchV_H: textAreaDelta); var delta = (attachments.table.find('li').length>0 && attachments.table.height() > 0)? prgV_H: (content.attachments? attchV_H: textAreaDelta);
var bodySize = (bodyH - Math.round($headerSec.height() + $headerSec.offset().top) - delta); var bodySize = (bodyH - Math.round($headerSec.height() + $headerSec.offset().top) - delta);
if (textArea.id != "mail_htmltext") if (textArea.id != "mail_htmltext")
{ {
textArea.getParent().set_height(bodySize); textArea.getParent().set_height(bodySize);
textArea.set_height(bodySize); textArea.set_height(bodySize);
} }
else if (typeof textArea != 'undefined' && textArea.id == 'mail_htmltext') else if (typeof textArea != 'undefined' && textArea.id == 'mail_htmltext')
{ {
textArea.ckeditor.resize('100%', bodySize); textArea.ckeditor.resize('100%', bodySize);
} }
else else
{ {
textArea.set_height(bodySize - 90); textArea.set_height(bodySize - 90);
}
} }
} }
catch(e) {
// ignore errors causing compose to load twice
}
}, },
/** /**