Commit Graph

252 Commits

Author SHA1 Message Date
Scott Taylor
90da8aab4a Add wp.media.view.MediaFrame.MediaDetails, which wp.media.view.MediaFrame.AudioDetails and media.view.MediaFrame.VideoDetails extend. The subclasses subsequently only need to set createStates() and bindHandlers(), as well as any missing toolbar views.
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27479


git-svn-id: http://core.svn.wordpress.org/trunk@27323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-09 06:05:14 +00:00
Scott Taylor
f7af18e1d6 Audio/Video shortcodes in the media modal:
* Make a generic model, `wp.media.model.PostMedia`, which replaces `wp.media.model.PostAudio` and `wp.media.model.PostVideo`
* Make a generic library, `wp.media.controller.MediaLibrary`, which replaces `wp.media.controller.ReplaceVideo` and `wp.media.controller.ReplaceAudio`
* `wp.media.controller.MediaLibrary` is used to create new states that want to load a library filtered by type, making it incredibly simple to add states to frames. See `wp.media.view.MediaFrame.VideoDetails` and `wp.media.view.MediaFrame.AudioDetails`.

UX changes:

* Add the ability to manage HTML5 fallbacks - add additional `<source>`s or remove specific `<source>`s
* In the Video Details state, add the ability to select a poster image

See #27016.


Built from https://develop.svn.wordpress.org/trunk@27478


git-svn-id: http://core.svn.wordpress.org/trunk@27322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-09 05:25:15 +00:00
Scott Taylor
dc00fc7e7f Audio/Video shortcodes in the media modal:
* Add `embedMimes` to `_wpMediaViewsL10n`
* Use `escape` instead of `interpolate` when setting attributes in Underscore templates
* When creating the `<audio>` and `<video>` tags dynamically, set inner `<source>` nodes instead of the `src` attribute and properly set the mime-type per source as the `type` attribute. This is also drastically reduces the amount of code used to generate the tags.

See #27016.


Built from https://develop.svn.wordpress.org/trunk@27476


git-svn-id: http://core.svn.wordpress.org/trunk@27320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-09 01:01:14 +00:00
Andrew Ozz
c3212baa4d Limit the drag/drop upload only to newer browsers (IE10+), add a fullscreen dropzone in DFW mode, props kovshenin, see #19845
Built from https://develop.svn.wordpress.org/trunk@27464


git-svn-id: http://core.svn.wordpress.org/trunk@27309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-08 01:35:15 +00:00
Scott Taylor
818bf7c6af When MEDIA_TRASH is true, show the proper context in the attachment-details sidebar. Without this fix, it always showed "Delete Permanently."
Props toszcze.
Fixes #26783.


Built from https://develop.svn.wordpress.org/trunk@27454


git-svn-id: http://core.svn.wordpress.org/trunk@27300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 16:42:14 +00:00
Scott Taylor
3b212f7e0f JSHint addendum to [27450].
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27453


git-svn-id: http://core.svn.wordpress.org/trunk@27299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 08:44:15 +00:00
Scott Taylor
7f15998947 Videos in the media modal:
* Support rendering of chromeless YouTube when a video shortcode's `src` is a YouTube URL. 
* Don't instantiate an instance of `MediaElementPlayer` until after the view has been attached to the DOM and the view's `ready` event has fired.
* Don't set `poster` for videos when its value is empty. Much like `src` in the `img` tag - when empty, it will assume and load the current window's URL.
* When removing a player instance, don't call the `pause` method if the playback is not native.

See #27016.


Built from https://develop.svn.wordpress.org/trunk@27452


git-svn-id: http://core.svn.wordpress.org/trunk@27298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 08:32:14 +00:00
Scott Taylor
52fdb09e2d Support the autoplay attribute, even when the plugin type for a MediaElement instance is Flash. In the media modal, wp.media.view.VideoDetails and wp.media.view.AudioDetails now extend a unified wp.media.view.MediaDetails class which contains all of the player creation and destruction logic. The remove() method mimics the mejs.MediaElementPlayer.remove() method, but does not re-add the audio/video tag to the DOM. The MEjs method is especially problematic when the tag has autoplay="true" and the view has been detached but not destroyed.
Fixes #25077.
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27450


