Commit Graph

503 Commits

Author SHA1 Message Date
Andrea Fercia
b1cd71c2d2 Accessibility: Media: Add more headings in the Media Modal.
Headings are the predominant mechanism for screen reader users to find information in a page. They also help all users to better identify the main sections of user interfaces.

- adds three new headings within the media modal 
- improves plural form translation for "item selected" by using `wp.i18n`
- horizontally centers the media modal menu in the responsive view

Props kjellr, karmatosed, melchoyce, afercia.
See #47149.
Fixes #47610.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-03 12:10:57 +00:00
Andrea Fercia
63e199abc7 Accessibility: Media: Use the ARIA tabs pattern for the media modal menus.
The ARIA tabs pattern improves interaction for keyboard and assistive technologies users.
It gives the menu items proper roles, and `aria-selected` allows users of assistive technologies to know which tab is currently selected.

Props audrasjb, afercia, joedolson, karmatosed, melchoyce.
See #47149.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 19:37:58 +00:00
antpb
247e7eb7d5 Media: Revert [46354] preventing bad clipping of text in image details page.
See #47115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 17:12:59 +00:00
antpb
7c8028febf Media: Prevents clipping of text when scaling image edit screen.
Props sabernhardt, audrasjb, afercia.
See #47115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 16:34:58 +00:00
Andrea Fercia
abb00ee8a4 Media: Fix JavaScript TypeError after [45376].
Props desrosj, afercia.
Fixes #48021.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-26 13:06:56 +00:00
Andrea Fercia
9e26d98d7e Accessibility: Media: Make screen readers announce the Media search results.
- adds audible messages via `wp.a11y.speak()` to announce the search results 
- removes a `keyup` event that was there only to support old browsers 
- removes `aria-modal="true"` from the media modal dialog as it prevents the ARIA live regions to be perceived by screen readers
- triggers the search only after 2 ASCII characters have been typed

Props anevins, antpb, aduth, loreleiaurora, afercia.
Fixes #47146.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-23 12:19:56 +00:00
Adam Silverstein
0cb3860138 External Libraries: Update Backbone.js to 1.4.0.
Upgrade Backbone to the latest stable version. Fix some issues in Media with `listenTo` which changed in this version, see https://backbonejs.org/#changelog.

Props desrosj, priyankkpatel, pierlo.
Fixes #47478.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-17 17:19:54 +00:00
Andrew Ozz
e313498193 Uploads: After an image is uploaded and PHP times out or runs out of memory during post-processing (the server response is HTTP 500 error), try to resize it three more times. Then, if all attempts fail, do a cleanup of any sub-sizes that may have been created and show an error message asking the user to scale the image and upload it again.
See #47872.
Built from https://develop.svn.wordpress.org/trunk@45934


git-svn-id: http://core.svn.wordpress.org/trunk@45745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-04 01:11:54 +00:00
Andrea Fercia
3ab18dba93 Accessibility: Add a default title for the media modal dialog.
Makes sure the media modal dialog `h1` heading isn't empty when custom media frames don't set a title. This is particularly important now that the media modal is an ARIA dialog, as the title is referenced by an `aria-labelledby` attribute to properly label the dialog.

Props donmhico, audrasjb.
Fixes #47612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 15:18:56 +00:00
Sergey Biryukov
6b9ab1c5c5 Docs: Update @since tag for new JS functions and variables introduced in [45572].
Props garrett-eclipse.
See #47145.
Built from https://develop.svn.wordpress.org/trunk@45867


git-svn-id: http://core.svn.wordpress.org/trunk@45678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-20 22:54:55 +00:00
Tammie Lister
d5c7657189 Media: Reduces the bulk media options to have one primary button
This fixes where 2 primary buttons were showing for bulk actions within media trash.

Props garrett-eclipse, afercia, ianbelanger, SergeyBiryukov
Fixes #46757, #46758

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


