From 190e34d513eb188e64f8b463dce0f4d6b8fcd70c Mon Sep 17 00:00:00 2001 From: OldHawk Date: Tue, 12 Dec 2017 17:27:27 +0800 Subject: [PATCH] feat(chat): emoji support on maker group create popup side overlay #20 --- modules/about/client/less/about.less | 3 +- .../collections/client/less/collections.less | 3 +- .../torrent-info.client.controller.js | 49 +++++++++++++++++++ .../views/view-torrent.client.view.html | 13 +++-- 4 files changed, 59 insertions(+), 9 deletions(-) diff --git a/modules/about/client/less/about.less b/modules/about/client/less/about.less index 88650e6f..2510966b 100644 --- a/modules/about/client/less/about.less +++ b/modules/about/client/less/about.less @@ -169,7 +169,7 @@ width: 100%; height: ~"calc(100% - 50px)"; overflow: auto; - padding: 30px 15px; + padding: 30px 10px; .maker-form { margin-top: 20px; input { @@ -192,7 +192,6 @@ bottom: 0; padding: 8px 10px; } - } .maker-view-top { diff --git a/modules/collections/client/less/collections.less b/modules/collections/client/less/collections.less index feb38cbf..178cd03b 100644 --- a/modules/collections/client/less/collections.less +++ b/modules/collections/client/less/collections.less @@ -13,7 +13,7 @@ width: 100%; height: ~"calc(100% - 50px)"; overflow: auto; - padding: 30px 15px; + padding: 30px 10px; .collection-form { margin-top: 20px; input { @@ -21,7 +21,6 @@ } textarea { resize: vertical; - margin-top: 20px; width: 100%; min-height: 200px; } diff --git a/modules/torrents/client/controllers/torrent-info.client.controller.js b/modules/torrents/client/controllers/torrent-info.client.controller.js index 8ae15771..b6c8e183 100644 --- a/modules/torrents/client/controllers/torrent-info.client.controller.js +++ b/modules/torrents/client/controllers/torrent-info.client.controller.js @@ -202,6 +202,55 @@ SideOverlay.close(null, 'tagsPopupSlide'); }; + /** + * initOverviewComplete + */ + vm.initOverviewComplete = function () { + $('.overview-textarea').textcomplete([ + { // emoji strategy + match: /\B:([\-+\w]*)$/, + search: function (term, callback) { + callback($.map(window.emojies, function (emoji) { + return emoji.indexOf(term) === 0 ? emoji : null; + })); + }, + template: function (value) { + return '' + '' + value + ''; + }, + replace: function (value) { + return ':' + value + ': '; + }, + index: 1 + } + ]); + }; + + /** + * onOverviewKeyDown + * @param e + */ + vm.onOverviewKeyDown = function (e) { + if (e.keyCode === 27) { // ESC + var hasPopupMenu = false; + var emojiMenu = $('.textcomplete-dropdown'); + angular.forEach(emojiMenu, function (e) { + if (e.style.display === 'block') { + hasPopupMenu = true; + } + }); + if (hasPopupMenu) { + e.stopPropagation(); + } + } + }; + + /** + * onPopupMessageOpen + */ + vm.onPopupMessageOpen = function () { + $('#coll-name').focus(); + }; + /** * setTorrentTags */ diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index 9c22266a..e85f8c5f 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -436,18 +436,21 @@ -
-
+
+
- - +