Changeset 5005
- Timestamp:
- 09/19/09 20:58:34 (2 years ago)
- Location:
- trunk/TinyMCEPlugin
- Files:
-
- 4 edited
-
data/System/TinyMCEPlugin.txt (modified) (1 diff)
-
pub/System/TinyMCEPlugin/foswiki_tiny_src.js (modified) (1 diff)
-
pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin.js (modified) (1 diff)
-
pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin_src.js (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/TinyMCEPlugin/data/System/TinyMCEPlugin.txt
r4979 r5005 136 136 | Release: | %$RELEASE% | 137 137 | Change History: | <!-- versions below in reverse order --> | 138 | 19 Sep 2009 | Foswikitask:Item2037: Fix fullscreen-to-WikiText transition | 138 139 | 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. | 139 140 | 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. | -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/foswiki_tiny_src.js
r4145 r5005 121 121 // Make the raw-edit help visible (still subject to toggle) 122 122 var el = document.getElementById("foswikiTinyMcePluginWysiwygEditHelp"); 123 if (el) {124 el.style.display = 'none';125 }123 if (el) { 124 el.style.display = 'none'; 125 } 126 126 el = document.getElementById("foswikiTinyMcePluginRawEditHelp"); 127 if (el) {128 el.style.display = 'block';129 }127 if (el) { 128 el.style.display = 'block'; 129 } 130 130 131 131 // Evaluate post-processors attached from plugins -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin.js
r3995 r5005 1 1 (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()) 2 2 ed.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;}} 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){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');} 4 else{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;}} 4 5 if(format.el!=null){var fmt=format.el;if(fmt.length) 5 6 fmt='<'+fmt+'>';ed.execCommand('FormatBlock',false,fmt);if(format.el==''){var elm=ed.selection.getNode();ed.execCommand('removeformat',false,elm);}} -
trunk/TinyMCEPlugin/pub/System/TinyMCEPlugin/tinymce/jscripts/tiny_mce/plugins/foswikibuttons/editor_plugin_src.js
r3995 r5005 18 18 tinymce.PluginManager.requireLangPack('foswikibuttons'); 19 19 20 tinymce.create('tinymce.plugins.FoswikiButtons', {20 tinymce.create('tinymce.plugins.FoswikiButtons', { 21 21 formats_lb: null, // formats listbox 22 22 … … 32 32 }); 33 33 34 // Register buttons35 ed.addButton('tt', {34 // Register buttons 35 ed.addButton('tt', { 36 36 title : 'foswikibuttons.tt_desc', 37 37 cmd : 'foswikibuttonsTT', 38 38 image: url + '/img/tt.gif' 39 });39 }); 40 40 41 41 ed.addCommand('foswikibuttonsColour', function() { … … 58 58 }); 59 59 60 ed.addButton('colour', {61 title : 'foswikibuttons.colour_desc',62 cmd : 'foswikibuttonsColour',60 ed.addButton('colour', { 61 title : 'foswikibuttons.colour_desc', 62 cmd : 'foswikibuttonsColour', 63 63 image: url + '/img/colour.gif' 64 });64 }); 65 65 66 66 ed.addCommand('foswikibuttonsAttach', function() { … … 81 81 82 82 ed.addButton('attach', { 83 title : 'foswikibuttons.attach_desc',84 cmd : 'foswikibuttonsAttach',83 title : 'foswikibuttons.attach_desc', 84 cmd : 'foswikibuttonsAttach', 85 85 image: url + '/img/attach.gif' 86 });86 }); 87 87 88 88 ed.addCommand('foswikibuttonsHide', function() { 89 89 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', 98 122 image: url + '/img/hide.gif' 99 });123 }); 100 124 101 125 ed.addCommand('foswikibuttonsFormat', function(ui, fn) { … … 127 151 }); 128 152 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 { 134 158 longname : 'Foswiki Buttons Plugin', 135 159 author : 'Crawford Currie', … … 137 161 infourl : 'http://c-dot.co.uk', 138 162 version : 2 139 };163 }; 140 164 }, 141 165 142 createControl : function(n, cm) {166 createControl : function(n, cm) { 143 167 if (n == 'foswikiformat') { 144 168 var ed = tinyMCE.activeEditor; … … 158 182 return m; 159 183 } 160 return null;161 },184 return null; 185 }, 162 186 163 187 _nodeChange : function(ed, cm, n, co) { 164 if (n == null)165 return;166 167 if (co) {168 // Disable the buttons169 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 } 176 200 var elm = ed.dom.getParent(n, '.WYSIWYG_TT'); 177 201 if (elm != null) 178 202 cm.setActive('tt', true); 179 else203 else 180 204 cm.setActive('tt', false); 181 205 elm = ed.dom.getParent(n, '.WYSIWYG_COLOR'); 182 206 if (elm != null) 183 207 cm.setActive('colour', true); 184 else208 else 185 209 cm.setActive('colour', false); 186 210 … … 207 231 } 208 232 } 209 return true;210 211 }212 });213 214 // Register plugin215 tinymce.PluginManager.add('foswikibuttons',233 return true; 234 235 } 236 }); 237 238 // Register plugin 239 tinymce.PluginManager.add('foswikibuttons', 216 240 tinymce.plugins.FoswikiButtons); 217 241 })(); … … 222 246 223 247 var 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 : 1231 };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(), 236 260 //tinyMCE.baseURL + "/plugins/foswikibuttons/css/foswikibuttons.css"); 237 },238 239 getControlHTML : function(cn) {261 }, 262 263 getControlHTML : function(cn) { 240 264 var html, formats; 241 switch (cn) {265 switch (cn) { 242 266 case "tt": 243 267 return tinyMCE.getButtonHTML(cn, 'lang_foswikibuttons_tt_desc', … … 270 294 271 295 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, 278 302 user_interface, value) { 279 var em;303 var em; 280 304 var inst = tinyMCE.getInstanceById(editor_id); 281 305 282 switch (command) {306 switch (command) { 283 307 case "foswikiCOLOUR": 284 308 var t = inst.selection.getSelectedText(); … … 360 384 tinyMCE.execCommand('mceEndUndoLevel'); 361 385 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, 368 392 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 buttons376 tinyMCE.switchClass(editor_id + '_tt', 'mceButtonDisable393 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 377 401 d'); 378 tinyMCE.switchClass(editor_id + '_colour', 'mceButtonDis402 tinyMCE.switchClass(editor_id + '_colour', 'mceButtonDis 379 403 abled'); 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' 383 407 ); 384 tinyMCE.switchClass(editor_id + '_colour', 'mceButtonNor408 tinyMCE.switchClass(editor_id + '_colour', 'mceButtonNor 385 409 mal'); 386 }387 388 switch (node.nodeName) {389 case "TT":410 } 411 412 switch (node.nodeName) { 413 case "TT": 390 414 tinyMCE.switchClass(editor_id + '_tt', 'mceButtonSelected'); 391 415 return true; 392 }393 394 var selectElm = document.getElementById(416 } 417 418 var selectElm = document.getElementById( 395 419 editor_id + "_foswikiFormatSelect"); 396 420 if (selectElm) { … … 418 442 } 419 443 } 420 return true;421 }444 return true; 445 } 422 446 }; 423 447
Note: See TracChangeset
for help on using the changeset viewer.
