So I want to show image thumbnails
too in the <textarea>
along with text. If you know a javascript solution that's perfect too(if possible in vanilla JS).
Like this:
__________________
|Hello World |
| _______ |
| | Img | |
| | | |
| |_____| |
|Hello again. |
| _______ |
| | Img2| |
| | | |
| |_____| |
|________________|
As I know and seen in a div or anything what has contentEditable="true"
allows image too but, allows many other HTML tags and a lots of things what I don't want :|
I want just text
and images
.
Use a div with contentEditable attribute which acts like a textarea. That's how wysiwyg editors are created.
div {
width: 300px;
height: 200px;
border: 1px solid #ccc;
}
<div contentEditable="true">Type here. You can insert images too
<img src="http://t2.gstatic.com/images?q=tbn:ANd9GcQCze-mfukcuvzKk7Ilj2zQ0CS6PbOkq7ZhRInnNd1Yz3TQzU4e&t=1" />
</div>