网站如何采用emojo?

超级管理员    2017-12-26 23:15:41  
<link rel="stylesheet" href="frontend/appui/summernote/dist/summernote.css">
<script type="text/javascript" src="frontend/appui/summernote/dist/summernote.js"></script>
<script type="text/javascript" src="frontend/appui/summernote/dist/lang/summernote-zh-CN.js"></script>
<script>
$(function () {
        //var emojiUrls = {"angry":"\/frontend\/appui\/images\/emojis\/angry.png"};
var emojiUrls = <?php echo json_encode($emojis); ?>;
window.emojis = Object.keys(emojiUrls);
$('#reply').summernote({
height: 150,
tabsize: 2,
lang: 'zh-CN',
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
['insert', ['link', 'video']]
],
//            hintDirection: 'top',
hint: [{
match: /:([\-+\w]+)$/,
search: function (keyword, callback) {
callback($.grep(emojis, function (item) {
return item.indexOf(keyword) === 0;
}));
},
template: function (item) {
var content = emojiUrls[item];
return '<img src="' + content + '" width="20" /> :' + item + ':';
},
content: function (item) {
var url = emojiUrls[item];
if (url) {
return $('<img />').attr('src', url).css('width', 20)[0];
}
return '';
}
}]

});
});