Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42416 closed defect (bug) (fixed)

Code assumes iframe mode, exception in inline mode

Reported by: programmin's profile programmin Owned by: westonruter's profile westonruter
Milestone: 4.9.2 Priority: normal
Severity: normal Version: 4.9
Component: TinyMCE Keywords: has-patch commit fixed-major
Focuses: javascript Cc:

Description

In 4.9 RC the editor has this in wp-includes/js/mce-view.js:

			// Obtain the target width for the embed.
			if ( self.editor ) {
				maxwidth = self.editor.iframeElement.clientWidth - 20; // Minus the sum of horizontal margins and borders.
			}

This should probably be editor.bodyElement when an editor is in [inline https://www.tinymce.com/docs/demo/inline/] mode not the iframed mode.

self.editor.iframeElement causes an exception.

Possibly somewhat related to https://core.trac.wordpress.org/ticket/28929 but I hadn't noticed that problem recently.

Attachments (1)

42416.diff (476 bytes) - added by aduth 7 years ago.

Download all attachments as: .zip

Change History (16)

#1 @westonruter
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.9

#2 @westonruter
7 years ago

  • Keywords reporter-feedback added

@programmin can you provide an example for how inline mode could be forced the editor?

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

#4 @westonruter
7 years ago

I understand TinyMCE has an inline mode, but can TinyMCE _for the WP editor_ get the inline mode? Sample code to do this would be appreciated.

#5 @programmin
7 years ago

The Wordpress post editor on wp-admin is not the only place you can include the wp editor. When you use inline mode that js file causes exception and this started on 4.9 testing.

#6 @westonruter
7 years ago

@programmin Please provide some sample code for demonstrating this.

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


7 years ago

#8 @jbpaul17
7 years ago

  • Milestone changed from 4.9 to 4.9.1

Per today's 4.9 bug scrub, we're punting this from 4.9 to 4.9.1 to allow for appropriate time for feedback/review/updates.

#9 @johnbillion
7 years ago

  • Milestone changed from 4.9.1 to 4.9.2

@aduth
7 years ago

#10 @aduth
7 years ago

This can be demonstrated in the Gutenberg editor, which uses inline mode for rendering TinyMCE, including the Classic Text block. The related issue has been reported here:

https://github.com/WordPress/gutenberg/issues/3568

The above patch changes the behavior to retrieve clientWidth from the body element, which supports both iframe and inline modes, and should recreate the expected behavior of assigning an embed maximum width corresponding to the available width of the editor body.

#11 @obenland
7 years ago

  • Keywords has-patch added; needs-patch reporter-feedback removed
  • Owner set to westonruter
  • Status changed from new to assigned

#12 @westonruter
7 years ago

  • Keywords commit added
  • Status changed from assigned to accepted

With 42416.diff, embeds are appearing with the proper width in both the Text widget and the classic editor.

#13 @westonruter
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 42390:

Editor: Fix determining TinyMCE editor width when in inline mode instead of iframe mode.

See #40854.
Amends [41985].
Props aduth.
Fixes #42416 for trunk.

#14 @westonruter
7 years ago

  • Keywords fixed-major added
  • Resolution fixed deleted
  • Status changed from closed to reopened

#15 @westonruter
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 42391:

Editor: Fix determining TinyMCE editor width when in inline mode instead of iframe mode.

See #40854.
Amends [41985].
Props aduth.
Fixes #42416 for 4.9.

Note: See TracTickets for help on using tickets.