Maybe fix multiline send bug
This commit is contained in:
parent
75128f4c3b
commit
dfa62f90ce
@ -1390,32 +1390,30 @@ angular.module('myApp.controllers', ['myApp.i18n'])
|
||||
$timeout(function () {
|
||||
var text = $scope.draftMessage.text;
|
||||
|
||||
if (!angular.isString(text) || !text.length) {
|
||||
return false;
|
||||
if (angular.isString(text) && text.length > 0) {
|
||||
text = text.replace(/:([a-z0-9\-\+\*_]+?):/gi, function (all, name) {
|
||||
var utfChar = $.emojiarea.reverseIcons[name];
|
||||
if (utfChar !== undefined) {
|
||||
return utfChar;
|
||||
}
|
||||
return all;
|
||||
});
|
||||
|
||||
var timeout = 0;
|
||||
do {
|
||||
|
||||
(function (peerID, curText, curTimeout) {
|
||||
setTimeout(function () {
|
||||
AppMessagesManager.sendText(peerID, curText);
|
||||
}, curTimeout)
|
||||
})($scope.curDialog.peerID, text.substr(0, 4096), timeout);
|
||||
|
||||
text = text.substr(4096);
|
||||
timeout += 100;
|
||||
|
||||
} while (text.length);
|
||||
}
|
||||
|
||||
text = text.replace(/:([a-z0-9\-\+\*_]+?):/gi, function (all, name) {
|
||||
var utfChar = $.emojiarea.reverseIcons[name];
|
||||
if (utfChar !== undefined) {
|
||||
return utfChar;
|
||||
}
|
||||
return all;
|
||||
});
|
||||
|
||||
var timeout = 0;
|
||||
do {
|
||||
|
||||
(function (peerID, curText, curTimeout) {
|
||||
setTimeout(function () {
|
||||
AppMessagesManager.sendText(peerID, curText);
|
||||
}, curTimeout)
|
||||
})($scope.curDialog.peerID, text.substr(0, 4096), timeout);
|
||||
|
||||
text = text.substr(4096);
|
||||
timeout += 100;
|
||||
|
||||
} while (text.length);
|
||||
|
||||
resetDraft();
|
||||
$scope.$broadcast('ui_message_send');
|
||||
});
|
||||
|
@ -900,9 +900,11 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
.on('keyup', function (e) {
|
||||
updateHeight();
|
||||
|
||||
$scope.$apply(function () {
|
||||
$scope.draftMessage.text = richTextarea.textContent;
|
||||
});
|
||||
if (!sendAwaiting) {
|
||||
$scope.$apply(function () {
|
||||
$scope.draftMessage.text = richTextarea.textContent;
|
||||
});
|
||||
}
|
||||
|
||||
$timeout.cancel(updatePromise);
|
||||
updatePromise = $timeout(updateValue, 1000);
|
||||
@ -1032,10 +1034,19 @@ angular.module('myApp.directives', ['myApp.filters'])
|
||||
$scope.$on('ui_history_change', focusField);
|
||||
}
|
||||
|
||||
$scope.$on('ui_message_send', focusField);
|
||||
|
||||
$scope.$on('ui_peer_draft', updateRichTextarea);
|
||||
$scope.$on('ui_message_before_send', updateValue);
|
||||
|
||||
var sendAwaiting = false;
|
||||
$scope.$on('ui_message_before_send', function () {
|
||||
sendAwaiting = true;
|
||||
$timeout.cancel(updatePromise);
|
||||
updateValue();
|
||||
});
|
||||
$scope.$on('ui_message_send', function () {
|
||||
sendAwaiting = false;
|
||||
focusField();
|
||||
});
|
||||
|
||||
|
||||
function focusField () {
|
||||
onContentLoaded(function () {
|
||||
|
@ -243,7 +243,7 @@
|
||||
thumb="ownPhoto"
|
||||
/>
|
||||
</div>
|
||||
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}" ng-submit="sendMessage($event)">
|
||||
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}">
|
||||
|
||||
<div class="im_send_field_wrap">
|
||||
<div class="im_send_dropbox_wrap" my-i18n="im_photos_drop_text"></div>
|
||||
|
@ -124,7 +124,7 @@
|
||||
<div class="im_send_form_wrap1">
|
||||
|
||||
<div class="im_send_form_wrap clearfix" ng-controller="AppImSendController">
|
||||
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}" ng-submit="sendMessage($event)">
|
||||
<form my-send-form draft-message="draftMessage" class="im_send_form" ng-class="{im_send_form_empty: !draftMessage.text.length}">
|
||||
|
||||
<div class="im_send_field_wrap">
|
||||
<div class="im_send_dropbox_wrap" my-i18n="im_photos_drop_text"></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user