Changeset 3975
- Timestamp:
- 05/24/09 14:45:54 (3 years ago)
- Location:
- trunk/TinyMCEPlugin
- Files:
-
- 3 edited
-
data/System/TinyMCEPlugin.txt (modified) (1 diff)
-
pub/System/TinyMCEPlugin/foswiki_tiny.js (modified) (2 diffs)
-
pub/System/TinyMCEPlugin/foswiki_tiny_src.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/TinyMCEPlugin/data/System/TinyMCEPlugin.txt
r3973 r3975 128 128 129 129 | Author: | [[http://c-dot.co.uk][Crawford Currie]] | 130 | Copyright: | © 2007-200 8Crawford Currie http://c-dot.co.uk |130 | Copyright: | © 2007-2009 Crawford Currie http://c-dot.co.uk | 131 131 | License: | [[http://www.gnu.org/licenses/gpl.html][GPL (Gnu General Public License)]] | 132 132 | | 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]]. | 133 133 | Plugin Version: | %$VERSION% | 134 134 | Change History: | <!-- versions below in reverse order --> | 135 | 24 May 2009 | Foswikitask:Item1205: add support for global NOWYSIWYG flag Foswikitask:Item1341: keep TML lettered & roman numeral lists (Michael Tempest) Foswikitask:Item1534: fix typewriter text (Michael Tempest) |135 | 24 May 2009 | Foswikitask:Item1205: add support for global NOWYSIWYG flag Foswikitask:Item1341: keep TML lettered & roman numeral lists (Michael Tempest) Foswikitask:Item1534: fix typewriter text (Michael Tempest) Foswikitask:Item1548: fix data-loss warning when saving from wiki-text (Michael Tempest) | 136 136 | 10 Apr 2009 | Foswikitask:Item1394: fixed colour handling Foswikitask:Item8108: added safari,inlinepopups,fullscreen plugins, fixed some minor bugs on IE | 137 137 | 3 Apr 2009 | Foswikitask:Item1383: Optimised the preferences Foswikitask:Item8094: fixed the pickaxe | -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny.js
r3798 r3975 2 2 return FoswikiTiny.foswikiVars[name];},expandVariables:function(url){for(var i in FoswikiTiny.foswikiVars){url=url.replace('%'+i+'%',FoswikiTiny.foswikiVars[i],'g');} 3 3 return url;},enableSaveButton:function(enabled){var status=enabled?null:"disabled";var elm=document.getElementById("save");if(elm){elm.disabled=status;} 4 elm=document.getElementById("quietsave");if(elm){elm.disabled=status;} 5 elm=document.getElementById("checkpoint");if(elm){elm.disabled=status;} 4 6 elm=document.getElementById("preview");if(elm){elm.style.display='none';elm.disabled=status;}},transform:function(editor,handler,text,onSuccess,onFail){var url=FoswikiTiny.getFoswikiVar("SCRIPTURL");var suffix=FoswikiTiny.getFoswikiVar("SCRIPTSUFFIX");if(suffix==null)suffix='';url+="/rest"+suffix+"/WysiwygPlugin/"+handler;var path=FoswikiTiny.getFoswikiVar("WEB")+'.' 5 7 +FoswikiTiny.getFoswikiVar("TOPIC");tinymce.util.XHR.send({url:url,content_type:"application/x-www-form-urlencoded",type:"POST",data:"nocache="+encodeURIComponent((new Date()).getTime()) 6 8 +"&topic="+encodeURIComponent(path) 7 +"&text="+encodeURIComponent(text),async:true,scope:editor,success:onSuccess,error:onFail})},initialisedFromServer:false,setUpContent:function(editor_id,body,doc){if(FoswikiTiny.initialisedFromServer)return;var editor=tinyMCE.getInstanceById(editor_id);FoswikiTiny.switchToWYSIWYG(editor);FoswikiTiny.initialisedFromServer=true;},onSubmitHandler:false,switchToRaw:function(editor){var text=editor.getContent();document.getElementById("foswikiTinyMcePluginWysiwygEditHelp").style.display='none';document.getElementById("foswikiTinyMcePluginRawEditHelp").style.display='block';for(var i=0;i<FoswikiTiny.html2tml.length;i++){var cb=FoswikiTiny.html2tml[i];text=cb.apply(editor,[editor,text]);} 9 +"&text="+encodeURIComponent(text),async:true,scope:editor,success:onSuccess,error:onFail})},initialisedFromServer:false,setUpContent:function(editor_id,body,doc){if(FoswikiTiny.initialisedFromServer)return;var editor=tinyMCE.getInstanceById(editor_id);FoswikiTiny.switchToWYSIWYG(editor);FoswikiTiny.initialisedFromServer=true;},cleanBeforeSave:function(eid,buttonId){var el=document.getElementById(buttonId);if(el==null) 10 return;el.onclick=function(){var editor=tinyMCE.getInstanceById(eid);editor.isNotDirty=true;return true;}},onSubmitHandler:false,switchToRaw:function(editor){var text=editor.getContent();document.getElementById("foswikiTinyMcePluginWysiwygEditHelp").style.display='none';document.getElementById("foswikiTinyMcePluginRawEditHelp").style.display='block';for(var i=0;i<FoswikiTiny.html2tml.length;i++){var cb=FoswikiTiny.html2tml[i];text=cb.apply(editor,[editor,text]);} 8 11 FoswikiTiny.enableSaveButton(false);editor.getElement().value="Please wait... retrieving page from server.";FoswikiTiny.transform(editor,"html2tml",text,function(text,req,o){this.getElement().value=text;FoswikiTiny.enableSaveButton(true);},function(type,req,o){this.setContent("<div class='foswikiAlert'>" 9 12 +"There was a problem retrieving " … … 11 14 +type+" "+req.status+"</div>");});var eid=editor.id;var id=eid+"_2WYSIWYG";var el=document.getElementById(id);if(el){el.style.display="block";}else{el=document.createElement('INPUT');el.id=id;el.type="button";el.value="WYSIWYG";el.className="foswikiButton";el.onclick=function(){document.getElementById("foswikiTinyMcePluginWysiwygEditHelp").style.display='block';document.getElementById("foswikiTinyMcePluginRawEditHelp").style.display='none';tinyMCE.execCommand("mceToggleEditor",null,eid);FoswikiTiny.switchToWYSIWYG(editor);return false;} 12 15 var pel=editor.getElement().parentNode;pel.insertBefore(el,editor.getElement());} 13 editor.getElement().onchange=function(){var editor=tinyMCE.getInstanceById(eid);editor.isNotDirty=false;return true;},this.onSubmitHandler=function(ed,e){editor.initialized=false;};editor.onSubmit.addToTop(this.onSubmitHandler); },switchToWYSIWYG:function(editor){editor.getElement().onchange=null;var text=editor.getElement().value;if(this.onSubmitHandler){editor.onSubmit.remove(this.onSubmitHandler);this.onSubmitHandler=null;}16 editor.getElement().onchange=function(){var editor=tinyMCE.getInstanceById(eid);editor.isNotDirty=false;return true;},this.onSubmitHandler=function(ed,e){editor.initialized=false;};editor.onSubmit.addToTop(this.onSubmitHandler);FoswikiTiny.cleanBeforeSave(eid,"save");FoswikiTiny.cleanBeforeSave(eid,"quietsave");FoswikiTiny.cleanBeforeSave(eid,"checkpoint");FoswikiTiny.cleanBeforeSave(eid,"preview");FoswikiTiny.cleanBeforeSave(eid,"cancel");},switchToWYSIWYG:function(editor){editor.getElement().onchange=null;var text=editor.getElement().value;if(this.onSubmitHandler){editor.onSubmit.remove(this.onSubmitHandler);this.onSubmitHandler=null;} 14 17 FoswikiTiny.enableSaveButton(false);editor.setContent("<span class='foswikiAlert'>" 15 18 +"Please wait... retrieving page from server." -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny_src.js
r3799 r3975 44 44 var status = enabled ? null : "disabled"; 45 45 var elm = document.getElementById("save"); 46 if (elm) { 47 elm.disabled = status; 48 } 49 elm = document.getElementById("quietsave"); 50 if (elm) { 51 elm.disabled = status; 52 } 53 elm = document.getElementById("checkpoint"); 46 54 if (elm) { 47 55 elm.disabled = status; … … 89 97 FoswikiTiny.switchToWYSIWYG(editor); 90 98 FoswikiTiny.initialisedFromServer = true; 99 }, 100 101 cleanBeforeSave : function (eid, buttonId) { 102 var el = document.getElementById(buttonId); 103 if (el == null) 104 return; 105 // SMELL: what if there is already an onclick handler? 106 el.onclick = function () { 107 var editor = tinyMCE.getInstanceById(eid); 108 editor.isNotDirty = true; 109 return true; 110 } 91 111 }, 92 112 … … 168 188 // to break when we upgrade TMCE 169 189 editor.onSubmit.addToTop(this.onSubmitHandler); 190 // Make the save buttons mark the text as not-dirty 191 // to avoid the popup that says "Are you sure? The changes you have made will be lost" 192 FoswikiTiny.cleanBeforeSave(eid, "save"); 193 FoswikiTiny.cleanBeforeSave(eid, "quietsave"); 194 FoswikiTiny.cleanBeforeSave(eid, "checkpoint"); 195 // preview shouldn't get the popup either, when preview is enabled one day 196 FoswikiTiny.cleanBeforeSave(eid, "preview"); 197 // cancel shouldn't get the popup because the user just *said* they want to cancel 198 FoswikiTiny.cleanBeforeSave(eid, "cancel"); 170 199 }, 171 200
Note: See TracChangeset
for help on using the changeset viewer.