git-svn-id: http://core.svn.wordpress.org/trunk@27296 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-07 05:52:14 +00:00
Helen Hou-Sandí
4bb7e03548 At long last, a first pass at bringing the image editor into the media modal. props gcorne, DH-Shredder, tomauger. see #21811.
Built from https://develop.svn.wordpress.org/trunk@27445


git-svn-id: http://core.svn.wordpress.org/trunk@27292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 22:55:14 +00:00
Scott Taylor
023b419727 Call the correct remove() method on the MEjs instance when exiting the media modal.
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27443


git-svn-id: http://core.svn.wordpress.org/trunk@27290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 20:13:15 +00:00
Scott Taylor
eda85e17ca Cleanup audio/video shortcodes in the media modal:
* On the controller's `update`, `replace`, and `close` events, call `detach()` on the frame
* Cleanup the HTML ouput of the Underscore templates.
* Move some logic from the Underscore template to the `VideoDetails` view class.

See #27016.


Built from https://develop.svn.wordpress.org/trunk@27440


git-svn-id: http://core.svn.wordpress.org/trunk@27287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 19:06:16 +00:00
Scott Taylor
ba27ced46b Add a loading indicator to the Media Library.
Props kadamwhite, gcorne, kovshenin.
Fixes #24859.


Built from https://develop.svn.wordpress.org/trunk@27438


git-svn-id: http://core.svn.wordpress.org/trunk@27285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 17:46:15 +00:00
Scott Taylor
bc9838f86f We shall pledge to run jshint before committing.
Props nacin for the nudge.


Built from https://develop.svn.wordpress.org/trunk@27435


git-svn-id: http://core.svn.wordpress.org/trunk@27282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-06 16:06:14 +00:00
Scott Taylor
9aa05f8681 Add a timestamp to the urls passed to <audio> and <video> in the modal to ensure that cached view instances aren't referenced by MEjs. Pause the player when closing the controller's modal.
See #27016, #26779.


Built from https://develop.svn.wordpress.org/trunk@27420


git-svn-id: http://core.svn.wordpress.org/trunk@27267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 21:37:13 +00:00
Scott Taylor
09d8606428 Add some missing JSDoc blocks to media-related code.
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27415


git-svn-id: http://core.svn.wordpress.org/trunk@27262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 18:37:15 +00:00
Scott Taylor
0ccc1d52ac Audio doesn't have the same quirks as video in the media modal. We don't have to aggressively destroy the mejs instance.
See #27016.


Built from https://develop.svn.wordpress.org/trunk@27414


git-svn-id: http://core.svn.wordpress.org/trunk@27261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 18:32:14 +00:00
Scott Taylor
ff8844deae Add TinyMCE placeholders for audio and video shortcodes.
* Add `wp.media.mixin`.
* Add `wp.media.audio` and `wp.media.video`.
* Add `wp.media.model.PostAudio` and `wp.media.model.PostVideo`
* Add `wp.media.controller.AudioDetails` and `wp.media.controller.VideoDetails`.
* Add `wp.media.controller.ReplaceAudio` and `wp.media.controller.ReplaceVideo`.
* Add `wp.media.view.MediaFrame.AudioDetails` and `wp.media.view.MediaFrame.VideoDetails`.
* Add `wp.media.view.AudioDetails` and `wp.media.view.VideoDetails`.
* Update the `wpgallery` TinyMCE plugin.
* Display audio and video players in the media modal when shortcode is clicked.
* Provide a UI to edit shortcode attributes in the media modal.
* Provide a UI to replace the `src` media file in an `audio` or `video` shortcode.

See #27016.


Built from https://develop.svn.wordpress.org/trunk@27411


git-svn-id: http://core.svn.wordpress.org/trunk@27258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 15:06:14 +00:00
Andrew Nacin
70d23fc559 Support multiple editor instances when drag-and-drop-uploading onto them.
Also reduces z-index to below the toolbar, and adds a comment.

