Issue
I am developing social networking application using angular technology
I used CKEditor for creating posts and created a separate emoji function
I couldn't find the way to convert symbols ;) :( :)
to emojis in HTML div tag
If anyone knows please let me guide on it
Thanks
Solution
If I understand your question clearly, you want to display emoticons on the webpage when users enter their symbol in the textarea. This can be done using an inbuilt text editor plugin like TinyMCE. But if you want to try the native way, the simple funda here is: These emoticon characters are available as Unicode decimal or hexadecimal codepoints when used with UTF-8, a default charset used on webpages. To get a list of smileys hexadecimal code points, refer to this: https://www.unicode.org/charts/PDF/U1F600.pdf
To display any special character on the webpage, we use '&#x<hexa_code_point>' or '&#<dec_code_point>'.
For eg,
🙂 = 🙂
😒 = 😒
😴 = 😴
so you will need a map between a string entered in your textarea and this code. For eg,
{
':|': "1F610"
}
and then corresponding to that code point, we can display smiley.
For reference, https://codesandbox.io/s/vibrant-lehmann-ibvncy?file=/index.html
Answered By - Nitesh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.