gocodebox / lifterlms

LifterLMS, a WordPress LMS Solution: Easily create, sell, and protect engaging online courses.
https://lifterlms.com
GNU General Public License v3.0
178 stars 135 forks source link

Access plan editor doesn't load with visual editing disabled #470

Open pjeby opened 6 years ago

pjeby commented 6 years ago

1. Reproduction Steps

2. Expected Behavior

3. Actual Behavior

thomasplevy commented 6 years ago

@pjeby any errors on the JS console that you're seeing here?

pjeby commented 6 years ago

Before the hundreds of "waiting" messages, there are two jqmigrate warnings:

Both traces list LLMS.init, but are unlikely to be a problem because they also appear when the visual editor is enabled and the product options section works normally.

Ironically, when the section works, there is an error in the console:

tinymce.min.js Uncaught TypeError: Cannot set property 'onload' of null

Anyway, the most critical difference between the working and non-working conditions is that when the visual editor is enabled, there are wp-includes/js/tinymce scripts included on the page, and when it is not, they are not.

LLMS apparently requires the visual editor to be enabled, rather than falling back to plain textareas as wordpress itself does. ISTM that it should either fall back gracefully in that case, or else force the needed scripts to be included.

It would appear that Wordpress has (since 4.8) some hooks that can be used to ensure that certain scripts are loaded after TinyMCE, so that might be an option for replacing the "check ten times a second for 30 seconds" approach to dependency ordering.

Alternately, simply having LLMS check whether the visual editor is even enabled in the first place and not having the dependency check take place could support the "fall back to plain text" approach.

thomasplevy commented 6 years ago

@pjeby I'll look into finding a better solution when the editor is disabled. Thanks