elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.57k stars 1.42k forks source link

Uncaught TypeError: Cannot read property 'toolbar1' of undefined #8990

Open mastef opened 5 years ago

mastef commented 5 years ago

I'm having the same issue from #404 ( closed in 2016 ) with Uncaught TypeError: Cannot read property 'toolbar1' of undefined triggered in rearrangeButtons when I try to edit a text field. Can't edit any text editor fields due to that.

Triggered by this line : https://github.com/elementor/elementor/blob/master/assets/dev/js/editor/controls/wysiwyg.js#L137

This code block seems to be executing that function : https://github.com/elementor/elementor/blob/master/assets/dev/js/editor/controls/wysiwyg.js#L81-L85

It looks like tinyMCEPreInit.mceInit.elementorwpeditor is not defined - although it should be, right? tinyMCEPreInit.mceInit is an object with empty keys, based on how many times I try to load the text editor: image

Happy to debug more.

The bad part about this is that the text editor was loading properly just a few minutes/hours back, but when I attempted to restore an older 3-4 months old revision of the homepage through the WP interface ( Elementor revisions don't seem to go that far back ) this issue started appearing. I've disabled cache plugins, autooptimize, etc.

elementor.config.wp_editor has a value. Maybe the onReady event doesn't fire? I can see that this logic was recently changed here with the if ( ! this.isDestroyed ) { check : https://github.com/elementor/elementor/commit/170d95d3b9dfad312c54260b509ce41ae687305e by @kobizz - but I'm not sure this is related.

CiliaFred commented 4 years ago

Hi, did you solve it ?

Got same problem

marlonmantilla commented 4 years ago

Hey guys, having the same issue here after making a sub-domain change. Any ideas ?

cchitsiang commented 4 years ago

~Hi, we also experiencing the same issue with our site at the moment, post here to see if anyone have any workaround could share. Also any ETA to fix this issue~

UPDATE: In our case, we got the issue is because of we are using CloudFront with Wordpress. CloudFront does not forward the UserAgent header to the Wordpress blog. WordPress apparently disables the visual editor when an unrecognized UserAgent is requesting the page. Whitelisting the UserAgent header in CloudFront fixed our issue.

Hope this helps others facing the same issue

marlonmantilla commented 4 years ago

If anyone else it's struggling with this, you can try this plugin https://wordpress.org/plugins/visual-mode-in-cloudfront/ after activating the editor started to work.