I don't know exactly how to describe this, and don't know if 100% related to a Wappler question, sorry if that's the case..
But I've been fighting for some days with this scenario and wonder if someone has been facing something similar:
I've succesfully integrated an emoji toolbar on summernote using this:
<script>
document.emojiSource = '../tam-emoji/img';
document.addEventListener('DOMContentLoaded', function() {
$('#summernote').on('summernote.init', function() {
var emojiButton = function(context) {
var ui = $.summernote.ui;
var button = ui.button({
contents: '<i class="fa fa-smile-o"></i>',
tooltip: 'Emoji',
click: function() {
$('#summernote').emoji({
button: '.note-btn'
});
}
});
return button.render();
};
$('#summernote').summernote('addPlugin', {
buttons: {
emoji: emojiButton
}
});
});
});
</script>
And I want to use This solution for tagging users from Heather..
So:
<script>
function mentions() {
dmx.global.set('editorConfig', {
hint: {
mentions: dmx.parse('sc_mentions.data.query'),
match: /\B@(\w+)$/,
search: function (keyword, callback) {
var regex = new RegExp(keyword, 'i');
callback($.grep(this.mentions, function (item) {
return regex.test(item.name_users);
}));
},
template: function (item) {
return item.name_users;
},
content: function (item) {
return $('<a href="' + item.name_users + '">' + '@' + item.name_users + '</a>')[0];
}
}
});
}
</script>
And the editor becomes on:
<textarea id="summernote" name="post"
dmx-bind:config="editorConfig" is="dmx-summernote"
lang="es-ES"
dmx-bind:toolbar="[['insert', ['emoji']],['tool',['codeview','undo','redo','bold']]]"></textarea>
Both work perfect
on separated pages/when mentions()
is not called.
But when I put those js together on the same editor and run mentions()
it seems dmx.global.set('editorConfig')
brakes something as:
And the emoji panel doesn't close..
Any idea, what can I try here to solve this?
Thanks in advance everyone