Load YUI Editor javascript and CSS files only if there is an editor on the page

xhochy - February 27, 2009 - 17:48
Project:YUI Rich Text Editor
Version:6.x-2.33
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

Only load the files needed for the editor if there is an editor on the active page that requires them. Do not load them if there is no editor. In the attachment I added a patch that loads the files only if any of the specified ids exist on the current page, loading of these files is done by the help of jQuery.

Without this patch the files get loaded on any page of the Drupal installation, so that the first time a user visits that page, he has to download a lot of data which he doesn't need, this is not the fast web experience he wants.

This work is part of https://code.launchpad.net/~uwelk/yui/drupal-yui_editor where I stored my modifications to the YUI Editor module which I need for a certain website, it is still not a mature site, so do not rely on this, please stick to the added patch.

AttachmentSize
yui-editor-load-on-demand.patch9.04 KB

#1

InternetPro - July 9, 2009 - 05:53

I have downloaded and tested this patch. It seems to work as advertised. I'd like to see this included in the module files. I'll continue to test it and let you know if I hit any problems.

Well done and thank you for this contribution!

#2

mcrittenden - July 14, 2009 - 14:11
Status:needs review» reviewed & tested by the community

Same here. Would be great to get it in there.

 
 

Drupal is a registered trademark of Dries Buytaert.