Commit Graph

110 Commits

Author SHA1 Message Date
Ella Iseulde Van Dorpe
00e4f35300 TinyMCE: wpviews: cache iframe heights
Cache iframe heights per instance so it can be reused. This will prevent to content from moving in the editor when undoing or redoing changes.

Fixes #32593.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-08 21:32:27 +00:00
Ella Iseulde Van Dorpe
e9ac7f5164 TinyMCE: views: fix typo in createInstance
This prevented instances from being reused.

Fixes #32591.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-08 19:54:25 +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
Andrew Ozz
60706015e1 Revert editing of video embed parameters in the media modal, [31620] and [31626] for now. Plan on revisiting in 4.3.
Props iseulde. Fixes #31139, fixes #32006.
Built from https://develop.svn.wordpress.org/trunk@32258


git-svn-id: http://core.svn.wordpress.org/trunk@32229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 22:41:26 +00:00
Andrew Ozz
f003efc8aa TinyMCE wpView: ensure contentNode is passed to all callbacks.
Props iseulde. Fixes #31669.
Built from https://develop.svn.wordpress.org/trunk@32255


git-svn-id: http://core.svn.wordpress.org/trunk@32226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-21 18:36:24 +00:00
Andrew Ozz
541573b378 TinyMCE wpView: resize sandbox iframes on load. Fixes a problem with resizing after all images are loaded.
Props iseulde, mattheu. Fixes #31480.
Built from https://develop.svn.wordpress.org/trunk@32056


git-svn-id: http://core.svn.wordpress.org/trunk@32035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-06 18:55:28 +00:00
Andrew Ozz
0186bbcb95 TinyMCE wpView:
- Fix editor undo levels.
- Remove views and markers in the DOM before serialization.
- Unbind views before removing them on hide.
- Empty the content in the timeout, so it doesn't render iframes twice.
Props iseulde. Fixes #31669.
Built from https://develop.svn.wordpress.org/trunk@32022


git-svn-id: http://core.svn.wordpress.org/trunk@32001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-04 23:00:26 +00:00
Andrew Ozz
c545c63606 TinyMCE: always focus the editor after using the floated toolbar.
Props iseulde. Fixes #30619.
Built from https://develop.svn.wordpress.org/trunk@31972


git-svn-id: http://core.svn.wordpress.org/trunk@31951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 21:50:27 +00:00
Andrew Ozz
036f131b14 TinyMCE wpViews: fix typos in the conditional checking which stylesheets to import.
Props mattheu. See #31464.
Built from https://develop.svn.wordpress.org/trunk@31757


git-svn-id: http://core.svn.wordpress.org/trunk@31738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-12 20:08:27 +00:00
Andrew Ozz
04494a6c32 TinyMCE wpViews: always import the non-default editor styles in the sandbox iframe in views.
Props iseulde, mattheu. Fixes #31464.
Built from https://develop.svn.wordpress.org/trunk@31742


git-svn-id: http://core.svn.wordpress.org/trunk@31723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-12 01:05:54 +00:00
Andrew Ozz
b5f1514b54 TinyMCE: improve setting of the sandboxing iframe inside a view.
Props mattheu, iseulde. Fixes #31412.
Built from https://develop.svn.wordpress.org/trunk@31740


git-svn-id: http://core.svn.wordpress.org/trunk@31721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 23:53:26 +00:00
Andrew Ozz
cb185ed5bc TinyMCE wpViews: use the real attribute value instead of the cached jQuery data. Fixes updating of the wpView text strings.
Props iseulde. Fixes #31601.
Built from https://develop.svn.wordpress.org/trunk@31731


git-svn-id: http://core.svn.wordpress.org/trunk@31712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 22:40:28 +00:00
Andrew Ozz
6e14ff9234 TinyMCE:
- Abstract the code for creating floating toolbars.
- Introduce `editor.wp` namespace to hold exported methods from our plugins.
- Create the wpView toolbar(s) with the new method. This makes them work the same as the image toolbar: shortcuts, esc key, etc.
Props iseulde. See #30619.
Built from https://develop.svn.wordpress.org/trunk@31725


git-svn-id: http://core.svn.wordpress.org/trunk@31706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-11 19:12:28 +00:00
Andrew Ozz
15ec9441cb TinyMCE wpView: decode HTML entities before trying to match the wpView text string. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31689


