-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Widgets with a WYSIWYG parameter fail when inserting them into a WYSIWYG in a form. #19742
Comments
Hi @molovo. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
where @molovo do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
Hi @engcom-backlog-nazar. Thank you for working on this issue.
|
@magento-engcom-team give me 2.2.6 instance |
Hi @molovo. Thank you for your request. I'm working on Magento 2.2.6 instance for you |
Hi @molovo, here is your Magento instance. |
@engcom-backlog-nazar technically yes, but that issue seems abandoned - there has been no update other than acknowledgement and nofurther information for almost a year. |
@molovo ok we can close an older issue and leave this one open ? |
@engcom-backlog-nazar 👍 sounds good to me |
@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets |
Problem in lib/web/mage/adminhtml/wysiwyg/widget.js lines 357, 360 and 402. Need replace tinyMCE.activeEditor to tinyMCE.get(this.widgetTargetId). Magento v2.2.5. `
` |
@EduardTd which version of Magento are you running? The example you posted doesn't match the content of |
I can confirm that replacing |
This PR is a potential fix for issues magento#19742 and magento#13409 (Thanks to @EduardTd for pointing me in the right direction). I've tested this briefly in my own install and it appears to resolve the issue. Submitting this PR so that the issue can be tested fully.
v2.2.5 |
WYSIWYG not intended for use inside the WYSIWYG. Anyway it's custom solution. I don't think that it's bug. It' a feature :D |
I also have this problem and on version 2.3. I can confirm that the two line change above to widget.js does appear to populate the page content editor but it is with the HTML rather than a widget icon. Also, while the population of the page content sort of functions the actual widget is not saved as expected and all of the editor contents are essentially destroyed. This fix also appears to prevent the frontend from working |
@j-robin-hunter the fix posted above was for an older version (v2.2.5) and the code in that file is very different to that in v2.3.0. I've submitted a PR containing the fixes, but to the 2.3 version of this file, which works correctly, and doesn't produce the issues you've described above. |
Preconditions (*)
This is occurring for me in two separate Magento 2 projects, using the following versions.
Steps to reproduce (*)
(Code examples in this gist)
Expected result (*)
Actual result (*)
In-depth explanation
I've created a screen recording in which I've done my best to demonstrate the strange behaviour occurring here, and I'll explain in more detail below.
I appreciate the screen recording could be a little confusing, so here's the steps I'm attempting to demonstrate:
add_widgets
is set to falseThis was recorded in the category editor, but the issue occurs in any form which allows adding widgets via a WYSIWYG. In my case, this is Categories, Products and CMS pages in one Enterprise Edition project, and CMS pages and some other custom modules in one Community Edition project, so it seems the issue is universal.
When you first enter content into the WYSIWYG in the widget, and click 'Insert Widget', it appears to disappear. What appears to be happening, is that the widget content is inserted into itself, in the WYSIWYG inside the widget form.
If you click 'Show/Hide editor' to convert the content in the WYSIWYG to plain text before clicking 'Insert Widget', the widget is then inserted correctly.
However, if you have multiple WYSIWYGs within a form (e.g. in my current project, category pages have 3 WYSIWYGs added as EAV attributes which all accept widgets), even after hiding the editor in the widget form, the widget content is always inserted into the first WYSIWYG on the page, regardless of which one you selected to insert the content into. You then need to copy and paste the new widget from the incorrect WYSIWYG, to the correct one. This is only the case for widgets containing this WYSIWYG block - other widgets insert correctly.
If you edit an existing widget, upon clicking Insert Widget the same issue occurs - the updated content is inserted into the first WYSIWYG in the DOM (as per both of the scenarios above) and the original widget remains where it was.
It also doesn't matter which of the WYSIWYGs on the page have the
add_widgets
option set - it is always inserted into the first one, even ifadd_widgets
is false for that WYSIWYG.The text was updated successfully, but these errors were encountered: