[wp-trac] [WordPress Trac] #47218: Update TinyMCE to 5.X.X
WordPress Trac
noreply at wordpress.org
Fri Dec 18 12:17:19 UTC 2020
#47218: Update TinyMCE to 5.X.X
-------------------------+------------------------------
Reporter: Presskopp | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: TinyMCE | Version:
Severity: normal | Resolution:
Keywords: 2nd-opinion | Focuses:
-------------------------+------------------------------
Comment (by azaozz):
Been looking at/thinking about what are the best options here for a while.
The problem is that there is no official "migrate" plugin when upgrading
from 4.x to 5.x like the `compat3x` plugin for migrating (back-compat)
from 3.x to 4.x.
There are quite a few API changes in 5.x: renamed methods, deprecated
functions and settings, new UI with a bit different HTML stricture and CSS
classes, etc. that break backwards compatibility. See:
https://www.tiny.cloud/docs/migration-from-4x/.
For example, `editor.addButton()` is perhaps the most used API call in
WordPress plugins that add custom TinyMCE plugins. In TinyMCE 5.x this
results in an error, see:
https://github.com/tinymce/tinymce/blob/014d8599bb398168a98e8c9964bc29a394d75cd8/modules/tinymce/src/core/main/ts/api/Editor.ts#L1130.
Changes:
TinyMCE 4:
{{{
editor.addButton('mybutton', {
text: 'My Button',
cmd: 'mceSave'
});
}}}
TinyMCE 5:
{{{
editor.ui.registry.addButton('myButton', {
text: 'My Button',
onAction: function () {
editor.execCommand('mceSave');
}
});
}}}
(In addition the "button settings" have changed too. There's no more
support for `cmd`, instead a callback function is needed, and there's no
`onclick`, has been renamed to `onAction`.)
What it will take to upgrade TinyMCE to version 5.x in WordPress?
As far as I see:
- Create a team of (as many of) the authors of WordPress plugins that add
TinyMCE code/plugins. The main purpose of the team would be to determine
and then test all needed changes to core, and perhaps to "spread the
word".
- Make an in-house `compat4x` plugin for TinyMCE 5.x. Looks like it won't
be possible to have "full" compatibility, but most cases of deprecation
and renamed functions/methods can be patched/fixed.
- Make a feature plugin with the updated TinyMCE and the above compat
plugin.
- Test the feature plugin. Ask "everybody" to test as much as possible to
catch edge cases that can be fixed/patched.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47218#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list