Commit Graph

107 Commits

Author SHA1 Message Date
Daryl Koopersmith
d4744fda0a Media: Prevent undefined errors when media scripts are enqueued outside of wp_enqueue_media(). fixes #22495, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 01:48:37 +00:00
Daryl Koopersmith
05db7000c4 Media: Detect when views are added to the DOM and fire a ready event. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-20 00:53:02 +00:00
Daryl Koopersmith
663cde2c51 Media: Add render tracking to views. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 22:48:11 +00:00
Daryl Koopersmith
e6943d1033 Media: Add silent options to the views; improve documentation. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 12:11:16 +00:00
Daryl Koopersmith
028d378322 Media: Add a method to fetch the first subview. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 10:41:24 +00:00
Daryl Koopersmith
31576e6c0c Media: Add documentation to media.Views. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 10:40:49 +00:00
Daryl Koopersmith
549b5f61ae Media: Only show the alignment setting when viewing an image. fixes #21836, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 07:24:47 +00:00
Daryl Koopersmith
1af6c38db3 Media: Add default render method to views.
* Use default `render` method in the `Frame` view.
* Rename `Views.attach` to `Views.insert`.
* Add `Views.all` to retrieve all subviews.
* Add `Views.detach` to detach all subviews.
* Detect whether views are going to be reused in `View.set` and `detach` them instead of calling `dispose`.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 06:02:00 +00:00
Daryl Koopersmith
473583a4f4 Media: Allow subviews to be inserted at a specific index. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 04:41:57 +00:00
Daryl Koopersmith
795ba27d10 Media: Convert the attachments browser view's destroy method to the newer dispose method. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 03:33:29 +00:00
Daryl Koopersmith
ff204257db Media: Remove unused batch edit states and strings. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 03:11:48 +00:00
Daryl Koopersmith
25ebc64c20 Media: Remove debug cruft from [22655]. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 02:44:34 +00:00
Daryl Koopersmith
561f01bd79 Media: Optimize media models.
* Merge `Composite` model with general `Attachments` model, as `Attachments.validate` and `Composite.evaluate` were functionally equivalent.
* Queries should only watch `wp.Uploader.queue`, as watching `Attachments.all` results in queries attempting to add attachments before their properties are set (which then results a few too many irrelevant adds/removes). `Attachments.all` should potentially be removed or rethought.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 02:43:10 +00:00
Daryl Koopersmith
10eada54dc Media: Move Attachments view preventDefault handler to the events object. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 01:17:30 +00:00
Daryl Koopersmith
13a3cc30b2 Media: Allow for the views manager to be extended. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 00:54:18 +00:00
Daryl Koopersmith
4256ba0b48 Media: Add a base view class.
* Centralizes view and subview management, unifying several disjointed constructs.
* Utilizes the `dispose` functionality found in Backbone master, providing a standard method for memory management.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-19 00:36:47 +00:00
Daryl Koopersmith
b57d3ff767 Media: zIndex peace was only temporary.
Revert [22611] in favor of using plupload's `container` setting. Turns out, plupload's flash shim is forced to the exact same index as the admin bar, so balancing the two is better solved by nesting the shim.