props kovshenin.
see #19845.

Built from https://develop.svn.wordpress.org/trunk@27378


git-svn-id: http://core.svn.wordpress.org/trunk@27227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-03 17:44:16 +00:00
Scott Taylor
cbe89d6710 Adjust the priority of the separator in the Edit Playlist and Edit Video Playlist menus to match the structure of the Edit Gallery menu.
Props gcorne.
See #26631.


Built from https://develop.svn.wordpress.org/trunk@27363


git-svn-id: http://core.svn.wordpress.org/trunk@27213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-02 23:13:14 +00:00
Scott Taylor
c0a9ee8452 Make CollectionEdit and CollectionAdd less dynamically quirky. Rename some instance properties for disambiguation. Pass some properties from options when creating instances in wp.media.view.MediaFrame.Post.
See #26631.
Props gcorne.


Built from https://develop.svn.wordpress.org/trunk@27362


git-svn-id: http://core.svn.wordpress.org/trunk@27212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-02 23:11:14 +00:00
Scott Taylor
330f27f095 Add some braces for jshint in media-views.js.
See #26631.
Props gcorne.


Built from https://develop.svn.wordpress.org/trunk@27361


git-svn-id: http://core.svn.wordpress.org/trunk@27211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-02 23:07:15 +00:00
Sergey Biryukov
f01dc328c5 Remove extra comma. props jorbin. see #19845.
Built from https://develop.svn.wordpress.org/trunk@27352


git-svn-id: http://core.svn.wordpress.org/trunk@27203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-02 19:01:13 +00:00
Andrew Nacin
482856e2e1 Add the ability to drag and drop files directly onto the editor.
The file will then begin to upload and the media manager will open.

props kovshenin.
see #19845.

Built from https://develop.svn.wordpress.org/trunk@27343


git-svn-id: http://core.svn.wordpress.org/trunk@27195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-01 21:34:17 +00:00
Scott Taylor
3dc901a92a Rather than extending media.controller.CollectionAdd 3 times, make it a constructor that dynamically extends media.controller.Library and use instances of it instead.
See #26631.


Built from https://develop.svn.wordpress.org/trunk@27322


git-svn-id: http://core.svn.wordpress.org/trunk@27174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-27 23:04:13 +00:00
Scott Taylor
abebb1fde2 Correct a misspelled property name in a media-views.js annotation.
Props kovshenin.
See #26870.


Built from https://develop.svn.wordpress.org/trunk@27309


git-svn-id: http://core.svn.wordpress.org/trunk@27162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-27 03:07:14 +00:00
Andrew Ozz
511f12f793 When closing the various "edit" media modals, remove the related views elements from the DOM. Props gcorne, fixes #27204.
Built from https://develop.svn.wordpress.org/trunk@27276


git-svn-id: http://core.svn.wordpress.org/trunk@27132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 21:03:15 +00:00
Andrew Nacin
74f2a32f52 Fixed mixed spaces and tabs. Also remove trailing comma. see #26631.
Built from https://develop.svn.wordpress.org/trunk@27266


git-svn-id: http://core.svn.wordpress.org/trunk@27123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-25 17:32:14 +00:00
Scott Taylor
943f295d2e Add core support for Playlists and Video Playlists.
* Playlists operate like galleries in the admin. 
* Provide default UI and JS support in themes using MediaElement and Backbone. 
* The shortcodes are clickable, editable, and configurable using the media modal. 
* Playlists support images for each item, whether or not the current theme supports images for `attachment:audio` and `attachment:video`
* Playlists respond to `$content_width` and resize videos accordingly.
* All playlist data is included inline, using a script tag with `type="application/json"`, allowing anyone to unenqueue the WP playlist JS and roll their own.
* Playlist styles are minimal and work out of the box in the last 5 default themes. They inherit and adapt to the current theme's font styles, and their rules are easily overrideable.

See #26631.


Built from https://develop.svn.wordpress.org/trunk@27239


