NPM Resource Changed PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
24 Apr 2022

Pull Request for Issue #37596.

Summary of Changes

Updates TinyMCE to version 6. This is an early draft, so it needs extensive testing. So please take it with caution.

What has changed can be found here https://www.tiny.cloud/docs/tinymce/6/migration-from-5x

As version 6 doesn't contain anymore the hr, paste, print plugins. So I'm just onloading it, before merge this must be removed from the params.

@dgrammatiko probably something you want to look at too

Testing Instructions

Play around with different settings in the TinyMCE editor plugin and test them by opening an article form.

Actual result BEFORE applying this Pull Request

All works.

Expected result AFTER applying this Pull Request

All should work and no console errors.

avatar laoneo laoneo - open - 24 Apr 2022
avatar laoneo laoneo - change - 24 Apr 2022
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Apr 2022
Category JavaScript Repository NPM Change Libraries Front End Plugins
avatar laoneo laoneo - change - 24 Apr 2022
Labels Added: NPM Resource Changed ?
avatar joomla-cms-bot joomla-cms-bot - change - 24 Apr 2022
Category JavaScript Repository NPM Change Libraries Front End Plugins JavaScript Repository NPM Change Front End Plugins
avatar dgrammatiko
dgrammatiko - comment - 24 Apr 2022
avatar dgrammatiko
dgrammatiko - comment - 24 Apr 2022

Oh boy, there are quite some changes needed, eg

'styleselect' => ['label' => Text::_('PLG_TINY_TOOLBAR_BUTTON_STYLESELECT'), 'text' => 'Formats'],
'formatselect' => ['label' => Text::_('PLG_TINY_TOOLBAR_BUTTON_FORMATSELECT'), 'text' => 'Paragraph'],
'fontselect' => ['label' => Text::_('PLG_TINY_TOOLBAR_BUTTON_FONTSELECT'), 'text' => 'Font Family'],
'fontsizeselect' => ['label' => Text::_('PLG_TINY_TOOLBAR_BUTTON_FONTSIZESELECT'), 'text' => 'Font Sizes'],

Need to be renamed to fontfamily and fontsize

UI or UX element Old name New name
Option font_formats font_family_formats
Toolbar item fontselect fontfamily
Menu item fontformats fontfamily
Option fontsize_formats font_size_formats
Toolbar item fontsizeselect fontsize
Menu item fontsizes fontsize

and there are more... (will try to do some PR after dinner)

avatar laoneo laoneo - change - 27 Apr 2022
The description was changed
avatar laoneo laoneo - edited - 27 Apr 2022
avatar laoneo
laoneo - comment - 28 Apr 2022

So I have just to rename the variables in the mentioned file, is there no params upgrade neded during Joomla update?
What I had also to do was to copy the models folder from tinyMCE to the Joomla one. Can you point me here to the code where you copy the assets from node_modules to media. Couldn't figure that out.

avatar laoneo
laoneo - comment - 28 Apr 2022

When I do there the changes with the new folders, they have no effect.

avatar laoneo
laoneo - comment - 9 May 2022

@dgrammatiko can you help here regarding the build script to copy the models folder?

avatar dgrammatiko
dgrammatiko - comment - 9 May 2022

Sure:

After

await mkdir(join(itemvendorPath, 'templates'), { mode: 0o755 });

add

await mkdir(join(itemvendorPath, 'models'), { mode: 0o755 });

After

await copyAllFiles('themes', 'tinymce', 'themes');

add

await copyAllFiles('models', 'tinymce', 'models');
avatar laoneo
laoneo - comment - 9 May 2022

Strange, I'm pretty sure that I tried this. Thanks, it worked...

avatar laoneo
laoneo - comment - 9 May 2022

What would be the best way to migrate the options which got renamed?

avatar dgrammatiko
dgrammatiko - comment - 9 May 2022

@laoneo I don't think the options were exposed to the CMS, thus it's just the changes in the respected traits, hopefully this PR covers them

avatar laoneo
laoneo - comment - 9 May 2022

@dgrammatiko thanks. Putting this now as ready for testing.