git-svn-id: http://core.svn.wordpress.org/trunk@31670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 19:09:27 +00:00
Andrew Ozz
f02a17e2a1 TinyMCE wpView: improve unbinding of mutationObserver in nested iframes. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31667


git-svn-id: http://core.svn.wordpress.org/trunk@31648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 16:53:27 +00:00
Andrew Ozz
36610e072b TinyMCE wpView: revert decoding of HTML entities. Doesn't work in old IE and needs to be more selective. Keep the change from .html() to .text() when getting the content of a node. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31621


git-svn-id: http://core.svn.wordpress.org/trunk@31602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 12:36:28 +00:00
Scott Taylor
cc953717b7 Allow inline editing of width and height parameters while previewing an embed in the media modal:
* Use `wp.shortcode()` instead of manually constructing a shortcode in `views/embed/link`
* Allow a URL to transition to a shortcode (and vice versa) when returning an embed to TinyMCE
* In `WP_Embed`, store the last URL and last set of attributes requested in class properties
* `wp_ajax_parse_embed()`, allow `[embed]`s to have attributes. Return `attr` in the response.

This is a first pass to allow broad testing with recent MCE view changes. 

See #31139.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-05 06:00:26 +00:00
Andrew Ozz
810df170e7 TinyMCE wpView: decode HTML entities before trying to insert view markers. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31612


git-svn-id: http://core.svn.wordpress.org/trunk@31593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-04 20:35:27 +00:00
Andrew Ozz
5aae51144d TinyMCE wpView: update the "update" method. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31586


git-svn-id: http://core.svn.wordpress.org/trunk@31567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 22:29:26 +00:00
Andrew Ozz
a226da32d3 TinyMCE: wpView improvements: introduce getText() and remove() methods, improved getInstance(), better docs. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31559


git-svn-id: http://core.svn.wordpress.org/trunk@31540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-26 19:32:24 +00:00
Andrew Ozz
5f27c59f49 TinyMCE: wpView improvements: remove the (obsolete) get/setViewText methods. Update stopping/pausing of multiple ME media players. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31548


git-svn-id: http://core.svn.wordpress.org/trunk@31529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-26 00:31:31 +00:00
Andrew Ozz
b799bd8e33 TinyMCE: wpView improvements:
- Better structure, simpler "view" registration, better extensibility.
- Better inline documentation.
- Don't show a placeholder for pasted link until we know the link is "embeddable'.
And many more improvements. Props iseulde. See #31412.
Built from https://develop.svn.wordpress.org/trunk@31546


git-svn-id: http://core.svn.wordpress.org/trunk@31527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 23:13:25 +00:00
Andrew Ozz
0fa4845eec TinyMCE wpView: don't insert nested paragraphs when inserting embeddable URLs. Props iseulde, fixes #29526.
Built from https://develop.svn.wordpress.org/trunk@31485


git-svn-id: http://core.svn.wordpress.org/trunk@31466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-20 23:17:27 +00:00
Andrew Ozz
5715db82d4 TinyMCE wpView: fire nodeChanged when an embedded iframe is resized so we can adjust the editor height and other UI components. Props iseulde, fixes #30646.
Built from https://develop.svn.wordpress.org/trunk@31466


git-svn-id: http://core.svn.wordpress.org/trunk@31447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-15 18:19:27 +00:00
Helen Hou-Sandí
fa053ea65b MCE views: Always refresh the view after updating a gallery.
This allows things like caption changes to be synced, as they are tied to the attachment and not the shortcode.

props iseulde.
fixes #31239.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-05 20:12:22 +00:00
Andrew Ozz
d16c8cf1fc TinyMCE: update the wpView toolbar to look the same as the new image toolbar.
Fixes #30561.
Built from https://develop.svn.wordpress.org/trunk@30694


git-svn-id: http://core.svn.wordpress.org/trunk@30684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 00:26:22 +00:00
Scott Taylor
f60e85b0e4 When creating audio and video MCE views, listen to the players within each iframe to capture the "play" event. When a player plays, pause the players in every other iframe sandbox.
Fixes #29384.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 08:45:22 +00:00
Scott Taylor
75d347b259 Add size to the UI for Gallery Settings in the media modal. Ensure that the TinyMCE view is refreshed when size changes.
Props richardmtl, noplanman, wonderboymusic.
Fixes #18143.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29551 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 03:45:16 +00:00
Andrew Ozz
c59604e137 TinyMCE wpView: fix 'undefined' head when not adding more stylesheets to the sandbox iframe, fixes #29399
Built from https://develop.svn.wordpress.org/trunk@29649


git-svn-id: http://core.svn.wordpress.org/trunk@29423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-27 18:23:18 +00:00
Scott Taylor
149346ff6e MCE View sandboxes:
* Use a `MutationObserver` to listen to the `body` class of the parent editor frame.
* In `wpview_media_sandbox_styles()`, only return the MEjs stylesheets.
* In `wp_ajax_parse_media_shortcode()` and `wp_ajax_parse_embed()`, return an object instead of an HTML blob to allow passing `body` and `head` separately	

Props avryl, azaozz.
Fixes #29048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29389 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-26 04:46:15 +00:00
Andrew Ozz
61292620c5 Editor scrolling:
- Pin the TinyMCE statusbar (elements path) to the bottom.
- Add support for pinning the menu when present.
- Add borders from CSS.
- Optimize getting most elements outerHeight.
Part props avryl, fixes #29293, see #28328.
Built from https://develop.svn.wordpress.org/trunk@29579


git-svn-id: http://core.svn.wordpress.org/trunk@29353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-24 05:11:16 +00:00
Andrew Ozz
42258a6d89 TinyMCE wpView: fix showing errors for non-embeddable URLs, no-ssl or no items. Props avryl, fixes #29114, see #29268.
Built from https://develop.svn.wordpress.org/trunk@29577


git-svn-id: http://core.svn.wordpress.org/trunk@29351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-22 18:55:15 +00:00
Andrew Ozz
5545f24b4f TinyMCE wpView: prevent errors when pasting multiple non-embeddable URLs, props avryl, fixes #29268
Built from https://develop.svn.wordpress.org/trunk@29571


git-svn-id: http://core.svn.wordpress.org/trunk@29345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-22 00:14:17 +00:00
Andrew Ozz
51b307bcd3 TinyMCE wpView: add sandbox iframe body styling to get proper height when resizing the iframe, fixes #29270.
Built from https://develop.svn.wordpress.org/trunk@29544


git-svn-id: http://core.svn.wordpress.org/trunk@29320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-19 22:20:15 +00:00
Andrew Ozz
afdb25bd56 TinyMCE wpView sandbox iframes:
- Make them transparent.
- Don't load tons of unrelated styles that can break them. This could result in minimal styling mismatch to the front-end, but keeps the views working well and looking good.
Props avryl, fixes #29048.
Built from https://develop.svn.wordpress.org/trunk@29543


git-svn-id: http://core.svn.wordpress.org/trunk@29319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-19 21:53:15 +00:00
Scott Taylor
36e4e9917b wpviews: whenever a view is updated or inserted, don't refresh ALL of the views.
Props avryl.
Fixes #28788.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-18 03:59:17 +00:00
Andrew Ozz
ac463e5c71 TinyMCE wpView: add small delay before inserting wpview sandbox iframes into the DOM. Fixes a problem in Firefox that may prevent rendering them. Fixes #29241.
Built from https://develop.svn.wordpress.org/trunk@29513


git-svn-id: http://core.svn.wordpress.org/trunk@29290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-17 03:43:18 +00:00
Andrew Ozz
2f4bd918b2 TinyMCE: fix the 'editimage' plugin for touch devices. Better attempt to hide the onscreen keyboard when the media modal opens and TinyMCE is in focus. See #28595, #29166
Built from https://develop.svn.wordpress.org/trunk@29471


git-svn-id: http://core.svn.wordpress.org/trunk@29249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-12 04:27:18 +00:00
Andrew Ozz
c40feac4d9 wpView: consolidate pausePlayers() and unsetPlayers(), they are almost the same. Prevent errors when instead of a player ME.js shows only a "Download File" placeholder (in IE). See #28905.
Built from https://develop.svn.wordpress.org/trunk@29272


git-svn-id: http://core.svn.wordpress.org/trunk@29054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-22 21:49:16 +00:00
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