Closed Bug 783853 Opened 12 years ago Closed 12 years ago

Only load CKEditor JavaScript when WYSIWYG is present

Categories

(developer.mozilla.org Graveyard :: Editing, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: teoli, Unassigned)

References

Details

Each wiki page requests these 3 scripts:
  <script src="{{ MEDIA_URL }}ckeditor/ckeditor.js"></script>
  <script src="{{ MEDIA_URL }}ckeditor/adapters/jquery.js"></script>
  <script src="{{ MEDIA_URL }}js/wiki_ckeditor.js"></script>


Only $edit pages (I think) make uses of CKEditor. Move the loading of these scripts from:
kuma / apps / wiki / templates / wiki / base.html

to the bottom of:
 kuma / apps / wiki / templates / wiki / edit_document.html

(in an else block from the loading of Ace, as we don't need CK when editing templates).

This will save time on the first visit to a wiki page. These 3 files take between 0.8 and 1.5s to be loaded (then parsed, …). Note we won't see a net gain from this time, as these requests can be conducted in parallel (8 for modern browsers), but it means that 3 other HTTP requests may be started earlier.
It's not as easy as this, because of the possibility of section editing....*BUT* we could then, instead, switch to only loading WYSIWYG scripts if the user is logged in;  that way search engines don't have to wait because they'll never be logged in
Nor are most of our users ever logged in.
Oh right, section editing!

Loading it only if logged in will indeed mitigate the problem. (Also with the caching system, but that's another bug).

With both thing, it means that logged-in editors, and only them, may have one request too early (and not too much). Which is very acceptable.
That is a good idea. I think we should do that, but still at least consider what Jean-Yves requested -- not loading the JavaScript at all unless the WYSIWYG is present.

I opened bug 785412 for the former. We can keep this bug around for the latter.
Summary: Don't load ckeditor scripts on page without usage for ckeditor → Only load CKEditor JavaScript when WYSIWYG is present
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/608cb2b53fb7d496b5f3284e860dc05c0af638e9
fix bug 783853 - remove CKEDITOR js files if user not logged in

https://github.com/mozilla/kuma/commit/5cf68fb43730e2ba1b7dc6f678517438581ca6d7
Merge pull request #538 from darkwing/ckeditor-js-783853

fix bug 783853 - remove CKEDITOR js files if user not logged in
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
verified fixed the ckeditor files were not loaded when logged out 


https://developer.allizom.org/en-US/docs/HTML or when thr ckeditor was not present
Status: RESOLVED → VERIFIED
Version: Kuma → unspecified
Component: Docs Platform → Editing
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.