Commit Graph

2035 Commits

Author SHA1 Message Date
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
Dominik Schilling
21158f33f7 Widget Customizer: Fix 'WidgetCustomizerPreview' is undefined error in IE8/9.
* Move `WidgetCustomizerPreview` to `wp.customize.WidgetCustomizerPreview`
* Move `WidgetCustomizerPreview_exports` to export_preview_data()
* Use `_wpWidgetCustomizerPreviewSettings` to transfer settings to `wp.customize.WidgetCustomizerPreview`

see #27485.
Built from https://develop.svn.wordpress.org/trunk@27653


git-svn-id: http://core.svn.wordpress.org/trunk@27496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 21:04:15 +00:00
Dominik Schilling
04cb00c9e1 Customizer: Use the _.now() function from Undescore.js for the current timestamp. Date.now() isn't supported in IE8.
fixes #27477.
Built from https://develop.svn.wordpress.org/trunk@27651


git-svn-id: http://core.svn.wordpress.org/trunk@27494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-22 10:54:14 +00:00
Scott Taylor
4ad3972f74 Fixes for jshint
Built from https://develop.svn.wordpress.org/trunk@27643


git-svn-id: http://core.svn.wordpress.org/trunk@27486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 22:27:15 +00:00
Scott Taylor
00924f6275 Add JSDoc blocks to media-audiovideo.js.
See #27016.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 22:23:15 +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
Andrew Ozz
e05fa407bf wpView: select/deselect views when moving the caret with the arrow keys, don't move the caret after deselect(), props gcorne, see #26959
Built from https://develop.svn.wordpress.org/trunk@27632


git-svn-id: http://core.svn.wordpress.org/trunk@27475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 02:48: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
Helen Hou-Sandí
bef7f9e75e Further unify and refine media and view control styling. see #27320.
Built from https://develop.svn.wordpress.org/trunk@27628


git-svn-id: http://core.svn.wordpress.org/trunk@27471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-20 00:48:15 +00:00
Andrew Nacin
30fd56b3dc Only enqueue the image editor in the media modal in the admin.
props gcorne.
see #21811.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 21:16:14 +00:00
Helen Hou-Sandí
7ede169d47 Ensure the media library spinner hides when displaying a cached result set. props kovshenin. see #24859.
Built from https://develop.svn.wordpress.org/trunk@27621