see #22441, #22446, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-16 10:30:36 +00:00
Daryl Koopersmith
24910d5c06 Media: Only show the edit selection link for the media library. Make the upload attachments list sortable. Only retain the silent option when running Attachments.validate(). see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-15 03:09:35 +00:00
Daryl Koopersmith
79c74bbe1e Media: Enter batch insert workflow by editing the selection instead of having an explicit button. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-15 02:36:06 +00:00
Daryl Koopersmith
511c14e4ed Media: Unify the "Insert" and "Insert.Post" toolbars. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 22:40:34 +00:00
Daryl Koopersmith
8227b30046 Media: Improve image size-related UI and code.
* Add dimensions to the "sizes" dropdown.
* Ensure a `full` size is generated in `wp_prepare_attachment_for_js()`.
* Print the dimensions for the full size in the attachment summary (instead of those for the current size).
* When generating the attachment view's template, map `imageSize()` to the `size` property instead of overriding the default data.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 22:08:02 +00:00
Daryl Koopersmith
8e775dff4b Media: Better image detection in the embed from URL tab. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-13 03:33:41 +00:00
Daryl Koopersmith
8c73f531b9 Media: Add an "upload more files" button to upload states. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-12 23:52:17 +00:00
Daryl Koopersmith
1ec12cccb9 Media: Allow successive embed URLs. see [22547], #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-12 06:02:03 +00:00
Daryl Koopersmith
2d87f983ad Media: Add Embed from URL tab.
Note: There is a bug that currently blocks adding several successive embeds.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-12 05:57:12 +00:00
Daryl Koopersmith
498e4c1366 Media: Ensure variables in the attachment details template have defined defaults.
* Adds styling to the upload progress bar in the attachment details template.
* Defines the `filename` attribute when Plupload creates the client-side `Attachment` model.

fixes #22410, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-11 05:16:41 +00:00
Daryl Koopersmith
82213846c3 Media: Add backwards compatibility for attachment_fields_to_edit and attachment_fields_to_save. see #22186.
git-svn-id: http://core.svn.wordpress.org/trunk@22541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-11 01:26:42 +00:00
Daryl Koopersmith
790464193d Media: Add custom URL as an option to attachment display properties. see #21390, #22206.
git-svn-id: http://core.svn.wordpress.org/trunk@22537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 20:36:46 +00:00
Daryl Koopersmith
43c289dee6 Media: Automatically strip any non-image items from the collection when creating a gallery.
Also changes the rules for when the "new gallery" button shows:
* More than two items must be selected.
* At least one of them must be an image.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 19:25:39 +00:00
Daryl Koopersmith
2396b66c98 Media: Watch additional search events. Properly captures clearing the search box. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 18:56:11 +00:00
Daryl Koopersmith
30e0a600bf Media: Add title, caption, and alt text, and attachment info to sidebar.
* Improve sidebar styles.
* Separate the hybrid title/caption field.
* Improve the sidebar image thumbnail.
* Remove filenames from inside the non-image icon thumbnail.
* Properly sync title/caption/alt.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 18:25:04 +00:00
Daryl Koopersmith
9c20d148b9 Media: Add instructions to drag and drop to reorder images on gallery and batch edit pages.
Removes search boxes from these pages as well.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 09:11:33 +00:00
Daryl Koopersmith
bed08350f4 Media: Backwards compatibility for media_upload_tabs.
* Adds `createIframeStates()` to the `MediaFrame` view. It creates states and bindings for the `media_upload_tabs` output, and is included on `MediaFrame.Post` by default.
* Hijacks `tb_remove()` when the media modal is open to ensure the modal closes correctly.
* Adds a `chromeless` parameter to thickbox media tab URLs to render the UI without the old row of tabs.

see #22186, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 07:51:37 +00:00
Daryl Koopersmith
880b1e4b81 Media JS: Pass the region instance through when firing the activate and deactivate events. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 12:43:39 +00:00
Daryl Koopersmith
b9ed8db596 Media: Keep track of gallery display properties in a separate model instead of mixed in with the query parameters. This allows for arbitrary gallery arguments and a more flexible data structure. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 12:37:21 +00:00
Daryl Koopersmith
db30495fcd Media: Correctly set the edit gallery's library. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 12:09:15 +00:00
Daryl Koopersmith
3797b7e18c Media JS: Only block button events by default if the button does not link to anything. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 11:30:40 +00:00
Daryl Koopersmith
9c7acdfe7c Media: Add a basic starting frame for upload/library selection.
`media.view.MediaFrame.Select` is a frame class with a handful of sensible defaults to handle selecting and uploading items in the media library.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 09:47:12 +00:00
Daryl Koopersmith
76b23b3d48 Media: Add size dropdown to attachment display settings in the media modal. fixes #22206, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 06:15:25 +00:00
Daryl Koopersmith
9c4214745b Media: Ensure search box reflects actual search state.
* Also switches search box to use `<input type="search" />` to take advantage of browser UI to clear the field.

