Take a look at this screenshot:
https://i.sstatic.net/zojKK.jpg
This code snippet allows me to include emoji spans within a DIV.
$('body').on('click', '.selectable-icons', function(e) {
if (e.target.tagName.toLowerCase() === 'span') {
document.querySelector('[contenteditable]').appendChild(e.target.cloneNode(true));
$('[contenteditable]').append(" ");
var current_text = $('[contenteditable]').html();
alert(current_text);
$('.publisher_div').html(current_text);
}
The issue I'm facing is that a space is not being added after the span
tag, preventing me from writing text immediately following it.