Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#28929 closed defect (bug) (invalid)

mce-view is now dependant on iframe mode, not inline mode

Reported by: programmin Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.0
Component: Editor Keywords:
Focuses: javascript Cc:


In the current nightly build of 4.0, pausePlayers function is presuming it's being used in iframe mode, not inline mode:

pausePlayers: function() {
				this.getNodes( function( editor, node, content ) {
					var p, win = $( 'iframe', content ).get(0).contentWindow;

					if ( win && win.mejs ) {
						for ( p in win.mejs.players ) {

There is no iframe in inline mode, this causes fatal exception and no shortcode views are properly shown when initialized in inline mode.

This problem doesn't exist in 3.9.1.

Change History (6)

#1 @programmin
6 years ago

Why not use editor.getWin()? This returns the window of inner iframe in iframe mode, or the window of document it resides in in inline mode. Also, what is the benefit of .get(0), is that the same as $(something)[0]?

#2 @iseulde
6 years ago

Do you mean inline audio views vs iframed views, or inline editor vs iframed editor? Are you extending wp.mce.av? We're not looking for the editor iframe there, but for the view iframe. If you get a fatal error, something else must have gone wrong so that there are no view iframes.

editor.getWin() returns the editor window, that's not what we need here. And yes .get(0) is the jQuery way of doing [0]. It does exactly the same.

#3 @programmin
6 years ago

Are you saying all wp-views must now be iframes, within the mce-editor area?

In MCE4 iframe around contents is not required - in many use cases the inline mode is better, inherits page styling. Look at that inline example - no iframes: http://www.tinymce.com/tryit/inline.php

If this is the problem, getWin would be the equivalent here:

jQuery('iframe')[0].contentWindow === tinymce.activeEditor.getWin()

result: true!

#4 @iseulde
6 years ago

No not all of them are iframes. Audio and video must me sandboxed, and some embeds like tweets too.
I know it's possible to use TinyMCE without an iframe, I've used that for the front-end editor.
We can't do anything with editor.geWin() here, we need the the windows form the iframed views...
Where exactly are you using the inline mode? We've not tested wpviews at all for that. For now it's only meant to be used in the main editor.

#5 @programmin
6 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I hadn't seen this problem recently

#6 @SergeyBiryukov
6 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.