To do so, the Attachment view code had to be shifted above the Workspace view code to ensure the subview is defined (preventing errors).
Also corrects an error in `wp.media.view.Attachments.add` where it was still using the default Attachment view.
see #21390, #21809.
git-svn-id: https://develop.svn.wordpress.org/trunk@22046 602fd350-edb4-49c9-b593-d223f7449a82
* Adds `view.Workspace.Library` and `view.Workspace.Gallery` as extensions of `view.Workspace` to implement the individual screens
* Shifts the toolbar logic that was library-specific from the generic `Workspace` view to `Workspace.Library`.
* Adds a toolbar to the `Gallery` view.
* 'Create a gallery' and 'Return to media library' buttons toggle between the two views.
* 'Insert gallery into post' closes the modal, but does not actually perform its namesake action.
* Note that elements can still be deselected in the gallery view. This will be fixed in a future commit.
Improvements to avoid over-eager event unbinding:
* `Modal` views now properly detach their contents before replacing them with a new element.
* Likewise, `Workspace` views detach their main content blocks when re-rendering the view.
To test the gallery workflow (which is incomplete), run the following in your browser's console:
`wp.media({ multiple: true });`
see #21809, #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21906 602fd350-edb4-49c9-b593-d223f7449a82
Currently uses actions for inserting media into a post as an example (hence the raw text). To test a workflow that supports multiple selection, run the following in your browser's JavaScript console:
wp.media({ multiple: true });
see #21390, #21808.
git-svn-id: https://develop.svn.wordpress.org/trunk@21769 602fd350-edb4-49c9-b593-d223f7449a82
Please note that this commit does not integrate media into the existing UI. If you would like to see the new UI, navigate to the post editor and run the following in your browser's Javascript console:
new wp.media.controller.Workflow().render().modal.open();
The Javascript is broken up into two files, with the slugs media-models and media-views.
* media-models: The models are UI agnostic, and can be used independent of the views. If you'd like to create custom UIs, this is the script for you.
* media-views: This is the Media Experience. The views (and controllers) depend on the models (which are listed as a dependency and will automatically be included thanks to wp_enqueue_script). The views also require the media templates, media-view styles, and the plupload bridge settings. Perhaps we should create a function to include the whole shebang, but in the meantime...
To include media-views in the admin, run the following PHP in or after 'admin_enqueue_scripts':
wp_enqueue_script( 'media-views' );
wp_enqueue_style( 'media-views' );
wp_plupload_default_settings();
add_action( 'admin_footer', 'wp_print_media_templates' );
see #21390.
git-svn-id: https://develop.svn.wordpress.org/trunk@21683 602fd350-edb4-49c9-b593-d223f7449a82