summernote mentions ajax code example
Example: summernote mentions ajax
$(document).ready(function()
{
$('.editor').summernote({
height: 300,
hint: {
match: /\B@(\w*)$/,
users: function(keyword, callback) {
$.ajax({
url: '/users/' + keyword,
type: 'get',
async: true //This works but freezes the UI
}).done(callback);
},
search: function (keyword, callback) {
this.users(keyword, callback); //callback must be an array
},
content: function (item) {
return '@' + item;
}
}
});
});