mirror of
https://github.com/moparisthebest/mail
synced 2024-12-23 15:58:49 -05:00
addressInput directive: prevent race conditions with focusMe directive, prevent loosing focus when hitting space in empty input field
This commit is contained in:
parent
5a1b9c1af9
commit
29dfb9fe7e
@ -531,12 +531,14 @@ define(function(require) {
|
||||
// catch space, comma, semicolon
|
||||
e.preventDefault();
|
||||
|
||||
// add next field only if current input is not empty
|
||||
if(field[index].address) {
|
||||
// create new field input
|
||||
addInput(field, scope);
|
||||
// find next input and focus
|
||||
var nextId = fieldName + (index + 1);
|
||||
document.getElementById(nextId).focus();
|
||||
|
||||
}
|
||||
} else if ((code === 8 || code === 46) && !field[index].address && field.length > 1) {
|
||||
// backspace, delete on empty input
|
||||
// remove input
|
||||
|
@ -14,7 +14,7 @@
|
||||
<p field="to">
|
||||
<label>To:</label>
|
||||
<span ng-repeat="recipient in to track by $index">
|
||||
<input id="to{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(to, $index)" address-input="to" tabindex="1" ng-mouseover="getKeyId(recipient)" focus-me="state.lightbox === 'write' && writerTitle !== 'Reply'">
|
||||
<input id="to{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(to, $index)" address-input="to" tabindex="1" ng-mouseover="getKeyId(recipient)" focus-me="$index === 0 && state.lightbox === 'write' && writerTitle !== 'Reply'">
|
||||
</span>
|
||||
</p>
|
||||
<p field="cc" ng-show="showCC === true">
|
||||
|
Loading…
Reference in New Issue
Block a user