Commit Graph

1176 Commits

Author SHA1 Message Date
Daryl Koopersmith
f7c1aaf26d Add a sidebar to the media modal.
* Adds `wp.media.view.Sidebar`, to aid in rendering the sidebar.
* Removes the `directions` from the `Attachments` view and shifts search into a separate view (`wp.mce.view.Search`) that can be relocated at will. This also serves to simplify the `Attachments` view by removing the nested `list` and `$list` parameters.
* Show the toolbar on the featured image workflow, effectively requiring confirmation before closing the dialog.

see #21390, #21776, #21808.


git-svn-id: http://core.svn.wordpress.org/trunk@22321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-29 06:56:23 +00:00
Daryl Koopersmith
53ccb09bce Give media a heart transplant.
Revises the concept of the media controller and workspace views (i.e. two central points of control) to be more granular. The main media object is now the `Frame`, which is a hybrid view and state machine.

The state machine is a collection of states, which are just generic instances of `Backbone.Model`. This circumvents the problem of juggling global parameters when changing states. Each state contains its own event loop. All events are also forwarded to the frame itself (as is the case in all model/collection relationships).

The frame view contains several regions, each of which can be overridden without harming or re-rendering the other regions. These work well when used in conjunction with the state machine events.

This removes the upload sidebar (don't worry, visible upload UI will return). Drag and drop uploading still works. The ability to upload has been abstracted into its own view (instead of being attached to the central workspace view).

Editing galleries is temporarily broken — the gallery creation and editing experiences will be unified in a future patch.

Adds events to detect dragging changes in `wp.Uploader` and adds methods to detect and leverage browser support for CSS3 transitions.

see #21390, #21809.


git-svn-id: http://core.svn.wordpress.org/trunk@22320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-28 23:29:17 +00:00
Bot (Assets)
3ff4a47f36 Compress scripts/styles: 3.5-beta2-22311.
git-svn-id: http://core.svn.wordpress.org/trunk@22311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 22:58:32 +00:00
Andrew Ozz
bcb040f1e0 Hide the "You are using the multi-file uploader. Problems? Try the browser uploader instead." when Plupload falls back to "html4" runtime, fixes #19496
git-svn-id: http://core.svn.wordpress.org/trunk@22305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 20:53:38 +00:00
Bot (Assets)
3cc79b6461 Compress scripts/styles: 3.5-beta2-22269.
git-svn-id: http://core.svn.wordpress.org/trunk@22269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-22 22:58:34 +00:00
Daryl Koopersmith
4188c373fd Correctly assign post_parent to attachments uploaded in the new media modal. fixes #22085, see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-22 17:40:06 +00:00
Bot (Assets)
c2d9d834dc Compress scripts/styles: 3.5-beta2-22265.
git-svn-id: http://core.svn.wordpress.org/trunk@22265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-19 22:58:33 +00:00
Andrew Ozz
1dad05c508 Make the admin menu and toolbar work well on mobile devices, props georgestephanis, see #20614
git-svn-id: http://core.svn.wordpress.org/trunk@22262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-19 18:31:21 +00:00
Bot (Assets)
19d83ff7e8 Compress scripts/styles: 3.5-beta2-22252. TinyMCE updated.
git-svn-id: http://core.svn.wordpress.org/trunk@22252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-16 22:58:39 +00:00
Andrew Ozz
e8b10439bb Accessibility shortcuts: new looks and fix for the WebKit focus bug, props lessbloat, fixes #21471
git-svn-id: http://core.svn.wordpress.org/trunk@22249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-16 21:26:59 +00:00
Daryl Koopersmith
74cea87b2c Add attachment display settings to the media modal.
* Add a media view for button groups.
* Add button dropdown containers.
* Add a dropdown property to the button media model.

fixes #22206, #21814, see #21390, #21813, #21598.


git-svn-id: http://core.svn.wordpress.org/trunk@22247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-16 19:25:17 +00:00
Andrew Ozz
97fc06f706 TinyMCE: fix showing popup buttons on images in WebKit, fixes #22188
git-svn-id: http://core.svn.wordpress.org/trunk@22246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-16 18:16:29 +00:00
Andrew Nacin
65534a21c0 jQuery Masonry for uploaded custom headers. props zamoose. fixes #20346.
git-svn-id: http://core.svn.wordpress.org/trunk@22228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-14 17:05:16 +00:00
Bot (Assets)
3012719800 Compress scripts/styles: 3.5-beta1-22223. TinyMCE updated.
git-svn-id: http://core.svn.wordpress.org/trunk@22223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 22:58:48 +00:00
Daryl Koopersmith
5302794b9b Display gallery and attachment MCE views as inline blocks. Make gallery MCE view wrappers block level. see #21390, #21813, #21815.
git-svn-id: http://core.svn.wordpress.org/trunk@22221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 18:41:38 +00:00
Daryl Koopersmith
5c9fa8ee8f Properly align MCE attachment views.
* Adds a `$wrapper` property to MCE views to allow them to manipulate the wrapper on render. This should be used sparingly — only for layout changes that cannot be accomplished through altering the wrapper's children — and likely only for adding/removing classes.
* Uses `wp.html.string()` in `wp.mce.view.toView()`.

see #21390, #21812, #21813.


git-svn-id: http://core.svn.wordpress.org/trunk@22220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 18:36:21 +00:00
Daryl Koopersmith
dbbcd85ce3 MCE Views: Add alignment styles for generic views.
Adds `alignnone`, `aligncenter`, `alignleft`, and `alignright` by default.

see #21390, #21812, #21813.


git-svn-id: http://core.svn.wordpress.org/trunk@22219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 18:32:12 +00:00
Daryl Koopersmith
3ee553c6bc Add a nonce to wp_ajax_save_attachment. see #21390, #21807.
git-svn-id: http://core.svn.wordpress.org/trunk@22212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 16:02:45 +00:00
Daryl Koopersmith
62e5ae4e56 MCE Views: First pass at keystroke and insertion handling.
* When a MCE view is selected, normal keystrokes (those without command/control) are blocked.
* Backspace/delete will successfully remove the view.
* Arrow handling will be added at a later point.
* When a MCE view is selected and content is pasted or injected (e.g. when an attachment is added), the content is added to the first text node after the view. If the view is at the end of the document or the next element is another view, a text node is injected into the DOM immediately after the selected view.

see #21390, #21812, #21813, #21815.


git-svn-id: http://core.svn.wordpress.org/trunk@22210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-12 03:28:22 +00:00
Daryl Koopersmith
e0135ddf09 MCE Views: Add selection/deselection when a view is clicked.
These methods should be expanded to prevent content from being inserted into the view by blocking and rerouting keystrokes as appropriate as well as repositioning the caret before content is inserted.

see #21390, #21812, #21813, #21815.


git-svn-id: http://core.svn.wordpress.org/trunk@22208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 23:52:09 +00:00
Bot (Assets)
28cddba189 Compress scripts/styles: 3.5-beta1-22204.
git-svn-id: http://core.svn.wordpress.org/trunk@22204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 22:58:47 +00:00
Daryl Koopersmith
4c9f50537c Media Modal: Attachments on the gallery page now inherit general events with the exception of click-to-select. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 04:04:12 +00:00
Andrew Nacin
a610836667 jQuery 1.9.0 final. see #21736.
git-svn-id: http://core.svn.wordpress.org/trunk@22182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 03:34:19 +00:00
Daryl Koopersmith
ce36b0b5f0 Media Modal: Only automatically select uploading attachments when in a workflow that supports multiple images.
Fixes a bug in featured images where uploading an image would force you to reopen the modal (as the modal would close on upload).

see #21390, #21776.


git-svn-id: http://core.svn.wordpress.org/trunk@22175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-11 00:28:01 +00:00
Daryl Koopersmith
9d44f5c57d Add caption and title default values for the attachment view template. see #21390, #21807.
git-svn-id: http://core.svn.wordpress.org/trunk@22174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 23:55:45 +00:00
Daryl Koopersmith
1daa774b27 Caption editing in the media modal library.
* Adds a `describe` option to the workflow controller to support inline caption editing.
* For images, descriptions are mapped to the `caption` attribute.
* For other media items, descriptions are mapped to the `title` attribute.
* Descriptions are saved when the textarea's `change` event fires (i.e. when the textarea is blurred).

fixes #21807, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 23:32:48 +00:00
Bot (Assets)
d71143817e Compress scripts/styles: 3.5-beta1-22172.
git-svn-id: http://core.svn.wordpress.org/trunk@22172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 22:58:38 +00:00
Daryl Koopersmith
d8cd26095a Correctly insert non-image attachments as links.
* Adds `wp.media.string.link( attachment )` for printing attachment links.
* Adds the `link` attribute to `Attachment` models that corresponds to the link to the attachment post.

see #21390, #21836.


git-svn-id: http://core.svn.wordpress.org/trunk@22170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 21:54:21 +00:00
Daryl Koopersmith
1d60c42550 Add a class to the TinyMCE view end marker.
Certain TinyMCE plugins scan for all spans in the document and remove any that do not have classes (or a handful of other attributes). This is quite aggressive, and breaks the regex used to scan for MCE views when transforming them back to plain text. Adding a class ensures that any plugins that do so will not break MCE views.

see #21812, #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 10:52:14 +00:00
Daryl Koopersmith
d1c2c7714c Media JS: More default Attachments view template values. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 10:45:01 +00:00
Daryl Koopersmith
ebe800de42 Media JS: Ensure the subtype key has a default set.
Prevents undefined JS errors in the attachments view template.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 10:08:43 +00:00
Daryl Koopersmith
38b0a99f26 Show filenames for non-image attachments in the new media modal.
Also passes all attachment model attributes to the attachment view template by default (instead of selecting specific values).

see #21390, #21836.


git-svn-id: http://core.svn.wordpress.org/trunk@22159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 09:55:47 +00:00
Daryl Koopersmith
b2c3153b90 When editing a gallery, images can now be added from the media library.
Enables the "Add images from media library" button when editing. The UX has room for improvement, but it's a start.

see #21390, #21809.


git-svn-id: http://core.svn.wordpress.org/trunk@22157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 09:30:22 +00:00
Daryl Koopersmith
70bd368ad8 Gallery editing in the media modal.
The edit button on gallery MCE views will open a new instance of the media modal. Images can be removed, uploaded, and reordered. However, the "Add images from media library" button is not yet functional.

see #21390, #21809, #21815.


git-svn-id: http://core.svn.wordpress.org/trunk@22155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 08:31:12 +00:00
Daryl Koopersmith
24d9eefa46 Improve styling and markup for gallery and attachment MCE views.
Attachment views can now inherit from the theme's `editor-style.css` — just have any rules that apply to the `img` tag apply to `.editor-attachment` as well.

Adds a non-functional edit button to gallery views.

see #21390, #21813, #21815.


git-svn-id: http://core.svn.wordpress.org/trunk@22154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-10 06:47:22 +00:00
Bot (Assets)
4efe0b5efa Compress scripts/styles: 3.5-beta1-22150.
git-svn-id: http://core.svn.wordpress.org/trunk@22150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 22:58:33 +00:00
Jon Cave
e3c7cf5cc1 Remove allowed query args before checking isEmpty() in Query model. See #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 22:55:49 +00:00
Daryl Koopersmith
4c2f61c767 Improve JavaScript object formatting. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 02:07:09 +00:00
Daryl Koopersmith
9788d9142c Properly handle inserting full size images. props timbeks, fixes #22124.
git-svn-id: http://core.svn.wordpress.org/trunk@22140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 00:55:44 +00:00
Daryl Koopersmith
6312e4af27 On second thought, we're going to need the library-specific attachment view. see #21390, [22138].
git-svn-id: http://core.svn.wordpress.org/trunk@22139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 00:27:14 +00:00
Daryl Koopersmith
108b0feaed Remove the attachment quick-insert button from the media modal. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-09 00:21:52 +00:00
Daryl Koopersmith
aa19c0d66c Better thumbnail previews in the image editor.
* Images are auto-cropped, then fit to the preview on hover (with a slight delay). This is an experiment; we'll see how it turns out.
* Various style changes.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-08 23:20:04 +00:00
Bot (Assets)
6416d4fe53 Compress scripts/styles: 3.5-beta1-22133.
git-svn-id: http://core.svn.wordpress.org/trunk@22133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 22:58:41 +00:00
Jon Cave
8961dc5d91 Theme Customizer: Correctly update background-attachment property in live preview
Props bainternet. Fixes #21732.


git-svn-id: http://core.svn.wordpress.org/trunk@22131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 14:46:39 +00:00
Bot (Assets)
06d16327f5 Compress scripts/styles: 3.5-beta1-22128.
git-svn-id: http://core.svn.wordpress.org/trunk@22128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-07 02:27:48 +00:00
Daryl Koopersmith
1baac22e9d Improve the lazy instantiation of the 'wp' JavaScript variable. props evansolomon, fixes #22113.
git-svn-id: http://core.svn.wordpress.org/trunk@22126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-06 00:43:36 +00:00
Daryl Koopersmith
1deab58658 Use the new media modal to insert galleries into TinyMCE and the text editor.
'''Galleries'''

* Gallery insertion from the new media modal (into TinyMCE, the text editor, etc).
* Gallery previews in TinyMCE now use the `wp.mce.views` API.
* Disables the TinyMCE `wpgallery` plugin.
* Gallery previews consist of the first image of the gallery and the appearance of a stack. This will later be fleshed out to include more images/functionality (including editing the gallery, gallery properties, and showing the number of images in the gallery).
* Multiple galleries can be added to a single post.
* The gallery MCE view provides a bridge between the `wp.shortcode` and `Attachments` representation of a gallery, which allows the existing collection to persist when a gallery is initially created (preventing a request to the server for the query).


'''Shortcodes'''

* Renames `wp.shortcode.Match` to `wp.shortcode` to better expose the shortcode constructor.
* The `wp.shortcode` constructor now accepts an object of options instead of a `wp.shortcode.regexp()` match.
* A `wp.shortcode` instance can be created from a `wp.shortcode.regexp()` match by calling `wp.shortcode.fromMatch( match )`.
* Adds `wp.shortcode.string()`, which takes a set of shortcode parameters and converts them into a string.* Renames `wp.shortcode.prototype.text()` to `wp.shortcode.prototype.string()`.
* Adds an additional capture group to `wp.shortcode.regexp()` that records whether or not the shortcode has a closing tag. This allows us to improve the accuracy of the syntax used when transforming a shortcode object back into a string.

'''Media Models'''

* Prevents media `Query` models from observing the central `Attachments.all` object when query args without corresponding filters are set (otherwise, queries quickly amass false positives).
* Adds `post__in`, `post__not_in`, and `post_parent` as acceptable JS attachment `Query` args.
* `Attachments.more()` always returns a `$.promise` object.

see #21390, #21809, #21812, #21815, #21817.


git-svn-id: http://core.svn.wordpress.org/trunk@22120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-05 04:23:59 +00:00
Daryl Koopersmith
ca4275859f MCE Views: Use default shortcode properties when the shortcode parameter is set.
Prevents devs from having to manually extend the default shortcode property object.

see #21390, #21812.


git-svn-id: http://core.svn.wordpress.org/trunk@22102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-03 06:40:07 +00:00
Daryl Koopersmith
e687b66922 Allow galleries to be reordered by drag and drop.
An `Attachments` view now accepts a `sortable` property. Manual sorting is only enabled when the corresponding collection doesn't have a comparator.

jQuery UI sortable must be enqueued for sorting to work.

see #21390, #21809.


git-svn-id: http://core.svn.wordpress.org/trunk@22101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-03 04:21:50 +00:00
Daryl Koopersmith
6353c72bb8 Update underscore.js to version 1.4.1. fixes #22081, see #22026.
git-svn-id: http://core.svn.wordpress.org/trunk@22100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-03 00:27:16 +00:00