git-svn-id: http://core.svn.wordpress.org/trunk@27464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 18:27:15 +00:00
Andrew Nacin
deb8779af5 More translation cleanups.
Affects widgets (see #27112), custom headers (see #21785), theme installer (see #27055, reverts [27614]), and some media stuff. Untranslates some complicated strings that need additional study.

see #27453.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 08:18:14 +00:00
Scott Taylor
8a50510c0a JSHint fix for [27608].
Built from https://develop.svn.wordpress.org/trunk@27619


git-svn-id: http://core.svn.wordpress.org/trunk@27462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 07:24:16 +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
Andrew Ozz
ee6d178f15 TinyMCE: update to 4.0.20, see #24067
Built from https://develop.svn.wordpress.org/trunk@27603


git-svn-id: http://core.svn.wordpress.org/trunk@27446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 04:46:15 +00:00
Andrew Ozz
4428dc3b7c TinyMCE show/hide toolbar row: fix the value for getUserSetting('hidetb'): 0 == hidden, 1 == visible, see #24067
Built from https://develop.svn.wordpress.org/trunk@27602


git-svn-id: http://core.svn.wordpress.org/trunk@27445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 02:30:15 +00:00
Andrew Ozz
c2a5748582 wpView: don't overlap floated elements, see #26959
Built from https://develop.svn.wordpress.org/trunk@27601


git-svn-id: http://core.svn.wordpress.org/trunk@27444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 01:16:15 +00:00
Dominik Schilling
a96b9c80b5 Widget Customizer: Remove unused vars.
see #27112.
Built from https://develop.svn.wordpress.org/trunk@27588


git-svn-id: http://core.svn.wordpress.org/trunk@27431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 18:35:16 +00:00
Dominik Schilling
64af78ca43 Widget Customizer: Restore highlighting of widgets in preview.
props westonruter.
see #27358.
Built from https://develop.svn.wordpress.org/trunk@27584


git-svn-id: http://core.svn.wordpress.org/trunk@27427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 15:21:15 +00:00
Andrew Ozz
41c747f4c1 wpView:
- Makes sure that the editor is focused when clicking on a wpview.
- When a view is the first or last node in the editor and a click on the area around the view adds a new paragraph, deselect the wpview so that the new paragraph is properly focused.
- When navigating via keyboard, select or deselect wpviews as appropriate.
Props gcorne, see #26959
Built from https://develop.svn.wordpress.org/trunk@27582


git-svn-id: http://core.svn.wordpress.org/trunk@27425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 04:57:14 +00:00
Andrew Ozz
c8ecc9f07a TinyMCE gallery preview: fix editing the same gallery multiple times. Instead of .data() use .attr('data-...'), jQuery caches the former. Props gcorne, see #26959
Built from https://develop.svn.wordpress.org/trunk@27581


git-svn-id: http://core.svn.wordpress.org/trunk@27424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 03:48:15 +00:00
Andrew Ozz
46a471489e TinyMCE gallery preview: fix errors when an image doesn't have/is smaller than thumbnail size, props gcorne, see #26959
Built from https://develop.svn.wordpress.org/trunk@27580


git-svn-id: http://core.svn.wordpress.org/trunk@27423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 03:25:14 +00:00
Andrew Ozz
a322a0cd3d TinyMCE: move the caption and gallery toolbars to the right, fix selected gallery border/outline, see #27320
Built from https://develop.svn.wordpress.org/trunk@27579


git-svn-id: http://core.svn.wordpress.org/trunk@27422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 02:30:15 +00:00
Andrew Ozz
402f48ca15 TinyMCE:
- Update the styling of the image caption and gallery toolbars.
- Fix issue where the hidden clipboard div in wpView.
- Switch to using the pencil dashicon for Edit.
- Add `max-width: 100%;` to images in the gallery preview and adjust column widths.
Props cramdesign, mattheu, gcorne, melchoyce, see #27320, fixes #27376, fixes #27354

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


git-svn-id: http://core.svn.wordpress.org/trunk@27421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-18 00:20:15 +00:00
Andrew Ozz
513b6992e5 Restyle the plugin install details modal to match the rest of the admin. Props avryl and paulwilde for initial mockup, see #26952
Built from https://develop.svn.wordpress.org/trunk@27559


git-svn-id: http://core.svn.wordpress.org/trunk@27402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-16 18:28:17 +00:00
Andrew Ozz
08663710cb TinyMCE: add internal command and shortcut (Alt+Shift+X) for toggling <code>. Define a button that can be added to any toolbar as wp_code. See #6113
Built from https://develop.svn.wordpress.org/trunk@27545


git-svn-id: http://core.svn.wordpress.org/trunk@27388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 22:43:16 +00:00
Scott Taylor
e1fee3abc6 MCE Views: don't (re-)render views if the format of the content is "raw" to avoid adding additional undo levels on undo/redo.
Props gcorne.
Fixes #27416.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:41:15 +00:00
Scott Taylor
12034fcc59 In wp.media.mixin, add ua and a compat map to separate and clarify browser detection and support. Leverage Underscore list iterators in isCompatible().
See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 20:26:15 +00:00
Scott Taylor
bd4085fac3 The canPlayType property for audio and video in JS is so bad that the official valid responses are "probably" and "maybe". There are many cases where we might want to know if an audio|video tag is gonna blow up in our face before even attempting to make a MediaElementPlayer instance out of it.
The best (and most cautious) way to tackle this is to whitelist types by browser. Imagine that one implemented MEjs in TinyMCE's rich editor mode, this would be very helpful.

Add `isCompatible( $media )` to `wp.media.mixin`. Future features will use this.

See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 14:36:14 +00:00
Scott Taylor
117d1bd31e Move removePlayer() and unsetPlayer() to wp.media.mixin so that other classes can take advantage of them.
* `removePlayer()` is an alternative to MediaElement's player removal method that does not re-add the audio|video element back to the DOM.
* `unsetPlayer()` will check for an existing `player` property on the passed instance and pause all players before calling `unsetPlayer()`

See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 13:48:15 +00:00
Scott Taylor
9432aaca82 Rather than extending wp.media.mixin, only borrow coerce when necessary in wp.media.audio|video|collection. wp.media.mixin will make sense to be mixed in for classes that expect to interact with the player. More universal methods can be added and inherited by all those who extend their prototype with it.
Assuming someone had implemented players in the editor, pause all players when switching between editor tabs. A method, `pauseAllPlayers`, has been added to `wp.media.mixin`.

See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27380 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 13:17:16 +00:00
Scott Taylor
608177d39b In media.model.PostMedia, for these 2 scenarios:
* `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
2014-03-14 13:00:14 +00:00
Scott Taylor
56b919e651 Make media.view.VideoDetails.prepareSrc a static class method instead of an instance method. Properly pairs it with its incrementing instances property.
See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 12:43:15 +00:00
Scott Taylor
e47bc77616 Load MediaElement's CSS when TinyMCE is loaded via $mce_css in editor_settings(). Add some baseline styles in wp-content.css for audio, video, and embed tags to ensure their max-width is 100%, regardless of whether MEjs is implemented in TinyMCE.
See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 12:34:16 +00:00
Andrew Ozz
93ec80e732 Modals: darken all overlays, update all box-shadows and headings, correct thickbox styling, make the link modal narrower and bring back the animation (css transition). Props avryl, see #26952
Built from https://develop.svn.wordpress.org/trunk@27532


git-svn-id: http://core.svn.wordpress.org/trunk@27375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 05:55:16 +00:00
Andrew Ozz
1ebf6bc9ee Drag/drop upload: don't trigger on "local" dragging, hide the overlay on click. Props kovshenin, fixes #19845
Built from https://develop.svn.wordpress.org/trunk@27531


git-svn-id: http://core.svn.wordpress.org/trunk@27374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-14 00:42:14 +00:00
Scott Taylor
b4569b69dc Revert [27528] until Flash in Firefox behaves :(
See #27389.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 23:39:16 +00:00
Scott Taylor
ba84f57083 Add MCE Views for audio and video. Please clear your browser cache so that you get the latest TinyMCE stylesheet.
* 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
2014-03-13 23:10:14 +00:00
Scott Taylor
a945b2738f Add a class property to wp.media.view.MediaDetails called instances that is incremented every time the class is invoked. This mimics what happens in the shortcodes: the sources receive an incremented cache-buster so that the browser won't ignore the file when preload="metadata" is set.
See #26779.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 03:55:15 +00:00
Scott Taylor
8705921741 In wp.media.view.AttachmentFilters, when creating its inner HTML content, pass filter.text via .html( str ) instead of .text( str ) to allow more formatting options.
Props tlovett1.
Fixes #25010.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 03:19:15 +00:00
Helen Hou-Sandí
326f49688f Ensure the correct model is selected when editing an image from gallery mode. props gcorne. fixes #27363.
Built from https://develop.svn.wordpress.org/trunk@27517


git-svn-id: http://core.svn.wordpress.org/trunk@27360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-12 22:05:15 +00:00
Helen Hou-Sandí
9aafd2294d Smooth out some display and race condition issues with the media modal loading spinner. props kadamwhite, gcorne. see #24859.
Built from https://develop.svn.wordpress.org/trunk@27516


git-svn-id: http://core.svn.wordpress.org/trunk@27359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-12 21:07:14 +00:00
Andrew Ozz
2a7918390b TinyMCE modals: re-enable the Close button in charmap, fix arrows in listboxes, add and position dashicons to the menu (when visible), see #26952
Built from https://develop.svn.wordpress.org/trunk@27513


git-svn-id: http://core.svn.wordpress.org/trunk@27356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-12 08:19:14 +00:00
Andrew Ozz
d1008b2dfe wpLink: bring back the Cancel link, improve responsive styles, see #26952
Built from https://develop.svn.wordpress.org/trunk@27510


git-svn-id: http://core.svn.wordpress.org/trunk@27353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-12 03:07:15 +00:00
Andrew Nacin
69ccc8b53d JS linting for [27497].
see #21785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-11 04:20:14 +00:00
Andrew Nacin
a589d9d757 Add header image uploads with cropping to the customizer.
props mcsf, ehg, gcorne.
see #21785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-11 04:13:16 +00:00
Andrew Ozz
05e23f7506 wpLink: stop using UI dialog, restyle the modal, add better responsive behaviour.
Fix UI dialog styling to match the rest of the admin styling.
Props avryl, see #26952
Built from https://develop.svn.wordpress.org/trunk@27494


git-svn-id: http://core.svn.wordpress.org/trunk@27336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-11 00:04:14 +00:00
Scott Taylor
394feb8f91 Add a class, wp-playlist-playing, to the currently loaded track when tracks are displayed. Add some subtle styles for light and dark playlist themes.
See #27321.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-10 00:15:14 +00:00
Scott Taylor
f078f3e10e Video editing in the media modal:
* Add a state: `Add Subititles`
* Add `text/vtt` to the list of allowed mime-types, files end in `.vtt`. `.srt` files are served as `text/plain`.
* The content body of a video shortcode should be used for adding `<track>` elements only. This happens dynamically in the modal. If added by hand, they can still be parsed and managed.

See #27016.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-09 10:32:15 +00:00