I want to be able to put a way to easily insert GIFs/images into a webpage like the way Discord inserts images by text (i.e.
I assume it processes some
<textarea>‘s content and gets the name of the image, and then inserts it. How can I do this?
Can I do some sort of
replace() insert abuse type thing, like:
Text.replace(":example:", "<img src='imagepath.png'>")
textarea tag are’t possible.
Because these elements can handle only plain text like Ascii, UTF-8, and others. Emoji works in it because is part of the Unicode system.
In that way, u can do this as Hermanboxcar said above, replacing an string with another.
The way Discord works are more complex because it handles events and sub-nodes in DOM (Document Object Model).
You could look for WYSIWYG, it’s the name of Discord’s text field are using.
I recommend you inspect Discord in the browser and try to type anything else. You will see that it works in another way as you no expect
Answered By – ayelsew