From 3475d85f225ca8c725f5e7ce3090a77de47e87fd Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Thu, 20 Nov 2014 21:51:29 +0300 Subject: [PATCH] Fixed typing from draft and switch peer --- app/js/directives.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/js/directives.js b/app/js/directives.js index 84d5f553..cbc9b10a 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1128,7 +1128,7 @@ angular.module('myApp.directives', ['myApp.filters']) updateValue(); $scope.draftMessage.send(); $(element).trigger('message_send'); - resetAfterSubmit(); + resetTyping(); return cancelEvent(e); } } @@ -1140,7 +1140,7 @@ angular.module('myApp.directives', ['myApp.filters']) updateValue(); $scope.draftMessage.send(); $(element).trigger('message_send'); - resetAfterSubmit(); + resetTyping(); return cancelEvent(e); }); @@ -1158,7 +1158,7 @@ angular.module('myApp.directives', ['myApp.filters']) } }); - function resetAfterSubmit () { + function resetTyping () { lastTyping = 0; lastLength = 0; }; @@ -1169,6 +1169,7 @@ angular.module('myApp.directives', ['myApp.filters']) var html = $('
').text($scope.draftMessage.text || '').html(); html = html.replace(/\n/g, '
'); $(richTextarea).html(html); + lastLength = html.length; updateHeight(); } } @@ -1206,6 +1207,7 @@ angular.module('myApp.directives', ['myApp.filters']) $scope.$on('ui_history_change', focusField); } + $scope.$on('ui_peer_change', resetTyping); $scope.$on('ui_peer_draft', updateRichTextarea); var sendAwaiting = false;