Changeset 3369


Ignore:
Timestamp:
04/03/09 17:28:17 (3 years ago)
Author:
CrawfordCurrie
Message:

Item1383: Optimised the preferences Item8094: fixed the pickaxe

Location:
trunk/TinyMCEPlugin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/TinyMCEPlugin/data/System/TinyMCEPlugin.txt

    r3104 r3369  
    3535   * *Click* on edit of any topic. 
    3636 
    37 ---++ Settings 
    38 You can override this setting by defining TINYMCEPLUGIN_DEBUG to enable some simple debug features. 
    39    * Set DEBUG = 0 
     37---++ Preferences 
     38If 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. 
    4039 
    41 This 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    * Set INIT = mode:"textareas", 
     40The [[%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 
     41guidance 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", 
    4544   editor_selector : "foswikiWysiwygEdit", 
    4645   save_on_tinymce_forms: true, 
     
    5049   relative_urls : false, 
    5150   remove_script_host : false, 
     51   dialog_type: "modal", 
    5252   setupcontent_callback : FoswikiTiny.setUpContent, 
    5353   urlconverter_callback : "FoswikiTiny.convertLink", 
    54    hide_instance_callback : FoswikiTiny.switchToRaw, 
    55    show_instance_callback : FoswikiTiny.switchToWYSIWYG, 
    5654   foswikipuburl_callback : "FoswikiTiny.convertPubURL", 
    5755   save_callback : "FoswikiTiny.saveCallback", 
     
    8987   theme_advanced_path: false, 
    9088   theme_advanced_statusbar_location : "bottom", 
     89   keep_styles : false, 
     90   gecko_spellcheck : true, 
    9191   content_css : "%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin/wysiwyg%IF{"$TINYMCEPLUGIN_DEBUG" then="_src"}%.css,%PUBURLPATH%/%SYSTEMWEB%/SkinTemplates/base.css,%FOSWIKI_STYLE_URL%,%FOSWIKI_COLORS_URL%" 
    9292</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 =  
     93You 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. 
    9997 
    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. 
     98You 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> 
    101101 
    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)=.    
     102Some browsers don't support Tiny MCE. You can prevent the editor from 
     103being 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 
    105104 
    106105%INCLUDE{"%SYSTEMWEB%.WysiwygPluginSettings"}% 
     106 
     107You 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> 
    107110 
    108111---++ Frequently Asked Questions 
     
    116119|  Author: | [[http://c-dot.co.uk][Crawford Currie]] | 
    117120|  Copyright: | &copy; 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 | 
    119121|  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]]. | 
    120123|  Plugin Version: | %$VERSION% | 
    121124|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
     125|  3 Apr 2009 | Foswikitask:Item1383: Optimised the preferences Foswikitask:Item8094: fixed the pickaxe | 
    122126|  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 | 
    126130|  03 Aug 2008 | TWiki 4.2.1 release version | 
    127131|  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  
    21# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 
    32# 
     
    1918use Assert; 
    2019 
    21 our $VERSION          = '$Rev$'; 
    22 our $RELEASE          = '21 Jan 2009'; 
    23 our $SHORTDESCRIPTION = 'Integration of TinyMCE with WysiwygPlugin'; 
     20our $VERSION           = '$Rev$'; 
     21our $RELEASE           = '21 Jan 2009'; 
     22our $SHORTDESCRIPTION  = 'Integration of the !TinyMCE WYSIWYG Editor'; 
     23our $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! 
     28our $defaultINIT       = <<'HERE'; 
     29mode:"textareas", 
     30editor_selector : "foswikiWysiwygEdit", 
     31save_on_tinymce_forms: true, 
     32cleanup : true, 
     33theme : "advanced", 
     34convert_urls : true, 
     35relative_urls : false, 
     36remove_script_host : false, 
     37dialog_type: "modal", 
     38setupcontent_callback : FoswikiTiny.setUpContent, 
     39urlconverter_callback : "FoswikiTiny.convertLink", 
     40foswikipuburl_callback : "FoswikiTiny.convertPubURL", 
     41save_callback : "FoswikiTiny.saveCallback", 
     42%IF{"$TINYMCEPLUGIN_DEBUG" then="debug:true,"}% 
     43plugins : "table,searchreplace,autosave,paste,foswikibuttons,foswikiimage%IF{ "context TinyMCEUsabilityUpgradePluginEnabled" then=",foswikilink" else=""}%", 
     44foswiki_secret_id : "%WYSIWYG_SECRET_ID%", 
     45foswiki_vars : { PUBURLPATH : "%PUBURLPATH%", PUBURL : "%PUBURL%", WEB : "%WEB%", TOPIC : "%TOPIC%", ATTACHURL : "%ATTACHURL%", ATTACHURLPATH : "%ATTACHURLPATH%", VIEWSCRIPTURL : "%SCRIPTURL{view}%", SCRIPTSUFFIX: "%SCRIPTSUFFIX%", SCRIPTURL : "%SCRIPTURL%", SYSTEMWEB: "%SYSTEMWEB%" }, 
     46theme_advanced_toolbar_align : "left", 
     47foswikibuttons_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], 
     60paste_create_paragraphs : true, 
     61paste_create_linebreaks : false, 
     62paste_convert_middot_lists : true, 
     63paste_convert_headers_to_strong : false, 
     64paste_remove_spans: true, 
     65paste_remove_styles: true, 
     66paste_strip_class_attributes: "all", 
     67theme_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", 
     68theme_advanced_buttons2: "tablecontrols,separator,code,hide", 
     69theme_advanced_buttons3: "", 
     70theme_advanced_toolbar_location: "top", 
     71theme_advanced_resize_horizontal : false, 
     72theme_advanced_resizing : true, 
     73theme_advanced_path: false, 
     74theme_advanced_statusbar_location : "bottom", 
     75keep_styles : false, 
     76gecko_spellcheck : true, 
     77content_css : "%PUBURLPATH%/%SYSTEMWEB%/TinyMCEPlugin/wysiwyg%IF{"$TINYMCEPLUGIN_DEBUG" then="_src"}%.css,%PUBURLPATH%/%SYSTEMWEB%/SkinTemplates/base.css,%FOSWIKI_STYLE_URL%,%FOSWIKI_COLORS_URL%" 
     78HERE 
     79our %defaultINIT_BROWSER     = ( 
     80    MSIE => 'paste_auto_cleanup_on_paste : true', 
     81    OPERA => '', 
     82    GECKO => '', 
     83    SAFARI => '', 
     84   ); 
    2485 
    2586use Foswiki::Func; 
     
    102163 
    103164    my $init = Foswiki::Func::getPreferencesValue('TINYMCEPLUGIN_INIT') 
    104       || <<'HERE'; 
    105 ' 
    106 HERE 
     165      || $defaultINIT; 
    107166    my $extras = ''; 
    108167 
     
    122181    } 
    123182    if ($extras) { 
    124         $extras = 
    125           Foswiki::Func::getPreferencesValue( 'TINYMCEPLUGIN_INIT_' . $extras ); 
     183        $extras = Foswiki::Func::getPreferencesValue( 
     184            'TINYMCEPLUGIN_INIT_' . $extras ) || $defaultINIT_BROWSER{$extras}; 
    126185        if ( defined $extras ) { 
    127186            $init = join( ',', ( split( ',', $init ), split( ',', $extras ) ) ); 
  • trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny_src.js

    r3104 r3369  
    4141    }, 
    4242 
    43     enableSave: function(enabled) { 
     43    enableSaveButton: function(enabled) { 
    4444        var status = enabled ? null : "disabled"; 
    4545        var elm = document.getElementById("save"); 
     
    9191    }, 
    9292 
     93    onSubmitHandler : false, 
     94 
    9395    // Convert HTML content to textarea. Called from the WYSIWYG->raw switch 
    9496    switchToRaw : function (editor) { 
    95         // As shown by OliverKrueger in Item5138, trivial text may include 
    96         // UTF-8 chars. These need to be encoded to entities before we can 
    97         // 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); 
    10097        var text = editor.getContent(); 
    10198 
    102         // Evaluate post-processors 
     99        // Evaluate post-processors attached from plugins 
    103100        for (var i = 0; i < FoswikiTiny.html2tml.length; i++) { 
    104101            var cb = FoswikiTiny.html2tml[i]; 
    105102            text = cb.apply(editor, [ editor, text ]); 
    106103        } 
    107         FoswikiTiny.enableSave(false); 
     104        FoswikiTiny.enableSaveButton(false); 
    108105        editor.getElement().value = 
    109106            "Please wait... retrieving page from server."; 
     
    112109            function (text, req, o) { 
    113110                this.getElement().value = text; 
    114                 FoswikiTiny.enableSave(true); 
     111                FoswikiTiny.enableSaveButton(true); 
    115112            }, 
    116113            function (type, req, o) { 
     
    119116                                + o.url + ": " 
    120117                                + type + " " + req.status + "</div>"); 
     118                //FoswikiTiny.enableSaveButton(true); leave save disabled 
    121119            }); 
    122120        // Add the button for the switch back to WYSIWYG mode 
     
    148146            editor.isNotDirty = false; 
    149147            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); 
    151163    }, 
    152164 
     
    160172        var text = editor.getElement().value; 
    161173 
    162         FoswikiTiny.enableSave(false); 
     174        if (this.onSubmitHandler) { 
     175            editor.onSubmit.remove(this.onSubmitHandler); 
     176            this.onSubmitHandler = null; 
     177        } 
     178        FoswikiTiny.enableSaveButton(false); 
    163179        editor.setContent("<span class='foswikiAlert'>" 
    164180                          + "Please wait... retrieving page from server." 
     
    174190                this.setContent(text); 
    175191                this.isNotDirty = true; 
    176                 FoswikiTiny.enableSave(true); 
     192                FoswikiTiny.enableSaveButton(true); 
    177193            }, 
    178194            function (type, req, o) { 
     
    182198                                + o.url + ": " 
    183199                                + type + " " + req.status + "</div>"); 
    184                 //FoswikiTiny.enableSave(true); leave save disabled 
     200                //FoswikiTiny.enableSaveButton(true); leave save disabled 
    185201            }); 
    186202 
Note: See TracChangeset for help on using the changeset viewer.