Browse Source

Inline bots bugfixes

master
Igor Zhukov 8 years ago
parent
commit
c0d94fe976
  1. 6
      app/js/controllers.js
  2. 10
      app/js/directives.js
  3. 2
      app/js/lib/ng_utils.js
  4. 6
      app/js/message_composer.js
  5. 28
      app/less/app.less
  6. 6
      app/partials/desktop/im.html

6
app/js/controllers.js

@ -2243,6 +2243,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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']) @@ -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) {

10
app/js/directives.js

@ -1539,14 +1539,14 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -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) {

2
app/js/lib/ng_utils.js

@ -977,7 +977,7 @@ angular.module('izhukov.utils', []) @@ -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);

6
app/js/message_composer.js

@ -795,6 +795,7 @@ MessageComposer.prototype.setUpPlaintext = function () { @@ -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) { @@ -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) { @@ -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) { @@ -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) { @@ -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;
};

28
app/less/app.less

@ -1452,6 +1452,7 @@ a.im_dialog_selected { @@ -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 { @@ -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 { @@ -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 { @@ -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;

6
app/partials/desktop/im.html

@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
</div>
<div ng-show="!state.notSelected &amp;&amp; !state.loaded" class="im_history_loading" my-vertical-position="0.35" padding="true">
<div my-arc-progress stroke="5" width="60"></div>
<div my-arc-progress stroke="5" width="50"></div>
</div>
<div ng-show="state.loaded">
@ -105,8 +105,8 @@ @@ -105,8 +105,8 @@
<div class="im_history" ng-class="{im_history_selectable: !historyState.botActions, im_history_select_active: historyState.selectActions}">
<div class="im_history_empty_wrap" ng-show="state.empty" ng-switch="state.mayBeHasMore">
<div ng-switch-when="true" class="im_history_loading" my-vertical-position="0.25" padding="true">
<div my-arc-progress stroke="5" width="60"></div>
<div ng-switch-when="true" class="im_history_loading" my-vertical-position="0.3" padding="true">
<div my-arc-progress stroke="5" width="50"></div>
</div>
<div ng-switch-default class="im_history_empty" my-vertical-position="0.25" padding="true" my-i18n="im_no_messages"></div>
</div>

Loading…
Cancel
Save