fixes #22315, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 04:44:31 +00:00
Daryl Koopersmith
dd504180f7 Media: In the main media library in the insert media dialog, only show attachment display settings when one attachment is selected. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 02:11:37 +00:00
Daryl Koopersmith
21ff438642 Media: Add batch insertion workflow. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 01:44:02 +00:00
Daryl Koopersmith
23b62b3d77 Media JS: Use correct variable name when binding to the change:library event. see [22477], #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 01:24:55 +00:00
Daryl Koopersmith
103694aa4f Media JS: Add JIT composite library creation/destruction to states to allow for dynamically excluded Attachment models. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 01:23:20 +00:00
Daryl Koopersmith
fe570eb90c Media JS: Add media.model.Composite, to aid in the representation of joint views. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 15:32:40 +00:00
Daryl Koopersmith
ef0774026b Media: Improve sidebar handling and make attachment display properties attachment-specific.
`wp.mce.media`
* Watch all workflows for the `insert` event and attempt to insert the current state's `selection` if it exists.
* Fetch and pass attachment display properties through to `wp.media.string.image()`.

`wp.media.controller.Region`
* Separate the concept of events and modes.
* All events triggered on a `Region` trigger both `event` and `event:mode` callbacks.
* When a mode is deactivated, `deactivate` and `deactivate:mode` events are fired.
* When a mode is activated, `activate` and `activate:mode` events are fired.

`wp.media.controller.Library`
* Remove the `details()`, `buildDetails()`, and `clearDetails()` methods that juggled sidebar views. Instead, handle the sidebar views using modes.

`wp.media.controller.Gallery`
* Shift the overloaded `sidebar()` method to use modes.

`wp.media.view.MediaFrame.Post`
* Declare `activate:mode` event bindings using an nested object to reduce repetition.
* Update sidebar activation callbacks.

`wp.media.view.Settings`
* Refactor to leverage HTML data attributes and implicit values (instead of setting the fallback whenever an object was created). This has the additional benefit that gallery shortcode parameters are not output when the user has left them set to the default.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-08 14:15:09 +00:00
Daryl Koopersmith
4daeaf464d Media: Improve memory management of views, events, and DOM nodes. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 22:43:16 +00:00
Daryl Koopersmith
90781c9e83 Media: Integrate the gallery workflow with the media menu.
`wp.media.model.Query.more()`
* If a request has already been sent out for more attachments, return that request object instead of creating another.

`wp.media.controller.Region`
* A region allows views to be swapped in and out of a section of the page without either view having to know about the other.
* Application components can use the same callbacks and resources by leveraging `Region.mode()`, which triggers a set of callbacks to create or transform the current view, but only if necessary.

`wp.media.view.Frame`
* Leverage `Region` controllers instead of forcing states to swap view objects, which causes states to fit more comfortably in the controller-camp.
* Add `previous()`, a method to fetch the previous state `id`.
* Separate out the default settings over several objects (so blank frames can be instantiated).

`wp.media.view.MediaFrame`
* The base `Frame` used for media management: handles integration with the `Modal` and `UploaderWindow` views.

`wp.media.view.MediaFrame.Post`
* Includes all default media states and callbacks necessary for inserting media into a post.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 20:14:41 +00:00
Daryl Koopersmith
349afb3c4f Media JS: Move state-related logic from sidebar views to the state controllers. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-06 01:19:39 +00:00
Daryl Koopersmith
825bea7637 Media: Show an inline uploader when the media library is empty.
Merges most of `wp.media.controller.Upload` into `wp.media.controller.Library`, so we always create an inline uploader instead of an attachments browser if the state's `library` is empty.

props rzen, fixes #22323, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-05 02:43:47 +00:00