WordPress.org

Make WordPress Core

Opened 5 weeks ago

Last modified 2 weeks ago

#44134 new task (blessed)

Update to TinyMCE 4.7.13

Reported by: hometowntrailers Owned by:
Milestone: 4.9.7 Priority: normal
Severity: normal Version: trunk
Component: TinyMCE Keywords: needs-patch
Focuses: Cc:

Description

WordPress 4.9.6 updated TinyMCE to 4.7.11, but since that ticket was opened two more TinyMCE releases became available.

TinyMCE 4.7.12 and 4.7.13 fixes an additional 20 issues (+/-).

Attachments (1)

44134-test.diff (481 bytes) - added by azaozz 4 weeks ago.

Download all attachments as: .zip

Change History (24)

#1 @desrosj
5 weeks ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to task (blessed)

A list of commits since 4.7.11.

In summary:

Version 4.7.13 (2018-05-16)
    Fixed a bug where Edge 17 wouldn't be able to select images or tables. #TINY-1679
    Fixed issue where whitespace wasn't preserved when the editor was initialized on pre elements. #TINY-1649
    Fixed a bug with the fontselect dropdowns throwing an error if the editor was hidden in Firefox. #TINY-1664
    Fixed a bug where it wasn't possible to merge table cells on IE 11. #TINY-1671
    Fixed a bug where textcolor wasn't applying properly on IE 11 in some situations. #TINY-1663
    Fixed a bug where the justifyfull command state wasn't working correctly. #TINY-1677
    Fixed a bug where the styles wasn't updated correctly when resizing some tables. #TINY-1668
    Added missing code menu item from the default menu config. #TINY-1648
    Added new align button for combining the separate align buttons into a menu button. #TINY-1652
Version 4.7.12 (2018-05-03)
    Added an option to filter out image svg data urls.
    Added support for html5 details and summary elements.
    Changed so the mce-abs-layout-item css rule targets html instead of body. Patch contributed by nazar-pc.
    Fixed a bug where the "read" step on the mobile theme was still present on android mobile browsers.
    Fixed a bug where all images in the editor document would reload on any editor change.
    Fixed a bug with the Table Plugin where ObjectResized event wasn't being triggered on column resize.
    Fixed so the selection is set to the first suitable caret position after editor.setContent called.
    Fixed so links with xlink:href attributes are filtered correctly to prevent XSS.
    Fixed a bug on IE11 where pasting content into an inline editor initialized on a heading element would create new editable elements.
    Fixed a bug where readonly mode would not work as expected when the editor contained contentEditable=true elements.
    Fixed a bug where the Link Plugin would throw an error when used together with the webcomponents polyfill. Patch contributed by 4esnog.
    Fixed a bug where the "Powered by TinyMCE" branding link would break on XHTML pages. Patch contributed by tistre.
    Fixed a bug where the same id would be used in the blobcache for all pasted images. Patch contributed by thorn0.

#3 @hometowntrailers
5 weeks ago

Could the TinyMCE update be moved to WP 4.9.7?

#4 @azaozz
5 weeks ago

  • Milestone changed from Future Release to 4.9.7

And another bug that is fixed in TinyMCE 4.7.13: https://wordpress.org/support/topic/table-bug-with-edge-plugin-needs-update-to-4-7-13/.

Moving to 4.9.7.

Last edited 5 weeks ago by azaozz (previous) (diff)

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


5 weeks ago

#6 @danielbachhuber
5 weeks ago

I'm also seeing a TypeError: tinymce.ui.Control is undefined that isn't present in WP 4.9.5.

My TinyMCE plugin JavaScript is https://gist.github.com/danielbachhuber/7994605866299c57e2d9f9bac021f423

#7 @lakenh
5 weeks ago

#44207 was marked as a duplicate.

#8 @Clorith
5 weeks ago

#44218 was marked as a duplicate.

#11 follow-up: @bdanzer29
4 weeks ago

I also get the same issue as @danielbachhuber with tinymce.ui.Control not working. When I debug the tinymce.ui I get only factory functions and nothing else.

#12 in reply to: ↑ 11 @azaozz
4 weeks ago

Replying to bdanzer29:

I also get the same issue as @danielbachhuber with tinymce.ui.Control not working.

Right, think we should close #44272 as duplicate.

#13 @azaozz
4 weeks ago

#44272 was marked as a duplicate.

#14 @azaozz
4 weeks ago

  • Keywords reporter-feedback added

@danielbachhuber @bdanzer29 confirmed that tinymce.ui.Control is not available before TinyMCE is initialized. This seems to be a change in TinyMCE 4.7.0 and is the same in TinyMCE 4.7.13.

However in my testing the theme seems to always be loaded and initialized first, before the plugins (at least in the default editors in WP, the main editor and the Text widget).

