Text area with image

1

Hello, I'm going to make a form and I do not know how to do it to include an image inside the text area, something like that.

TEXT

TEXT

IMAGE

TEXT

Something of a kind for the include user to know? As it is done here in stack overflow, for questions.

    
asked by anonymous 02.06.2017 / 13:27

1 answer

3

What you want to do is resolved with WYSIWYG editors ( What You See Is What You Get ). A simple example of these editors is TinyMCE . To use it:

  • Access the URL: link to create your account;
  • In the side menu, visit API Key Manager ;
  • Copy the key that appears (will use it later);
  • To use it on the page, you can download the library directly from the site. Here I will use the version in the cloud for example purposes. Add the tinymce.min.js JavaScript file, stating your API key:

    <script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=your_API_key"></script>

    andcreatethetextareaelementthatyouwanttosetaseditor.InyourJavaScriptfile,addthecodesnippetthatinitializestheeditor:

    tinymce.init({selector:'textarea'});

    Aboutusingimagesintheeditor,youcanreadthe File & Image Upload .

    See the example below (not working as it is running on the Snippet):

    tinymce.init({ selector:'textarea' });
    <script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=API_KEY"></script><textarea>Seueditordetexto</textarea>

    Othersimilareditors:

    14.07.2017 / 17:20