Changeset 3369
- Timestamp:
- 04/03/09 17:28:17 (3 years ago)
- Location:
- trunk/TinyMCEPlugin
- Files:
-
- 3 edited
-
data/System/TinyMCEPlugin.txt (modified) (4 diffs)
-
lib/Foswiki/Plugins/TinyMCEPlugin.pm (modified) (4 diffs)
-
pub/System/TinyMCEPlugin/foswiki_tiny_src.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/TinyMCEPlugin/data/System/TinyMCEPlugin.txt
r3104 r3369 35 35 * *Click* on edit of any topic. 36 36 37 ---++ Settings 38 You can override this setting by defining TINYMCEPLUGIN_DEBUG to enable some simple debug features. 39 * Set DEBUG = 0 37 ---++ Preferences 38 If you want to change any of the preferences you are recommended to copy the examples below and paste them into your own [[%SYSTEMWEB%.PreferenceSettings][preference settings]]. The settings in this topic are just examples and have no effect. 40 39 41 Th is setting contains all the options passed to the TinyMCE editor on startup.42 For a full explanation of the available options, and guidance on reconfiguring TinyMCE, see the [[http://wiki.moxiecode.com/index.php/TinyMCE:Configuration][Moxicode TinyMCE Wiki]]. Note the inclusion of the Pattern Skin standard CSS files in the =content_css= setting. 43 <verbatim> 44 * SetINIT = mode:"textareas",40 The [[%SYSTEMWEB%.PreferenceSettings][preference setting]] =TINYMCEPLUGIN_INIT= lets you redefine all the options passed to the Tiny MCE editor on startup. For a full explanation of the available options, and 41 guidance on reconfiguring Tiny MCE, see the [[http://wiki.moxiecode.com/index.php/TinyMCE:Configuration][Moxicode TinyMCE Wiki]]. The default options are as follows. Note the inclusion of the Pattern Skin standard CSS files in the 42 =content_css= setting. 43 <verbatim> * Set TINYMCEPLUGIN_INIT = mode:"textareas", 45 44 editor_selector : "foswikiWysiwygEdit", 46 45 save_on_tinymce_forms: true, … … 50 49 relative_urls : false, 51 50 remove_script_host : false, 51 dialog_type: "modal", 52 52 setupcontent_callback : FoswikiTiny.setUpContent, 53 53 urlconverter_callback : "FoswikiTiny.convertLink", 54 hide_instance_callback : FoswikiTiny.switchToRaw,55 show_instance_callback : FoswikiTiny.switchToWYSIWYG,56 54 foswikipuburl_callback : "FoswikiTiny.convertPubURL", 57 55 save_callback : "FoswikiTiny.saveCallback", … … 89 87 theme_advanced_path: false, 90 88 theme_advanced_statusbar_location : "bottom", 89 keep_styles : false, 90 gecko_spellcheck : true, 91 91 content_css : "%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin/wysiwyg%IF{"$TINYMCEPLUGIN_DEBUG" then="_src"}%.css,%PUBURLPATH%/%SYSTEMWEB%/SkinTemplates/base.css,%FOSWIKI_STYLE_URL%,%FOSWIKI_COLORS_URL%" 92 92 </verbatim> 93 * Additional settings for specific browsers. 94 * Warning: if you enable =paste_auto_cleanup_on_paste then it automatically implies =past_use_dialog= on all non-MSIE browsers. 95 * Set INIT_MSIE = paste_auto_cleanup_on_paste : true 96 * Set INIT_OPERA = 97 * Set INIT_GECKO = 98 * Set INIT_SAFARI = 93 You can set additional options for specific browsers. You can define extra options for MSIE, OPERA, GECKO and SAFARI. For example, 94 <verbatim> * Set TINYMCEPLUGIN_INIT_MSIE = paste_auto_cleanup_on_paste : true 95 </verbatim> 96 * Warning: if you enable =paste_auto_cleanup_on_paste then it automatically implies =paste_use_dialog= on all non-MSIE browsers. 99 97 100 You can override these settings in the same way as any other [[%SYSTEMWEB%.PreferenceSettings][preference settings]], by setting e.g. =TINYMCEPLUGIN_INIT= in the site, web or topic preferences. You are *not* recommended to edit the setting here. 98 You can *disable* the plugin in any web or topic, or for any specific user, by setting =TINYMCEPLUGIN_DISABLE= to 1. e.g. 99 <verbatim> * Set TINYMCEPLUGIN_DISABLE = 1 100 </verbatim> 101 101 102 * You can *disable* the plugin in any web or topic, or for any specific user, by setting the =TINYMCEPLUGIN_DISABLE= preference to 1. 103 * Some browsers don't support !TinyMCE. You can prevent the editor from 104 being invoked on these browsers by setting =TINYMCEPLUGIN_BAD_BROWSERS= to a regular expression that matches the user-agent string for any broken browsers. The default is =(?i-xsm:Konqueror|Opera)=. 102 Some browsers don't support Tiny MCE. You can prevent the editor from 103 being invoked on these browsers by setting =TINYMCEPLUGIN_BAD_BROWSERS= to a regular expression that matches the user-agent string for any broken browsers. The default is =(?i-xsm:Konqueror|Opera)=. For a full list of supported browsers see http://wiki.moxiecode.com/index.php/TinyMCE:Compatibility 105 104 106 105 %INCLUDE{"%SYSTEMWEB%.WysiwygPluginSettings"}% 106 107 You can use the [[%SYSTEMWEB%.PreferenceSettings][preference setting]] =TINYMCEPLUGIN_DEBUG= to make the editor load uncompressed Javascript and CSS. This is very helpful when debugging. e.g. 108 <verbatim> * Set TINYMCEPLUGIN_DEBUG = 1 109 </verbatim> 107 110 108 111 ---++ Frequently Asked Questions … … 116 119 | Author: | [[http://c-dot.co.uk][Crawford Currie]] | 117 120 | Copyright: | © 2007-2008 Crawford Currie http://c-dot.co.uk | 118 | | This package also includes the complete sources for version 2.1.1.1 of the !TinyMCE editor |119 121 | License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] | 122 | | This package also includes the complete sources for version 3.2.2 of the !TinyMCE editor which is covered by [[http://tinymce.moxiecode.com/license.php][its own license]]. | 120 123 | Plugin Version: | %$VERSION% | 121 124 | Change History: | <!-- versions below in reverse order --> | 125 | 3 Apr 2009 | Foswikitask:Item1383: Optimised the preferences Foswikitask:Item8094: fixed the pickaxe | 122 126 | 15 Mar 2009 | Foswikitask:Item930: Crawford Currie upgraded to Tiny MCE 3.2.2 and recoded all the standard plugins that had to be recoded | 123 | 21 Jan 2009 | Foswikitask:Item833: Eugen Mayer added SYSTEMWEB to foswiki_vars, simplifying the activation of the foswikilink dialog of Extensions.TinyMCEUsabilityUpgradePlugin (if installed)|124 | 06 Dec 2008 | Foswikitask:Item5859: Eugen Mayer removed XHR headers that were banjaxing NTLM|125 | 03 Dec 2008 | Re-released for the Foswiki project |127 | 21 Jan 2009 | Foswikitask:Item833: added SYSTEMWEB to foswiki_vars, simplifying the activation of the foswikilink dialog of Extensions.TinyMCEUsabilityUpgradePlugin (if installed) - Eugen Mayer | 128 | 06 Dec 2008 | Foswikitask:Item5859: removed XHR headers that were banjaxing NTLM - Eugen Mayer | 129 | 03 Dec 2008 | Crawford Currie re-released for the Foswiki project | 126 130 | 03 Aug 2008 | TWiki 4.2.1 release version | 127 131 | 04 May 2008 | TWikibug:Item5547: Change mechanism by which TMCE recognises textareas to camp on. Use class instead of element name. | -
trunk/TinyMCEPlugin/lib/Foswiki/Plugins/TinyMCEPlugin.pm
r2957 r3369 1 2 1 # Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 3 2 # … … 19 18 use Assert; 20 19 21 our $VERSION = '$Rev$'; 22 our $RELEASE = '21 Jan 2009'; 23 our $SHORTDESCRIPTION = 'Integration of TinyMCE with WysiwygPlugin'; 20 our $VERSION = '$Rev$'; 21 our $RELEASE = '21 Jan 2009'; 22 our $SHORTDESCRIPTION = 'Integration of the !TinyMCE WYSIWYG Editor'; 23 our $NO_PREFS_IN_TOPIC = 1; 24 25 # Defaults for TINYMCEPLUGIN_INIT and INIT_browser. Defined as our vars to 26 # allow other extensions to override them. 27 # PLEASE ENSURE THE PLUGIN TOPIC EXAMPLES ARE KEPT IN SYNCH! 28 our $defaultINIT = <<'HERE'; 29 mode:"textareas", 30 editor_selector : "foswikiWysiwygEdit", 31 save_on_tinymce_forms: true, 32 cleanup : true, 33 theme : "advanced", 34 convert_urls : true, 35 relative_urls : false, 36 remove_script_host : false, 37 dialog_type: "modal", 38 setupcontent_callback : FoswikiTiny.setUpContent, 39 urlconverter_callback : "FoswikiTiny.convertLink", 40 foswikipuburl_callback : "FoswikiTiny.convertPubURL", 41 save_callback : "FoswikiTiny.saveCallback", 42 %IF{"$TINYMCEPLUGIN_DEBUG" then="debug:true,"}% 43 plugins : "table,searchreplace,autosave,paste,foswikibuttons,foswikiimage%IF{ "context TinyMCEUsabilityUpgradePluginEnabled" then=",foswikilink" else=""}%", 44 foswiki_secret_id : "%WYSIWYG_SECRET_ID%", 45 foswiki_vars : { PUBURLPATH : "%PUBURLPATH%", PUBURL : "%PUBURL%", WEB : "%WEB%", TOPIC : "%TOPIC%", ATTACHURL : "%ATTACHURL%", ATTACHURLPATH : "%ATTACHURLPATH%", VIEWSCRIPTURL : "%SCRIPTURL{view}%", SCRIPTSUFFIX: "%SCRIPTSUFFIX%", SCRIPTURL : "%SCRIPTURL%", SYSTEMWEB: "%SYSTEMWEB%" }, 46 theme_advanced_toolbar_align : "left", 47 foswikibuttons_formats : [ 48 { name: "Normal", el: "", style: null }, 49 { name: "Heading 1", el: "h1", style: false }, 50 { name: "Heading 2", el: "h2", style: false }, 51 { name: "Heading 3", el: "h3", style: false }, 52 { name: "Heading 4", el: "h4", style: false }, 53 { name: "Heading 5", el: "h5", style: false }, 54 { name: "Heading 6", el: "h6", style: false }, 55 { name: "VERBATIM", el: "pre", style: "TMLverbatim" }, 56 { name: "LITERAL", el: "span", style: "WYSIWYG_LITERAL" }, 57 { name: "Protect on save", el: null, style: "WYSIWYG_PROTECTED" }, 58 { name: "Protect forever", el: null, style: "WYSIWYG_STICKY" } 59 ], 60 paste_create_paragraphs : true, 61 paste_create_linebreaks : false, 62 paste_convert_middot_lists : true, 63 paste_convert_headers_to_strong : false, 64 paste_remove_spans: true, 65 paste_remove_styles: true, 66 paste_strip_class_attributes: "all", 67 theme_advanced_buttons1 : "foswikiformat,separator,bold,italic,tt,colour,removeformat,separator,bullist,numlist,outdent,indent,separator,link,unlink,anchor,separator,attach,image,charmap,hr,separator,undo,redo,separator,search,replace", 68 theme_advanced_buttons2: "tablecontrols,separator,code,hide", 69 theme_advanced_buttons3: "", 70 theme_advanced_toolbar_location: "top", 71 theme_advanced_resize_horizontal : false, 72 theme_advanced_resizing : true, 73 theme_advanced_path: false, 74 theme_advanced_statusbar_location : "bottom", 75 keep_styles : false, 76 gecko_spellcheck : true, 77 content_css : "%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin/wysiwyg%IF{"$TINYMCEPLUGIN_DEBUG" then="_src"}%.css,%PUBURLPATH%/%SYSTEMWEB%/SkinTemplates/base.css,%FOSWIKI_STYLE_URL%,%FOSWIKI_COLORS_URL%" 78 HERE 79 our %defaultINIT_BROWSER = ( 80 MSIE => 'paste_auto_cleanup_on_paste : true', 81 OPERA => '', 82 GECKO => '', 83 SAFARI => '', 84 ); 24 85 25 86 use Foswiki::Func; … … 102 163 103 164 my $init = Foswiki::Func::getPreferencesValue('TINYMCEPLUGIN_INIT') 104 || <<'HERE'; 105 ' 106 HERE 165 || $defaultINIT; 107 166 my $extras = ''; 108 167 … … 122 181 } 123 182 if ($extras) { 124 $extras = 125 Foswiki::Func::getPreferencesValue( 'TINYMCEPLUGIN_INIT_' . $extras );183 $extras = Foswiki::Func::getPreferencesValue( 184 'TINYMCEPLUGIN_INIT_' . $extras ) || $defaultINIT_BROWSER{$extras}; 126 185 if ( defined $extras ) { 127 186 $init = join( ',', ( split( ',', $init ), split( ',', $extras ) ) ); -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny_src.js
r3104 r3369 41 41 }, 42 42 43 enableSave : function(enabled) {43 enableSaveButton: function(enabled) { 44 44 var status = enabled ? null : "disabled"; 45 45 var elm = document.getElementById("save"); … … 91 91 }, 92 92 93 onSubmitHandler : false, 94 93 95 // Convert HTML content to textarea. Called from the WYSIWYG->raw switch 94 96 switchToRaw : function (editor) { 95 // As shown by OliverKrueger in Item5138, trivial text may include96 // UTF-8 chars. These need to be encoded to entities before we can97 // pass the string back to the server. This is done in triggerSave,98 // but note that it requires cleanup:true to work.99 //SMELL: how? editor.triggerSave(false, true);100 97 var text = editor.getContent(); 101 98 102 // Evaluate post-processors 99 // Evaluate post-processors attached from plugins 103 100 for (var i = 0; i < FoswikiTiny.html2tml.length; i++) { 104 101 var cb = FoswikiTiny.html2tml[i]; 105 102 text = cb.apply(editor, [ editor, text ]); 106 103 } 107 FoswikiTiny.enableSave (false);104 FoswikiTiny.enableSaveButton(false); 108 105 editor.getElement().value = 109 106 "Please wait... retrieving page from server."; … … 112 109 function (text, req, o) { 113 110 this.getElement().value = text; 114 FoswikiTiny.enableSave (true);111 FoswikiTiny.enableSaveButton(true); 115 112 }, 116 113 function (type, req, o) { … … 119 116 + o.url + ": " 120 117 + type + " " + req.status + "</div>"); 118 //FoswikiTiny.enableSaveButton(true); leave save disabled 121 119 }); 122 120 // Add the button for the switch back to WYSIWYG mode … … 148 146 editor.isNotDirty = false; 149 147 return true; 150 } 148 }, 149 // Ooo-err. Stomp on the default submit handler and 150 // forcibly disable the editor to prevent a call to 151 // the TMCE save. This in turn blocks the getContent 152 // that would otherwise wipe out the content of the 153 // textarea with the DOM. We'd better make damn sure we 154 // remove this handler when we switch back! 155 this.onSubmitHandler = function(ed, e) { 156 // SMELL: Editor.initialized is undocumented and liable 157 // to break when we upgrade TMCE 158 editor.initialized = false; 159 }; 160 // SMELL: Event.addToTop() is undocumented and liable 161 // to break when we upgrade TMCE 162 editor.onSubmit.addToTop(this.onSubmitHandler); 151 163 }, 152 164 … … 160 172 var text = editor.getElement().value; 161 173 162 FoswikiTiny.enableSave(false); 174 if (this.onSubmitHandler) { 175 editor.onSubmit.remove(this.onSubmitHandler); 176 this.onSubmitHandler = null; 177 } 178 FoswikiTiny.enableSaveButton(false); 163 179 editor.setContent("<span class='foswikiAlert'>" 164 180 + "Please wait... retrieving page from server." … … 174 190 this.setContent(text); 175 191 this.isNotDirty = true; 176 FoswikiTiny.enableSave (true);192 FoswikiTiny.enableSaveButton(true); 177 193 }, 178 194 function (type, req, o) { … … 182 198 + o.url + ": " 183 199 + type + " " + req.status + "</div>"); 184 //FoswikiTiny.enableSave (true); leave save disabled200 //FoswikiTiny.enableSaveButton(true); leave save disabled 185 201 }); 186 202
Note: See TracChangeset
for help on using the changeset viewer.
