Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restores backwards compatibility with TinyMCE plugins again (after it… #39258

Open
wants to merge 1 commit into
base: 2.4-develop
Choose a base branch
from

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
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: pending review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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