Commit Graph

33 Commits

Author SHA1 Message Date
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
Joe McGill
53a58e35b7 Media: Fix MEJS error when removing a media player.
This fixes a bug introduced by the upgrade to MediaElement.js, where code 
calling `wp.media.mixin.removePlayer()` would result in a JS error.

Props rafa8626, afercia.
Fixes #41787.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-06 16:31:54 +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
Weston Ruter
7af3b92736 Media: Upgrade MediaElement.js from 2.22.0 to 4.2.3.
Props rafa8626, grosbouff, westonruter, azaozz, Plastikschnitzer for testing.
See #39686.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-01 04:43:51 +00:00
Dominik Schilling
4693b25171 Update Backbone and Underscore to the latest versions.
Backbone, from 1.1.2 to 1.2.3. Underscore, from 1.6.0 to 1.8.3.

The new versions of Backbone and Underscore offer numerous small bug fixes and some optimizations and other improvements. Check the [http://backbonejs.org/#changelog Backbone changelog] and [http://underscorejs.org/#changelog Underscore changelog] for the full details. 

The new versions include some significant changes that may break existing code. Plugins or themes that rely on the bundled Backbone and/or Underscore libraries should carefully check functionality with the latest versions and run any available unit tests to ensure compatibility.

Some changes of note that were addressed in core as part of this upgrade:

* `_.flatten` no longer works with objects since Underscore.js 1.7. `_.flatten()` working with objects was an unintended side-affect of the implementation, see [https://github.com/jashkenas/underscore/issues/1904#issuecomment-60241576 underscore#1904]. Check any `_flatten` usage and only flatten arrays.
* As of Backbone 1.2.0, you can no longer modify the `events` hash or your view's `el` property in `initialize`, so don't try to modify them there. 
* Since Underscore 1.7, Underscore templates no longer accept an initial data object. `_.template` always returns a function now so make sure you use it that way.

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


git-svn-id: http://core.svn.wordpress.org/trunk@36513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-17 15:22:26 +00:00
Andrew Ozz
5a6be6d431 Media: fix undefined error that prevents showing a preview in the media modal when replacing video or audio.
Fixes #35363.
Built from https://develop.svn.wordpress.org/trunk@36233


git-svn-id: http://core.svn.wordpress.org/trunk@36200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-09 02:22:26 +00:00
Aaron Jorbin
c9307fc95a Update Grunt dev-dependencies
grunt-browserify : minor version update
grunt-contrib-cssmin : minor version update
grunt-contrib-imagemin : patch version update
grunt-contrib-jshint : patch version update
grunt-contrib-uglify : minor version update (causes some changes to minified JS)
grunt-includes : minor version update
grunt-sass : major version update ( underlying libsass update ).

Props wonderboymusic
See #31700


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


git-svn-id: http://core.svn.wordpress.org/trunk@32959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-28 14:51:30 +00:00
Andrew Ozz
4f9682f39e TinyMCE wpView: preserve HTML wrapped in shortcodes.
Fixes #32078.
Built from https://develop.svn.wordpress.org/trunk@32678


git-svn-id: http://core.svn.wordpress.org/trunk@32648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-01 18:09:26 +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
Scott Taylor
afa3a03ff8 Avoid an IE8 JS error when removing a MediaElement player.
Props afercia.
Fixes #31058.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 18:43:27 +00:00
Scott Taylor
952a5c9971 Support chromeless Vimeo via MEjs:
* Bump MediaElement script loader versions to 2.16.2 - missed in [30634], oops!
* Add `Froogaloop` to `js/mediaelement` scripts for Vimeo
* Check for Vimeo in the same locations that YouTube is checked
* Dynamically load Froogaloop script in admin when editing a TinyMCE view
* Edit MediaElement to call `mejs.$.extend` instead of `$.extend` in `mejs.HtmlMediaElementShim.createPlugin()`, since `$` is not available via WP's jQuery (I will report this upstream):
6f9a78e008/src/js/me-shim.js (L631)

Fixes #29267.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-31 20:41:24 +00:00
Scott Taylor
28c22db07d Video:
* Don't set height on responsive `<div>` when generating markup
* Move some CSS rules from the style tag to `.wp-video`
* Use Video Details view event delegation instead of click events delegated from `<body>`
* Fix some CSS rule collision in the grid modal

See #29110.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-09 19:39:15 +00:00
Scott Taylor
e75d42daff Cleanup after [29179]:
* Remove `wp.media.mixin.pauseAllPlayers()` - was only ever intended to be used in MCE views, reaches too far into global scope. Rendered irrelevant since [28364].
* Remove `wp.media.mixin.pausePlayers()` - added in [28364]. MCE views no longer keep track of player instances and call mixin methods, they refer to their child iframes and call MEjs methods on the iframe's `window.mejs.players`. 

See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 19:36:14 +00:00
Scott Taylor
93fdff3581 Simplify creation of audio, video, and playlist MCE views by placing them in iframe sandboxes.
Wins:
* Eliminates duplication of code between PHP and JS
* Views can load JS without messing with TinyMCE and scope
* MEjs doesn't break when it loads a file plugin-mode. This allows any file type the MEjs supports to play in MCE views.
* YouTube now works as the source for video.
* Users can still style the views, editor stylesheets are included in these sandboxes.
* Audio and Video URLs and `[embed]`s are no longer broken.
* Remove the crazy compat code necessary to determine what file types play in what browser.
* Remove unneeded Underscore templates.
* Remove the compat code for playlists.

See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-15 22:18:14 +00:00
Scott Taylor
57dbc55e6e When setting the poster image for a video shortcode, set that image as the featured image for that attachment (if found) in the background. This AJAX functionality could be used for audio as well.
Introduces `attachment_url_to_postid()` to attempt to turn URLs into post IDs.

Fixes #27891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:48:17 +00:00
Helen Hou-Sandí
63f9cbd02a Media grid, round 2. Expect much more to come.
* Instead of a sidebar for details, utilize a modal. The modal experience allows for a larger preview, editing images, audio/video previews, and previous/next navigation, like the theme browser. Think of it as an attachment browser.
* Show some details in the grid view to more easily distinguish items.

props ericlewis, wonderboymusic, JerrySarcastic. see #24716.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 03:39:15 +00:00
Scott Taylor
9181f36b7e Add IE11 to the browser whitelist for MediaElement-based MCE views.
Props azaozz.
Fixes #28742.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 01:10:15 +00:00
Scott Taylor
aeadf0c7cf Allow users to set overrides for MediaElement instances by always passing _wpmejsSettings instead of just _wpmejsSettings.pluginPath.
Props Otto42 for the initial patch.
Fixes #25243.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-11 06:25:15 +00:00
Scott Taylor
37b7f39e95 When pausing "all" players attached to MCE views, don't reach into global scope and pause "every" player. Only pause the players bound to MCE views.
Fixes #27971.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-11 02:07:14 +00:00
Scott Taylor
f22beb987c First pass at wpview logic for the [embed] shortcode. URLs on a their own line are parsed as well. The toolbar will appear with the "remove" button when the view is clicked. Edit has not been implemented yet.
Props avryl, wonderboymusic.
See #28195.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-10 23:36:18 +00:00
Scott Taylor
55becc0dfd Refinements for asynchronous rendering in wp.mce.media.PlaylistView:
* Add `visibility: hidden` as an inline style to `<audio>` tags, there is a race with the stylesheet which can get enqueued in the body and loaded in the footer.
* When creating new instances of `MediaElementPlayer`, always push them onto a stack. Lone views can be responsible for multiple instances of the same shortcode on render.
* Rename `wp.media.mixin.unsetPlayer()` to `wp.media.mixin.unsetPlayers()` to reflect the above.
* Call `wp.media.mixin.unsetPlayers()` on the view's `unbind()` method, instead of inline in the `render()` method
* Make sure `WPPlaylistView` is instantiated for each editor instance
* Ensure that the `No Items Found` view state is not rendered when attachments actually do exist.

Props gcorne, wonderboymusic.
See #27899.



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


git-svn-id: http://core.svn.wordpress.org/trunk@28013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-22 17:53:16 +00:00
Andrew Ozz
191dd168c1 TinyMCE wpViews:
- Prevent undo steps from being added when the body of a wpview changes.
- Add unbind() to handle cleanup on DOM rebuilding in TinyMCE.
- Ensure that MediaElement's cleanup routine is run on every player in all instances of the editor.
- Initialize the players after some delay to ensure CSS is loaded.
Props gcorne and wonderboymusic, fixes #27389
Built from https://develop.svn.wordpress.org/trunk@28084


git-svn-id: http://core.svn.wordpress.org/trunk@27915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-12 00:46:14 +00:00
Scott Taylor
2c88f6e941 [27640] supported a caption for audio and video shortcodes as part of a UX iteration for the related MCE views. These captions have since be excluded, so the extra code should be removed (it was there for this sole reason).
See #27320.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 06:13:18 +00:00
Scott Taylor
ff6c0731fa Move counting of attachments for audio/video to the backend, instead of using a reduce function in JS.
See #27554.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 18:16:16 +00:00
Scott Taylor
4f868ad882 There is no more video-playlist shortcode. To use video, it is now [playlist type="video" ....]. Also deleting core playlist styles. The style attribute is still supported, defaulting to light. Our core style support was 4-5 CSS rules.
See #27552. Leaving open for comments and potential bugs.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 17:58:15 +00:00
Scott Taylor
eddc48def7 Don't make mce-view a dependency for media-audiovideo. Make media-audiovideo and wp-playlist dependencies for mce-view and only enqueue mce-view in the admin in wp_enqueue_media(). MCE views don't need to be included when media is loaded on the front end.
Fixes #27509.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 12:11:14 +00:00
Scott Taylor
86f4061b26 When an HTML5 fallback button is pressed in the Audio or Video Details state, filter the library by that specific mime-type when the Add Audio|Video Source is activated.
See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-23 03:16:14 +00:00
Scott Taylor
410646fc52 General code cleanup and improving video sizing in the admin:
* Abstract the setting of a primary button and its callback in `wp.media.view.MediaFrame.MediaDetails`
* Account for the existence or non-existence of `$content_width` in the TinyMCE views for video
* Make sure video models always have dimensions, even if they are the defaults
* For browsers that are not Firefox, don't use a timeout when setting the `MediaElementPlayer` instance in TinyMCE views

See #27320.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 23:26:17 +00:00
Scott Taylor
615dd5331b Unifying media controls and supporting playlists in the editor:
* Support a `caption` attribute for audio and video shortcodes
* In `wp.media.audio|video`, rename `update` to `shortcode` to allow these models to share the same mixins as `wp.media.collection` subclasses
* When sending an audio or video shortcode to the editor, create a default caption if the user hasn't entered one. This currently only displays in the editor, not on the front end. Captions aren't tied to a specific attachment here because external sources are supported.
* In the `wp.mce.media` mixin, in the `edit` method, read `attr` instead of `data` when attempting to parse the encoded shortcode. `data` does not automatically update when the attribute changes. This was a blessing to debug.
* Add `wp.mce.media.PlaylistView` to support playlist views in TinyMCE
* Expose `WPPlaylistView` to global scope and suppress auto-parsing of playlist nodes when in the admin. Allow `WPPlaylistView` to be passed `metadata` on creation instead of requiring a JSON blob to be parsed.
* Remove all of the playlist logic from the `wpgallery` TinyMCE plugin.
* In `wp_prepare_attachment_for_js()` return more data for audio/video so that playlists can have parity in the admin/front end.

See #27320.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 13:33:14 +00:00
Scott Taylor
bcb54794ff Move wp.media.view.MediaDetails to media-audiovideo.js. This should have moved over with the rest.
See [27608].


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


git-svn-id: http://core.svn.wordpress.org/trunk@27474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 02:45:15 +00:00
Scott Taylor
7ad4205f70 Add MCE views for audio and video shortcodes. When the shortcode does not contain a source that supports native playback, just show the filename.
* Remove the audio/video shortcode parsing from the `wpgallery` plugin.
* Make `mce-view` a dependency of `media-audiovideo`
* Introduce `wp.mce.video`, `wp.mce.audio`, `wp.mce.media`, and `wp.mce.media.View`
* Rename `wp.media.audio|video.shortcode()` to `wp.media.audio|video.update()` since it is called on Update and returns a `wp.shortcode` object now.
* In `wp.mce.View.render()`, fire a `ready` event when the placeholder is being parsed and pass the current node to the event handler.

See #27389, #27437.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 07:02:15 +00:00
Scott Taylor
a17dd704c4 Create a new file, media-audiovideo.js, to house all of the audio and video JS code in core.
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
2014-03-19 05:31:15 +00:00