1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-04 15:24:23 +01:00
fab-manager/vendor/assets/components/summernote/examples/hint-emoji.html
2016-03-23 18:39:41 +01:00

63 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>summernote</title>
<!-- include jquery -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<!-- include libraries BS3 -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" />
<!-- include summernote -->
<link rel="stylesheet" href="../dist/summernote.css">
<script type="text/javascript" src="../dist/summernote.js"></script>
<script type="text/javascript" src="../lang/summernote-ko-KR.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var self = this;
// load github's emoji list
$.ajax({
url: 'https://api.github.com/emojis'
}).then(function (data) {
var emojis = Object.keys(data);
var emojiUrls = data;
$('.summernote').summernote({
height: 300,
hintDirection: 'top',
hint: [{
search: function (keyword, callback) {
callback($.grep(emojis, function (item) {
return item.indexOf(keyword) === 0;
}));
},
match: /\B:([\-+\w]+)$/,
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 '';
}
}]
});
});
});
</script>
</head>
<body>
<textarea class="summernote">Type text start with ":". For example, :smile or :+1:.</textarea>
</body>
</html>