mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 13:59:23 +00:00
Perform colons conversion
This commit is contained in:
parent
25525dcd94
commit
b05a26d734
@ -14,6 +14,11 @@ ComunicWeb.components.emoji.parser = {
|
|||||||
*/
|
*/
|
||||||
__twemojiBase: ComunicWeb.__config.assetsURL + "3rdparty/twemoji/2/",
|
__twemojiBase: ComunicWeb.__config.assetsURL + "3rdparty/twemoji/2/",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmojiConvertor instance
|
||||||
|
*/
|
||||||
|
__emojiConvertor: null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse emojies
|
* Parse emojies
|
||||||
*
|
*
|
||||||
@ -26,6 +31,9 @@ ComunicWeb.components.emoji.parser = {
|
|||||||
//Peform string parsing
|
//Peform string parsing
|
||||||
infos.element.innerHTML = this.shorcutToHTMLcode(infos.element.innerHTML);
|
infos.element.innerHTML = this.shorcutToHTMLcode(infos.element.innerHTML);
|
||||||
|
|
||||||
|
//Perform colon conversion
|
||||||
|
infos.element.innerHTML = this.colonConversion(infos.element.innerHTML);
|
||||||
|
|
||||||
//Perform Twitter parsing
|
//Perform Twitter parsing
|
||||||
this.twitterEmojiesParsing(infos.element);
|
this.twitterEmojiesParsing(infos.element);
|
||||||
|
|
||||||
@ -33,6 +41,25 @@ ComunicWeb.components.emoji.parser = {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform the conversion from colon code to Emoji code
|
||||||
|
*
|
||||||
|
* @param {string} string The string to convert
|
||||||
|
* @return {string} Converted string
|
||||||
|
*/
|
||||||
|
colonConversion: function(string){
|
||||||
|
|
||||||
|
//Check if the emoji convertor has to be created
|
||||||
|
if(this.__emojiConvertor == null){
|
||||||
|
this.__emojiConvertor = new EmojiConvertor();
|
||||||
|
this.__emojiConvertor.init_env(); // else auto-detection will trigger when we first convert
|
||||||
|
this.__emojiConvertor.replace_mode = 'unified';
|
||||||
|
this.__emojiConvertor.allow_native = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.__emojiConvertor.replace_colons(string);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform Twitter emojies parsing
|
* Perform Twitter emojies parsing
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user