Okay
  Public Ticket #1877345
Javascript error in admin
Closed

Comments

  • Courtney Thaggard started the conversation

    A javascript error on dashboard (admin) originating from LayerSlider is causing issues with other plugins that use TinyMCE; the TinyMCE editor breaks and does not function. This error does not appear on LayerSlider itself, only on other plugins that are installed.

    In particular, when trying to edit "Notifications" as part of a form in GravityForms, the editor breaks (screenshot attached). The error in question is "ReferenceError: LS_MCE_I10n is not defined" initialized by Layerslider/static/admin/js/ls-admin-tinymce.js (screenshot attached). Deactivating LayerSlider clears the error and the WYSIWYG editor works again.

    We are on PHP 7.2, WP 5.0.3, LayerSlider 6.7.6.


  • [deleted] replied

    Hello Courtney Thaggard,

    Thank you for getting in touch with us. My name is Attila and I'm happy to assist you today. I appreciate your patience while we've been working towards your ticket.

    Please set up a temporary WP login for us, so we can investigate this error further. You can send private messages here with the login details, so other users won't see it. Thank you.

  •   Courtney Thaggard replied privately
  • [deleted] replied

    Thank you. My colleagues and I will look into this and get back to you shortly.

  • [deleted] replied

    Thank you for the patience. We've tried to investigate this error with the login you provided, but we will need further access to be able to locate the exact issue. We would need to edit the plugin's files to find out more. WP has a built-in editor for this, but it does not seem to be working on your site. So we will need a temporary FTP access to LayerSlider's files to continue troubleshooting. Thank you!

  •   Courtney Thaggard replied privately
  •  73
    John replied

    Hi Courtney,

    I'm John from the Kreatura Dev Team.

    Thank you for your patience and help with the admin and FTP access. With those I was able to trace this issue back to its source.

    In short: Gravity Forms has a feature called No-Conflict Mode. It's intended to filter out unnecessary scripts from being loaded on their editor pages to avoid any potential incompatibilities. Unfortunately, it doesn't always have the intended effect. Disabling it under Forms -> Settings will instantly resolve this issue.

    Now that we know the source of this problem we will also add a patch to LayerSlider to fall back gracefully in these situations. I've added a temporary fix to the /wp-content/plugins/LayerSlider/static/admin/js/ls-admin-tinymce.js file, so you can also copy that to your live site as an alternative.

    A more technical explanation: TinyMCE, the text editor WP uses, has a plugin system. LayerSlider has a helper utility that integrates into the editor, so customers can easily insert sliders into their posts and pages. Gravity Forms also uses this editor, which means that TinyMCE loads some LayerSlider assets for the utility. However, these assets depend on other scripts that Gravity Forms blocks. I've noticed that these required files are only missing on Gravity Forms pages. After some searching I managed to find the relevant part in code and saw that it depends on the setting mentioned above.

    Thank you again for your cooperation. You can now remove the test accounts.

    Best Regards,
    John | Kreatura Dev Team

  • Courtney Thaggard replied

    Hi John, thanks so much for the information and in-depth investigation and explanation of the issue. I have disabled "No Conflict" mode on Gravity Forms and it's working perfectly now.