Recent Topics

3.3.3 - TinyMCE - Does not honour plugin options (patch inc)

started by on Apr 19, 2010 – Last touched: Apr 19, 2010

Apr 19, 2010 11:46    

A few small bugs in the _tinymce.plugin.php file were loading some of the plugin configuration options from the default values instead of the user saved values. This made it impossible to disable the context menu (which is required for Firefox spell check to work).

To verify the bug simply uncheck the context menu option under plugin settings for TinyMCE. Then start editing a page and notice the right-click context menu is still active.

This patch may be a hack, and not a proper fix. In the get_tmce_init function there are two variables referenced in regards to user-specified options. They are the class member Settings and the global variable UserSettings. The UserSettings variable would not return user-specified values, only default values. If the UserSettings global contains default configuration values, it might be better named as DefaultUserSettings to avoid future confusion. Or if this variable is intended to mirror the settings in the Settings member variable, then the real bug may be elsewhere in the code.

Code

--- orig/plugins/tinymce_plugin/_tinymce.plugin.php      2009-07-13 11:48:46.000000000 -0600
+++ new/plugins/tinymce_plugin/_tinymce.plugin.php     2010-04-19 03:18:59.000000000 -0600
@@ -685,12 +685,12 @@ class tinymce_plugin extends Plugin
                $tmce_theme_advanced_buttons3_array = array();
                $tmce_theme_advanced_buttons4_array = array();
 
-               if( $UserSettings->get('control_form_abortions') )
+               if( $this->Settings->get('control_form_abortions') )
                {       // Activate bozo validator: autosave plugin in TinyMCE
                        $tmce_plugins_array[] = 'autosave';
                }
 
-               if( $this->UserSettings->get('tmce_options_contextmenu') == 1 )
+               if( $this->Settings->get('tmce_options_contextmenu') == 1 )
                {
                        $tmce_plugins_array[] = 'contextmenu';
                }
@@ -730,13 +730,13 @@ class tinymce_plugin extends Plugin
                                'sub,sup'
                        );
 
-                       if( $this->UserSettings->get('tmce_options_directionality') == 1 )
+                       if( $this->Settings->get('tmce_options_directionality') == 1 )
                        {
                                $tmce_plugins_array[] = 'directionality';
                                array_push($tmce_theme_advanced_buttons3_array, 'ltr,rtl');
                        }
 
-                       if( $this->UserSettings->get('tmce_options_paste') == 1 )
+                       if( $this->Settings->get('tmce_options_paste') == 1 )
                        {
                                $tmce_plugins_array[] = 'paste';
                                $tmce_theme_advanced_buttons3_array[] = 'pastetext,pasteword';
@@ -748,7 +748,7 @@ class tinymce_plugin extends Plugin
 
                        $tmce_theme_advanced_buttons4_array = array();
 
-                       if( $this->UserSettings->get('tmce_options_xhtmlxtras') == 1 )
+                       if( $this->Settings->get('tmce_options_xhtmlxtras') == 1 )
                        {
                                array_push($tmce_plugins_array,'xhtmlxtras');
                                array_push($tmce_theme_advanced_buttons4_array,'cite,abbr,acronym,del,ins');

May 01, 2010 06:06

Thanks for sharing the patch. I hope devs will take it in account.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.