magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

[Issue] Restores backwards compatibility with TinyMCE plugins again (after it… #39262

Open m2-assistant[bot] opened 1 month ago

m2-assistant[bot] commented 1 month ago

This issue is automatically created based on existing pull request: magento/magento2#39258: Restores backwards compatibility with TinyMCE plugins again (after it…


… broke with introduction of TinyMCE7).

Description (*)

Magento comes with 2 new TinyMCE plugins by default:

Recently, with the switch from TinyMCE v5 to v7 in the latest security patch releases (2.4.7-p3, ...) and 2.4.8-beta1, those plugins got rewritten to adhere to the new system in TinyMCE 7. However, a big mistake was made by not returning the widgets as an object, which meant that you couldn't call the functions defined inside the plugin anymore when trying to use the widget from another location.

Example with magentowidget, old version vs new version, note that in the new version there is no object being returned in that magentowidget function anymore.

This resulted in this error output when trying to call the encodeWidgets on the magentowidget instance, because that last one was just an empty object:

TypeError: tinymce.activeEditor.plugins.magentowidget.encodeWidgets is not a function

This PR fixes that.

Related Pull Requests

Fixed Issues (if relevant)

  1. https://github.com/Magenerds/PageDesigner/issues/54

Manual testing scenarios (*)

  1. Setup Magento 2.4.7-p2 without magento's pagebuilder
  2. Install https://github.com/Magenerds/PageDesigner
  3. In the backoffice, create a new cms page, using the pagedesigner interface
  4. save the page
  5. now upgrade to Magento 2.4.7-p3 (still without magento's pagebuilder)
  6. Return to the backoffice, and start editing that new page created in step 4
  7. Open the 'content' tab and see if the pagedesigner interface is loading the content, also take a look at your browsers inspector.

That last step will fail and you'll see an error in your browser's console. This PR fixes this issue.

Questions or comments

Adding automated tests for this will be hard, so I'm not doing it, hopefully that's okay, if not, please write them yourselves, I won't have the time to put into this task.

Contribution checklist (*)

m2-assistant[bot] commented 1 month ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 1 month ago

Hello @hostep,

We are moving this issue On Hold due to the below issue:

https://github.com/magento/magento2/issues/39252

The team is working on the rollback of TinyMCE with the previous version. We will pick up this issue whenever the activity is complete.

Thanks