avatar HLeithner
HLeithner - comment - 30 May 2022

In my opinion the upgrade is a b/c break and couldn't go into 4.x, at least it would break one of my extension.

avatar brianteeman
brianteeman - comment - 30 May 2022

Could you explain what breaks in your extension please

avatar HLeithner
HLeithner - comment - 30 May 2022

In my case I only checked that I check the version major number ;-) which yeah not the best way to detect features but it's legacy code which was needed to detect tinymce 3/4 and JCE and now 5 and JCE. But I only do simple things (getcontent setcontent listen to focus/blur event).

looking at https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ it could easily break some plugins doing more then me, having a tinycme plugins maybe.

Beside that we have a strict b/c policy on javascript code, no b/c breaks,

6.1.2 JavaScript
All JavaScript functions and classes that are not flagged as private.

avatar brianteeman
brianteeman - comment - 30 May 2022

My 2c is that its not a valid reason not to upgrade

avatar laoneo
laoneo - comment - 30 May 2022

@HLeithner pretty sure this BC policy is only for our own scripts and not for external ones. Beside that a 3rd party extension should only interact with the public API from core and not directly with the editor implementation itself. If it does, then it should be prepared for this situation.

avatar HLeithner
HLeithner - comment - 30 May 2022

My 2c is that its not a valid reason not to upgrade

our b/c promise is not a valid reason? what is then a valid reason?

I would really like to have a more modern policy but we only have joomla/rfc#29 which is stalled because nobody seems to be interested.

@laoneo actually I should be prepared for NO b/c break in a minor update, doesn't matter what. that's the reason for semver. I know we don't care to much about this because it's hard to fulfill the expectation.

avatar brianteeman
brianteeman - comment - 30 May 2022

I would really like to have a more modern policy but we only have joomla/rfc#29 which is stalled because nobody seems to be interested.

Not true - several people of commented and contributed. At the end of the day the rfc process is something only the production department can decide on so its the pd thats not interested.

avatar laoneo
laoneo - comment - 30 May 2022

If you use a none public API (everything what doesn't go under https://github.com/joomla/joomla-cms/blob/4.2-dev/build/media_source/system/js/core.es6.js#L66-L101) then I hope your code will break. Because you are abusing the code base. This is not what backwards compatibility is about and has nothing to do with semver. You really should change your code to use the "official" editors API of core, because there we have a policy. And if the API doesn't have what you need, then make a pr.

To finalize this, honestly I do not care if we wait for 5.

avatar HLeithner
HLeithner - comment - 30 May 2022

@laoneo we are a CMS the end user doesn't care if we think something in this folder or that folder is important for b/c, we provide a packages as one download, and as long as we have a user base nothing should break except we explicitly say it (in which form doesn't matter, we do it in semantic versioning). That's not only important for users who blindly update the joomla installation. Also for extension developer who could expect that there code still works.

You are right we don't promise 3rd party dependencies like guzzle, but tinymce is a first class dependency and our main editor which is more important then anything else in a CMS, if it breaks or changes the html output it saves then you break a user website (100k).

So if it's ok for you I would like to wait for 5 to merge this. (I hopefully find a way for upgrading PR to PSR-12 soon)

avatar dgrammatiko
dgrammatiko - comment - 30 May 2022

@HLeithner you might have a point about not upgrading to major version in a minor release, but not in this case:

  • the current version of tinyMCE reached EOL so NOT UPGRADING IS A SECURITY issue
  • Devs should not do stupid things. I also have a plug-in that messes with the core tinyMCE and I’m pretty sure I won’t have to patch it but even if I have I ll do it before 4.2
avatar laoneo
laoneo - comment - 30 May 2022

I think, staying on 5 in 4 would be ok as 5.10 is not EOL https://www.tiny.cloud/docs/general-configuration-guide/system-requirements.

We can postpone it to 5, no problem. Despite, I would merge it very early when 4.3 starts. I did this only to test if this pr would cause an issue as mentioned by Brian here.

avatar HLeithner
HLeithner - comment - 30 May 2022

