Closed (fixed)
Project:
Tiny Tiny MCE
Version:
5.x-1.1
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jun 2008 at 12:02 UTC
Updated:
24 Jun 2008 at 14:50 UTC
I realized that the module starts with
<?php
if (function_exists('user_access')) {
// *********************************
// Link the necessary scripts
// *********************************
$path = drupal_get_path('module', 'tinytinymce');
drupal_add_js($path.'/tinymce/jscripts/tiny_mce/tiny_mce.js', 'module', 'header', false, true, false);
drupal_add_js(tinytinymce_init().tinytinymce_toggle(), 'inline');
} else {
drupal_set_message(t('Tiny Tiny MCE is not correctly installed - please check the installation notes'));
}
?>
But this means that the tiny_mce.js file are loaded for users that might never use TINYMCE
I propose to get rid of this part of the code and load the .js file when needed
inside the phptemplate_textarea() call
<?php
....
if (!$excluded && (user_access('use tinytinymce advanced') === true || user_access('use tinytinymce simple') === true)) {
$path = drupal_get_path('module', 'tinytinymce');
drupal_add_js($path.'/tinymce/jscripts/tiny_mce/tiny_mce.js', 'module', 'header', false, true, false);
drupal_add_js(tinytinymce_init().tinytinymce_toggle(), 'inline');
$pos = strrpos($out, '</div>');
....
?>
Comments
Comment #1
Steve Lockwood commentedThis looks like an improvement, thanks.
I suggest that you wrap the section of code in
if (function_exists('user_access')) {
...
}
This was to prevent the module from crashing in cases where it was not installed in the right place or if the wrong caching settings were being used.
I will take a proper look at your code and incorporate in a future release.
Steve
Comment #2
giorgoskSteve I think your problem with caching lies in the fact
that your are overiding the theme_textarea()
(maybe the wrong approach)
I am looking into how tinymce module does its magic
and I think you should look closely into
Because I think that is where it all starts
Comment #3
Steve Lockwood commentedComment #4
Steve Lockwood commentedComment #5
giorgoskSteve I believe issues are closed automatically
after 2 weeks of inactivity