I'm not sure if this will be "fixed" upstream. Also not sure why your plugins are running before TinyMCE and the theme are initialized. Please add any additional info on how to reproduce this, if possible.

Last edited 4 weeks ago by azaozz (previous) (diff)

#15 @danielbachhuber
4 weeks ago

@azaozz I'm simply registering this GitHub Gist with the following:

public static function filter_mce_external_plugins( $plugins ) {
	$assets_path           = dirname( dirname( __FILE__ ) ) . '/assets';
	$assets_url            = plugins_url( 'assets', __DIR__ );
	$filepath              = '/js/tinymce-plugin.js';
	$mtime                 = filemtime( $assets_path . $filepath );
	$plugins['tastylinks'] = $assets_url . $filepath . '?v=' . (int) $mtime;
	return $plugins;
}

My TinyMCE plugin closely parallels wplink, so I'm not sure why wplink works and my TinyMCE plugin doesn't.

(function(tinymce){
	tinymce.ui.Factory.add( 'WPTastyLinkPreview', tinymce.ui.Control.extend( {

vs.

( function( tinymce ) {
	tinymce.ui.Factory.add( 'WPLinkPreview', tinymce.ui.Control.extend( {

#16 @bdanzer29
4 weeks ago

I am registering my script through mce_external_plugins filter.

Edit: Also wanted to add that even if I add a later priority to the filter I still get the same issue.

<?php
add_filter('mce_external_plugins', function ($plugin_array) {
                $plugin_array['lorem'] = Assets::get_plugin_url().Assets::get_asset('js', 'lorem');
                $plugin_array['lorem2'] = Assets::get_plugin_url().Assets::get_asset('js', 'lorem2');

                return $plugin_array;
            });
Last edited 4 weeks ago by bdanzer29 (previous) (diff)

@azaozz
4 weeks ago

#17 @azaozz
4 weeks ago

Think I found the problem. @danielbachhuber @bdanzer29 can you see if 44134-test.diff fixes it for you? It removes the "old" way of loading external plugins that doesn't seem needed any more.

#18 @bdanzer29
4 weeks ago

@azaozz When I remove that code it does work for me! Thanks for the help! Do you have any idea when 4.9.7 might be released?

#19 follow-up: @danielbachhuber
4 weeks ago

  • Keywords reporter-feedback removed

@azaozz Yes, 44134-test.diff fixes the issue for me.

#20 follow-up: @dougwollison
3 weeks ago

I came across a breaking change caused by 4.7. It's teeny tiny and can be fixed with a single line of code, but it's a break nevertheless. Made the mistake of posting this to #43862 which is closed (I'm rusty with Trac etiquette).

Before, when you added a lister to the SetupEditor event, like so:

tinymce.on( 'SetupEditor', function( editor ) {
    // Do stuff with the editor that's been setup
} );

The callback was passed the editor instance directly. Now though, in 4.7, it is instead passed an event object containing the instance:

tinymce.on( 'SetupEditor', function( e ) {
    var editor = e.editor;
    // Do stuff with the editor that's been setup
} );

Any code that uses the former method will cause errors to be thrown due to trying to access properties and methods that don't exist on the event object. The most apparent effect to the end user is that the Visual tab in the editor appears blank, and you cant switch to/back to Visual view if you're on or switch to Text view.

Thankfully, this is an easy fix, and can be made backwards compatible with var editor = e.editor || e;

What's concerning is I didn't spot any mention of the change in TinyMCE's change log, beyond a fix to their own Compat3x plugin to account for it.

Last edited 3 weeks ago by dougwollison (previous) (diff)

#21 in reply to: ↑ 19 @azaozz
2 weeks ago

Replying to danielbachhuber:

Created #44330 and patched it there.

#22 in reply to: ↑ 20 ; follow-up: @azaozz
2 weeks ago

Replying to dougwollison:

I came across a breaking change caused by 4.7. It's teeny tiny and can be fixed with a single line of code, but it's a break nevertheless.

Yeah, this is a change (normalization) upstream. All custom events in TinyMCE pass an event object with several properties, the editor instance is one of them. I'm afraid we can't do anything about it.

#23 in reply to: ↑ 22 @dougwollison
2 weeks ago

Replying to azaozz:

Replying to dougwollison:

I came across a breaking change caused by 4.7. It's teeny tiny and can be fixed with a single line of code, but it's a break nevertheless.

Yeah, this is a change (normalization) upstream. All custom events in TinyMCE pass an event object with several properties, the editor instance is one of them. I'm afraid we can't do anything about it.

I understand, and like I said it's not a daunting task to patch my code. I was just pointing out the issue, since this kinda came out of nowhere in what's usually an auto-update minor release of WP, instead of being in a major release.

Note: See TracTickets for help on using tickets.