cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <!-- Create a new TinyMCE-enabled textarea -->
    <textarea rows="12" class="tinymce"></textarea>

    <!-- A Modal with our pictures laid out -->
    <div class="modal fade" id="filePicker" tabindex="-1" role="dialog" aria-labelledby="lblFilePicker" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">

                <!-- Modal Heading amd Close Button -->
                <div class="modal-header">
                    <h5 class="modal-title" id="lblFilePicker">Please Select an Image</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <!-- Modal Content - Your images will go here. This is also a good place to include an upload form. -->
                <div class="modal-body fileSelection">
                    <img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/60e7b030151067.5615792c7de28.jpg" />
                    <img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/15ae4e41225637.579df12d7f7eb.jpg" />
                    <img src="https://mir-s3-cdn-cf.behance.net/project_modules/max_1200/447ff629294033.55ec58b2e376d.jpg" />
                </div>
            </div> <!-- /end of modal-content -->
        </div>  <!-- /end of modal-dialog -->
    </div> <!-- /end of modal -->
            
          
!
            
              .fileSelection img{
  width: 100%;
}
            
          
!
            
              // A variable used to track the active textarea, in case multiple textareas are included on the same page.
        // - this will store the textarea the image must be included in.
        var activeTextArea = null;

        // Initialize a new TinyMCE textarea
        tinymce.init({
            selector: ".tinymce",  // change this to target the appropriate HTML control on your page
            setup: function (editor) { // on the setup of the TinyMCE plugin, add a button with the alias 'addImage'
                editor.addButton('addImage', {
                    text: 'Add Image', // the text to display alongside the button
                    icon: 'image', // the icon to display alongside the button
                    onclick: function () {
                        activeTextArea = editor; // onclick of this button, set the active textarea to that of which the button was pressed
                        $('#filePicker').modal('show'); // show the file picker modal
                    }
                });
            },
            //include buttons on the toolbar of our TinyMCE textarea, notice our new aliased button 'addImage' is included
            toolbar1: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | addImage'
        });

        // when an image is selected, insert the image into the active textarea and then close the modal
        $(function () {
            $(".fileSelection img").click(function (e) {
                activeTextArea.insertContent('&nbsp; <img src="' + $(this).attr("src") + '" /> &nbsp;');
                $('#filePicker').modal('hide');
            });
        });
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console