@dgrammatiko

  • the current version of tinyMCE reached EOL so NOT UPGRADING IS A SECURITY issue

https://www.tiny.cloud/docs/general-configuration-guide/system-requirements/ 5.10.5 was released 5 days ago and the EOL is not defined yet. If we trust the tiny documentation.

  • Devs should not do stupid things. I also have a plug-in that messes with the core tinyMCE and I’m pretty sure I won’t have to patch it but even if I have I ll do it before 4.2

What stupid things do you mean?

  • Using one of the 50 API/Options/Properties which have been removed in 6.0?
  • Or using tinymce.PluginManager.load where in 5 you have 2 callback functions and now it returns a promise?
avatar brianteeman
brianteeman - comment - 1 Jun 2022

see #37949 for the update to 5.10.5

avatar roland-d roland-d - change - 18 Jun 2022
Title
[4.2] Upgrade TinyMCE to version 6
[5.0] Upgrade TinyMCE to version 6
avatar roland-d roland-d - edited - 18 Jun 2022
avatar laoneo laoneo - change - 28 Aug 2022
Labels Removed: ?
avatar laoneo laoneo - change - 28 Aug 2022
Labels Added: PR-5.0-dev
avatar joomla-cms-bot joomla-cms-bot - change - 28 Aug 2022
Category JavaScript Repository NPM Change Front End Plugins Unit Tests Repository Administration Language & Strings JavaScript NPM Change Installation Libraries Front End Plugins
avatar laoneo laoneo - change - 28 Aug 2022
Labels Added: ? Language Change
avatar joomla-cms-bot joomla-cms-bot - change - 28 Aug 2022
Category JavaScript Repository NPM Change Front End Plugins Unit Tests Administration Language & Strings Installation Libraries JavaScript Repository NPM Change Front End Plugins
08f063a 29 Aug 2022 avatar laoneo build
d702f76 29 Aug 2022 avatar laoneo cs
avatar laoneo laoneo - change - 29 Aug 2022
Labels Removed: ? Language Change
avatar brianteeman
brianteeman - comment - 19 Sep 2022

What is the situation now with b/c. As I understand it j5 will not have b/c breaks

avatar HLeithner
HLeithner - comment - 19 Sep 2022

@brianteeman no, it doesn't break thing that have been deprecated in 4.x, also js is not part of the b/c promise there will be b/c breaks which will be minimal and should not effect most of the 3rd party components.

avatar HLeithner
HLeithner - comment - 19 Sep 2022

I will merge this without out tests because I expect that this will be tested enough in the development lifecycle.

avatar HLeithner HLeithner - change - 19 Sep 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-09-19 14:55:50
Closed_By HLeithner
avatar HLeithner HLeithner - close - 19 Sep 2022
avatar HLeithner HLeithner - merge - 19 Sep 2022
avatar HLeithner
HLeithner - comment - 19 Sep 2022

thanks @laoneo

avatar brianteeman
brianteeman - comment - 19 Sep 2022

It breaks things that are not deprecated. And why is js not part of the b/c promise. As a regular user I wouldn't care or even know the subtle difference between PHP and js

avatar brianteeman
brianteeman - comment - 19 Sep 2022

/me confused as the policy says

6.1.2 JavaScript

All JavaScript functions and classes that are not flagged as private.

avatar HLeithner
HLeithner - comment - 19 Sep 2022

True I forget that the only thing that has a useful b/c promise is for what every reason the javascript stuff... any way I will do a Production motion for the update since the b/c breaks are not to big for the editor and 3rd party extensions should work with more then one editor.

thanks for pointing this out.

avatar laoneo
laoneo - comment - 19 Sep 2022

Honestly I doubt that this applies for dependencies and is only for core code. Otherwise it would not make sense as when we deprecate for a new major version of a library when it gets merged in three years the next one will very likely be out already. So we have to do the same game again or what?

avatar brianteeman
brianteeman - comment - 19 Sep 2022

That's why I raised it as an issue. And tiny can be and is extended by extensions available on the JED so it's not exactly the same as other external libraries.

Add a Comment

Login with GitHub to post a comment