Commit Graph

520 Commits

Author SHA1 Message Date
Andrea Fercia
d6a73ef110 Media: avoid page scrolling when opening the media modal.
Moves focus to a proper element within the media modal to avoid the underlying
page to scroll to the bottom. Removes the media modal `freeze` option.

Props andreiglingeanu, adamsilverstein.
Fixes 39859.

Built from https://develop.svn.wordpress.org/trunk@42624


git-svn-id: http://core.svn.wordpress.org/trunk@42453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-31 17:03:33 +00:00
Sergey Biryukov
a1121f1def Media: Fix JSHint error after [42595].
See #42646.
Built from https://develop.svn.wordpress.org/trunk@42599


git-svn-id: http://core.svn.wordpress.org/trunk@42428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-24 21:51:31 +00:00
Sergey Biryukov
365c70d415 Media: Store and reuse image cropper ratio settings if available, instead of overwriting.
Props adamsilverstein.
Fixes #42646.
Built from https://develop.svn.wordpress.org/trunk@42595


git-svn-id: http://core.svn.wordpress.org/trunk@42424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-24 21:36:31 +00:00
atimmer
6310ad30d0 Docs: Improve JS Docs for controllers/customize-image-cropper.js.
Props manuelaugustin, bramheijmink, andizer, ireneyoast.
Fixes #43020.

Built from https://develop.svn.wordpress.org/trunk@42435


git-svn-id: http://core.svn.wordpress.org/trunk@42265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-01-11 14:32:52 +00:00
atimmer
f296e2cbbc Docs: Improve JSDoc for media/views/attachments.js.
Props maartenleenders, herregroen, jipmoors, ireneyoast.
Fixes #42832.

Built from https://develop.svn.wordpress.org/trunk@42415


git-svn-id: http://core.svn.wordpress.org/trunk@42246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-21 14:27:52 +00:00
atimmer
f6a37e7d39 Docs: Remove @summary tags from JSDoc.
As decided in the JavaScript core chat. With a few reasons:

* It is visually cleaner when reading the source.
* This bring the JavaScript documentation closer to the PHP documentation.

The only disadvantage is that the JSDoc parser doesn't split out the summary and the description in the new format. We've decided to solve this when building the JavaScript documentation parser.

Props herregroen.
Fixes #42901.

Built from https://develop.svn.wordpress.org/trunk@42411


git-svn-id: http://core.svn.wordpress.org/trunk@42240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-18 14:14:53 +00:00
atimmer
65b715c991 Docs: Improve JSDoc for js/media/controllers/edit-image.js.
Amends r42392  - includes the built media files.

Built from https://develop.svn.wordpress.org/trunk@42410


git-svn-id: http://core.svn.wordpress.org/trunk@42239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-18 11:20:47 +00:00
Adam Silverstein
9ff1fb5af1 Docs: Improve JSDocs for cropper.js.
Ammends r42352 - include the built media files.

Built from https://develop.svn.wordpress.org/trunk@42353


git-svn-id: http://core.svn.wordpress.org/trunk@42182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-12-03 18:56:46 +00:00
Joe McGill
d21f6799a6 Customizer: Improve handling of crops in the media library.
This is a follow up on r41732, implementing the following improvements:

* Attachment parent info is now stored in attachment meta rather than a 
separate post meta key.
* Attachments created from contextual crops (e.g. header, logos, etc.) are
filtered out of the media library using a new `_filterContext` method in
`wp.media.controller.Library`.

Props joemcgill, westonruter.
See #21819.

Built from https://develop.svn.wordpress.org/trunk@41937


git-svn-id: http://core.svn.wordpress.org/trunk@41771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-19 04:18:47 +00:00
Adam Silverstein
adb8f0161b Build: Webpack instead of Browserify as JavaScript bundler.
Use Webpack as our bundler of choice, enabling improved JavaScript build chain capabilities.

Props aduth, netweb, kadamwhite, schlessera.
Fixes #40894. 

Built from https://develop.svn.wordpress.org/trunk@41752


git-svn-id: http://core.svn.wordpress.org/trunk@41586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 21:02:23 +00:00
Adam Silverstein
43eb51d4a6 Customizer: retain aspect ration when cropping media w/ shift+click/drag.
Enforce a 1:1 ratio when holding the shift key and dragging in the image cropping tool in the customizer context.

Props melchoyce, mikeschroder.
Fixes #40211.

Built from https://develop.svn.wordpress.org/trunk@41557


git-svn-id: http://core.svn.wordpress.org/trunk@41390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-21 22:45:44 +00:00
Sergey Biryukov
2f701f7d0e Media: Rename "Insert Media" window title to "Add Media" for consistency with the "Add Media" button.
Props danieltj.
Fixes #41704.
Built from https://develop.svn.wordpress.org/trunk@41383


