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: https://develop.svn.wordpress.org/trunk@23590 602fd350-edb4-49c9-b593-d223f7449a82
* 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: https://develop.svn.wordpress.org/trunk@23589 602fd350-edb4-49c9-b593-d223f7449a82
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: https://develop.svn.wordpress.org/trunk@23262 602fd350-edb4-49c9-b593-d223f7449a82
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: https://develop.svn.wordpress.org/trunk@23259 602fd350-edb4-49c9-b593-d223f7449a82
* 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: https://develop.svn.wordpress.org/trunk@23089 602fd350-edb4-49c9-b593-d223f7449a82
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: https://develop.svn.wordpress.org/trunk@23083 602fd350-edb4-49c9-b593-d223f7449a82
Longer strings (such as a translation) looks excellent when it wraps to another line.
props markjaquith, fixes#22753.
git-svn-id: https://develop.svn.wordpress.org/trunk@23076 602fd350-edb4-49c9-b593-d223f7449a82
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: https://develop.svn.wordpress.org/trunk@23068 602fd350-edb4-49c9-b593-d223f7449a82
* 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: https://develop.svn.wordpress.org/trunk@23029 602fd350-edb4-49c9-b593-d223f7449a82
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: https://develop.svn.wordpress.org/trunk@22979 602fd350-edb4-49c9-b593-d223f7449a82
This functionality is designed to be backwards compatible with manual querying for attachments by menu_order.
props koopersmith.
see #22607.
git-svn-id: https://develop.svn.wordpress.org/trunk@22967 602fd350-edb4-49c9-b593-d223f7449a82