Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#44134 closed task (blessed) (fixed)

Update to TinyMCE 4.7.13

Reported by: hometowntrailers's profile hometowntrailers Owned by: azaozz's profile azaozz
Milestone: 4.9.8 Priority: normal
Severity: normal Version: 5.1
Component: TinyMCE Keywords: needs-testing fixed-major
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 6 years ago.

Download all attachments as: .zip

Change History (33)

#1 @desrosj
6 years 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
6 years ago

Could the TinyMCE update be moved to WP 4.9.7?

#4 @azaozz
6 years 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 6 years ago by azaozz (previous) (diff)

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


6 years ago

#6 @danielbachhuber
6 years 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
6 years ago

#44207 was marked as a duplicate.

#8 @Clorith
6 years ago

#44218 was marked as a duplicate.

#11 follow-up: @bdanzer29
6 years 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
6 years 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
6 years ago

#44272 was marked as a duplicate.

#14 @azaozz
6 years 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 6 years ago by azaozz (previous) (diff)

#15 @danielbachhuber
6 years 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
6 years 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 6 years ago by bdanzer29 (previous) (diff)

@azaozz
6 years ago

#17 @azaozz
6 years 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
6 years 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
6 years ago

  • Keywords reporter-feedback removed

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

#20 follow-up: @dougwollison
6 years 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 6 years ago by dougwollison (previous) (diff)

#21 in reply to: ↑ 19 @azaozz
6 years ago

Replying to danielbachhuber:

Created #44330 and patched it there.

#22 in reply to: ↑ 20 ; follow-up: @azaozz
6 years 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
6 years 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.

#24 @ocean90
6 years ago

  • Milestone changed from 4.9.7 to 4.9.8

4.9.7 has been released, moving to next milestone.

#25 @hometowntrailers
6 years ago

  • Summary changed from Update to TinyMCE 4.7.13 to Update to TinyMCE 4.7.13 --- EDIT: or 4.8.0

TinyMCE 4.8.0 has been released today.

Any reason to not upgrade to 4.8.0, rather than 4.7.13?

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


6 years ago

#27 @azaozz
6 years ago

  • Summary changed from Update to TinyMCE 4.7.13 --- EDIT: or 4.8.0 to Update to TinyMCE 4.7.13

Yeah, TinyMCE 4.8 was released few days ago. Can update straight to it instead of 4.7.x.

#28 @azaozz
6 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 43447:

TinyMCE: update to 4.8.0, changelog: https://www.tiny.cloud/docs/changelog/#version480july112018

Fixes #44134.

#29 @azaozz
6 years ago

  • Keywords needs-testing fixed-major added; needs-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for 4.9.8.

#30 @azaozz
6 years ago

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

In 43472:

TinyMCE: update to 4.8.0, changelog: https://www.tiny.cloud/docs/changelog/#version480july112018

Merges [43447] to the 4.9 branch.
Fixes #44134.

#31 @desrosj
6 years ago

In 44401:

Editor: Use explicit context instead of a trailing space for Edit string in TinyMCE.

In [42523], trunk was updated to use explicit context instead of a trailing space for the Edit string in TinyMCE plugins. [43472] later backported this change, but the string in class-wp-editor.php was missed. This fixes the Edit string so not display as Edit|button in the 5.0 branch.

Props dimadin.

See #42543, #44134.
Fixes #44919.

#32 @sabernhardt
5 years ago

#44327 was marked as a duplicate.

Note: See TracTickets for help on using tickets.