git-svn-id: http://core.svn.wordpress.org/trunk@41216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-16 11:03:45 +00:00
Adam Silverstein
8a23b80b56 Docs: JSDoc improvements for namespaces.
Improve JS parsing of our inline JSDocs by introducing `@namespace`, `@lends` and `@memberOf`. Helps set the way for showing our JavaScript documentation on developer.wordpress.org, see https://meta.trac.wordpress.org/ticket/3063.

* Define all used namespaces using @namespace.
* Correctly specify in which namespace each class is using @memberOf.
* Define each usage of the extend function as a prototype assignment using @lends.
* Some comment blocks were moved to correct the parsing of certain definitions. 

Props herregroen, atimmer, netweb, SergeyBiryukov.  
Fixes #41682.

Built from https://develop.svn.wordpress.org/trunk@41351


git-svn-id: http://core.svn.wordpress.org/trunk@41184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-09-08 18:42:49 +00:00
James Nylen
c91b130b53 REST API: Allow overriding jQuery.ajax calls from within wp-admin
There are now 3 places where we call out to the REST API from within wp-admin.  This commit introduces a small library to allow overriding these calls, centralize nonce-passing logic, and eliminate the need to pass a full REST URL down to client code (this last feature is not yet used and will be explored in a separate ticket).

Fixes #40919.

Built from https://develop.svn.wordpress.org/trunk@41206


git-svn-id: http://core.svn.wordpress.org/trunk@41046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-02 16:45:44 +00:00
Weston Ruter
18fd50d2b6 Media: Improve acceptance of YouTube /embed/ URLs when inserting in media modal.
Props timmydcrawford.
Fixes #41201.

Built from https://develop.svn.wordpress.org/trunk@41179


git-svn-id: http://core.svn.wordpress.org/trunk@41019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-28 02:36:46 +00:00
Joe McGill
37b500c4bd Sanity check $uploaderToggler in wp.media.view.UploaderInline.
This ensures `$uploaderToggler` exists before checking length so any views
extending or scripts accessing this view, won't encounter errors that stop execution.

Props Blackbam, yahil.
Fixes #41231.

Built from https://develop.svn.wordpress.org/trunk@41009


git-svn-id: http://core.svn.wordpress.org/trunk@40859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-06 00:41:41 +00:00
Adam Silverstein
7846cdc632 Media: Disable the edit image->replace button when no item selected.
On the edit media screen, ensure that the 'replace' button is disabled until a media item is selected. Fix an issue where clicking the button with no item selected threw a JavaScript error and failed to work.

Props timmydcrawford, subrataemfluence, psiico.
Fixes #40589.


Built from https://develop.svn.wordpress.org/trunk@40902


git-svn-id: http://core.svn.wordpress.org/trunk@40752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-15 09:38:46 +00:00
Adam Silverstein
c7f7e76515 Media: Fix an issue selecting media when clicking item edges.
Adjust targeting of the click handler for media item selection so clicking edges of media items properly selects them.

Props circlecube, psiico.
Fixes #40578.


Built from https://develop.svn.wordpress.org/trunk@40874


git-svn-id: http://core.svn.wordpress.org/trunk@40724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-05 00:49:43 +00:00
Weston Ruter
764d8b521f Media: Trim whitespace in URLs provided for external embeds.
Also avoid showing error notice in media widget when URL field is empty.

Props timmydcrawford, westonruter.
Fixes #40771.

Built from https://develop.svn.wordpress.org/trunk@40772