git-svn-id: http://core.svn.wordpress.org/trunk@45512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-30 23:20:57 +00:00
Andrea Fercia
00704114e0 Accessibility: Make the Media modal an ARIA modal dialog.
For a number of years, the Media modal missed an explicit ARIA role and the required attributes for modal dialogs.

This was confusing for assistive technology users, since they may not realize they're inside a dialog, and that consequently the keyboard interactions may be different from the rest of the page. Lack of an explicit label for the dialog was confusing as well, since assistive technology users didn't have an immediate sense of what the dialog is for.

This change makes the Media modal meet the ARIA Authoring Practices recommendations, helping users better understand the purpose and interactions with the modal. Also, it makes sure to hide the rest of the page content from assistive technologies, until support for `aria-modal="true"` improves.

Additionally:
- moves the modal H1 heading to the beginning of the modal content 
- changes the modal left menu position to make visual and DOM order match 
- improves the `wp.media.view.FocusManager` documentation

Fixes #47145.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-27 12:33:56 +00:00
atimmer
73ad55051b Docs: Improve JSDoc for media/views/attachment/details.js.
Props maartenleenders, boblinthorst, dfangstrom.
Fixes #47588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-22 13:02:52 +00:00
Andrea Fercia
d69a3e6f90 Accessibility: Handle one more case of focus loss when switching view in the Media Views.
See #43169.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-13 16:22:52 +00:00
Andrea Fercia
340fd28d82 Accessibility: Improve focus management in the Media Views.
- keeps focus management only where necessary to avoid focus losses
- removes focus management where a specific user workflow was assumed
- makes the "Attachment Details" navigation buttons really disabled when there are no next or previous attachments
- adds inline comments to clarify all the usages of focus()

Fixes #43169.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-12 21:03:52 +00:00
Andrea Fercia
f57e10a35d Accessibility: Fix the order of the Previous, Next, and Close buttons in the Attachment Details modal.
Making the visual and DOM order match benefits keyboard users who navigate documents sequentially and expect the focus order to be consistent with the sequential reading order.

Fixes #47458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-09 15:48:53 +00:00
Andrea Fercia
6a9bcaeaa9 Accessibility: Improve accessibility of all the media views form controls.
- changes the media views form controls to have explicitly associated labels with for/id attributes
- adds a few missing labels / aria-labels
- improves a few existing labels / aria-labels
- improves semantics in a few places, by adding visually hidden headings, fieldset + legend elements, aria-describedby attributes
- improves the image custom size input fields and their labelling
- adds `role="status"` to the "saved" indicator so that status messages are announced to assistive technologies
- swaps the columns source order in the image details template, to make visual and DOM order match
- swaps the "Replace" and "Back" buttons source order in the Replace Image view, to make visual and DOM order match
- gallery settings: move checkbox label to the right: checkboxes are supposed to have labels on the right
- merge similar strings, unified to "Drop files to upload" (removed "Drop files here", and "Drop files anywhere to upload")
- makes the "upload-ui" consistent across the media views
- hides the IE 11 "X" `::-ms-clear` button in the Insert from URL field, as it conflicts with the uploading spinner
- adds comments to all the media templates to clarify their usage
- slightly increases vertical spacing between form fields in the media sidebar
- removes some CSS selectors introduced as backwards compatibility for WordPress pre-4.4
- removes some CSS still targeting Internet Explorer 7 and 8

Fixes #47141.
Fixes #47122.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-07 20:45:02 +00:00
Andrea Fercia
74c0d658b4 Accessibility: Improve the media views upload Dismiss Errors button.
- makes the Dismiss Errors button visible in the media views inline uploader
- avoids a focus loss when activating the Dismiss Errors button

See the related GitHub issue from the WPCampus accessibility audit https://github.com/WordPress/gutenberg/issues/15354

Fixes #47113.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-22 19:33:53 +00:00
Gary Pendergast
4b1ff1c298 Media: Update the media bulk action labels for consistency.
Props ianbelanger, garrett-eclipse, afercia, Presskopp.
Fixes #44675.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-08 23:54:52 +00:00
Adam Silverstein
19c4841fb6 Media: introduce a "Heading" view for improved accessibility.
* Add a new media view: `wp.media.view.Heading` designed to add accessibility friendly headers in the media library/modal.
* Add an initial "Attachments list" heading above the attachments list.

Props afercia.
Fixes #36925.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:05:52 +00:00
Andrea Fercia
e9db7c48d2 Accessibility: improve the "URL" and "Alt text" fields in the media modals.
Many users found the attachment URL field confusing: it says "URL" so it may appear like a field meant to paste a URL into.
Also, the Alt text field is the most important one in terms of content, while the Title field needs to be de-emphasized.

- changes the URL field label to "Copy link"
- moves the alt text field to the top as first field 
- avoids to set initial focus on the alt text field 
- adds an explanatory text with a link pointing to the W3C "alt decision tree" tutorial 
- adds `aria-describedby` to target the explanatory text
- adjusts the CSS accordingly
- updates the QUnit index.html file

Props melchoyce, audrasjb, afercia.
Fixes #41612.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-15 10:43:51 +00:00
Andrea Fercia
a32aeb0392 Media: Improve unselecting media in the media bulk selection mode.
Disables the "Delete Selected" button when unselecting media by clicking the
"checkmark" box in the media bulk selection mode.

Props subrataemfluence, adamsilverstein.
Fixes #42239.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-17 12:08:49 +00:00
Andrea Fercia
3578f89900 Accessibility: Improve the way Internet Explorer 11 and JAWS announce fieldset legends.
When Internet Explorer encounters a non interactive element with a `tabindex`
attribute, it adds the element to the accessibility tree with a `role=group` and
an accessible name computed from the element. This prevents JAWS from announcing
any fieldset legend within the element.

- removes `tabindex="0"` from the content and the toolbar containers: these tabindex attributes are no longer needed
- removes `aria-label="Main content"` from the content container: not needed
- keeps the media modal focus fallback introduced in [38142] by making the `#wpbody-content` element focusable only when needed

Props stevefaulkner, aardrian.
Fixes #43154.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-17 11:55:51 +00:00
desrosj
5db34748e6 Script loader: Adjust JS packages registration.
Adjusts the packages registration after [43723]:

    Combine the different registration functions into one `wp_default_packages` function. To reach this goal move the prefix logic into a function so it can be called from different locations. Use a static variable there to prevent duplicate inclusion of `version.php`.

    Call this function from the `wp_default_scripts` action by registering it as a default filter.

    Combine some of the logic in `_WP_Editors::print_tinymce_scripts` into `wp_register_tinymce_scripts`. The logic to force an uncompressed TinyMCE script file stays in `_WP_Editors::force_uncompressed_tinymce` because that logic is very specific to the classic editor.

    The script handle `wp-tinymce` is now a dependency of the editor script handle. In combination with the previous item, this makes the classic editor work.

    Adjust the syntax of the script paths to be more consistent with other WordPress code.

    Always use "production" mode for the media files to prevent people from inadvertently committing development files.

Props pento, omarreiss, atimmer.

Merges [43738] into trunk.

Fixes #45065.
Built from https://develop.svn.wordpress.org/trunk@44115


git-svn-id: http://core.svn.wordpress.org/trunk@43945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 17:27:38 +00:00
atimmer
4f9ba9044e Build tools: Upgrade webpack to version 4.
* Minification is done by uglify, so disable that in the media build.
* The webpack boilerplate has changed, which explains the changes in the build files.
* ModuleConcatenationPlugin is enable by default for production builds so we don't have to specify that ourselves.

Merge notes: In `trunk` uglify isn't run on the media files after webpack, so webpack does need to do that. Newer webpack versions use `terser-webpack-plugin` as the default minification. Use the `uglifyjs-webpack-plugin` plugin to maintain the same behavior as before. We can look into terser as a minifier later.

Merges [43688] to trunk.
See #45065.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 11:05:25 +00:00
atimmer
bde558be2f Docs: Add file doc @output annotations.
These annotations make it clear to the reader of a JavaScript source
where the build process outputs to. These annotations can later be
integrated in a webpack configuration. This way there is one source of
truth.

The `build` folder is omitted from the paths, because a single JS file
shouldn't not be responsible of knowing where outputs in general will
end up at. A file only knows its output location relative to the
project.

Props adamsilverstein, herregroen, omarreiss, pento.
Fixes #44361.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:30:15 +00:00
Gary Pendergast
922f83a69f Once upon a midnight dreary, while I coded, weak and weary,
In many a strange and curious file of forgotten lore—
While I pondered, blaming Nacin, my notifications suddenly awakened,
As of someone quietly DMing;—DMing me, I can’t ignore.
“’Tis some contributor,” I muttered, “DMing me an idea or four—
            Only this and nothing more.”

Ah, distinctly I remember, at WordCamp US, last December;
A mad proposal nearly laid me—down out cold—upon the floor.
Curious, I listened closely;—to a plan I agreed with, mostly—
A way to make our JavaScript—JavaScript which was a chore—
Maintainable, extendable, for the future, is what I saw.
            Guten-ready for evermore.

Open here I switch to Slack, when, with many a patch and hack,
In there stepped Omar, a JavaScript developer hardcore;
Pronouncing all the changes fit; ready now to be commit;
“There’s nothing else for us to do,” DMing me, “It’s done!” he swore—
“No longer random guessing at which file need next be explored—
            Let’s move on, we’re all aboard.”

Moved all together, grouped and managed, in folders all is packaged,
The code had all been cleaned and tidied, important parts moved to the fore,
“Though this change be useful here,” I said, “it is too large, I fear,
We couldn’t manage such a patch, we’ve done nothing like this before—
Tell me where doth go this change, change to make our codebase soar!”
            Quoth Omar, “In WordPress Core.”

Props omarreis for shepherding this significant change.
Props adamsilverstein, aduth, atimmer, dingo_bastard, frank-klein, gziolo, herregroen, jaswrks, jeremyfelt, jipmoors, jorbin, netweb, ocean90, pento, tjnowell, and youknowriad for testing, feedback, discussion, encouragement, commiserations, etc.
I make no apologies for this commit message.
Fixes #43055.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-23 10:05:31 +00:00
atimmer
b6ef716d97 Docs: Improve JSDoc for media/controllers/gallery-edit.js.
Amends [43141] - includes the built media files.

See #43866.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-03 14:48:22 +00:00
Andrew Ozz
3266b10d04 Privacy: add "Mine" filter for media similarly to posts and comments.
Props audrasjb.
See #43820.
Built from https://develop.svn.wordpress.org/trunk@43056


git-svn-id: http://core.svn.wordpress.org/trunk@42885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-01 15:43:22 +00:00
Dominik Schilling
f33092e163 Media: Update built files after [42798].
See #43500.
Built from https://develop.svn.wordpress.org/trunk@42931


git-svn-id: http://core.svn.wordpress.org/trunk@42761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-03 19:49:30 +00:00
Adam Silverstein
a299c5c344 Fix eshint error since r42739.
Remove a trailing comma in [42739] that was throing a jshint error.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 16:49:30 +00:00
Adam Silverstein
da89d20c39 Media: grid view - correct placeholder positioning during uploads.
Preventing contextually created attachments from being added to the grid collection in Attachments.validator. Remove the previous filtering introduced in [41937] which caused the placement issue.

Props lancewillett, Junaidkbr, designsimply, joemcgill.
Fixes #42968.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 16:41:31 +00:00
atimmer
5e190dc084 Docs: Improve JSDoc for media/views/spinner.js.
Amends r42675 - includes the built media files.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-13 15:45:30 +00:00
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