Changeset 7679
- Timestamp:
- 06/07/10 19:39:12 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm
r7644 r7679 214 214 my $tmceURL = $pluginURL . '/tinymce/jscripts/tiny_mce'; 215 215 216 # expand and URL-encodethe init string216 # expand the init string 217 217 my $metainit = Foswiki::Func::expandCommonVariables($init); 218 219 # URL-encode the init string 218 220 $metainit =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge; 219 221 220 my $exportedPrefs = Foswiki::Func::getPreferencesValue('EXPORTEDPREFERENCES')||''; 221 if ($exportedPrefs) { 222 # Send the encoded JSON to foswiki_tiny.js via an exported preference 223 Foswiki::Func::setPreferencesValue( 'TINYMCEPLUGIN_INIT_ENCODED', $metainit); 224 my @list = split(/[,\s]+/, $exportedPrefs); 225 unless (grep { /^TINYMCEPLUGIN_INIT_ENCODED$/ } @list) { 226 push(@list, 'TINYMCEPLUGIN_INIT_ENCODED'); 227 } 228 Foswiki::Func::setPreferencesValue( 229 'EXPORTEDPREFERENCES', join(',', @list)); 230 } 231 else { 232 # There is no EXPORTEDPREFERENCES preference, so assume that preferences 233 # are not exported automatically and export it here explicitly 234 Foswiki::Func::addToZone('body', 'tinyMCE_init', <<"SCRIPT"); 235 <script language="javascript" type="text/javascript">foswiki.preferences['TINYMCEPLUGIN_INIT_ENCODED']="$metainit"</script> 222 # SMELL: meta tag now in a separate addToHEAD for Item8566, due to 223 # addToZONE shenanigans. <meta> tags really do have to be in the head! 224 Foswiki::Func::addToZone('head', 'tinyMCE::Meta', <<"SCRIPT"); 225 <meta name="foswiki.TINYMCEPLUGIN_INIT_ENCODED" content="$metainit" /> 236 226 SCRIPT 237 }238 227 239 228 my $behaving; … … 257 246 $encodedVersion =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge; 258 247 259 260 248 Foswiki::Func::addToZone('body', 'tinyMCE', <<"SCRIPT", 'tinyMCE::Meta, JQUERYPLUGIN::FOSWIKI'); 261 249 <script language="javascript" type="text/javascript" src="$tmceURL/tiny_mce_jquery$USE_SRC.js?v=$encodedVersion"></script>
Note: See TracChangeset
for help on using the changeset viewer.