git-svn-id: http://core.svn.wordpress.org/trunk@40630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-17 01:59:42 +00:00
James Nylen
589c4b4b2d REST API: Add endpoint for proxying requests to external oEmbed providers.
This endpoint is a prerequisite for the media widgets work (see https://github.com/xwp/wp-core-media-widgets).

Also use the new endpoint in the media modal instead of the `parse-embed` AJAX action.

Props westonruter, timmydcrawford, swissspidy, jnylen0.
Fixes #40450.

Built from https://develop.svn.wordpress.org/trunk@40628


git-svn-id: http://core.svn.wordpress.org/trunk@40489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-11 18:18:46 +00:00
Andrea Fercia
88e515fac0 Accessibility: Improve the suggested image size text in the media views.
Adds `pixels` as unit, avoiding abbreviation for a clearer pronunciation by screen
readers. Also, adds the word `by` instead of the special character `times`.

Props Presskopp, stormrockwell.
Fixes #38932.

Built from https://develop.svn.wordpress.org/trunk@40573


git-svn-id: http://core.svn.wordpress.org/trunk@40443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-05-05 23:29:44 +00:00
Andrea Fercia
822b8afb50 Accessibility: Improve the Media Library inline uploader accessibility.
For better accessibility, expandable panels should be placed immediately after
the control that expands them. This change moves the Media Library inline
uploader up, right after the "Add New" button, also introducing consistency with
the Plugin and Theme uploaders.
Adds a proper ARIA role on the button and an `aria-expanded` attribute to give
better feedback to assistive technologies users about the uploader's expanded state.
Improves the focus handling when closing the uploader, improves the focus style
and color contrast ratio of the uploader "close" button.

Props mantismamita, karmatosed, adamsilverstein, afercia.
Fixes #37188.

Built from https://develop.svn.wordpress.org/trunk@40359


git-svn-id: http://core.svn.wordpress.org/trunk@40266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-31 17:38:43 +00:00
Andrea Fercia
c3a2b57241 Media: Restore correct upload errors displaying after [37610].
Props codegeass, MatheusGimenez, joemcgill.
Fixes #39516.

Built from https://develop.svn.wordpress.org/trunk@40126


git-svn-id: http://core.svn.wordpress.org/trunk@40063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-26 18:15:43 +00:00
Adam Silverstein
e322b0eb77 Media: debounce the media grid search, avoiding duplicate requests.
Add a debounce wrapper to the media grid search handler. The search callback is now fired after a 300 ms typing pause.

Remove redundant handlers for 'search' and 'change', preventing multiple/duplicate search callbacks.

Props certainstrings, joemcgill, Kelderic, batmoo.
Fixes #38911.

Built from https://develop.svn.wordpress.org/trunk@40060


git-svn-id: http://core.svn.wordpress.org/trunk@39997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-15 17:29:44 +00:00
Scott Taylor
9bf3844ef9 Media: in wp.media.view.DeleteSelectedPermanentlyButton, move destructive async operations outside of the selection loop.
Fixes #39780.

Built from https://develop.svn.wordpress.org/trunk@40051


git-svn-id: http://core.svn.wordpress.org/trunk@39988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-08 19:44:41 +00:00
Scott Taylor
907e8cbd66 Media: in wp.media.view.Toolbar.refresh(), check for a selection before iterating over models.
Props chandrapatel.
Fixes #39511.

Built from https://develop.svn.wordpress.org/trunk@40050


git-svn-id: http://core.svn.wordpress.org/trunk@39987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-02-08 19:17:43 +00:00
Andrea Fercia
4ca4ff999a Accessibility: Make the inline uploader button a real button.
See `wp.media.view.UploaderWindow`.

Fixes #39305.

Built from https://develop.svn.wordpress.org/trunk@40021


git-svn-id: http://core.svn.wordpress.org/trunk@39958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-01-27 18:32:41 +00:00
Andrea Fercia
da4da31af1 Administration: Better consistency for the Media, Add Plugins, and Add Themes toolbars.
Fixes the Add Themes toolbar padding. Standardizes the placeholders to no title
case and three trailing dots. Expands the Media search placeholder in
"Search media items..." for consistency with the Plugins and Themes toolbars.

Props mikeviele, jamesacero, mattking5000, koenschipper, dungengronovius.

Fixes #38010.

Built from https://develop.svn.wordpress.org/trunk@38795


git-svn-id: http://core.svn.wordpress.org/trunk@38738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-14 21:33:28 +00:00
Andrew Ozz
2f45415c73 Media modal: make it possible to reorder images by dragging on devices with both touch screen and mouse support.
Props adamsilverstein.
Fixes #31652.
Built from https://develop.svn.wordpress.org/trunk@38793


git-svn-id: http://core.svn.wordpress.org/trunk@38736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-14 20:29:28 +00:00
Andrea Fercia
c3ad2eee78 Accessibility: Handle focus when closing the media modal.
When closing the media modal, by default focus should be moved back to the UI
control that was clicked to open the modal. The only exception is when inserting
images into the Visual or Text editor.

Fixes #38142.

Built from https://develop.svn.wordpress.org/trunk@38652


git-svn-id: http://core.svn.wordpress.org/trunk@38595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-09-25 21:33:31 +00:00
Joe McGill
f1dddc6bfb Media: Restore keyboard navigation of the media grid.
This changes the binding of event listeners in the Attachments Browser
to use `on` instead of `listenTo` for the `attachment:keydown:arrow` and
`attachment:details:shift-tab` events. The existing listeners broke
when we upgraded Backbone in [36546].

Props adamsilverstein.
Fixes #36900.
Built from https://develop.svn.wordpress.org/trunk@37755


git-svn-id: http://core.svn.wordpress.org/trunk@37720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-21 13:35:34 +00:00
Joe McGill
bd3c735c6e Media: Fix rendering of incorrect toolbar in the Edit view.
This switches event binding in `wp.media.controller.EditImage` to use `on`
instead of `listenTo` to restore rendering of the correct toolbar when the
`toolbar:render:edit-image` event fires. The existing listeners broke
when we upgraded Backbone in [36546].

Props adamsilverstein.
Fixes #36861 for trunk.
Built from https://develop.svn.wordpress.org/trunk@37678


git-svn-id: http://core.svn.wordpress.org/trunk@37644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-10 21:12:29 +00:00
Andrea Fercia
8bd79e49f0 Accessibility: match the visual and tab order in the Media Modal grid.
By moving the Details sidebar after the attachments grid, the tab order is
greatly improved for keyboard users and matches the logical and visual order.

Fixes #36909.
Built from https://develop.svn.wordpress.org/trunk@37610


git-svn-id: http://core.svn.wordpress.org/trunk@37578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-01 17:39:27 +00:00
Konstantin Obenland
1edaf1c357 Customize: Respect aspect ratio on cropped images.
Takes into account whether the control supports `flex_width` and/or
`flex_height` and adjusts destination measurements accordingly.

Fixes #36318.


Built from https://develop.svn.wordpress.org/trunk@37113


git-svn-id: http://core.svn.wordpress.org/trunk@37080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-30 15:14:27 +00:00
Weston Ruter
d1ae0642cf Customize: Add support for flex sizes in CustomizeImageCropper.
Ensures that `$flex_width` and `$flex_height` as specified on `WP_Customize_Cropped_Image_Control` will be honored when a crop is saved.

See #36255.
Fixes #34851.

Built from https://develop.svn.wordpress.org/trunk@37042


git-svn-id: http://core.svn.wordpress.org/trunk@37009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-22 03:55:29 +00:00
Weston Ruter
40f6779665 Customize: Fix image cropping when doing live preview of theme switches.
Ensure that the Customizer gets bootstrapped with the pre-activated `theme` supplied in the `custom-header-crop` admin ajax requests.

Props faishal, rittesh.patel.
Fixes #32783.

Built from https://develop.svn.wordpress.org/trunk@36866


git-svn-id: http://core.svn.wordpress.org/trunk@36833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-06 01:45:27 +00:00
Dominik Schilling
71b735974b Media Library: After [36546] restore the "Add new" functionality.
Rework handling of the `'toggle:upload:attachment'` event using `.on` vs `.listenTo` for better compatibility with the current version of Backbone.

Props adamsilverstein.
See #34350.
Fixes #35853.
Built from https://develop.svn.wordpress.org/trunk@36575


git-svn-id: http://core.svn.wordpress.org/trunk@36542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-18 17:50:26 +00:00
Andrew Ozz
6abb7e6284 Media: when inserting an attachment in the editor and it is not an image, ensure the link is set to something else than none.
Props eherman24, azaozz.
Fizes #35153 for trunk.
Built from https://develop.svn.wordpress.org/trunk@36166


git-svn-id: http://core.svn.wordpress.org/trunk@36132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-04 00:33:28 +00:00
Andrew Ozz
8dd2a31c38 Plupload: update to 2.1.8. Changelog: https://github.com/moxiecode/plupload/releases.
Hide the editor uploader overlay on all drop events in the window, not only when dropping on the editor uploader element.


Fixes #34251, #22403.
Built from https://develop.svn.wordpress.org/trunk@35019


git-svn-id: http://core.svn.wordpress.org/trunk@34984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-10 23:50:25 +00:00
Scott Taylor
767dd35a47 Media:
When inserting an image into a post, the values in `wp.media.controller.Library` should not default to linking the image when no user settings are present.

The default display setting value for `link` is now `none`. User settings persist and will override or confirm this value based on user actions.

Props liljimmi, janhenckens, eherman24, wonderboymusic.
Fixes #31467.

Built from https://develop.svn.wordpress.org/trunk@33729


git-svn-id: http://core.svn.wordpress.org/trunk@33697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-25 12:13:23 +00:00
Ella Iseulde Van Dorpe
1d92ed1c79 JSHint: don't redeclare globals listed in .jshintrc
See #33021.

Built from https://develop.svn.wordpress.org/trunk@33337


git-svn-id: http://core.svn.wordpress.org/trunk@33309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-20 23:39:24 +00:00
Konstantin Obenland
3248497cf3 Site Icon: Add crop preview to the media modal.
* Monkey patches imgAreaSelect library to support touch events.
* Removes Settings version of Site Icon since it would have been the same flow.
* Removes default value for Customizer setting - there is no default favicon.

Fixes #16434.



Built from https://develop.svn.wordpress.org/trunk@33329


git-svn-id: http://core.svn.wordpress.org/trunk@33301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-20 15:57:25 +00:00
Scott Taylor
72bf48f0b9 In Media microtemplates after [32467], use <button> instead of <a> for several more non-links.
Props afercia.
Fixes #26550.

Built from https://develop.svn.wordpress.org/trunk@32952


git-svn-id: http://core.svn.wordpress.org/trunk@32923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-26 05:01:24 +00:00
Scott Taylor
b30b08fd92 Refresh attachment links in the media modal are unneeded since bringing the image editor into it in [27445].
Props rommelxcastro.
Fixes #32550.

Built from https://develop.svn.wordpress.org/trunk@32909


git-svn-id: http://core.svn.wordpress.org/trunk@32880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-22 21:33:26 +00:00
Scott Taylor
8c7e1b8ac0 In wp.media.view.UploaderStatus.filename(), don't truncate the filename.
Props helen.
Fixes #31216.

Built from https://develop.svn.wordpress.org/trunk@32908


git-svn-id: http://core.svn.wordpress.org/trunk@32879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-22 21:26:26 +00:00
Andrew Ozz
c13cb27c14 Fix error when dropping files for uploading on the editor before the media modal is initialized.
Props rommelxcastro, sebastiantiede. Fixes #32527.
Built from https://develop.svn.wordpress.org/trunk@32894


git-svn-id: http://core.svn.wordpress.org/trunk@32865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-20 21:08:26 +00:00
Ella Iseulde Van Dorpe
521de0130b Browserify after [32677]
See #30949.

Built from https://develop.svn.wordpress.org/trunk@32697


git-svn-id: http://core.svn.wordpress.org/trunk@32667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-06 19:50:29 +00:00
Scott Taylor
2c42a665a2 wp.media.view.Button should create <button>s, not <a href="#">s.
Props afercia.
See #32236.

Built from https://develop.svn.wordpress.org/trunk@32464


git-svn-id: http://core.svn.wordpress.org/trunk@32434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 20:39:27 +00:00
Scott Taylor
a417b2cf1a In EmbedLink, a URL needs to be at least 11 chars to be useful.
Fixes #32059.

Built from https://develop.svn.wordpress.org/trunk@32463


git-svn-id: http://core.svn.wordpress.org/trunk@32433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 20:30:26 +00:00
Scott Taylor
b7d4685f3d When creating an EmbedLink view, don't add a spinner - it already exists in Embed.
Use the value of `wp.media.controller.Embed.sensitivity` as the sensitivity value for the debounced method in `EmbedLink` to ensure that the spinner toggles don't stutter or overlap.

Fixes #32036.

Built from https://develop.svn.wordpress.org/trunk@32462


git-svn-id: http://core.svn.wordpress.org/trunk@32432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 20:10:26 +00:00
Scott Taylor
af326241ff When fetching in media/views/embed/link.js, call abort() on any existing XHRs.
Use `$.ajax` instead of `wp.ajax.send()` to allow this.
Pass `this` as `context` to the options to remove the need to bind callbacks.

Fixes #32035.

Built from https://develop.svn.wordpress.org/trunk@32460


git-svn-id: http://core.svn.wordpress.org/trunk@32430 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 19:16:25 +00:00
Scott Taylor
31f46f5363 In media/views/embed/link.js, URLs should have a valid protocol before an attempt to fetch them is made.
Fixes #32037.

Built from https://develop.svn.wordpress.org/trunk@32459


git-svn-id: http://core.svn.wordpress.org/trunk@32429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-08 18:34:28 +00:00
Scott Taylor
2807b7146f After [32258], restore the parts of [31620] and [31626] that weren't changes to the UI, but were improvements to existing code.
* Use `wp.shortcode()` instead of manually constructing a shortcode in `views/embed/link`
* In `WP_Embed`, store the last URL and last set of attributes requested in class properties
* `wp_ajax_parse_embed()`, allow `[embed]`s to have attributes. Return `attr` in the response.

See #31139.

Built from https://develop.svn.wordpress.org/trunk@32330


git-svn-id: http://core.svn.wordpress.org/trunk@32301 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-30 21:40:25 +00:00
Andrew Ozz
60706015e1 Revert editing of video embed parameters in the media modal, [31620] and [31626] for now. Plan on revisiting in 4.3.
Props iseulde. Fixes #31139, fixes #32006.
Built from https://develop.svn.wordpress.org/trunk@32258


git-svn-id: http://core.svn.wordpress.org/trunk@32229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 22:41:26 +00:00
Helen Hou-Sandí
a581c9851a Media: Date filtering does not need to be on for all contexts.
Affected areas include customizer upload controls and video playlist editing.

props ocean90.
fixes #32004.

Built from https://develop.svn.wordpress.org/trunk@32228


git-svn-id: http://core.svn.wordpress.org/trunk@32202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-20 19:49:24 +00:00
Scott Taylor
5e4616039c Move the built media JS files up a directory to their previous location and naming convention. This fidgets with part of [31373] and will maintain BC for those who were loading those files directly (not using the enqueue system).
Props iseulde, ocean90.
Fixes #31912.

Built from https://develop.svn.wordpress.org/trunk@32125


git-svn-id: http://core.svn.wordpress.org/trunk@32104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-14 15:31:28 +00:00
Scott Taylor
6cb16f7a21 Remove unused media JS files.
See #28510.

Built from https://develop.svn.wordpress.org/trunk@31405


git-svn-id: http://core.svn.wordpress.org/trunk@31386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-10 22:45:28 +00:00
Andrew Ozz
71885dceca Media modal: do not attempt to focus the hidden file input field added by Plupload when tabbing. Props afercia, fixes #30392.
Built from https://develop.svn.wordpress.org/trunk@31117


git-svn-id: http://core.svn.wordpress.org/trunk@31098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-09 21:47:29 +00:00
Sergey Biryukov
e53b581817 Remove non-functional date filter from Edit Selection view in media modal.
props tyxla.
fixes #30931.
Built from https://develop.svn.wordpress.org/trunk@31096


git-svn-id: http://core.svn.wordpress.org/trunk@31077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 18:23:23 +00:00
Scott Taylor
fb454239fb In Media Views, use this.listenTo( this.model, .... ) instead of this.model.on( .... ) to fix garbage collection and to avoid "ghost views."
Fixes #30896.

Built from https://develop.svn.wordpress.org/trunk@31045


git-svn-id: http://core.svn.wordpress.org/trunk@31026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-04 05:25:22 +00:00
Scott Taylor
e678f9d051 In Media Grid, don't immediately load full size images if the requested size passed to wp.media.view.Attachment.imageSize() does not exist, look for other suitable sizes.
Fixes #30861.

Built from https://develop.svn.wordpress.org/trunk@31039


git-svn-id: http://core.svn.wordpress.org/trunk@31020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 21:32:23 +00:00
Dominik Schilling
4652717828 Customizer: Remove date filter from the Header/Background Image upload frames.
Adds an option to `wp.media.view.AttachmentsBrowser` to hide the date filter added in [29813].

see #30689.
Built from https://develop.svn.wordpress.org/trunk@30872


git-svn-id: http://core.svn.wordpress.org/trunk@30862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-15 20:27:22 +00:00
Dominik Schilling
93078d7d9f Fix JSHint error introduced in [30780].
see #30608.
Built from https://develop.svn.wordpress.org/trunk@30792


git-svn-id: http://core.svn.wordpress.org/trunk@30782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-08 22:07:24 +00:00
Andrew Ozz
31990810f4 Media: ensure the toolbar is shown after leaving iframe-based content. Props mcsf, fixes #30608.
Built from https://develop.svn.wordpress.org/trunk@30780


git-svn-id: http://core.svn.wordpress.org/trunk@30770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 21:12:21 +00:00
Scott Taylor
845e8ab23d When using the spacebar to select something in "bulk select" mode, don't scroll the page.
Props avryl.
Fixes #30622.

Built from https://develop.svn.wordpress.org/trunk@30777


git-svn-id: http://core.svn.wordpress.org/trunk@30767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-07 20:11:43 +00:00
John Blackbourn
389811b3ec Remove the sortable functionality from the selection editing toolbar at the bottom of the media manager.
Fixes #29934
See #24352
Props jessepollak

Built from https://develop.svn.wordpress.org/trunk@30686


git-svn-id: http://core.svn.wordpress.org/trunk@30676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 04:18:23 +00:00
Scott Taylor
67e5d4041c When deleting media grid attachments, wait until the server responds before removing the model from its collection.
Props 5um17.
Fixes #30457.

Built from https://develop.svn.wordpress.org/trunk@30638


git-svn-id: http://core.svn.wordpress.org/trunk@30628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 06:19:23 +00:00
Helen Hou-Sandí
6225c63cf1 Media a11y: Don't set role=checkbox for the attachment details view.
Some unnecessary attributes were inherited from the attachment view, which created difficulties with screen readers.

fixes #30390.

Built from https://develop.svn.wordpress.org/trunk@30483


git-svn-id: http://core.svn.wordpress.org/trunk@30471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 17:15:23 +00:00
Dominik Schilling
12b2ca45ad Simplify selectors in [30374].
props wonderboymusic, adamsilverstein.
see #29326.
Built from https://develop.svn.wordpress.org/trunk@30461


git-svn-id: http://core.svn.wordpress.org/trunk@30452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-20 15:37:22 +00:00
John Blackbourn
e2a0c6a86d Improve keyboard control of Edit Selection mode in the media manager.
See #29326
Props adamsilverstein

Built from https://develop.svn.wordpress.org/trunk@30374


git-svn-id: http://core.svn.wordpress.org/trunk@30371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-18 03:34:25 +00:00
Scott Taylor
d5a9d63114 Improve wp.media documentation.
Props ericlewis.
See #28459.

Built from https://develop.svn.wordpress.org/trunk@30245


git-svn-id: http://core.svn.wordpress.org/trunk@30245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-05 19:39:22 +00:00
Scott Taylor
8fa0755584 Add some docs to wp.media.view.EditorUploader.
Props ericlewis.
See #29951.

Built from https://develop.svn.wordpress.org/trunk@30234


git-svn-id: http://core.svn.wordpress.org/trunk@30234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-04 20:48:23 +00:00
Scott Taylor
7eefc4d1e1 JSHint after [30124].
Built from https://develop.svn.wordpress.org/trunk@30125


git-svn-id: http://core.svn.wordpress.org/trunk@30125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 20:38:21 +00:00
Scott Taylor
a6cb067481 JSHint after [30120].
Built from https://develop.svn.wordpress.org/trunk@30124


git-svn-id: http://core.svn.wordpress.org/trunk@30124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 20:35:22 +00:00
Dominik Schilling
2e76a697f6 Fix JSHint errors introduced in [30120].
see #30193.
Built from https://develop.svn.wordpress.org/trunk@30123


git-svn-id: http://core.svn.wordpress.org/trunk@30123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 20:28:24 +00:00
Scott Taylor
999e0fbd99 Add verbose docs to media-views.js.
Props ericlewis.
See #30193.

Built from https://develop.svn.wordpress.org/trunk@30120


git-svn-id: http://core.svn.wordpress.org/trunk@30120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 15:20:23 +00:00
Scott Taylor
fb019893f9 In wp.Uploader, when uploader:ready is triggered, set ready to true on the instance. This allows media workflows to check for an existing uploaded instance when opening.
Without this check, workflows might wait for `uploader:ready`, which could already have been fired. This would result in an unresponsive editor dropzone.

Fixes #29689.

Built from https://develop.svn.wordpress.org/trunk@29917


git-svn-id: http://core.svn.wordpress.org/trunk@29669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-16 05:54:18 +00:00
Andrew Ozz
7f2f3dcb5d Media modal: fix reordering of the thumbnails while creating or editing a gallery, props avryl, fixes #29606 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29876


git-svn-id: http://core.svn.wordpress.org/trunk@29633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-11 23:24:23 +00:00
Scott Taylor
821f9f40ec For attachment-compat fields, show a spinner while wp.media.model.Attachment.saveCompat() is firing.
Fixes #27028.

Built from https://develop.svn.wordpress.org/trunk@29831


git-svn-id: http://core.svn.wordpress.org/trunk@29595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-03 18:43:20 +00:00
Scott Taylor
d8c913b3f9 Add the date filter from media grid to the media modal.
Props janhenckens, wonderboymusic.
Fixes #28990.

Built from https://develop.svn.wordpress.org/trunk@29813


git-svn-id: http://core.svn.wordpress.org/trunk@29579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 04:32:16 +00:00
Scott Taylor
202ede7696 After [29811], combine 2 if statements.
Built from https://develop.svn.wordpress.org/trunk@29812


git-svn-id: http://core.svn.wordpress.org/trunk@29578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 04:16:17 +00:00
Scott Taylor
b885885b67 Media Grid/List Table parity: when MEDIA_TRASH is true and trash is the current filter for the grid, add a second bulk action button: "Delete Selected"
Fixes #29742.

Built from https://develop.svn.wordpress.org/trunk@29811


git-svn-id: http://core.svn.wordpress.org/trunk@29577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-02 04:13:16 +00:00
Scott Taylor
f30266acb9 Media Grid:
* In Bulk Edit mode, don't attempt to delete or trash an attachment that doesn't have a `delete` nonce. The subsequent `_requery()` will then properly display the attachment still present in the library.
* Remove all updated models from the selection at the same time to avoid async race conditions. The selection is reset when the grid's `select` mode is deactivated, but this allows this view instance to be more portable.

This fix allows users to set caps on individual attachments without confusing the grid's library. This issue was present for bulk actions in general, had nothing to do with `MEDIA_TRASH` specifically.

Fixes #29597.

Built from https://develop.svn.wordpress.org/trunk@29755


git-svn-id: http://core.svn.wordpress.org/trunk@29527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-21 18:52:16 +00:00
Sergey Biryukov
9f066b2a1d Correct some @since values added in [29739].
see #28459.
Built from https://develop.svn.wordpress.org/trunk@29743


git-svn-id: http://core.svn.wordpress.org/trunk@29517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-13 12:18:18 +00:00
Scott Taylor
836e0f8cd5 Add some @since annotations to media-views.js.
Props DrewAPicture.
See #28459.

Built from https://develop.svn.wordpress.org/trunk@29739


git-svn-id: http://core.svn.wordpress.org/trunk@29513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-12 03:36:16 +00:00
Sergey Biryukov
39b859c21e Add 'Unattached' filter for galleries.
props pento.
fixes #29329.
Built from https://develop.svn.wordpress.org/trunk@29722


git-svn-id: http://core.svn.wordpress.org/trunk@29496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-09 07:14:16 +00:00
Andrew Nacin
b0f6b888b9 Media: Avoid repeated thumbnail resizing.
props avryl, wonderboymusic, azaozz.
fixes #27423.

Built from https://develop.svn.wordpress.org/trunk@29686


git-svn-id: http://core.svn.wordpress.org/trunk@29461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-03 06:10:19 +00:00
Andrew Nacin
4cfdb9851f Media Modal: Fix 'Insert from URL' oEmbed previews.
props johnbillion, azaozz.
fixes #29473.

Built from https://develop.svn.wordpress.org/trunk@29680


git-svn-id: http://core.svn.wordpress.org/trunk@29455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-03 00:37:16 +00:00
Helen Hou-Sandí
7586e15e0d Media: only apply wp-filter class to the grid view toolbar.
props gcorne.
fixes #29381.

Built from https://develop.svn.wordpress.org/trunk@29629


git-svn-id: http://core.svn.wordpress.org/trunk@29403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 19:06:15 +00:00
Helen Hou-Sandí
9e8b9a78ca Media library: Unify headers between view modes.
Includes back compat for `views_upload` links. These look a little awkward, but do not appear to be commonly used. Also prevents the view mode links from being dropped on smaller screens so a user doesn't get "stuck" in the list view.

This is different from other list tables, but aligns well with other uploaded content management screens (themes, plugins).

props pento, helen.
fixes #28946.

Built from https://develop.svn.wordpress.org/trunk@29625


git-svn-id: http://core.svn.wordpress.org/trunk@29399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 15:58:15 +00:00
Dominik Schilling
32030a073f RTL: Fix modal alignments.
* Prevent horizontal scrollbars in Chrome.
* URL fields should be always LTR.
* Force the plugin details to be LTR for all screens, see #19778.

fixes #29352.
Built from https://develop.svn.wordpress.org/trunk@29623


git-svn-id: http://core.svn.wordpress.org/trunk@29397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 12:55:16 +00:00
Scott Taylor
80bda02c0f Media Modal:
* the Image Details frame does not have a menu, indicate that by setting `menu: false` when adding states.
* mimic the default router rendering by toggling a `hide-menu` class on the frame when the region for menu is `null`
* remove the dead render code for the Image Details frame

See #29339.

Built from https://develop.svn.wordpress.org/trunk@29613


git-svn-id: http://core.svn.wordpress.org/trunk@29387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 04:22:16 +00:00
Helen Hou-Sandí
60c6399d1c Media Grid: Show upload errors above the grid rather than as a popup.
props pento, stephdau, helen. fixes #29141.

Built from https://develop.svn.wordpress.org/trunk@29612


git-svn-id: http://core.svn.wordpress.org/trunk@29386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 04:18:17 +00:00
Andrew Ozz
04e28b468c Media modal: fix the progress bar in the attachment thumbnail. Props gcorne, fixes #29367
Built from https://develop.svn.wordpress.org/trunk@29609


git-svn-id: http://core.svn.wordpress.org/trunk@29383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-25 22:45:16 +00:00
Scott Taylor
d869fe0603 Media: cleanup recent changes to media.view.FocusManager.
* Adjusts the focus method to target the menu for the current modal
* Refactor the FocusManager so that the method names and the functionality matches more closely with how it currently works. The changes in 4.0 to the FocusManager change the purpose of the focus manager entirely — instead of being a way to save and restore focus state, the new FocusManager is about constraining keyboard navigation via the tab key to inside the modal. 

Props gcorne.
See #23560.

Built from https://develop.svn.wordpress.org/trunk@29602


git-svn-id: http://core.svn.wordpress.org/trunk@29376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-25 18:23:16 +00:00
Scott Taylor
db0b4c5b4d Media: when activating a mode after [29056], don't trigger the {mode}:activate event twice in a row.
See #29366.

Built from https://develop.svn.wordpress.org/trunk@29601


git-svn-id: http://core.svn.wordpress.org/trunk@29375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-25 18:07:15 +00:00
Scott Taylor
1335ff3e40 Media Grid: Don't make checkboxes tabbable when in bulk select media grid mode, fixes tabbing in bulk select mode.
Props adamsilverstein.
See #28822.

Built from https://develop.svn.wordpress.org/trunk@29585


git-svn-id: http://core.svn.wordpress.org/trunk@29359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-24 16:55:15 +00:00
Scott Taylor
d5d0b37c35 Media Grid: restore focus to the selected item when shift-tab away from the attachment details sidebar.
Fixes #29303.

Built from https://develop.svn.wordpress.org/trunk@29584


git-svn-id: http://core.svn.wordpress.org/trunk@29358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-24 16:43:16 +00:00
Helen Hou-Sandí
8a545bf05e Media: Only fire keyboard events for the Attachments view once.
Firing them twice was breaking arrow key navigation in media attachment grids.

props gcorne.
fixes #29304.

Built from https://develop.svn.wordpress.org/trunk@29582


git-svn-id: http://core.svn.wordpress.org/trunk@29356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-24 16:17:16 +00:00
Scott Taylor
31e599943d Media Grid: after [29566], account for Trash and Delete.
See #28842.

Built from https://develop.svn.wordpress.org/trunk@29568


git-svn-id: http://core.svn.wordpress.org/trunk@29342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-21 04:42:16 +00:00