Commit Graph

71 Commits

Author SHA1 Message Date
Andrew Ozz
d74a2a9f07 TinyMCE wpView: prevent fatal (security) errors when trying to access iframe.contentWindow in pausePlayers() and unsetPlayers(). See #28905.
Built from https://develop.svn.wordpress.org/trunk@29202


git-svn-id: http://core.svn.wordpress.org/trunk@28986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-17 00:50:15 +00:00
Scott Taylor
c2a7544cd6 Make sure that the ready event only fires once for relevant MCE views that are sandbox'd in iframes. Move some editor callbacks to initialize.
Props avryl.
See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 22:10:16 +00:00
Scott Taylor
69986d87a7 Cleanup after [29179]:
Don't attach nodes to the view instance and check if the iframe still exists before resizing.

Props avryl.
See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 19:32:16 +00:00
Scott Taylor
cd497224a3 Cleanup after [29179]:
* Pause players when media is edited via modal
* Remove players on unind
* Account for failure when an empty node is passed to an `mce.view.View`

See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 18:19:14 +00:00
Scott Taylor
75d3fe3e65 Cleanup after [29179]:
* Cleanup players when the editor is hidden - window scope is unique to each frame
* Add the editor body class to each iframe sandbox
* Remove unneeded code from `wp-mediaelement.js`

See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 16:14:14 +00:00
Scott Taylor
57e966100f Cleanup after [29179]:
* `_WP_Editors::editor_settings()` no longer needs to load MEjs styles
* Make sure each identical shortcode with multiple instances also has an iframe sandbox for each instance
* For the time being, make audio and video shortcodes bypass the loading placeholder to avoid whiplash visually

Props avryl, wonderboymusic.
See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 15:40:14 +00:00
Andrew Ozz
5bef617d04 TinyMCE wpView: handle execCommand when the "fake caret" P is selected, props avryl, see #28595
Built from https://develop.svn.wordpress.org/trunk@29184


git-svn-id: http://core.svn.wordpress.org/trunk@28968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-16 02:19:15 +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
Andrew Ozz
93170e58fa TinyMCE wpView:
- Add loadingPlaceholder() that returns some html to use as placeholder while the view is loading. Includes a subtle CSS based loading animation.
- Fix setContent(), it should empty the element before appending the new node.
- Change getHtml() to always return a string.
Fixes #28761.
Built from https://develop.svn.wordpress.org/trunk@29019


git-svn-id: http://core.svn.wordpress.org/trunk@28807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-07 22:41:15 +00:00
Andrew Ozz
fb559a8095 TinyMCE: improve the way wpViews work. Add two paragraphs and capture the caret in them on clicking before/after/left/right of a view or moving the caret with the arrow keys, then show a "fake" caret.
This makes it much more "natural" to move the caret with the arrow keys and to add paragraphs before a view when it is the first element or after a view when it's last.

Props avryl, see #28595.
Built from https://develop.svn.wordpress.org/trunk@28994


git-svn-id: http://core.svn.wordpress.org/trunk@28782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 03:59:15 +00:00
Scott Taylor
1637dbe164 The MCE view for galleries needs to read wp.media.galleryDefaults.columns after [28990].
See #28693.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 02:06:14 +00:00
Andrew Ozz
5168f9c7c6 Secure embeds in the editor (first run):
- When the user pastes an embeddable http URL, try to get the https embed.
- If an embed provider doesn't support ssl embeds, show a placeholder/error message.
- Revise the way we return error messages.
See #28195, #28507.
Built from https://develop.svn.wordpress.org/trunk@28919


git-svn-id: http://core.svn.wordpress.org/trunk@28718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 05:49:16 +00:00
Scott Taylor
0abf8699f3 Further adjustments after [8364], listen to an editor instance event instead of delegating a body click when attempting to pause all players belonging to a particular MCE view.
Props avryl.
Fixes #27971.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-20 16:30:16 +00:00
Scott Taylor
9834317785 Diambiguate type and shortcode in TinyMCE view classes and their attached view.View class. Has the added feature of not causing JS errors.
See #28532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-18 23:03:15 +00:00
Andrew Ozz
84f3e30f7b wpView: improve handling of embed errors/error messages, see #28195
Built from https://develop.svn.wordpress.org/trunk@28754


git-svn-id: http://core.svn.wordpress.org/trunk@28568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-15 22:53:16 +00:00
Scott Taylor
46a4208f6b Add "edit" mode for [embed] and URL media previews.
See #28532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-13 21:42:15 +00:00
Andrew Ozz
f88149c370 wpView:
- Don't wrap single-line URLs in [embed]. Use them directly in generating a view.
- If the embedding HTML contains a script, "sandbox" it in an iframe to prevent it from changing the editor DOM.
- Automatically add toolbar and overlay when needed.
- Try to embed single-line URLs only if they are pasted in an empty paragraph.
Props avryl, see #28195
Built from https://develop.svn.wordpress.org/trunk@28748


git-svn-id: http://core.svn.wordpress.org/trunk@28562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-12 02:49:16 +00:00
Scott Taylor
d8e57f0148 As per @gcorne's suggestion, when calling wp.mce.views.register(), automatically set shortcode equal to the passed type in the set of default args instead of introducing a type property. It is still overrideable by the args that are passed.
See #28458.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-06 14:22:22 +00:00
Scott Taylor
ce508e95c2 Simplify the creation of MCE views somewhat:
* Rename the `wp.mce.media` mixin (which was named too ambiguously) to `wp.mce.av`.
* Use the same technique for extending mixins for MCE base classes for views and their base.View property class
* `wp.mce.views.register()` should have default constructor logic if one is not passed.

Props avryl.
See #28458.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 17:27:13 +00:00
Scott Taylor
987e9905ac When parsing an [embed] shortcode into a TinyMCE view, don't attempt to append any returned <script>s to the editor's <head>. This affects only a few supported endpoints: Issuu and Twitter.
See #28195.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-27 20:00:15 +00:00
Scott Taylor
89864b4a5a Don't pass embeds through the_content() when trying to render MCE previews, leverage WP_Embed and do_shortcode() instead.
Props kovshenin.
See #28195.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-26 23:43: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
0b1272e445 Persisting <track> elements as the body of a [video] shortcode in MCE Views:
* When generating the view's HTML, ensure that the shortcode's `content` is added to the model
* Add a `PostProcess` event in the `wpview` plugin to properly return the shortcode when the editor mode is toggled, ensuring that elements in the body are not dropped.

Props azaozz, wonderboymusic.
See #27915.



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


git-svn-id: http://core.svn.wordpress.org/trunk@28014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-22 18:21:16 +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
Scott Taylor
fd65d355a2 Add a compatibility layer in wp-playlist.js to avoid VM errors from MediaElement's plugin bridge in the TinyMCE views for playlists by suppressing playback for files whose mime-type is not supported in the user's browser natively.
This is similar to how audio and video shortcodes are handled: file types are whitelisted for native playback.

See #27892.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-20 03:53:15 +00:00
Andrew Nacin
a8cefa836d Graceful failures for TinyMCE views of video/audio playlists.
props gcorne.
fixes #27821.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-16 00:23:15 +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
Andrew Nacin
b00e343a25 Gallery Views: Avoid JS errors when image attachments lack metadata.
props gcorne.
fixes #27691.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 21:25:16 +00:00
Scott Taylor
5a67d92611 Browsers other than Firefox need a timeout when parsing audio and video shortcodes into MCE views.
See [27655].


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


git-svn-id: http://core.svn.wordpress.org/trunk@27817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 15:12:15 +00:00
Dominik Schilling
de2f2f449b Remove trailing whitespace from [27982].
Built from https://develop.svn.wordpress.org/trunk@27984


git-svn-id: http://core.svn.wordpress.org/trunk@27814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 09:03:14 +00:00
Andrew Ozz
1747c112d1 Add a note that wpView is "experimental", see #26959
Built from https://develop.svn.wordpress.org/trunk@27982


git-svn-id: http://core.svn.wordpress.org/trunk@27812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-07 06:59:16 +00:00
Andrew Ozz
c7eb5e7f1f Gallery preview: add a "No items found" state which is displayed when rendering the gallery wpview and no attachments are found. Props gcorne, fixes #27558
Built from https://develop.svn.wordpress.org/trunk@27899


git-svn-id: http://core.svn.wordpress.org/trunk@27730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-02 02:18:15 +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
b6f768bd30 jshint fixes for [27734].
Built from https://develop.svn.wordpress.org/trunk@27750


git-svn-id: http://core.svn.wordpress.org/trunk@27587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 21:41: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
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
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
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
Andrew Ozz
6074dfa272 Update mce-view.js and the wpview TinyMCE plugin, and use them to show gallery previews in the Visual editor, props gcorne, see #26959
Built from https://develop.svn.wordpress.org/trunk@27408


git-svn-id: http://core.svn.wordpress.org/trunk@27255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-05 07:01:14 +00:00
Daryl Koopersmith
b2db6270ee Media: Restore 3.4 editor behavior and remove TinyMCE views.
* Reactivates the `wpgallery` and `wpeditimage` TinyMCE plugins. Deactivates the `wpviews` TinyMCE plugin.
* Moves still-relevant logic from `mce-views.js` to `media-upload.js` and `shortcode.js`.
* No longer include `wp-includes/js/mce-views.js`. This code will not be used in 3.5, and should be considered unstable.
* Currently, this is the real 3.4 experience; as such, editing triggers the old modals. Changing this is the next major step.

When reassessing views, we should look over all of these tickets and anticipate these bugs accordingly.

fixes #21813, #22123, #22155, #22161, #22257, #22266, #22318, #22407, see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-14 07:17:22 +00:00
Daryl Koopersmith
b5ab7bbbc9 Media: Properly insert caption shortcodes for attachments.
git-svn-id: http://core.svn.wordpress.org/trunk@22554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-13 00:32:04 +00:00
Daryl Koopersmith
790464193d Media: Add custom URL as an option to attachment display properties. see #21390, #22206.
git-svn-id: http://core.svn.wordpress.org/trunk@22537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 20:36:46 +00:00
Daryl Koopersmith
944066ef83 Media: Account for a race condition when deleting an edit gallery frame. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 09:57:28 +00:00
Daryl Koopersmith
b9ed8db596 Media: Keep track of gallery display properties in a separate model instead of mixed in with the query parameters. This allows for arbitrary gallery arguments and a more flexible data structure. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 12:37:21 +00:00
Daryl Koopersmith
adf0c7e1a7 Media: When printing a gallery shortcode, hide the implicit orderby value. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 12:14:48 +00:00
Daryl Koopersmith
0c219be45d Media: Output correct link html when inserting attachments. see #21390.
git-svn-id: http://core.svn.wordpress.org/trunk@22499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 10:48:50 +00:00
Daryl Koopersmith
4a008574d2 Media JS: Use basic upload/library by default.
`wp.media` now recognizes the `frame` attribute (currently a string; either'select' or 'post') and defaults to using a basic select frame. It also checks for the existence of classes in a safer fashion, as it does not assume the `MediaFrame` property exists.

see #21390.


git-svn-id: http://core.svn.wordpress.org/trunk@22495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-09 09:59:36 +00:00