Browse Source

Fixed typing from draft and switch peer

master
Igor Zhukov 10 years ago
parent
commit
3475d85f22
  1. 8
      app/js/directives.js

8
app/js/directives.js

@ -1128,7 +1128,7 @@ angular.module('myApp.directives', ['myApp.filters'])
updateValue(); updateValue();
$scope.draftMessage.send(); $scope.draftMessage.send();
$(element).trigger('message_send'); $(element).trigger('message_send');
resetAfterSubmit(); resetTyping();
return cancelEvent(e); return cancelEvent(e);
} }
} }
@ -1140,7 +1140,7 @@ angular.module('myApp.directives', ['myApp.filters'])
updateValue(); updateValue();
$scope.draftMessage.send(); $scope.draftMessage.send();
$(element).trigger('message_send'); $(element).trigger('message_send');
resetAfterSubmit(); resetTyping();
return cancelEvent(e); return cancelEvent(e);
}); });
@ -1158,7 +1158,7 @@ angular.module('myApp.directives', ['myApp.filters'])
} }
}); });
function resetAfterSubmit () { function resetTyping () {
lastTyping = 0; lastTyping = 0;
lastLength = 0; lastLength = 0;
}; };
@ -1169,6 +1169,7 @@ angular.module('myApp.directives', ['myApp.filters'])
var html = $('<div>').text($scope.draftMessage.text || '').html(); var html = $('<div>').text($scope.draftMessage.text || '').html();
html = html.replace(/\n/g, '<br/>'); html = html.replace(/\n/g, '<br/>');
$(richTextarea).html(html); $(richTextarea).html(html);
lastLength = html.length;
updateHeight(); updateHeight();
} }
} }
@ -1206,6 +1207,7 @@ angular.module('myApp.directives', ['myApp.filters'])
$scope.$on('ui_history_change', focusField); $scope.$on('ui_history_change', focusField);
} }
$scope.$on('ui_peer_change', resetTyping);
$scope.$on('ui_peer_draft', updateRichTextarea); $scope.$on('ui_peer_draft', updateRichTextarea);
var sendAwaiting = false; var sendAwaiting = false;

Loading…
Cancel
Save