Permalink
Browse files

Item9973: Fix international chars in topic name breaking attach dialo…

…gue,

... by removing the escaping business (see code comments for justification)

Also added a new preference setting (d'oh!) for entity_encoding. The reason
is that between IRC and support web, there's at least half a dozen users
asking how to set this, and these are users who know that tinymce is capable
of such a setting and just want to know the best way to get Foswiki to play
ball.

Also, changed the default to numeric - OOB TinyMCE uses 'named'. 'raw' is
considered an advanced option (interesting ways we can break WysiwygPlugin
if you paste entities into TinyMCE that aren't supported in the charset
configured for the Foswiki site).

git-svn-id: http://svn.foswiki.org/branches/Release01x01@10483 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
PaulHarvey PaulHarvey
PaulHarvey authored and PaulHarvey committed Jan 6, 2011
1 parent 887bbf0 commit 0a834d96febad0119238ac10b580384a9703c78e
@@ -149,6 +149,11 @@ Below is the default configuration. If it is to be modified, it should be copied
then="%TINYMCEPLUGIN_AUTOSAVE_RETENTION%"
else="%STARTSECTION{"AUTOSAVE_RETENTION"}%4320m%ENDSECTION{"AUTOSAVE_RETENTION"}%"
}%",
"entity_encoding" : "%IF{
"defined 'TINYMCEPLUGIN_ENTITY_ENCODING'"
then="%TINYMCEPLUGIN_ENTITY_ENCODING%"
else="%STARTSECTION{"ENTITY_ENCODING"}%numeric%ENDSECTION{"ENTITY_ENCODING"}%"
}%",
"theme_advanced_toolbar_location" : "top",
"theme_advanced_resize_horizontal" : false,
"theme_advanced_resizing" : true,
@@ -185,6 +190,7 @@ Example:
| =NOWYSIWYG= | 0 | If this global setting is set to 1, TinyMCEPlugin (and all other WYSIWYG editors) will be disabled. |
| =TINYMCEPLUGIN_BAD_BROWSERS= | =(?i-xsm:Konqueror)= | A regular expression that matches the user-agent string of any browser for which !TinyMCE should not be loaded. |
| =TINYMCEPLUGIN_DEBUG= | 0 | If set to 1, the uncompressed version of !TinyMCE Javascript and CSS sources will be loaded by the browser. Useful for debugging. |
| =TINYMCEPLUGIN_ENTITY_ENCODING= | %INCLUDE{"%TOPIC%" section="ENTITY_ENCODING"}% | Controls how entities/characters get processed by !TinyMCE. Allowed values: =named, numeric, raw= |
---+++ Browser Specific Settings
Additional options may be set for specific browsers. You can define extra options for MSIE, OPERA, GECKO and SAFARI. For example,
@@ -248,11 +254,8 @@ Some notable plugins:
The topic [[TinyMCEFrequentlyAskedQuestions]] contains more help with things like: "How do I configure the buttons in my skin?", "How do I disable the WYSIWYG?" etc.
----
---+++ WysiwygPlugin Settings
TinyMCEPlugin depends on WysiwygPlugin to do the conversions from HTML to TML (Topic Markup Language) and back again. For more information, see WysiwygPlugin.
%INCLUDE{"%SYSTEMWEB%.WysiwygPluginSettings"}%
----
See WysiwygPluginSettings for more information
---++ Upgrading from TinyMCEPlugin versions prior to 05 Mar 2010 release
The =TINYMCEPLUGIN_INIT= string needs to be built differently, due to the API change affecting the way custom formats are applied in !TinyMCE 3.3.x since 3.2.x
@@ -270,6 +273,9 @@ If a customised =TINYMCEPLUGIN_INIT= string is in use, it should be re-built bas
* Work-around: Users may elect to persist with this behaviour, or alternatively, override =TINYMCEPLUGIN_MCEPLUGINS= to omit the =paste= plugin: however, this solution may introduce its own problems.
* Foswikitask:Item9198 - After inserting new table at top of document: unable to position cursor above
* Work-around: Use 'Save and continue' or switch to WikiText and back to WYSIWYG again to allow WysiwygPlugin to add an empty =<p/>= above the table
* Foswikitask:Item8085 - International characters (example, Š) are converted to HTML entities (IE. =Š= or =Š=)
* Ensure you are using the latest version of WysiwygPlugin.
* Work-around: Try changing the =TINYMCEPLUGIN_ENTITY_ENCODING= setting to =raw=. It's possible this may cause problems on older browsers.
---++ Known Issues of WysiwygPlugin (partial list)
For the full list, consult [[WysiwygPlugin#Known_issues][WysiwygPlugin documentation]]
@@ -288,7 +294,9 @@ Another great Foswiki extension from the <a style="text-decoration:none" href="h
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| ? | Foswikitask:Item2174: JS fix for deleting encoded-TML-whitespace on Firefox |
| 22 Nov 2010 | Foswikitask:Item9973: Fix problem where topic names with international characters prevented attach dialogue working correctly<br/> \
Foswikitask:Item8085: Added =TINYMCEPLUGIN_ENTITY_ENCODING= setting; default to =numeric= |
| 10 Nov 2010 | Foswikitask:Item2174: JS fix for deleting encoded-TML-whitespace on Firefox |
| 04 Nov 2010 | Foswikitask:Item9706: Upgrade to !TinyMCE 3.3.9.2<br/>\
Foswikitask:Item9953: Fix JS error transitioning to !WikiText from fullscreen<br/>\
Foswikitask:Item9952: Fix bold & italics buttons not activating on already bolded/italicised text properly<br/>\
@@ -8,7 +8,7 @@ use warnings;
use Assert;
our $VERSION = '$Rev$';
our $RELEASE = '04 Nov 2010';
our $RELEASE = '22 Nov 2010';
our $SHORTDESCRIPTION = 'Integration of the Tiny MCE WYSIWYG Editor';
our $NO_PREFS_IN_TOPIC = 1;
@@ -170,17 +170,6 @@ sub beforeEditHandler {
my $pluginURL = '%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin';
my $tmceURL = $pluginURL . '/tinymce/jscripts/tiny_mce';
# expand the init string
my $metainit = $init; #Already expanded
# URL-encode the init string
$metainit =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge;
# <meta> tags really do have to be in the head!
Foswiki::Func::addToHEAD( 'TINYMCEPLUGIN_INIT_ENCODED', <<"META" );
<meta name="foswiki.TINYMCEPLUGIN_INIT_ENCODED" content="$metainit" />
META
# URL-encode the version number to include in the .js URLs, so that
# the browser re-fetches the .js when this plugin is upgraded.
my $encodedVersion = $VERSION;
@@ -191,10 +180,19 @@ META
$encodedVersion =~
s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge;
# Inline JS to set config? Heresy! Well, we were encoding into <meta tags
# but this caused problems with non-8bit encodings (See Item9973). Given
# that we blindly eval'd the unescaped TINYMCEPLUGIN_INIT anyway, PaulHarvey
# doesn't think it was any more secure anyway. Alternative is to use
# https://github.com/douglascrockford/JSON-js lib
my $scripts = <<"SCRIPT";
<script language="javascript" type="text/javascript" src="$tmceURL/tiny_mce$USE_SRC.js?v=$encodedVersion"></script>
<script language="javascript" type="text/javascript" src="$pluginURL/foswiki_tiny$USE_SRC.js?v=$encodedVersion"></script>
<script language="javascript" type="text/javascript" src="$pluginURL/foswiki$USE_SRC.js?v=$encodedVersion"></script>
<script type="text/javascript" src="$tmceURL/tiny_mce$USE_SRC.js?v=$encodedVersion"></script>
<script type="text/javascript" src="$pluginURL/foswiki_tiny$USE_SRC.js?v=$encodedVersion"></script>
<script type="text/javascript">
FoswikiTiny.init = {
$init
};</script>
<script type="text/javascript" src="$pluginURL/foswiki$USE_SRC.js?v=$encodedVersion"></script>
SCRIPT
Foswiki::Func::addToZone( 'script', 'TinyMCEPlugin', $scripts,
@@ -1,5 +1,6 @@
/*
Copyright (C) 2007 Crawford Currie http://wikiring.com and Arthur Clemens
Copyright (C) 2010 Foswiki Contributors http://foswiki.org
All Rights Reserved.
This program is free software; you can redistribute it and/or
@@ -372,14 +373,13 @@ var FoswikiTiny = {
},
install: function() {
// find the TINYMCEPLUGIN_INIT_ENCODED preference
var tmce_init = foswiki.getPreference('TINYMCEPLUGIN_INIT_ENCODED');
if (tmce_init != null) {
eval("tinyMCE.init({" + unescape(tmce_init) + "});");
return;
// find the TINYMCEPLUGIN_INIT preference
if (FoswikiTiny.init) {
tinyMCE.init(FoswikiTiny.init);
} else {
alert(
'Unable to install TinyMCE: could not read "TINYMCEPLUGIN_INIT" from FoswikiTiny.init');
}
alert(
"Unable to install TinyMCE; 'TINYMCEPLUGIN_INIT_ENCODED' preference missing");
},
getTopicPath: function() {

0 comments on commit 0a834d9

Please sign in to comment.