From c0d94fe97627a4841522fefc1c34c1f88ea253ef Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 5 Feb 2016 15:44:30 +0300 Subject: [PATCH] Inline bots bugfixes --- app/js/controllers.js | 6 +++--- app/js/directives.js | 10 +++++----- app/js/lib/ng_utils.js | 2 +- app/js/message_composer.js | 6 ++++++ app/less/app.less | 28 ++++++++++++++++++++++++++-- app/partials/desktop/im.html | 6 +++--- 6 files changed, 44 insertions(+), 14 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 58c049b0..70aa3a3a 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2243,6 +2243,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) replyClear(); updateReplyKeyboard(); + delete $scope.draftMessage.inlineProgress; + $scope.$broadcast('inline_results', false); + // console.log(dT(), 'reset draft', $scope.curDialog.peer, forceDraft); if (forceDraft) { if (forceDraft == $scope.curDialog.peer) { @@ -2269,9 +2272,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.draftMessage.text = ''; $scope.$broadcast('ui_peer_draft'); } - - delete $scope.draftMessage.inlineProgress; - $scope.$broadcast('inline_results', false); } function applyDraftAttachment (e, attachment) { diff --git a/app/js/directives.js b/app/js/directives.js index 48e8cf4f..be395a0f 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1539,14 +1539,14 @@ angular.module('myApp.directives', ['myApp.filters']) } $scope.$on('inline_results', function (e, inlineResults) { + var w = ((richTextarea || messageField).offsetWidth || 382) - 2; + var h = 80; if (inlineResults) { - var w = ((richTextarea || messageField).offsetWidth || 382) - 2; - var h = 80; AppInlineBotsManager.regroupWrappedResults(inlineResults.results, w, h); - setZeroTimeout(function () { - composer.setInlineSuggestions(inlineResults); - }); } + setZeroTimeout(function () { + composer.setInlineSuggestions(inlineResults); + }); }); $scope.$on('inline_placeholder', function(e, data) { diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index de37b647..c82f932b 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -977,7 +977,7 @@ angular.module('izhukov.utils', []) var url = window.URL.createObjectURL(response.data); return $sce.trustAsResourceUrl(url); }, function (error) { - if (!Config.modes.chrome_packed) { + if (!Config.Modes.chrome_packed) { return $q.when($sce.trustAsResourceUrl(url)); } return $q.reject(error); diff --git a/app/js/message_composer.js b/app/js/message_composer.js index 367bd918..9b47249d 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -795,6 +795,7 @@ MessageComposer.prototype.setUpPlaintext = function () { MessageComposer.prototype.onKeyEvent = function (e) { var self = this; if (e.type == 'keyup') { + console.log(dT(), 'keyup', e.keyCode); this.checkAutocomplete(); var length = false; @@ -852,6 +853,7 @@ MessageComposer.prototype.onKeyEvent = function (e) { if (nextSel) { $(nextSel).addClass('composer_autocomplete_option_active'); this.scroller.scrollToNode(nextSel); + console.log(dT(), 'keydown cancel', e.keyCode); return cancelEvent(e); } } @@ -860,6 +862,7 @@ MessageComposer.prototype.onKeyEvent = function (e) { this.scroller.scrollToNode(nextSel); $(nextSel).addClass('composer_autocomplete_option_active'); + console.log(dT(), 'keydown cancel', e.keyCode); return cancelEvent(e); } @@ -889,6 +892,8 @@ MessageComposer.prototype.onKeyEvent = function (e) { if (self.onInlineResultSend) { self.onInlineResultSend(inlineID); } + self.hideSuggestions(); + console.log(dT(), 'keydown cancel', e.keyCode); return cancelEvent(e); } checkSubmit = true; @@ -973,6 +978,7 @@ MessageComposer.prototype.checkAutocomplete = function (forceFull) { if (value && this.curInlineResults && this.curInlineResults.text == value) { + console.trace(dT(), value, this.curInlineResults); this.showInlineSuggestions(this.curInlineResults); return; }; diff --git a/app/less/app.less b/app/less/app.less index f8e43dcd..882c09f9 100644 --- a/app/less/app.less +++ b/app/less/app.less @@ -1452,6 +1452,7 @@ a.im_dialog_selected { font-size: 12px; } .im_message_author_via { + color: #3a6d99; margin-left: 5px; } .im_message_fwd_via { @@ -3171,6 +3172,7 @@ _:-ms-lang(x), .composer_rich_textarea:empty:focus:before { height: 50px; margin-right: 10px; pointer-events: none; + text-align: center; } .inline_article_thumb { max-width: 50px; @@ -3178,19 +3180,41 @@ _:-ms-lang(x), .composer_rich_textarea:empty:focus:before { line-height: 0; } .inline_article_thumb_initials { - background: rgba(0,0,0, 0.05); + color: #999; + background: #EEE; line-height: 50px; text-align: center; font-size: 25px; text-transform: uppercase; + + li a:hover &, + li.composer_autocomplete_option_active a & { + color: #698192; + background: darken(#f2f6fa, 5%); + } } .inline_article_content_wrap { overflow: hidden; pointer-events: none; } +.inline_article_thumb_wrap, +.inline_article_title, +.inline_article_description, +.inline_article_url { + pointer-events: none; +} .inline_article_title { + color: #222; font-weight: bold; } +.inline_article_description { + color: #808080; + padding-top: 4px; + li a:hover &, + li.composer_autocomplete_option_active a & { + color: #698192; + } +} .composer_dropdown > li.inline_result_gif > a, @@ -3738,7 +3762,7 @@ h5 { overflow: hidden; } .img_gif_meta { - background: rgba(0,0,0,0.3); + background: rgba(0,0,0,0.4); width: 40px; height: 40px; line-height: 0; diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index e75dc83a..38cd4d99 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -91,7 +91,7 @@
-
+
@@ -105,8 +105,8 @@
-
-
+
+