ff0000/scarlet — pull request #4 by dannygarcia (2013-06-17 18:20:04+00:00)
Title: Insert Media

# Insert Media Extension

Most of this PR extends the wysihtml5 plugin:

1. Inserting media (images, video, etc.) within the wysiwyg textarea is now possible.
2. Extending the wysihtml5 plugin with further wysiwyg functionality is centralized and thus easier.

These are outlined in detail as follows.

## Inserting Media
Inserting media starts in the wysiwyg toolbar which is now a django template where I've included a new button called "insert media". It references a custom command called "insertMedia". That command has it's own file "insertMedia.js" and extends the wysihtml5 command object.

The functionality for selecting and inserting media is split into three modules.
- `Insert.js` base / shared functionality. Binds key inputs and handles common use cases.
- `InsertImage.js` specific to inserting images (3rd party or from the media library).
- `InsertVideo.js` specific to inserting embeddable video (youtube, vimeo, vine, etc.).

## Extending wysihtml5

New command objects can be added to a centralized `commands.js` file. Pretty easy stuff.

# Tabs

The design called for tabs so I made a simple tabs thing. It works like this:

HTML:

````html

Tab 1

Tab 2

Tab 1 content here.

Tab 1 content here.

````

JavaScript:

````javascript
var tabs = new Tabs(".tabs");
````

# End

I can demo this stuff on Tuesday if that's helpful.

![wysiwyg](https://f.cloud.github.com/assets/901728/663930/3898a472-d77a-11e2-8ac0-230bfe37c1d6.gif)