From b04388aa0629137862aa0175bd65057aad02c2be Mon Sep 17 00:00:00 2001 From: MichaelTempest Date: Mon, 7 Jun 2010 19:39:12 +0000 Subject: [PATCH] Item8294: Revert to using a tag, in accordance with Michael Daum's latest guidance, and back in line with how the code used to be before I tried EXPORTEDPREFERENCES. git-svn-id: http://svn.foswiki.org/trunk@7679 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- .../lib/Foswiki/Plugins/TinyMCEPlugin.pm | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm b/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm index 5b4b3c6ca6..bd633675bf 100644 --- a/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm +++ b/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm @@ -213,28 +213,17 @@ sub beforeEditHandler { my $pluginURL = '%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin'; my $tmceURL = $pluginURL . '/tinymce/jscripts/tiny_mce'; - # expand and URL-encode the init string + # expand the init string my $metainit = Foswiki::Func::expandCommonVariables($init); + + # URL-encode the init string $metainit =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge; - my $exportedPrefs = Foswiki::Func::getPreferencesValue('EXPORTEDPREFERENCES')||''; - if ($exportedPrefs) { - # Send the encoded JSON to foswiki_tiny.js via an exported preference - Foswiki::Func::setPreferencesValue( 'TINYMCEPLUGIN_INIT_ENCODED', $metainit); - my @list = split(/[,\s]+/, $exportedPrefs); - unless (grep { /^TINYMCEPLUGIN_INIT_ENCODED$/ } @list) { - push(@list, 'TINYMCEPLUGIN_INIT_ENCODED'); - } - Foswiki::Func::setPreferencesValue( - 'EXPORTEDPREFERENCES', join(',', @list)); - } - else { - # There is no EXPORTEDPREFERENCES preference, so assume that preferences - # are not exported automatically and export it here explicitly - Foswiki::Func::addToZone('body', 'tinyMCE_init', <<"SCRIPT"); - + # SMELL: meta tag now in a separate addToHEAD for Item8566, due to + # addToZONE shenanigans. tags really do have to be in the head! + Foswiki::Func::addToZone('head', 'tinyMCE::Meta', <<"SCRIPT"); + SCRIPT - } my $behaving; eval { @@ -256,7 +245,6 @@ SCRIPT # but Foswiki::Func.pm does not expose that function, so plugins may not use it $encodedVersion =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge; - Foswiki::Func::addToZone('body', 'tinyMCE', <<"SCRIPT", 'tinyMCE::Meta, JQUERYPLUGIN::FOSWIKI');