git-svn-id: http://core.svn.wordpress.org/trunk@27096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-24 18:08:16 +00:00
Scott Taylor
f319feb524 Register wp.media.controller.GalleryEdit and wp.media.controller.GalleryAdd using the new wp.media.controller.Collection* abstraction code.
See #26631.


Built from https://develop.svn.wordpress.org/trunk@27215


git-svn-id: http://core.svn.wordpress.org/trunk@27072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 18:34:12 +00:00
Scott Taylor
4193c7f6c3 In media-views.js, add wp.media.controller.CollectionAdd and wp.media.controller.CollectionEdit to provide an abstraction for Add and Edit screens in the media modal for collection-type things.
There are currently no instances of this. Those will be forthcoming.

See #26631.


Built from https://develop.svn.wordpress.org/trunk@27214


git-svn-id: http://core.svn.wordpress.org/trunk@27071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-20 18:25:14 +00:00
Andrew Nacin
ca4a29c002 Update media-views and wp.Backbone.View for Backbone 1.1.
* Collection set/add/remove/reset methods now return models, not `this`, so they can no longer be chained.
 * Options passed to Backbone.View's constructor are no longer attached automatically. wp.Backbone.View now does this automatically.

See [27170] for Backbone 1.1 itself.

props gcorne.
fixes #26799.

Built from https://develop.svn.wordpress.org/trunk@27171


git-svn-id: http://core.svn.wordpress.org/trunk@27036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-13 07:36:13 +00:00
Dominik Schilling
5d0f6bd98a Use jQuery.prop('checked') instead of jQuery.attr('checked'), which is deprecated.
Built from https://develop.svn.wordpress.org/trunk@27164


git-svn-id: http://core.svn.wordpress.org/trunk@27030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-11 21:13:14 +00:00
Scott Taylor
f1fff8a2e9 Add some inline docs to media-views.js and remove some unnecessary comments from a few super calls.
Props gcorne.
See #26870.


Built from https://develop.svn.wordpress.org/trunk@27126


git-svn-id: http://core.svn.wordpress.org/trunk@26993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-07 20:21:12 +00:00
Andrew Nacin
6169e8662b JSHint fixes for media-views and Gruntfile.
props gcorne.
fixes #27032, #27033.

Built from https://develop.svn.wordpress.org/trunk@27105


git-svn-id: http://core.svn.wordpress.org/trunk@26972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-06 05:32:12 +00:00
Andrew Ozz
2f6d9d37cc Consolidate "close on Escape" in the media modal, DFW, wpLink and Thickbox. Props kovshenin, fixes #26854.
Built from https://develop.svn.wordpress.org/trunk@27080


git-svn-id: http://core.svn.wordpress.org/trunk@26953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-03 05:31:14 +00:00
Scott Taylor
e1759d668a For starters, [27050] is rad. This just cleans up some extra new lines that were littered about, updates *some* of the inline docs (needs more), moves wp.media.controller.ImageDetails closer to its parent class, and de-dupes some code in media-template.php.
See #24409.


Built from https://develop.svn.wordpress.org/trunk@27051


git-svn-id: http://core.svn.wordpress.org/trunk@26925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-28 23:21:13 +00:00
Andrew Ozz
33eedc570b Introduce Edit Image (single mode) in the media modal and use it to edit images inserted in the editor. Adds new feature: replace an image in the editor. Props gcorne, see #24409.
Built from https://develop.svn.wordpress.org/trunk@27050


git-svn-id: http://core.svn.wordpress.org/trunk@26924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-28 21:17:12 +00:00
Scott Taylor
328fc8bae8 Add initial JSDoc blocks to media-views.js. The initial blocks are a baseline to work from and invite future iterations. Initial commit is to avoid commits this large in the future.
See #26870.


Built from https://develop.svn.wordpress.org/trunk@26986


git-svn-id: http://core.svn.wordpress.org/trunk@26863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-20 23:42:11 +00:00
Andrew Nacin
a5d83b489b Fix JSHint errors in media-views.js.
props kadamwhite.
fixes #25974.

Built from https://develop.svn.wordpress.org/trunk@26161


