diff --git a/app/js/controllers.js b/app/js/controllers.js index 6267b605..935b903f 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -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); } diff --git a/app/js/directives.js b/app/js/directives.js index b723cad3..aac67dee 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -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']) composer.setValue($scope.draftMessage.text || ''); updateHeight(); } - if (!Config.Navigator.touch) { + if (!Config.Navigator.touch || options && options.focus) { composer.focus(); } onContentLoaded(function () { diff --git a/app/js/init.js b/app/js/init.js index 0c3769e3..4cc3b4be 100644 --- a/app/js/init.js +++ b/app/js/init.js @@ -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; diff --git a/app/js/lib/config.js b/app/js/lib/config.js index c1ac4ab3..d41bb8a6 100644 --- a/app/js/lib/config.js +++ b/app/js/lib/config.js @@ -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:', diff --git a/app/js/lib/utils.js b/app/js/lib/utils.js index e072cc2f..4aa3b8a7 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -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) { diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 582d6afb..0ffa1a8b 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -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", diff --git a/app/js/message_composer.js b/app/js/message_composer.js index e4ee73f1..c76358c5 100644 --- a/app/js/message_composer.js +++ b/app/js/message_composer.js @@ -880,11 +880,17 @@ MessageComposer.prototype.onEmojiSelected = function (code, autocomplete) { } textarea.value = newValue; - this.selId = (this.selId || 0) + 1; - var html = this.getRichHtml(newValuePrefix) + ' ' + this.getRichHtml(suffix); - - this.richTextareaEl.html(html); - setRichFocus(textarea, $('#composer_sel' + this.selId)[0]); + var html; + if (suffix.length) { + this.selId = (this.selId || 0) + 1; + html = this.getRichHtml(newValuePrefix) + ' ' + this.getRichHtml(suffix); + this.richTextareaEl.html(html); + setRichFocus(textarea, $('#composer_sel' + this.selId)[0]); + } else { + html = this.getRichHtml(newValuePrefix) + ' '; + this.richTextareaEl.html(html); + setRichFocus(textarea); + } } else { var html = this.getEmojiHtml(code); if (window.getSelection) { @@ -967,11 +973,17 @@ MessageComposer.prototype.onMentionSelected = function (username) { } textarea.value = newValue; - this.selId = (this.selId || 0) + 1; - var html = this.getRichHtml(newValuePrefix) + ' ' + this.getRichHtml(suffix); - - this.richTextareaEl.html(html); - setRichFocus(textarea, $('#composer_sel' + this.selId)[0]); + var html; + if (suffix.length) { + this.selId = (this.selId || 0) + 1; + html = this.getRichHtml(newValuePrefix) + ' ' + this.getRichHtml(suffix); + this.richTextareaEl.html(html); + setRichFocus(textarea, $('#composer_sel' + this.selId)[0]); + } else { + html = this.getRichHtml(newValuePrefix) + ' '; + this.richTextareaEl.html(html); + setRichFocus(textarea); + } } else { var textarea = this.textareaEl[0]; diff --git a/app/less/desktop.less b/app/less/desktop.less index b276490e..492b03f3 100644 --- a/app/less/desktop.less +++ b/app/less/desktop.less @@ -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 { diff --git a/app/partials/desktop/channel_modal.html b/app/partials/desktop/channel_modal.html index 99c87a5b..fdb6e34c 100644 --- a/app/partials/desktop/channel_modal.html +++ b/app/partials/desktop/channel_modal.html @@ -50,7 +50,7 @@
-
+
diff --git a/app/partials/desktop/im.html b/app/partials/desktop/im.html index 2982af55..1e49d933 100644 --- a/app/partials/desktop/im.html +++ b/app/partials/desktop/im.html @@ -139,7 +139,7 @@
-
+
diff --git a/app/partials/mobile/channel_modal.html b/app/partials/mobile/channel_modal.html index 900a56e8..2e4d516e 100644 --- a/app/partials/mobile/channel_modal.html +++ b/app/partials/mobile/channel_modal.html @@ -63,7 +63,7 @@
-

+