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
The code now automatically selects uploading attachments in all workflows. In a workflow that selects multiple attachments, all attachments added to the upload queue are selected. In a workflow that selects a single attachment (e.g. selecting a featured image), the last attachment added to the upload queue is selected.
see #22817.
git-svn-id: http://core.svn.wordpress.org/trunk@23259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* This especially helps when you switch between insert/gallery and have non-images selected (as galleries don't support non-images).
* The views now act as filters on the "master" selection, instead of having their own selections that get passed around.
git-svn-id: http://core.svn.wordpress.org/trunk@23089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
We tried in vain -- a noble but ultimately failed effort -- to reduce the number of fields for attachments from four (title, caption, alt, description) to one (caption for images, title otherwise). Alternative text needed to stay for accessibility reasons, of course.
Eventually title returned due to heavy plugin reliance. Description is too used by too many plugins (often times incorrectly -- the caption is more likely the proper field), hence its less-than-triumphant return today.
Version 3.5 has tried to streamline media in a number of ways. Removing fields may have been too much at once, as it forced not only a user interface change, but a paradigm change as well.
Finally, on upload we populate the description field with IPTC/EXIF captions, rather than the caption field. See #22768, this should be fixed. For now, Description stays.
This commit also restores 'Title' attribute editing to the main tab of the Edit Image dialog. The "Title" field no longer populates title attributes for <img> tags by design (for accessibility and other purposes, see #18984). So, here is a more obvious 'workaround' for the tooltip community.
Finally, this:
* Cleans up the post.php attachment editor, including by showing a prettier form of the mime type.
* Enables plugins to specifically hide attachment_fields_to_edit from either post.php (where you can create meta boxes) or the modal (which you may not want to clutter), for compatibility reasons.
* Hides the 'Describe this file...' placeholder when a field is read-only in the modal.
props nacin, helenyhou.
fixes#22759.
git-svn-id: http://core.svn.wordpress.org/trunk@23083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Longer strings (such as a translation) looks excellent when it wraps to another line.
props markjaquith, fixes#22753.
git-svn-id: http://core.svn.wordpress.org/trunk@23076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Less distracting
* Some of these sections won't apply for CPTs without an editor
git-svn-id: http://core.svn.wordpress.org/trunk@23069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Also, use "images" wording instead of generic "media items" when in a gallery (images-only) context. fixes#22722
Both are props koopersmith
git-svn-id: http://core.svn.wordpress.org/trunk@23068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Records main document scroll position when launching media modal.
* Restores position when media modal is closed.
* Also locks background document scrolling while media modal is open, preventing inadvertent scrolling there.
props koopersmith. fixes#22716
git-svn-id: http://core.svn.wordpress.org/trunk@23029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Most users don't realize that the Featured Image meta box exists; if they do, few use it.
Restores the old meta box UI, including the admin_post_thumbnail_html filter. If a plugin is using _wp_post_thumbnail_html() in conjunction with Thickbox elsewhere, it will also magically still work.
Specific underlying changes:
* Converts the modal view to use the view manager, which means that a call to open() will automatically call render and attach if necessary.
* Doesn't automatically set a state in wp.media, to allow code to customize the states to be added before activation.
props koopersmith.
fixes#21776.
git-svn-id: http://core.svn.wordpress.org/trunk@22979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This functionality is designed to be backwards compatible with manual querying for attachments by menu_order.
props koopersmith.
see #22607.
git-svn-id: http://core.svn.wordpress.org/trunk@22967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add an Attachments collection filter for uploadedTo (post_parent).
* Correct an erroneous map from the non-existent parent prop to post_parent.
* Define default menuOrder and uploadedTo props for uploading attachments.
* Unify filterable props into a single method (improving validation performance for calls to set with multiple properties).
Props koopersmith
fixes#22654
git-svn-id: http://core.svn.wordpress.org/trunk@22951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When attachments are sorted, we convert the shortcode to [gallery ids=""], as before.
props koopersmith.
fixes#22608.
git-svn-id: http://core.svn.wordpress.org/trunk@22882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes issue where pasting a URL in 'From URL' (via the context menu) did not
enable the insert button, as the event was not yet fired.
props koopersmith.
fixes#22545.
git-svn-id: http://core.svn.wordpress.org/trunk@22836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Allows the uploader to leverage the ready event to know when it has been attached to the page.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Make the composite gallery library use `mirror` instead of `observe`, as one method now invokes the other. Also, make `mirror` return the attachment collection for chaining.
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* 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
* 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
* 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
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
* 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
* 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
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
* 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
`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
* 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
`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
`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
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
The main goal here is to rearrange the media components in a modularized structure to support more linear workflows. This is that structure using the pre-existing workflows, which will be improved over the course of the next few commits.
This leaves a few pieces a bit rough around the edges: namely gallery editing and selecting a featured image.
The fine print follows.
----
'''Styles'''
* Tightened padding around the modal to optimize for a smaller default screen size.
* Added a light dashed line surrounding the modal to provide a subtle cue for the persistent dropzone (which is evolving into a power user feature since we now have a dedicated `upload` state).
* Add a size for `hero` buttons.
* Remove transitions from frame subviews (e.g. menu, content, sidebar, toolbar).
----
'''Code'''
`wp.media.controller.StateManager`
* Don't fire `activate` and `deactivate` if attempting to switch to the current state.
`wp.media.controller.State`
* Add a base state class to bind default methods (as not all states will inherit from the `Library` state).
* On `activate`, fire `activate()`, `menu()`, `content()`, `sidebar()`, and `toolbar()`.
* The menu view is often a shared object (as its most common use case is switching between states). Assign the view to the state's `menu` attribute.
* `menu()` automatically fetches the state's `menu` attribute, attaches the menu view to the frame, and attempts to select a menu item that matches the state's `id`.
`wp.media.controller.Library`
* Now inherits from `wp.media.controller.State`.
`wp.media.controller.Upload`
* A new state to improve the upload experience.
* Displays a large dropzone when empty (a `UploaderInline` view).
* When attachments are uploaded, displays management interface (a `library` state restricted to attachments uploaded during the current session).
`wp.media.view.Frame`
* In `menu()`, `content()`, `sidebar()`, and `toolbar()`, only change the view if it differs from the current view. Also, ensure `hide-*` classes are properly removed.
*
`wp.media.view.PriorityList`
* A new container view used to sort and render child views by the `priority` property.
* Used by `wp.media.view.Sidebar` and `wp.media.view.Menu`.
* Next step: Use two instances to power `wp.media.view.Toolbar`.
`wp.media.view.Menu` and `wp.media.view.MenuItem`
* A new `PriorityList` view that renders a list of views used to switch between states.
* `MenuItem` instances have `id` attributes that are tied directly to states.
* Separators can be added as plain `Backbone.View` instances with the `separator` class.
* Supports any type of `Backbone.View`.
`media.view.Menu.Landing`
* The landing menu for the 'insert media' workflow.
* Includes an inactive link to an "Embed from URL" state.
* Next steps: only use in select cases to allot for other workflows (such as featured images).
`wp.media.view.AttachmentsBrowser`
* A container to render an `Attachments` view with accompanying UI controls (similar to what the `Attachments` view was when it contained the `$list` property).
* Currently only renders a `Search` view as a control.
* Next steps: Add optional view counts (e.g. "21 images"), upload buttons, and collection filter UI.
`wp.media.view.Attachments`
* If the `Attachments` scroll buffer is not filled with `Attachment` views, continue loading more attachments.
* Use `this.model` instead of `this.controller.state()` to allow `Attachments` views to have differing `edge` and `gutter` properties.
* Add `edge()`, a method used to calculate the optimal dimensions for an attachment based on the current width of the `Attachments` container element.
* `edge()` is currently only enabled on resize, as the relative positioning and CSS transforms used to center thumbnails are suboptimal when coupled with frequent resizing.
* Next steps: For infinite scroll performance improvements, look into absolutely positioning attachment views and paging groups of attachment views.
`wp.media.view.UploaderWindow`
* Now generates a `$browser` element as the browse button (instead of a full `UploaderInline` view). Using a portable browse button prevents us from having to create a new `wp.Uploader` instance every time we want access to a browse button.
`wp.media.view.UploaderInline`
* No longer directly linked to the `UploaderWindow` view or its `wp.Uploader` instance.
* Used as the default `upload` state view.
`wp.media.view.Selection`
* An interactive representation of the selected `Attachments`.
* Based on the improved workflows, this is likely overkill. For simplicity's sake, will probably remove this in favor of `SelectionPreview`.
----
see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22362 1a063a9b-81f0-0310-95a4-ce76da25c4cd