Skip to content

Conversation

hostep
Copy link
Contributor

@hostep hostep commented Oct 13, 2024

… broke with introduction of TinyMCE7).

Description (*)

Magento comes with 2 new TinyMCE plugins by default:

  • magentowidget
  • magentovariable

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. Doesn't appear to be working anymore with TinyMCE 7 Magenerds/PageDesigner#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 (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

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

Copy link

m2-assistant bot commented Oct 13, 2024

Hi @hostep. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@hostep
Copy link
Contributor Author

hostep commented Oct 13, 2024

@magento run all tests

@hostep
Copy link
Contributor Author

hostep commented Oct 13, 2024

@magento run Unit Tests

@fballiano
Copy link
Contributor

TinyMCE7 is GPL, I don't undestand how this update was pushed #39252

@hostep
Copy link
Contributor Author

hostep commented Oct 14, 2024

Yes yes, that's a completely different issue, and I was already aware of that, please give the legal team of Adobe some time to look into it and they'll get back with an answer hopefully.

@engcom-Hotel
Copy link
Contributor

@magento create issue

@engcom-Hotel engcom-Hotel added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Oct 15, 2024
@Priyakshic Priyakshic added the Project: Community Picked PRs upvoted by the community label Nov 13, 2024
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@engcom-Hotel engcom-Hotel self-requested a review November 18, 2024 08:27
@engcom-Hotel
Copy link
Contributor

Hello @hostep,

Thanks for the contribution!

We need to put this PR on Hold due to this #39252 (comment).

Let once roll back the tinyMCE and accordingly, we will pick this PR.

Thanks

@hostep hostep force-pushed the fixes-backwards-compatibility-with-tinymce-plugins-after-upgrade-to-tinymce7 branch from 47b1b99 to a71df16 Compare December 30, 2024 19:44
@hostep
Copy link
Contributor Author

hostep commented Dec 30, 2024

@engcom-Hotel: Now that TinyMCE was downgraded from v7 to v6 in 09c82b1, I re-tested the issue and the problem still happens. I also re-tested my fix and it still fixes the issue.

I re-based my fix on the latest 2.4-develop branch and force pushed it. So this can be picked up again. Thanks!

@magento run all tests

@engcom-Hotel
Copy link
Contributor

@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE, Static Tests

@engcom-Bravo
Copy link
Contributor

@magento run all tests

@engcom-Bravo
Copy link
Contributor

Hi @hostep,

Thanks for the collaboration & contribution!

✔️ QA Passed

Preconditions:

  • Install fresh Magento 2.4-develop

Steps to reproduce

  • Setup Magento without magento's pagebuilder
  • Install https://github.com/Magenerds/PageDesigner
  • In the backoffice, create a new cms page, using the pagedesigner interface
  • save the page
  • Return to the backoffice, and start editing that new page created in step 4
  • Open the 'content' tab and see if the pagedesigner interface is loading the content, also take a look at your browsers inspector.

Before: ✖️ 

Screenshot 2025-01-02 at 10 37 10 am

After: ✔️

Screenshot 2025-01-02 at 10 45 03 am

Builds are failed. Hence, moving this PR to Extended Testing.

Thanks.

@engcom-Dash engcom-Dash self-assigned this Jan 2, 2025
@engcom-Dash
Copy link
Contributor

@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

1 similar comment
@engcom-Dash
Copy link
Contributor

@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

@engcom-Dash
Copy link
Contributor

The Functional B2B, CE, and EE test failures have been inconsistent or are known issues in the last two builds and seem to be flaky. Failed integration tests can also be seen in other PRs (see here). They neither part of PR nor failing because of the PR changes, hence moving it to Merge in Progress.

Integration Tests
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/5d3caadb09c18cf22f4160bf223b7752/Integration/console-error-logs.html
image

Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/8f2ee9af9f206a173cc70512fcc2d4af/Integration/console-error-logs.html
image

Functional Tests B2B
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/aee7bfd1888486425b0b3a73d2679076/Functional/allure-report-b2b/index.html#categories/76effb04c71458640753efa402b62626/78c94e38f61edd34/
image

Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/e254413a3368836cef2dd6f46749fef0/Functional/allure-report-b2b/index.html#categories/76effb04c71458640753efa402b62626/5263431ecc285744/
image

Known Issue:
StorefrontAssertAvailableShippingRateIsChangedBasedOnInputedDataTest: ACQE-7380

Functional Tests CE
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/de35c1462c979deb0c5ee3aa239794dc/Functional/allure-report-ce/index.html#categories/e93c564a2dcd5e30ee0e0e811a828c2b/5f85fcacbf1b355/
image

Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/a71ccd332e05da4a8be4934097182a37/Functional/allure-report-ce/index.html#categories/e93c564a2dcd5e30ee0e0e811a828c2b/76ac62e35ce3a2e3/
image

Known Issues:
StorefrontAssertAvailableShippingRateIsChangedBasedOnInputedDataTest: ACQE-7380
StorefrontCreateCustomerWithInvalidDataTest: ACQE-7384

Functional Tests EE
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/ba1fdfceb3aaf53d3322a4955fba4c67/Functional/allure-report-ee/index.html#categories/76effb04c71458640753efa402b62626/458fd74c9ddc0d79/
image

Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/39258/c2e9481c4b636ea6a35217a3165eee1c/Functional/allure-report-ee/index.html#categories/76effb04c71458640753efa402b62626/dfbfc49a0bbb9297/
image

Known Issue:
StorefrontAssertAvailableShippingRateIsChangedBasedOnInputedDataTest: ACQE-7380

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit 787a020 into magento:2.4-develop Jan 7, 2025
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Project: Community Picked PRs upvoted by the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants