Changeset 5012


Ignore:
Timestamp:
09/20/09 11:42:19 (2 years ago)
Author:
KennethLavrsen
Message:

Item2037: Switching to Wiki Text (raw) when TMCE is fullscreen results in mess
Merging over fix so we hopefully can re-enable full screen. Will test first

Location:
branches/Release01x00/TinyMCEPlugin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x00/TinyMCEPlugin/data/System/TinyMCEPlugin.txt

    r4978 r5012  
    136136|  Release: | %$RELEASE% | 
    137137|  Change History: | <!-- versions below in reverse order -->&nbsp; | 
     138|  19 Sep 2009 | Foswikitask:Item2037: Fix fullscreen-to-WikiText transition | 
    138139|  18 Sep 2009 | Foswikitask:Item1798: Fixed a problem where editor wants to put text elements into blocks causing unwanted new lines. <br /> Foswikitask:Item1341: Fixed a problem so that editor does not convert TML lettered and roman numeral lists back to numbered lists. | 
    139140|  03 Jul 2009 | Foswikitask:Item8178: Check that the help elements are present before hiding or showing them, as they are not present in all skins. | 
  • branches/Release01x00/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny_src.js

    r4145 r5012  
    121121        // Make the raw-edit help visible (still subject to toggle) 
    122122        var el = document.getElementById("foswikiTinyMcePluginWysiwygEditHelp"); 
    123                 if (el) { 
    124                         el.style.display = 'none'; 
    125                 } 
     123        if (el) { 
     124            el.style.display = 'none'; 
     125        } 
    126126        el = document.getElementById("foswikiTinyMcePluginRawEditHelp"); 
    127                 if (el) { 
    128                         el.style.display = 'block'; 
    129                 } 
     127        if (el) { 
     128            el.style.display = 'block'; 
     129        } 
    130130 
    131131        // Evaluate post-processors attached from plugins 
  • branches/Release01x00/TinyMCEPlugin/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin.js

    r3995 r5012  
    11(function(){tinymce.PluginManager.requireLangPack('foswikibuttons');tinymce.create('tinymce.plugins.FoswikiButtons',{formats_lb:null,init:function(ed,url){ed.fw_formats=ed.getParam("foswikibuttons_formats");ed.fw_lb=null;ed.addCommand('foswikibuttonsTT',function(){if(!ed.selection.isCollapsed()) 
    22ed.execCommand('mceSetCSSClass',false,"WYSIWYG_TT");});ed.addButton('tt',{title:'foswikibuttons.tt_desc',cmd:'foswikibuttonsTT',image:url+'/img/tt.gif'});ed.addCommand('foswikibuttonsColour',function(){if(ed.selection.isCollapsed()) 
    3 return;ed.windowManager.open({location:false,menubar:false,toolbar:false,status:false,url:url+'/colours.htm',width:240,height:140,movable:true,popup_css:false,inline:true},{plugin_url:url});});ed.addButton('colour',{title:'foswikibuttons.colour_desc',cmd:'foswikibuttonsColour',image:url+'/img/colour.gif'});ed.addCommand('foswikibuttonsAttach',function(){ed.windowManager.open({location:false,menubar:false,toolbar:false,status:false,url:url+'/attach.htm',width:350,height:250,movable:true,inline:true},{plugin_url:url});});ed.addButton('attach',{title:'foswikibuttons.attach_desc',cmd:'foswikibuttonsAttach',image:url+'/img/attach.gif'});ed.addCommand('foswikibuttonsHide',function(){if(FoswikiTiny.saveEnabled){tinyMCE.execCommand("mceToggleEditor",true,ed.id);FoswikiTiny.switchToRaw(ed);}});ed.addButton('hide',{title:'foswikibuttons.hide_desc',cmd:'foswikibuttonsHide',image:url+'/img/hide.gif'});ed.addCommand('foswikibuttonsFormat',function(ui,fn){var format=null;for(var i=0;i<ed.fw_formats.length;i++){if(ed.fw_formats[i].name==fn){format=ed.fw_formats[i];break;}} 
     3return;ed.windowManager.open({location:false,menubar:false,toolbar:false,status:false,url:url+'/colours.htm',width:240,height:140,movable:true,popup_css:false,inline:true},{plugin_url:url});});ed.addButton('colour',{title:'foswikibuttons.colour_desc',cmd:'foswikibuttonsColour',image:url+'/img/colour.gif'});ed.addCommand('foswikibuttonsAttach',function(){ed.windowManager.open({location:false,menubar:false,toolbar:false,status:false,url:url+'/attach.htm',width:350,height:250,movable:true,inline:true},{plugin_url:url});});ed.addButton('attach',{title:'foswikibuttons.attach_desc',cmd:'foswikibuttonsAttach',image:url+'/img/attach.gif'});ed.addCommand('foswikibuttonsHide',function(){if(FoswikiTiny.saveEnabled){if(ed.getParam('fullscreen_is_enabled')){ed.onGetContent.add(function(){tinymce.DOM.win.setTimeout(function(){var e=tinyMCE.activeEditor;tinyMCE.execCommand("mceToggleEditor",true,e.id);FoswikiTiny.switchToRaw(e);},10);});ed.execCommand('mceFullScreen');} 
     4else{tinyMCE.execCommand("mceToggleEditor",true,ed.id);FoswikiTiny.switchToRaw(ed);}}});ed.addButton('hide',{title:'foswikibuttons.hide_desc',cmd:'foswikibuttonsHide',image:url+'/img/hide.gif'});ed.addCommand('foswikibuttonsFormat',function(ui,fn){var format=null;for(var i=0;i<ed.fw_formats.length;i++){if(ed.fw_formats[i].name==fn){format=ed.fw_formats[i];break;}} 
    45if(format.el!=null){var fmt=format.el;if(fmt.length) 
    56fmt='<'+fmt+'>';ed.execCommand('FormatBlock',false,fmt);if(format.el==''){var elm=ed.selection.getNode();ed.execCommand('removeformat',false,elm);}} 
  • branches/Release01x00/TinyMCEPlugin/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin_src.js

    r3995 r5012  
    1818    tinymce.PluginManager.requireLangPack('foswikibuttons'); 
    1919 
    20         tinymce.create('tinymce.plugins.FoswikiButtons', { 
     20    tinymce.create('tinymce.plugins.FoswikiButtons', { 
    2121        formats_lb: null, // formats listbox 
    2222 
     
    3232            }); 
    3333 
    34                         // Register buttons 
    35                         ed.addButton('tt', { 
     34            // Register buttons 
     35            ed.addButton('tt', { 
    3636                title : 'foswikibuttons.tt_desc', 
    3737                cmd : 'foswikibuttonsTT', 
    3838                image: url + '/img/tt.gif' 
    39                         }); 
     39            }); 
    4040 
    4141            ed.addCommand('foswikibuttonsColour', function() { 
     
    5858            }); 
    5959 
    60                         ed.addButton('colour', { 
    61                                 title : 'foswikibuttons.colour_desc', 
    62                                 cmd : 'foswikibuttonsColour', 
     60            ed.addButton('colour', { 
     61                title : 'foswikibuttons.colour_desc', 
     62                cmd : 'foswikibuttonsColour', 
    6363                image: url + '/img/colour.gif' 
    64                         }); 
     64            }); 
    6565 
    6666            ed.addCommand('foswikibuttonsAttach', function() { 
     
    8181 
    8282            ed.addButton('attach', { 
    83                                 title : 'foswikibuttons.attach_desc', 
    84                                 cmd : 'foswikibuttonsAttach', 
     83                title : 'foswikibuttons.attach_desc', 
     84                cmd : 'foswikibuttonsAttach', 
    8585                image: url + '/img/attach.gif' 
    86                         }); 
     86            }); 
    8787 
    8888            ed.addCommand('foswikibuttonsHide', function() { 
    8989                if (FoswikiTiny.saveEnabled) { 
    90                     tinyMCE.execCommand("mceToggleEditor", true, ed.id); 
    91                     FoswikiTiny.switchToRaw(ed); 
    92                 } 
    93             }); 
    94  
    95                         ed.addButton('hide', { 
    96                                 title : 'foswikibuttons.hide_desc', 
    97                                 cmd : 'foswikibuttonsHide', 
     90                    if (ed.getParam('fullscreen_is_enabled')) { 
     91                        // The fullscreen plugin does its work asynchronously,  
     92                        // and it does not provide explicit hooks. 
     93                        // However, it does a getContent prior to closing the editor 
     94                        // which fires an onGetContent event. 
     95                        // Hook into that, and fire off further asynchronous handling 
     96                        // tht will be processed after the fullscreen editor is destroyed. 
     97                        ed.onGetContent.add(function(){ 
     98                            tinymce.DOM.win.setTimeout(function() { 
     99                                // The fullscreen editor will have been destroyed 
     100                                // by the time this function executes, 
     101                                // so the active editor is the regular one. 
     102                                var e = tinyMCE.activeEditor; 
     103                                tinyMCE.execCommand("mceToggleEditor", true, e.id); 
     104                                FoswikiTiny.switchToRaw(e); 
     105                            }, 10); 
     106                        }); 
     107 
     108                        // Call the full-screen toggle function to hide the fullscreen editor 
     109                        ed.execCommand('mceFullScreen'); 
     110                    } 
     111                    else { 
     112                        // regular editor, not fullscreen 
     113                        tinyMCE.execCommand("mceToggleEditor", true, ed.id); 
     114                        FoswikiTiny.switchToRaw(ed); 
     115                    } 
     116                } 
     117            }); 
     118 
     119            ed.addButton('hide', { 
     120                title : 'foswikibuttons.hide_desc', 
     121                cmd : 'foswikibuttonsHide', 
    98122                image: url + '/img/hide.gif' 
    99                         }); 
     123            }); 
    100124 
    101125            ed.addCommand('foswikibuttonsFormat', function(ui, fn) { 
     
    127151            }); 
    128152 
    129                         ed.onNodeChange.add(this._nodeChange, this); 
    130                 }, 
    131  
    132                 getInfo : function() { 
    133                         return { 
     153            ed.onNodeChange.add(this._nodeChange, this); 
     154        }, 
     155 
     156        getInfo : function() { 
     157            return { 
    134158                    longname : 'Foswiki Buttons Plugin', 
    135159                    author : 'Crawford Currie', 
     
    137161                    infourl : 'http://c-dot.co.uk', 
    138162                    version : 2 
    139                         }; 
     163            }; 
    140164        }, 
    141165 
    142                 createControl : function(n, cm) { 
     166        createControl : function(n, cm) { 
    143167            if (n == 'foswikiformat') { 
    144168                var ed = tinyMCE.activeEditor; 
     
    158182                return m; 
    159183            } 
    160                         return null; 
    161                 }, 
     184            return null; 
     185        }, 
    162186 
    163187        _nodeChange : function(ed, cm, n, co) { 
    164                 if (n == null) 
    165                         return; 
    166  
    167                 if (co) { 
    168                         // Disable the buttons 
    169                         cm.setDisabled('tt', true); 
    170                         cm.setDisabled('colour', true); 
    171                 } else { 
    172                         // A selection means the buttons should be active. 
    173                         cm.setDisabled('tt', false); 
    174                         cm.setDisabled('colour', false); 
    175                 } 
     188            if (n == null) 
     189                return; 
     190 
     191            if (co) { 
     192                // Disable the buttons 
     193                cm.setDisabled('tt', true); 
     194                cm.setDisabled('colour', true); 
     195            } else { 
     196                // A selection means the buttons should be active. 
     197                cm.setDisabled('tt', false); 
     198                cm.setDisabled('colour', false); 
     199            } 
    176200            var elm = ed.dom.getParent(n, '.WYSIWYG_TT'); 
    177201            if (elm != null) 
    178202                cm.setActive('tt', true); 
    179                         else 
     203            else 
    180204                cm.setActive('tt', false); 
    181205            elm = ed.dom.getParent(n, '.WYSIWYG_COLOR'); 
    182206            if (elm != null) 
    183207                cm.setActive('colour', true); 
    184                         else 
     208            else 
    185209                cm.setActive('colour', false); 
    186210 
     
    207231                } 
    208232            } 
    209                 return true; 
    210  
    211         } 
    212         }); 
    213  
    214         // Register plugin 
    215         tinymce.PluginManager.add('foswikibuttons', 
     233            return true; 
     234 
     235        } 
     236    }); 
     237 
     238    // Register plugin 
     239    tinymce.PluginManager.add('foswikibuttons', 
    216240                              tinymce.plugins.FoswikiButtons); 
    217241})(); 
     
    222246 
    223247var FoswikiButtonsPlugin = { 
    224         getInfo : function() { 
    225                 return { 
    226                         longname : 'Foswiki Buttons Plugin', 
    227                         author : 'Crawford Currie', 
    228                         authorurl : 'http://c-dot.co.uk', 
    229                         infourl : 'http://c-dot.co.uk', 
    230                         version : 1 
    231                 }; 
    232         }, 
    233  
    234         initInstance : function(inst) { 
    235                 //tinyMCE.importCSS(inst.getDoc(), 
     248    getInfo : function() { 
     249        return { 
     250            longname : 'Foswiki Buttons Plugin', 
     251            author : 'Crawford Currie', 
     252            authorurl : 'http://c-dot.co.uk', 
     253            infourl : 'http://c-dot.co.uk', 
     254            version : 1 
     255        }; 
     256    }, 
     257 
     258    initInstance : function(inst) { 
     259        //tinyMCE.importCSS(inst.getDoc(), 
    236260        //tinyMCE.baseURL + "/plugins/foswikibuttons/css/foswikibuttons.css"); 
    237         }, 
    238  
    239         getControlHTML : function(cn) { 
     261    }, 
     262 
     263    getControlHTML : function(cn) { 
    240264        var html, formats; 
    241                 switch (cn) { 
     265        switch (cn) { 
    242266        case "tt": 
    243267            return tinyMCE.getButtonHTML(cn, 'lang_foswikibuttons_tt_desc', 
     
    270294             
    271295            return html; 
    272                 } 
    273  
    274                 return ""; 
    275         }, 
    276  
    277         execCommand : function(editor_id, element, command, 
     296        } 
     297 
     298        return ""; 
     299    }, 
     300 
     301    execCommand : function(editor_id, element, command, 
    278302                           user_interface, value) { 
    279                 var em; 
     303        var em; 
    280304        var inst = tinyMCE.getInstanceById(editor_id); 
    281305 
    282                 switch (command) { 
     306        switch (command) { 
    283307        case "foswikiCOLOUR": 
    284308            var t = inst.selection.getSelectedText(); 
     
    360384            tinyMCE.execCommand('mceEndUndoLevel'); 
    361385           return true; 
    362                 } 
    363  
    364                 return false; 
    365         }, 
    366  
    367         handleNodeChange : function(editor_id, node, undo_index, 
     386        } 
     387 
     388        return false; 
     389    }, 
     390 
     391    handleNodeChange : function(editor_id, node, undo_index, 
    368392                                undo_levels, visual_aid, any_selection) { 
    369                 var elm = tinyMCE.getParentElement(node); 
    370  
    371                 if (node == null) 
    372                         return; 
    373  
    374                 if (!any_selection) { 
    375                         // Disable the buttons 
    376                         tinyMCE.switchClass(editor_id + '_tt', 'mceButtonDisable 
     393        var elm = tinyMCE.getParentElement(node); 
     394 
     395        if (node == null) 
     396            return; 
     397 
     398        if (!any_selection) { 
     399            // Disable the buttons 
     400            tinyMCE.switchClass(editor_id + '_tt', 'mceButtonDisable 
    377401d'); 
    378                         tinyMCE.switchClass(editor_id + '_colour', 'mceButtonDis 
     402            tinyMCE.switchClass(editor_id + '_colour', 'mceButtonDis 
    379403abled'); 
    380                 } else { 
    381                         // A selection means the buttons should be active. 
    382                         tinyMCE.switchClass(editor_id + '_tt', 'mceButtonNormal' 
     404        } else { 
     405            // A selection means the buttons should be active. 
     406            tinyMCE.switchClass(editor_id + '_tt', 'mceButtonNormal' 
    383407); 
    384                         tinyMCE.switchClass(editor_id + '_colour', 'mceButtonNor 
     408            tinyMCE.switchClass(editor_id + '_colour', 'mceButtonNor 
    385409mal'); 
    386                 } 
    387  
    388                 switch (node.nodeName) { 
    389                         case "TT": 
     410        } 
     411 
     412        switch (node.nodeName) { 
     413            case "TT": 
    390414            tinyMCE.switchClass(editor_id + '_tt', 'mceButtonSelected'); 
    391415            return true; 
    392                 } 
    393  
    394                 var selectElm = document.getElementById( 
     416        } 
     417 
     418        var selectElm = document.getElementById( 
    395419            editor_id + "_foswikiFormatSelect"); 
    396420        if (selectElm) { 
     
    418442            } 
    419443        } 
    420                 return true; 
    421         } 
     444        return true; 
     445    } 
    422446}; 
    423447 
Note: See TracChangeset for help on using the changeset viewer.