Browse Source

Bugfixes

master
Igor Zhukov 9 years ago
parent
commit
0c11fc6a1f
  1. 2
      app/js/controllers.js
  2. 4
      app/js/directives.js
  3. 7
      app/js/init.js
  4. 2
      app/js/lib/config.js
  5. 4
      app/js/lib/utils.js
  6. 1
      app/js/locales/en-us.json
  7. 20
      app/js/message_composer.js
  8. 10
      app/less/desktop.less
  9. 2
      app/partials/desktop/channel_modal.html
  10. 2
      app/partials/desktop/im.html
  11. 2
      app/partials/mobile/channel_modal.html

2
app/js/controllers.js

@ -2184,7 +2184,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -2184,7 +2184,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} else {
$scope.draftMessage.text = '/';
}
$scope.$broadcast('ui_peer_draft');
$scope.$broadcast('ui_peer_draft', {focus: true});
return cancelEvent($event);
}

4
app/js/directives.js

@ -1568,7 +1568,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -1568,7 +1568,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
$scope.$on('ui_peer_change', composer.resetTyping.bind(composer));
$scope.$on('ui_peer_draft', function () {
$scope.$on('ui_peer_draft', function (e, options) {
var isBroadcast = $scope.draftMessage.isBroadcast;
composer.setPlaceholder(_(isBroadcast ? 'im_broadcast_field_placeholder_raw' : 'im_message_field_placeholder_raw'));
@ -1576,7 +1576,7 @@ angular.module('myApp.directives', ['myApp.filters']) @@ -1576,7 +1576,7 @@ angular.module('myApp.directives', ['myApp.filters'])
composer.setValue($scope.draftMessage.text || '');
updateHeight();
}
if (!Config.Navigator.touch) {
if (!Config.Navigator.touch || options && options.focus) {
composer.focus();
}
onContentLoaded(function () {

7
app/js/init.js

@ -96,6 +96,13 @@ @@ -96,6 +96,13 @@
}
};
if (Config.Modes.force_mobile) {
layout = 'mobile';
}
else if (Config.Modes.force_desktop) {
layout = 'desktop';
}
switch (layout) {
case 'mobile': Config.Mobile = true; break;
case 'desktop': Config.Mobile = false; break;

2
app/js/lib/config.js

@ -30,6 +30,8 @@ Config.Modes = { @@ -30,6 +30,8 @@ Config.Modes = {
debug: location.search.indexOf('debug=1') > 0,
http: location.search.indexOf('http=1') > 0,
ssl: location.search.indexOf('ssl=1') > 0 || location.protocol == 'https:' && location.search.indexOf('ssl=0') == -1,
force_mobile: location.search.indexOf('mobile=1') > 0,
force_desktop: location.search.indexOf('desktop=1') > 0,
nacl: location.search.indexOf('nacl=0')== -1,
webcrypto: location.search.indexOf('webcrypto=0')== -1,
packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:',

4
app/js/lib/utils.js

@ -216,6 +216,10 @@ function getRichElementValue(node, lines, line, selNode, selOffset) { @@ -216,6 +216,10 @@ function getRichElementValue(node, lines, line, selNode, selOffset) {
function setRichFocus(field, selectNode) {
field.focus();
if (selectNode && selectNode.parentNode == field && !selectNode.nextSibling) {
field.removeChild(selectNode);
selectNode = null;
}
if (window.getSelection && document.createRange) {
var range = document.createRange();
if (selectNode) {

1
app/js/locales/en-us.json

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
"group_modal_members_kick": "Remove",
"channel_modal_info": "Channel info",
"channel_modal_description": "Description",
"channel_modal_share_link": "Share link",
"channel_modal_share_loading": "Loading{dots}",
"channel_modal_join": "Join channel",

20
app/js/message_composer.js

@ -880,11 +880,17 @@ MessageComposer.prototype.onEmojiSelected = function (code, autocomplete) { @@ -880,11 +880,17 @@ MessageComposer.prototype.onEmojiSelected = function (code, autocomplete) {
}
textarea.value = newValue;
var html;
if (suffix.length) {
this.selId = (this.selId || 0) + 1;
var html = this.getRichHtml(newValuePrefix) + '&nbsp;<span id="composer_sel' + this.selId + '"></span>' + this.getRichHtml(suffix);
html = this.getRichHtml(newValuePrefix) + '&nbsp;<span id="composer_sel' + this.selId + '"></span>' + this.getRichHtml(suffix);
this.richTextareaEl.html(html);
setRichFocus(textarea, $('#composer_sel' + this.selId)[0]);
} else {
html = this.getRichHtml(newValuePrefix) + '&nbsp;';
this.richTextareaEl.html(html);
setRichFocus(textarea);
}
} else {
var html = this.getEmojiHtml(code);
if (window.getSelection) {
@ -967,11 +973,17 @@ MessageComposer.prototype.onMentionSelected = function (username) { @@ -967,11 +973,17 @@ MessageComposer.prototype.onMentionSelected = function (username) {
}
textarea.value = newValue;
var html;
if (suffix.length) {
this.selId = (this.selId || 0) + 1;
var html = this.getRichHtml(newValuePrefix) + '&nbsp;<span id="composer_sel' + this.selId + '"></span>' + this.getRichHtml(suffix);
html = this.getRichHtml(newValuePrefix) + '&nbsp;<span id="composer_sel' + this.selId + '"></span>' + this.getRichHtml(suffix);
this.richTextareaEl.html(html);
setRichFocus(textarea, $('#composer_sel' + this.selId)[0]);
} else {
html = this.getRichHtml(newValuePrefix) + '&nbsp;';
this.richTextareaEl.html(html);
setRichFocus(textarea);
}
}
else {
var textarea = this.textareaEl[0];

10
app/less/desktop.less

@ -1400,6 +1400,16 @@ a.im_panel_peer_photo .peer_initials { @@ -1400,6 +1400,16 @@ a.im_panel_peer_photo .peer_initials {
}
}
.im_edit_panel {
&_wrap.im_edit_small_panel_wrap {
padding-bottom: 8px;
}
.im_edit_small_panel_wrap &_border {
margin-bottom: 7px;
}
}
/* Peer modals */
.user_modal {
&_window .modal-dialog {

2
app/partials/desktop/channel_modal.html

@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
<div class="md_modal_section_param_value">
<span ng-bind-html="chatFull.rAbout"></span>
</div>
<div class="md_modal_section_param_name" my-i18n="user_modal_about"></div>
<div class="md_modal_section_param_name" my-i18n="channel_modal_description"></div>
</div>
<div class="md_modal_section_param_wrap" ng-if="chatFull.chat.username">

2
app/partials/desktop/im.html

@ -139,7 +139,7 @@ @@ -139,7 +139,7 @@
<div class="im_bottom_panel_wrap">
<div class="im_edit_panel_wrap clearfix" ng-show="historyState.actions()" ng-switch="historyState.actions()">
<div class="im_edit_panel_wrap clearfix" ng-show="historyState.actions()" ng-switch="historyState.actions()" ng-class="historyState.channelActions !== false ? 'im_edit_small_panel_wrap' : ''">
<div class="im_edit_panel_border"></div>
<div ng-switch-when="bot">

2
app/partials/mobile/channel_modal.html

@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
</div>
<div class="mobile_modal_section" ng-if="chatFull.rAbout">
<h4 class="mobile_modal_section_header" my-i18n="user_modal_about"></h4>
<h4 class="mobile_modal_section_header" my-i18n="channel_modal_description"></h4>
<div class="mobile_modal_section_value" ng-bind-html="chatFull.rAbout"></div>
</div>

Loading…
Cancel
Save