diff --git a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 index cbaffc2b85c..3c435b54b10 100644 --- a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 +++ b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 @@ -130,10 +130,13 @@ export default function(options) { if (options.transformComplete) { term = options.transformComplete(term); } - var text = me.val(); - text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length); - me.val(text); - Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length); + + if (term) { + var text = me.val(); + text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length); + me.val(text); + Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length); + } } } closeAutocomplete(); diff --git a/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 b/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 index ee449e3ccda..9ae602283fa 100644 --- a/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 +++ b/app/assets/javascripts/discourse/lib/emoji/emoji-toolbar.js.es6 @@ -236,6 +236,8 @@ var showSelector = function(options) { closeSelector(); }); + if (Discourse.Mobile.mobileView) PER_ROW = 9; + var page = parseInt(localStorage.emojiPage) || 0; var offset = parseInt(localStorage.emojiOffset) || 0; render(page, offset, options); diff --git a/app/assets/stylesheets/common/base/emoji.scss b/app/assets/stylesheets/common/base/emoji.scss index 69e111f445e..9cb13b4d5b1 100644 --- a/app/assets/stylesheets/common/base/emoji.scss +++ b/app/assets/stylesheets/common/base/emoji.scss @@ -9,10 +9,9 @@ body img.emoji { } .emoji-modal { + @include transform(translate(-50%, -50%)); z-index: 10000; position: fixed; - margin-left: -195px; - margin-top: -100px; left: 50%; top: 50%; background-color: dark-light-choose(#dadada, blend-primary-secondary(5%)); diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss index 8434f8c731c..47dbba7ef21 100644 --- a/app/assets/stylesheets/mobile.scss +++ b/app/assets/stylesheets/mobile.scss @@ -20,6 +20,7 @@ @import "mobile/directory"; @import "mobile/menu-panel"; @import "mobile/search"; +@import "mobile/emoji"; /* These files doesn't actually exist, they are injected by DiscourseSassImporter. */ diff --git a/app/assets/stylesheets/mobile/emoji.scss b/app/assets/stylesheets/mobile/emoji.scss new file mode 100644 index 00000000000..101f5e95b89 --- /dev/null +++ b/app/assets/stylesheets/mobile/emoji.scss @@ -0,0 +1,3 @@ +.emoji-table-wrapper { + min-width: 320px; +}