* Mail: Fix bug all fields in compose dialog always stay opened (happens in FF ESR)

This commit is contained in:
Hadi Nategh 2017-09-28 18:26:55 +02:00
parent 6b71e997fe
commit d2f1ac989b

View File

@ -237,9 +237,6 @@ app.classes.mail = AppJS.extend(
} }
var that = this; var that = this;
var plainText = this.et2.getWidgetById('mail_plaintext'); var plainText = this.et2.getWidgetById('mail_plaintext');
// set cursor to the begining of the textarea only for first focus
if (plainText) plainText.getDOMNode().setSelectionRange(0,0);
var textAreaWidget = this.et2.getWidgetById('mail_htmltext'); var textAreaWidget = this.et2.getWidgetById('mail_htmltext');
this.mail_isMainWindow = false; this.mail_isMainWindow = false;
this.compose_fieldExpander_init(); this.compose_fieldExpander_init();
@ -293,16 +290,15 @@ app.classes.mail = AppJS.extend(
// Set focus on To/body field // Set focus on To/body field
// depending on To field value // depending on To field value
var to = this.et2.getWidgetById('to'); var to = this.et2.getWidgetById('to');
var content = this.et2.getArrayMgr('content').data;
if (to && to.get_value() && to.get_value() != '') if (to && to.get_value() && to.get_value() != '')
{ {
var content = this.et2.getArrayMgr('content').data;
if (content.is_plain) if (content.is_plain)
{ {
var plainText = this.et2.getWidgetById('mail_plaintext');
// focus // focus
jQuery(plainText.node).focus(); jQuery(plainText.node).focus();
// get the cursor to the top of the textarea // get the cursor to the top of the textarea
if (typeof plainText.node.setSelectionRange !='undefined') plainText.node.setSelectionRange(0,0); if (typeof plainText.node.setSelectionRange !='undefined' && !plainText.node.is(":hidden")) plainText.node.setSelectionRange(0,0);
} }
else else
{ {
@ -314,6 +310,12 @@ app.classes.mail = AppJS.extend(
else if(to) else if(to)
{ {
jQuery('input',to.node).focus(); jQuery('input',to.node).focus();
// set cursor to the begining of the textarea only for first focus
if (content.is_plain
&& typeof plainText.node.setSelectionRange !='undefined')
{
plainText.node.setSelectionRange(0,0);
}
} }
var smime_sign = this.et2.getWidgetById('smime_sign'); var smime_sign = this.et2.getWidgetById('smime_sign');
var smime_encrypt = this.et2.getWidgetById('smime_encrypt'); var smime_encrypt = this.et2.getWidgetById('smime_encrypt');
@ -4769,7 +4771,7 @@ app.classes.mail = AppJS.extend(
} }
}); });
}, },
/** /**
* Initialize dropping targets for draggable emails * Initialize dropping targets for draggable emails
* - * -