Jump to:
| Project: | Yahoo YUI |
| Version: | 6.x-1.1-rc1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I'm only using YUI to be able to use the YUI Rich Text Editor. Nothing else.
The YUI Text Editor gives me control over where the YUI Rich Text Editor is visible via its separate configuration.
But regardless of where I tell YUI Text Editor to *not* appear, I cannot prevent YUI from loading 18 different .js files on every single page. I'd like to be able to avoid these loads.
Any thoughts on how I might prevent these .js loads? The code from YUI.module below that triggers these myriad loads is below.
/**
* Add a YUI JS file to the current page.
*
* @param $component
* Not used.
* @param $yui_source
* Location of the YUI library.
* @param $file_and_path
* File to include.
*/
function yui_add_js($component = NULL, $yui_source = NULL, $file_and_path = NULL) {
static $js_files = array();if (! preg_match('/^http:\/\//', $yui_source)) {
drupal_add_js($yui_source . $file_and_path);
}
elseif (! in_array($yui_source . $file_and_path, $js_files)) {
drupal_set_html_head('');
$js_files[] = $yui_source . $file_and_path;
}
}/**
* Add a YUI CSS file to the current page.
*
* @param $component
* Not used.
* @param $yui_source
* Location of the YUI library.
* @param $file_and_path
* File to include.
*/
function yui_add_css($component = NULL, $yui_source = NULL, $file_and_path = NULL) {
static $css_files = array();if (! preg_match('/^http:\/\//', $yui_source)) {
drupal_add_css($yui_source . $file_and_path);
}
elseif (! in_array($yui_source . $file_and_path, $css_files)) {
drupal_set_html_head('');
$css_files[] = $yui_source . $file_and_path;
}
}
Comments
#1
I have had the same issue but I fixed it myself, just take a look at http://xhochy.org/en/2009/02/28/yui-rich-text-editor-with-on-demand-load...
#2
Or see these bug reports:
#386008: Load YUI Editor javascript and CSS files only if there is an editor on the page
#386236: Add a parameter for url retrieval
#386066: Add support for YUI 2.7.x
#3
The patch for http://drupal.org/node/386236 for YUI has applied.