Bug in TinyMCE WYSIWYG editor plugin

Found a bug? Tell us!!
Post Reply
Marduk

Bug in TinyMCE WYSIWYG editor plugin

Post by Marduk »

Hi,
I've found a bug in the TinyMCE plugin concerning the language and UTF-8 setting.
If the charset of the blog is set to UTF-8 and the language is one of those which gets an "-utf(8)" postfix in the constant WYSIWYG_LANG defined in the corresponding file lang\UTF-8\serendipity_lang_language-shortcut.inc.php - the matching language file from TinyMCE normally located under plugins\serendipity_event_tinymce\tinymce\jscripts\tiny_mce\langs will not be included. This results in broken tooltips of the TinyMCE button bar and select box entries.
Generally speaking: if the language shortcut defined by s9y via the WYSIWYG_LANG constant doesn't match the filename of the language file from TinyMCE - the init of the TinyMCE javascript won't work properly. This will appear at the language Czech as well: s9y defines it either 'cs-win' or 'cs-iso' - in case of UTF-8 as 'cs-utf'. None of those reflect the Czech language file from TinyMCE which is named 'cs.js'. In my case it was 'de-utf' and 'de.js'.

So the bad code is located in the file plugins\serendipity_event_tinymce\serendipity_event_tinymce.php on line 121-122:

Code: Select all

        language
            : "<?php WYSIWYG_LANG; ?>",
I did a quick and dirty fix and changed that to:

Code: Select all

        language
            : "<?php echo substr(WYSIWYG_LANG, 0, 2); ?>",
By doing this only the first 2 characters are passed to TinyMCE for the language include. This will work in most cases - but not at every case. So there should be a matrix mapping the s9y values of the constant to the matching filenames from TinyMCE to ensure always a proper language include. Or maybe changing the WYSIWYG_LANG values according to the TinyMCE names? But I think there will be other dependencies on this constant.

My testing environment:
  • Serendipity 1.0-alpha2 (the serendipity-nightly from 2006-01-08 - s9y_200601081438.tar.gz)
  • PHP 5.1.1 & MySQL 5.0.16
  • TinyMCE 2.0.1 with TinyMCE compressor 1.06
  • TinyMCE Plugin marked v 1.8 2005/08/22 12:39:09
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Bug in TinyMCE WYSIWYG editor plugin

Post by garvinhicking »

Thanks a lot for this very important notice! I committed your change, which I think works fairly well for the time being.

As a complete fix, yes - we would need a mapping from which s9y WYSIWYG_LANG goes to which tinymce lang.

The problem is, we cannot change the s9y WYSIWY_LANG setting, because the internally bundled htmlarea plugin uses those values. Instead, it should be fixed in the plugins using that value for correct mapping.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply