Can add emojies on posts

This commit is contained in:
Pierre 2018-04-20 17:03:37 +02:00
parent 3cee773de0
commit 7d7fb2c499
3 changed files with 18 additions and 5 deletions

View File

@ -875,7 +875,7 @@
if (selection.ce) { // if contenteditable if (selection.ce) { // if contenteditable
el.focus(); el.focus();
document.execCommand('insertText', false, emo); el.innerHTML += emo; //COMUNIC EDIT document.execCommand('insertText', false, emo);
} else { } else {
var textBefore = val.substring(0, selection.start); var textBefore = val.substring(0, selection.start);
textBefore = textBefore.replace(/:\S*$/, '') textBefore = textBefore.replace(/:\S*$/, '')

View File

@ -11,7 +11,7 @@ ComunicWeb.components.emoji.picker = {
'<a href="#" class="wdt-emoji-popup-mobile-closer"> &times; </a>' + '<a href="#" class="wdt-emoji-popup-mobile-closer"> &times; </a>' +
'<div class="wdt-emoji-menu-content">' + '<div class="wdt-emoji-menu-content">' +
' <div id="wdt-emoji-menu-header">' + ' <div id="wdt-emoji-menu-header">' +
' <a class="wdt-emoji-tab active" data-group-name="Recent"></a>' + ' <!--<a class="wdt-emoji-tab active" data-group-name="Recent"></a>-->' +
' <a class="wdt-emoji-tab" data-group-name="People"></a>' + ' <a class="wdt-emoji-tab" data-group-name="People"></a>' +
' <a class="wdt-emoji-tab" data-group-name="Nature"></a>' + ' <a class="wdt-emoji-tab" data-group-name="Nature"></a>' +
' <a class="wdt-emoji-tab" data-group-name="Foods"></a>' + ' <a class="wdt-emoji-tab" data-group-name="Foods"></a>' +
@ -20,7 +20,7 @@ ComunicWeb.components.emoji.picker = {
' <a class="wdt-emoji-tab" data-group-name="Objects"></a>' + ' <a class="wdt-emoji-tab" data-group-name="Objects"></a>' +
' <a class="wdt-emoji-tab" data-group-name="Symbols"></a>' + ' <a class="wdt-emoji-tab" data-group-name="Symbols"></a>' +
' <a class="wdt-emoji-tab" data-group-name="Flags"></a>' + ' <a class="wdt-emoji-tab" data-group-name="Flags"></a>' +
' <a class="wdt-emoji-tab" data-group-name="Custom"></a>' + ' <!--<a class="wdt-emoji-tab" data-group-name="Custom"></a>-->' +
' </div>' + ' </div>' +
' <div class="wdt-emoji-scroll-wrapper">' + ' <div class="wdt-emoji-scroll-wrapper">' +
' <div id="wdt-emoji-menu-items">' + ' <div id="wdt-emoji-menu-items">' +

View File

@ -32,17 +32,30 @@ ComunicWeb.components.posts.form = {
class: "box-body" class: "box-body"
}); });
//Make sure emojie picker is already initialized
ComunicWeb.components.emoji.picker.init();
//Create post message contener
var newPostMessageContener = createElem2({
appendTo: boxBody,
type: "div"
});
//Create post message textarea //Create post message textarea
var inputMessageDiv = createElem2({ var inputMessageDiv = createElem2({
appendTo: boxBody, appendTo: newPostMessageContener,
type: "div", type: "div",
class: "new-message", class: "new-message wdt-emoji-bundle-enabled",
innerHTML: "" innerHTML: ""
}); });
//Enable bootstrap-wysiwyg //Enable bootstrap-wysiwyg
$(inputMessageDiv).wysiwyg(); $(inputMessageDiv).wysiwyg();
//Enable emojies picker
ComunicWeb.components.emoji.picker.addPicker(inputMessageDiv);
//Add the different post types //Add the different post types
var postTypesContainer = createElem2({ var postTypesContainer = createElem2({
appendTo: boxBody, appendTo: boxBody,