-
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
TinyMCE (WYSIWYG) doesn't work in admin when JS minify is enabled #11577
Comments
@jordy2607 We cannot reproduce this issue as described. Please add more details to your description of the steps you followed when identifying this issue. Screenshots or logs would be helpful, too. |
I have similar problem on 2.1.7. Requirement is to have production mode and minification enabled. For me it happens when I have 2 plugins enabled Dotmailer and Adyen Payment. I'm trying to narrow it down, but it takes a while due to need to redeploy static content. |
We have the same issue on a client's installation. Magento 2.1.7, production mode and minification enabled. We deactivated the minification and worked, so the issue is when minified. We still don't have a fix. One more detail, the server set up seems to have influence on it: the issue happens on the production server but not on the stage server. Attached a video of the issue. |
I have the same issue with two different Magento 2.2.0 sites. Issue only seems to occur when the Minify JavaScript Files option is enabled. Example of an incorrect path; |
This is the problem due to after turn on JS minify option the static file path is incorrect as well as all plugn js are minimize in .min.js form but in script name it not with .min version. I have fixed issue by modify in lib/web/tiny_mce/tiny_mce_src.js 1-Find code near line 10833 Replace with 2- Find code near line 11391 Change code in bellow file or override in admin theme: 4- Find code:
5- Run commands Now working fine |
When will this be fixed in the core and rolled out to 2.2 branch? |
@mipsvikas this problem isn't about loading wrong files in javascript. Tiny_mce library should be excluded from minification but it is not. On 2.1.7 version it worked well but in 2.1.10 is broken. |
Ok, I know where exactly problem is. You have to use extension which overrides dev/js/minify_exclude setting (it should have "/tiny_mce/" value which prevents this library from minification). In my case it was MSP_ReCaptcha extension. Maybe values from this setting should be merged instead of override by modules. |
@mipsvikas : Thanks you so much. It's work perfect as expect. Thanks once again. |
@JuteSenthil it's illusion, it's not working like a charm. Only on the first look but try to add image or link in editor and you shouldn't see modal content because links without .min are hardcored in tiny_mce templates |
@JuteSenthil Welcome |
@maqlec Its not due to any extension override. I had found issue into freshly installed magento. Might be it already resolved in the latest version. |
i can confirm the findings from @maqlec . In our case we are also using the MSP_ReCaptcha module. After disabling the minify_exclude config in this module the wysiwyg editor is working again when minification is enabled. The only other Magento module which adds this config is the Module_Store, which adds /tinymce/ to the minify_exclude list. Apparently these configs aren't merged in Magento 2.1. Workaround for me for now is to combine these settings in one of our own modules, which is specific for this magento installation.
|
Hello Guys, May be this code will help you. I am facing same issue but i did use CloudFlare and i disabled the Rocket Loader (speed > Rocket Loader ) but below code will help you with enable minified js also. `require(['jquery','tiny_mce/tiny_mce_src'], function($){
}); // close require |
As a couple of people here mentioned, this bug is caused by the fact that the value of the configurations So for people having this problem, a fix is to add a new module which depends on all the other modules which define that setting, and then define your own configuration for that setting with all the regexes which should match from the other modules, including @magento-engcom-team: I see you added the |
Hi @jordy2607. Thank you for your report. The fix will be available with the upcoming 2.3.0 release. |
@magento-engcom-team, will this be backported to 2.2.x versions? Separately, if anyone has created a patch to correct for this issue in 2.2.4 that would be awesome as well! Thanks Robert |
@duffner: the "fix" mentioned above isn't really backwards compatible, it would potentially break existing Magento 2.2 or 2.1 installations I think. Anyway, if you have this issue currently, try to search in Hope this helps :) |
@hostep, You're my hero! Thank you for being the first educated/helpful response I've ever received on the Magento issue tracker! If I could nominate what a helpful response looks like for the rest of the community this would be it! Thank you for educating me as to why, and pointing out risks! Have a great day! |
@hostep, I am struggling with one thing from the link you sent?
|
Hi @duffner Ah sorry, my explanation wasn't clear enough I think. Let me try again. So the issue here is that Magento defines by default a regular expression which matches paths to js & css assets: My guess is that you and others are running into problems because a custom module also defines such a regex which then overrides the default value of
In your case, I think the first regex of This is one way of making it work. But using this solution isn't very good because suppose there are 2 custom modules who do something like this. Those modules don't know that another module does the same, so they overwrite each others regexes and will potentially cause problems. The better way to solve it is to use that stackexchange answer, where the custom module instead of defining the regex in the You can find an example of a custom module where this got fixed over here. You'll see that the regex has been moved from the Hope this makes the problem more clear. |
I'm on 2.2.4 and disabling the Klarna module seems to have resolved the issue for me |
@SamB-GB: nice find! You are right, since the Klarna module comes bundled by default in Magento 2.2.4 now and contains the following code which causes the problem in its <dev>
<js>
<minify_exclude>
klarnacdn.net
</minify_exclude>
</js>
</dev> So they do it incorrectly. Now, if we would be able to find where that code is hosted on Github, we could send in a PR to fix it, but I can't seem to find it anywhere... |
Just update Klarna module with composer and its seems they have fixed the issue. This block has been removed.
Can anyone confirm please? |
So, let's close this issue which has been open for a long time and was always caused by 3rd party modules (one which was included by default in Magento). If people still run into this again, read through the thread, there are a lot of solutions suggested in here and I believe the explanation is clear enough to point you in the correct direction of finding the cause of the issue. Summary for module creators who want to exclude some css or js file(s) from minifying:
<config>
<default>
<dev>
<js>
<minify_exclude>
<unique_key_one>/regex1/</unique_key_one>
<unique_key_two>/regex2/</unique_key_two>
</minify_exclude>
</js>
</dev>
</default>
</config> If someone disagrees with me closing this, let me know. |
If someone is looking for a quick fix I've added into .htaccess file these rewrite urls and it's working RewriteRule ^[admin]/(.)/key/(.)/plugins/(.*)$ /pub/static/adminhtml/Magento/backend/en_US/tiny_mce/plugins/$3 [R=302,NC,L] RewriteRule ^[admin]/(.)/key/(.)/langs/(.*)$ /pub/static/adminhtml/Magento/backend/en_US/tiny_mce/langs/$3 [R=302,NC,L] RewriteRule ^[admin]/(.)/key/(.)/themes/advanced/(.*)$ /pub/static/adminhtml/Magento/backend/en_US/tiny_mce/themes/advanced/$3 [R=302,NC,L] It works without patches. The rewrite condition can be done better looking for urls like ^[admin]/(.)/key/(.)//plugins/(.*)$ (note the double slash) using RewriteCond as rewriterule removes the double slashes... but I was in an hurry :) Note: [admin] is the admin secret folder |
On M2.2 the proposed solution doesn't work with offsite javascript files that are being required into requirejs. I found my way here after js minification was breaking links to offsite .js files...i then added the core_config_data setting dev/js/minify_exclude to exclude the url address.... that fixed my 3rd party module, however, the addition of the exclude setting then broke the tiny_mce on the back end which broke the WSIWYG editor from showing. |
@AndyJAllen: exactly, that's why I reworked how to use the exclusion in Magento 2.3, so the exclusion of one module doesn't overwrite the one from another module. |
i am using magento 2.3 Still getting error in admin cms block - Please anyone there how guide me step by step ? |
@sumeetmobiwebtech I was having the same issue with my Magento 2.3 setup. For me the problem was in a third party module that was using the "old" tinymce. Search for text 'tinymce' in your app/code directory. If you find some references in third party modules try to check if they have updates for Magento 2.3. Version 2.3 do not use tinymce anymore so somewhere in your setup you still use tinymce so you get this problem because Magento can't find / define tinymce. The right way in magento 2.3.1 for use tinymce
|
@hugoruivo |
If you're using magento 2.3.*composer require pavelleonidov/module-tinymce4 |
hi @sjayjay005 i have upgraded to magento 2.3.2, facing same issue in WYSWYG related to tinyMCE js does this module fix this error. |
I have the same issue with Magento 2.3.3 enterprise, and none engineers at adobe is able to help me with a premium support (cloud). Thank you adobe ! |
Preconditions
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: