- 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
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
* 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
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
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
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
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
This allows you to instantiate a library that includes and/or excludes specific attachments by passing a single ID or an array of IDs.
Example usage:
{{{
wp.media({frame: 'post', library: {include: [414, 415]}}).open()
wp.media({frame: 'post', library: {include: 414}}).open()
wp.media({frame: 'post', library: {exclude: [414, 415]}}).open()
wp.media({frame: 'post', library: {exclude: 414}}).open()
}}}
Fixes#26587.
Built from https://develop.svn.wordpress.org/trunk@29759
git-svn-id: http://core.svn.wordpress.org/trunk@29531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add a setting to `_wpMediaViewsL10n.settings`: `mediaTrash`
* In the attachment edit modal, properly toggle between Trash/Untrash
* In `media.view.Attachment`, add a method for `untrashAttachment`
* When creating the grid toolbar, switch the setting order of subviews so that `media.view.DeleteSelectedButton` can listen to the instance of `media.view.AttachmentFilters.All` to update the text in its UI.
* Add a new filter to `media.view.AttachmentFilters.All`, `trash`, when `settings.mediaTrash` is true
* Allow the cached queries in `Query.get()` to be flushed when race conditions exist and collections need to be refreshed. This is currently only being used when `MEDIA_TRASH` is set, to refresh the filtered/mirrored collections related to `all`, `trash`, and any already queried filter.
* Cleanup the bootstrapping of `media.view.MediaFrame.Manage`
* Allow `wp_ajax_query_attachments()` to return items from the trash when `MEDIA_TRASH` is `true`
* Allow `wp_ajax_save_attachment()` to set `post_status` when `MEDIA_TRASH` is `true`. It allows `wp_delete_post()` to be called, which will trash the attachment instead of deleting when the flag is set.
Props koop for the knowledge sharing and thought partnership.
See #29145.
Built from https://develop.svn.wordpress.org/trunk@29490
git-svn-id: http://core.svn.wordpress.org/trunk@29268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Add wp.media.events which is intended to be a global media event bus.
- Add a post-render event to the ImageDetails view that third-party code can leverage to add subviews.
- Performance improvement for the initialization of the PostImage model.
- A bit more markup to the image details template to make it easier to add a view to the advanced options.
Props gcorne, fixes#27698
Built from https://develop.svn.wordpress.org/trunk@28095
git-svn-id: http://core.svn.wordpress.org/trunk@27926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Fix issue with adding a link to an image that didn't have one previously.
- Adjust the look-and-feel of the advance options toggle so that it becomes a section heading that can be open/closed.
- Add a Custom Size option to the size drop-down that reveals fields for soft-resizing the image inserted into the post.
Props gcorne, and props sdasse for the design help, see #27366
Built from https://develop.svn.wordpress.org/trunk@27918
git-svn-id: http://core.svn.wordpress.org/trunk@27748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
UX Changes:
* Don't add a menu item for "Add Audio|Video Source"
* In the Audio|Video Details modal, add buttons and some suggestive text for adding alternate playback sources
* Don't show "Create Audio|Video Playlist" menu items until the user has uploaded audio or video files
See #27437.
Built from https://develop.svn.wordpress.org/trunk@27608
git-svn-id: http://core.svn.wordpress.org/trunk@27451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* `src` is set, and 'Add a Source' results in the same file (or a file with the same extension) being added
* `src` is set, and 'Replace Audio|Video' is used, which will add a model property named by the attachment's extension
... call `model.unset( 'src' )`.
See #27389.
Built from https://develop.svn.wordpress.org/trunk@27536
git-svn-id: http://core.svn.wordpress.org/trunk@27379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Move TinyMCE shortcode handling from `wpgallery` plugin to `mce-view.js`
* Force `preload="none"` when rendering media in the editor to ensure fast loading (I realize this sounds illogical)
* Move audio and video tag builder logic in `media-template.php` into PHP funcs that can be reused by any code passing `data.model` to an Underscore template
* Pause all players when moving between editor tabs and when moving from the editor to editing in the media modal.
* Rename `wp.media.audio|video.shortcode()` to the more appropriate `wp.media.audio|video.update()` that now returns a `wp.shortcode` object instead of a string.
* Add necessary MediaElement css files to `$mce_css`
* In `wp.mce.View.render()`, support multiple instances of the same shortcode
* When rendering `wp.mce.View`s, fire a ready event that passes the current MCE View root element as context
See #27389.
Built from https://develop.svn.wordpress.org/trunk@27528
git-svn-id: http://core.svn.wordpress.org/trunk@27371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Make a generic model, `wp.media.model.PostMedia`, which replaces `wp.media.model.PostAudio` and `wp.media.model.PostVideo`
* Make a generic library, `wp.media.controller.MediaLibrary`, which replaces `wp.media.controller.ReplaceVideo` and `wp.media.controller.ReplaceAudio`
* `wp.media.controller.MediaLibrary` is used to create new states that want to load a library filtered by type, making it incredibly simple to add states to frames. See `wp.media.view.MediaFrame.VideoDetails` and `wp.media.view.MediaFrame.AudioDetails`.
UX changes:
* Add the ability to manage HTML5 fallbacks - add additional `<source>`s or remove specific `<source>`s
* In the Video Details state, add the ability to select a poster image
See #27016.
Built from https://develop.svn.wordpress.org/trunk@27478
git-svn-id: http://core.svn.wordpress.org/trunk@27322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add `wp.media.mixin`.
* Add `wp.media.audio` and `wp.media.video`.
* Add `wp.media.model.PostAudio` and `wp.media.model.PostVideo`
* Add `wp.media.controller.AudioDetails` and `wp.media.controller.VideoDetails`.
* Add `wp.media.controller.ReplaceAudio` and `wp.media.controller.ReplaceVideo`.
* Add `wp.media.view.MediaFrame.AudioDetails` and `wp.media.view.MediaFrame.VideoDetails`.
* Add `wp.media.view.AudioDetails` and `wp.media.view.VideoDetails`.
* Update the `wpgallery` TinyMCE plugin.
* Display audio and video players in the media modal when shortcode is clicked.
* Provide a UI to edit shortcode attributes in the media modal.
* Provide a UI to replace the `src` media file in an `audio` or `video` shortcode.
See #27016.
Built from https://develop.svn.wordpress.org/trunk@27411
git-svn-id: http://core.svn.wordpress.org/trunk@27258 1a063a9b-81f0-0310-95a4-ce76da25c4cd