git-svn-id: http://core.svn.wordpress.org/trunk@26072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-14 05:54:10 +00:00
Andrew Nacin
622709076b Media: Fix embedding of audio/video players when the file was just uploaded.
While uploading, we know an attachment's filename but not its mime type. Check specifically for extensions. Check for type as a convenience when it is available.

fixes #24449.



git-svn-id: http://core.svn.wordpress.org/trunk@24784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 17:29:55 +00:00
Andrew Nacin
2c67dea9bc Media: Add awareness to Attachment Display Settings that audio and video can be embedded.
Also:
 * Add file length metadata to Attachment Details.
 * Round the kb/s bitrate on post.php.

fixes #24449.



git-svn-id: http://core.svn.wordpress.org/trunk@24777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-23 05:39:08 +00:00
Daryl Koopersmith
452c0f4166 Add Backbone property to the wp-backbone namespace. See #24424.
git-svn-id: http://core.svn.wordpress.org/trunk@24367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-26 06:34:33 +00:00
Daryl Koopersmith
b8ce442044 Update the subview controller for the patterns found in Backbone 1.0.
Fixes #24424.


git-svn-id: http://core.svn.wordpress.org/trunk@24361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-25 21:38:12 +00:00
Daryl Koopersmith
56a6cac328 Extract the base views from media.
See #24424.


git-svn-id: http://core.svn.wordpress.org/trunk@24360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-05-25 21:03:04 +00:00
Mark Jaquith
262b3bd9b1 Don't allow images to be set as featured image until they have been processed.
props kadamwhite. fixes #23317.

git-svn-id: http://core.svn.wordpress.org/trunk@23956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-10 22:26:55 +00:00
Daryl Koopersmith
2798e396e3 Media: Reset modal after gallery insertion.
Removes hardcoded (and vestigial) 'upload' states in favor of using the default modal state.
When a media toolbar action is triggered, reset the modal after switching to the new state (as opposed to beforehand).

fixes #23675.


git-svn-id: http://core.svn.wordpress.org/trunk@23590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 07:36:21 +00:00
Daryl Koopersmith
00d88af87a Update Backbone to 0.9.10. Update media to handle breaking changes.
* When overriding `Backbone.sync()`, ensure the `sync` and `error` events fire consistently.

* `Model#make()` has been removed. Use `$` instead, and be sure to grab the DOM node where necessary (using `[0]`).

* `Collection#get()` now accepts `cid`s. `Collection#getByCid()` has been removed.

* When overriding the `State` constructor, bind `change` callbacks after the default `Model` constructor is called, because the `Model` constructor no longer passes the `silent` flag when calling `set()` for the default attributes.

* In 'change' events, `options.changes` was removed. It can now be accessed through `model.changed`. Check if any attributes have changed by calling `model.hasChanged()`. Also, don't mess with `model.changed`; it persists beyond the scope of a single event.

* `options.index` is no longer be set in the `add` event callback. Use `collection.indexOf(model)` can be used to retrieve the index of a model instead.

props gcorne. fixes #23262.


git-svn-id: http://core.svn.wordpress.org/trunk@23589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-03 07:04:06 +00:00
Andrew Nacin
9a7814c1a0 Don't unnecessarily re-render the attachment details view when editing the title and caption. Re-rendering causes issues with tabbing and focus, and is only necessary for other views (such as "Caption this image..." when editing a gallery).
props koopersmith.
fixes #23054.
for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 23:29:20 +00:00
Daryl Koopersmith
a84cef4556 Media: Properly reset the "add to gallery" library to ensure it accurately reflects the current gallery. see #22815.
git-svn-id: http://core.svn.wordpress.org/trunk@23263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:28:12 +00:00
Andrew Nacin
c95ff91fe7 Media: Restore 3.4 behavior by consulting the old-school DB options for default align, size, and link properties.
This restores linking to media files as the default, over attachment pages. This 'default' cannot currently be changed by a user setting (per 3.4 behavior), due to the default database schema.

see #22841, for trunk.



git-svn-id: http://core.svn.wordpress.org/trunk@23262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-01-04 08:02:16 +00:00