feat(forums): emoji in post form

This commit is contained in:
OldHawk
2017-12-09 23:16:34 +08:00
parent 4195a6059a
commit 018bb33723
11 changed files with 284 additions and 26 deletions

View File

@@ -5,16 +5,34 @@
.module('forums')
.controller('ForumsPostController', ForumsPostController);
ForumsPostController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'MeanTorrentConfig', 'ForumsService', 'Upload', '$timeout', 'NotifycationService',
'marked', 'ModalConfirmService', '$stateParams', 'TopicsService'];
ForumsPostController.$inject = ['$scope', '$state', '$window', 'Authentication', 'MeanTorrentConfig', 'ForumsService', 'Upload', '$timeout', 'NotifycationService',
'marked', '$stateParams', 'TopicsService'];
function ForumsPostController($scope, $state, $translate, Authentication, MeanTorrentConfig, ForumsService, Upload, $timeout, NotifycationService,
marked, ModalConfirmService, $stateParams, TopicsService) {
function ForumsPostController($scope, $state, $window, Authentication, MeanTorrentConfig, ForumsService, Upload, $timeout, NotifycationService,
marked, $stateParams, TopicsService) {
var vm = this;
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
vm.user = Authentication.user;
vm.forumPath = [];
$('.autocomplete').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 '<img class="ac-emoji" src="/graphics/emojis/' + value + '.png" />' + '<span class="ac-emoji-text">' + value + '</span>';
},
replace: function (value) {
return ':' + value + ': ';
},
index: 1
}
]);
/**
* init
*/