Changeset 6694
- Timestamp:
- 01/31/2008 06:10:46 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 26 added
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/js/post.js
r6675 r6694 179 179 jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); 180 180 }); 181 182 wpEditorInit = function() { 183 // Activate tinyMCE if it's the user's default editor 184 if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) { 185 document.getElementById('editorcontainer').style.padding = '0px'; 186 tinyMCE.execCommand("mceAddControl", true, "content"); 187 } else { 188 var H; 189 if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") ) 190 document.getElementById('content').style.height = H.ch - 30 + 'px'; 191 } 192 }; 193 194 switchEditors = { 195 196 saveCallback : function(el, content, body) { 197 198 document.getElementById(el).style.color = '#fff'; 199 if ( tinyMCE.activeEditor.isHidden() ) 200 content = document.getElementById(el).value; 201 else 202 content = this.pre_wpautop(content); 203 204 return content; 205 }, 206 207 pre_wpautop : function(content) { 208 // We have a TON of cleanup to do. 209 210 // content = content.replace(/\n|\r/g, ' '); 211 // Remove anonymous, empty paragraphs. 212 content = content.replace(new RegExp('<p>(\\s| |<br>)*</p>', 'mg'), ''); 213 214 // Mark </p> if it has any attributes. 215 content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>'); 216 217 // Get it ready for wpautop. 218 content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 219 content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 220 content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 221 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 222 223 // Fix some block element newline issues 224 var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre'; 225 content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 226 content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); 227 content = content.replace(new RegExp('<li>', 'g'), '\t<li>'); 228 229 if ( content.indexOf('<object') != -1 ) { 230 content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed 231 content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>'); 232 } 233 234 // Unmark special paragraph closing tags 235 content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 236 content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); 237 238 // Trim trailing whitespace 239 content = content.replace(new RegExp('\\s*$', ''), ''); 240 241 // Hope. 242 return content; 243 }, 244 245 go : function(id) { 246 var ed = tinyMCE.get(id); 247 var qt = document.getElementById('quicktags'); 248 var H = document.getElementById('edButtonHTML'); 249 var P = document.getElementById('edButtonPreview'); 250 var ta = document.getElementById(id); 251 var ec = document.getElementById('editorcontainer'); 252 253 if ( ! ed || ed.isHidden() ) { 254 ta.style.color = '#fff'; 255 256 this.edToggle(P, H); 257 edCloseAllTags(); // :-( 258 259 qt.style.display = 'none'; 260 ec.style.padding = '0px'; 261 262 ta.value = this.wpautop(ta.value); 263 264 if ( ed ) ed.show(); 265 else tinyMCE.execCommand("mceAddControl", false, id); 266 267 this.wpSetDefaultEditor( 'tinymce' ); 268 } else { 269 this.edToggle(H, P); 270 tinyMCE.triggerSave(); 271 ta.style.height = tinyMCE.activeEditor.contentAreaContainer.offsetHeight + 6 + 'px'; 272 273 if ( tinymce.isIE6 ) 274 ta.style.width = tinyMCE.activeEditor.contentAreaContainer.offsetWidth - 12 + 'px'; 275 276 ed.hide(); 277 ta.value = this.pre_wpautop(ta.value); 278 279 qt.style.display = 'block'; 280 ec.style.padding = '6px'; 281 ta.style.color = ''; 282 283 this.wpSetDefaultEditor( 'html' ); 284 } 285 }, 286 287 edToggle : function(A, B) { 288 A.className = 'active'; 289 B.className = ''; 290 291 B.onclick = A.onclick; 292 A.onclick = null; 293 }, 294 295 wpSetDefaultEditor : function( editor ) { 296 try { 297 editor = escape( editor.toString() ); 298 } catch(err) { 299 editor = 'tinymce'; 300 } 301 302 var userID = document.getElementById('user-id'); 303 var date = new Date(); 304 date.setTime(date.getTime()+(10*365*24*60*60*1000)); 305 document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString(); 306 }, 307 308 wpautop : function(pee) { 309 var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]'; 310 311 pee = pee + "\n\n"; 312 pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 313 pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1"); 314 pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n"); 315 pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 316 pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 317 pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 318 pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 319 pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 320 pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 321 pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 322 pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>'); 323 pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)', 'gi'), "$1"); 324 pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1"); 325 pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 326 pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 327 pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 328 pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); 329 //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm... 330 return pee; 331 } 332 } -
trunk/wp-admin/wp-admin.css
r6638 r6694 371 371 } 372 372 373 #postdivrich #content { 374 padding: 5px; 375 line-height: 140%; 373 #editorcontainer #content { 374 padding: 0; 375 line-height: 150%; 376 border: 0 none; 377 } 378 379 #editorcontainer { 380 padding: 6px; 376 381 } 377 382 … … 395 400 396 401 #postdivrich #quicktags { 397 background: #f0f0ee; 398 padding: 0; 399 border: 1px solid #ccc; 400 border-bottom: none; 402 background: #cee1ef; 403 padding: 0; 404 border: 0 none; 401 405 } 402 406 … … 1179 1183 } 1180 1184 1181 #poststuff .postbox, #titlediv {1185 #poststuff .postbox, #titlediv, #poststuff .postarea { 1182 1186 margin-left: 20px; 1183 1187 border: 1px solid #ebebeb; … … 1189 1193 1190 1194 #poststuff .postarea { 1191 margin-left: 20px;1192 1195 margin-right: 8px; 1193 1196 } … … 1224 1227 #poststuff #edButtonPreview, #poststuff #edButtonHTML { 1225 1228 display: block; 1226 height: 18px;1229 height: 20px; 1227 1230 padding: 5px; 1228 1231 margin-right: 8px; … … 1236 1239 color: #333; 1237 1240 font-weight: bold; 1238 -moz-border-radius: 2px; 1241 -moz-border-radius-topright: 2px; 1242 -moz-border-radius-topleft: 2px; 1239 1243 } 1240 1244 -
trunk/wp-includes/general-template.php
r6682 r6694 929 929 $wp_default_editor = wp_default_editor(); 930 930 $active = " class='active'"; 931 $inactive = " onclick='switchEditors (\"$id\");'";931 $inactive = " onclick='switchEditors.go(\"$id\");'"; 932 932 933 933 if ( 'tinymce' == $wp_default_editor ) 934 934 add_filter('the_editor_content', 'wp_richedit_pre'); 935 935 936 // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 937 ?> 938 936 // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 937 ?> 938 <style type="text/css"> 939 939 #postdivrich table, #postdivrich #quicktags {border-top: none;} 940 940 #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} 941 941 </style> 942 942 943 <div id='editor-toolbar' style='display:none;'> 943 <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors ("<?php echo $id; ?>")' /></div>944 <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors.go("<?php echo $id; ?>")' /></div> 944 945 <a id='edButtonHTML'<?php echo 'html' == $wp_default_editor ? $active : $inactive; ?>><?php _e('HTML'); ?></a> 945 946 <a id='edButtonPreview'<?php echo 'tinymce' == $wp_default_editor ? $active : $inactive; ?>><?php _e('Visual'); ?></a> … … 974 975 <?php endif; // 'html' != $wp_default_editor 975 976 976 $the_editor = apply_filters('the_editor', "<div ><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n");977 $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); 977 978 $the_editor_content = apply_filters('the_editor_content', $content); 978 979 … … 987 988 if ( typeof tinyMCE != 'undefined' ) { 988 989 // This code is meant to allow tabbing from Title to Post (TinyMCE). 989 if ( tinyMCE.isMSIE ) { 990 document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { 991 if ( tinyMCE.idCounter == 0 ) 992 return true; 993 e = e ? e : window.event; 994 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 995 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 996 if(typeof i == 'undefined') 997 return true; 998 tinyMCE.execCommand("mceStartTyping"); 999 this.blur(); 1000 i.contentWindow.focus(); 1001 e.returnValue = false; 1002 return false; 1003 } 1004 } 1005 } else { 1006 document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e) { 1007 if ( tinyMCE.idCounter == 0 ) 1008 return true; 1009 e = e ? e : window.event; 1010 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 1011 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 1012 if(typeof i == 'undefined') 1013 return true; 1014 tinyMCE.execCommand("mceStartTyping"); 1015 this.blur(); 1016 i.contentWindow.focus(); 1017 e.returnValue = false; 1018 return false; 1019 } 1020 } 1021 } 990 document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { 991 e = e || window.event; 992 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 993 if ( tinyMCE.activeEditor ) { 994 e = null; 995 if ( tinyMCE.activeEditor.isHidden() ) return true; 996 tinyMCE.activeEditor.focus(); 997 return false; 998 } 999 return true; 1000 } 1001 } 1022 1002 } 1023 1003 <?php endif; ?> -
trunk/wp-includes/js/autosave.js
r6649 r6694 83 83 84 84 function autosave() { 85 var rich = ( (typeof tinyMCE != "undefined") && tinyMCE.getInstanceById('content')) ? true : false;85 var rich = ( (typeof tinyMCE != "undefined") && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden() ) ? true : false; 86 86 var post_data = { 87 87 action: "autosave", … … 94 94 95 95 /* Gotta do this up here so we can check the length when tinyMCE is in use */ 96 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 97 post_data["content"] = jQuery("#content").val(); 98 } else { 96 if ( rich ) { 99 97 // Don't run while the TinyMCE spellcheck is on. 100 if(tinyMCE.selectedInstance.spellcheckerOn) return; 101 tinyMCE.wpTriggerSave(); 102 post_data["content"] = jQuery("#content").val(); 103 } 98 if ( tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) return; 99 tinyMCE.triggerSave(); 100 } 101 102 post_data["content"] = jQuery("#content").val(); 104 103 105 104 if(post_data["post_title"].length==0 || post_data["content"].length==0 || post_data["post_title"] + post_data["content"] == autosaveLast) { … … 123 122 post_data["excerpt"] = jQuery("#excerpt").val(); 124 123 125 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 126 post_data["content"] = jQuery("#content").val(); 127 } else { 128 tinyMCE.wpTriggerSave(); 129 post_data["content"] = jQuery("#content").val(); 130 } 124 if ( rich ) 125 tinyMCE.triggerSave(); 126 127 post_data["content"] = jQuery("#content").val(); 131 128 132 129 if(parseInt(post_data["post_ID"]) < 1) { -
trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js
r6632 r6694 1 /** 2 * $Id$ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 tinymce.create('tinymce.plugins.AutoSavePlugin', { 10 init : function(ed, url) { 11 var t = this; 12 13 t.editor = ed; 14 15 window.onbeforeunload = tinymce.plugins.AutoSavePlugin._beforeUnloadHandler; 16 }, 17 18 getInfo : function() { 19 return { 20 longname : 'Auto save', 21 author : 'Moxiecode Systems AB', 22 authorurl : 'http://tinymce.moxiecode.com', 23 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', 24 version : tinymce.majorVersion + "." + tinymce.minorVersion 25 }; 26 }, 27 28 // Private plugin internal methods 29 30 'static' : { 31 _beforeUnloadHandler : function() { 32 var msg; 33 34 tinymce.each(tinyMCE.editors, function(ed) { 35 if (ed.getParam("fullscreen_is_enabled")) 36 return; 37 38 if (ed.isDirty()) { 39 msg = ed.getLang("autosave.unload_msg"); 40 return false; 41 } 42 }); 43 44 return msg; 45 } 46 } 47 }); 48 49 // Register plugin 50 tinymce.PluginManager.add('autosave', tinymce.plugins.AutoSavePlugin); 51 })(); 1 (function(){tinymce.create('tinymce.plugins.AutoSavePlugin',{init:function(ed,url){var t=this;t.editor=ed;window.onbeforeunload=tinymce.plugins.AutoSavePlugin._beforeUnloadHandler;},getInfo:function(){return{longname:'Auto save',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave',version:tinymce.majorVersion+"."+tinymce.minorVersion};},'static':{_beforeUnloadHandler:function(){var msg;tinymce.each(tinyMCE.editors,function(ed){if(ed.getParam("fullscreen_is_enabled"))return;if(ed.isDirty()){msg=ed.getLang("autosave.unload_msg");return false;}});return msg;}}});tinymce.PluginManager.add('autosave',tinymce.plugins.AutoSavePlugin);})(); -
trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js
r6632 r6694 1 /** 2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 tinymce.create('tinymce.plugins.Directionality', { 10 init : function(ed, url) { 11 var t = this; 12 13 t.editor = ed; 14 15 ed.addCommand('mceDirectionLTR', function() { 16 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); 17 18 if (e) { 19 if (ed.dom.getAttrib(e, "dir") != "ltr") 20 ed.dom.setAttrib(e, "dir", "ltr"); 21 else 22 ed.dom.setAttrib(e, "dir", ""); 23 } 24 25 ed.nodeChanged(); 26 }); 27 28 ed.addCommand('mceDirectionRTL', function() { 29 var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock); 30 31 if (e) { 32 if (ed.dom.getAttrib(e, "dir") != "rtl") 33 ed.dom.setAttrib(e, "dir", "rtl"); 34 else 35 ed.dom.setAttrib(e, "dir", ""); 36 } 37 38 ed.nodeChanged(); 39 }); 40 41 ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'}); 42 ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'}); 43 44 ed.onNodeChange.add(t._nodeChange, t); 45 }, 46 47 getInfo : function() { 48 return { 49 longname : 'Directionality', 50 author : 'Moxiecode Systems AB', 51 authorurl : 'http://tinymce.moxiecode.com', 52 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', 53 version : tinymce.majorVersion + "." + tinymce.minorVersion 54 }; 55 }, 56 57 // Private methods 58 59 _nodeChange : function(ed, cm, n) { 60 var dom = ed.dom, dir; 61 62 n = dom.getParent(n, dom.isBlock); 63 if (!n) { 64 cm.setDisabled('ltr', 1); 65 cm.setDisabled('rtl', 1); 66 return; 67 } 68 69 dir = dom.getAttrib(n, 'dir'); 70 cm.setActive('ltr', dir == "ltr"); 71 cm.setDisabled('ltr', 0); 72 cm.setActive('rtl', dir == "rtl"); 73 cm.setDisabled('rtl', 0); 74 } 75 }); 76 77 // Register plugin 78 tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality); 79 })(); 1 (function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})(); -
trunk/wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.js
r6689 r6694 1 /** 2 * $Id: editor_plugin_src.js 544 2008-01-17 13:07:00Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var DOM = tinymce.DOM; 10 11 tinymce.create('tinymce.plugins.FullScreenPlugin', { 12 init : function(ed, url) { 13 var t = this, s = {}, vp; 14 15 t.editor = ed; 16 17 // Register commands 18 ed.addCommand('mceFullScreen', function() { 19 var win, de = document.documentElement; 20 21 if (ed.getParam('fullscreen_is_enabled')) { 22 if (ed.getParam('fullscreen_new_window')) 23 closeFullscreen(); // Call to close in new window 24 else { 25 window.setTimeout(function() { 26 tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); 27 tinyMCE.remove(ed); 28 DOM.remove('mce_fullscreen_container'); 29 de.style.overflow = ed.getParam('fullscreen_html_overflow'); 30 DOM.setStyle(document.body, 'overflow', ed.getParam('fullscreen_overflow')); 31 window.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); 32 }, 10); 33 } 34 35 return; 36 } 37 38 if (ed.getParam('fullscreen_new_window')) { 39 win = window.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight); 40 try { 41 win.resizeTo(screen.availWidth, screen.availHeight); 42 } catch (e) { 43 // Ignore 44 } 45 } else { 46 s.fullscreen_overflow = DOM.getStyle(document.body, 'overflow', 1) || 'auto'; 47 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); 48 vp = DOM.getViewPort(); 49 s.fullscreen_scrollx = vp.x; 50 s.fullscreen_scrolly = vp.y; 51 52 // Fixes an Opera bug where the scrollbars doesn't reappear 53 if (tinymce.isOpera && s.fullscreen_overflow == 'visible') 54 s.fullscreen_overflow = 'auto'; 55 56 // Fixes an IE bug where horizontal scrollbars would appear 57 if (tinymce.isIE && s.fullscreen_overflow == 'scroll') 58 s.fullscreen_overflow = 'auto'; 59 60 if (s.fullscreen_overflow == '0px') 61 s.fullscreen_overflow = ''; 62 63 DOM.setStyle(document.body, 'overflow', 'hidden'); 64 de.style.overflow = 'hidden'; //Fix for IE6/7 65 vp = DOM.getViewPort(); 66 window.scrollTo(0, 0); 67 68 if (tinymce.isIE) 69 vp.h -= 1; 70 71 n = DOM.add(document.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:150;'}); 72 DOM.add(n, 'div', {id : 'mce_fullscreen'}); 73 74 tinymce.each(ed.settings, function(v, n) { 75 s[n] = v; 76 }); 77 78 s.id = 'mce_fullscreen'; 79 s.width = n.clientWidth; 80 s.height = n.clientHeight - 15; 81 s.fullscreen_is_enabled = true; 82 s.fullscreen_editor_id = ed.id; 83 s.theme_advanced_resizing = false; 84 85 tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) { 86 s[k] = v; 87 }); 88 89 if (s.theme_advanced_toolbar_location === 'external') 90 s.theme_advanced_toolbar_location = 'top'; 91 92 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); 93 t.fullscreenEditor.onInit.add(function() { 94 t.fullscreenEditor.setContent(ed.getContent({format : 'raw', no_events : 1}), {format : 'raw', no_events : 1}); 95 }); 96 97 t.fullscreenEditor.render(); 98 tinyMCE.add(t.fullscreenEditor); 99 100 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); 101 t.fullscreenElement.update(); 102 //document.body.overflow = 'hidden'; 103 } 104 }); 105 106 // Register buttons 107 ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'}); 108 109 ed.onNodeChange.add(function(ed, cm) { 110 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); 111 }); 112 }, 113 114 getInfo : function() { 115 return { 116 longname : 'Fullscreen', 117 author : 'Moxiecode Systems AB', 118 authorurl : 'http://tinymce.moxiecode.com', 119 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', 120 version : tinymce.majorVersion + "." + tinymce.minorVersion 121 }; 122 } 123 }); 124 125 // Register plugin 126 tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin); 127 })(); 1 (function(){var DOM=tinymce.DOM;tinymce.create('tinymce.plugins.FullScreenPlugin',{init:function(ed,url){var t=this,s={},vp;t.editor=ed;ed.addCommand('mceFullScreen',function(){var win,de=document.documentElement;if(ed.getParam('fullscreen_is_enabled')){if(ed.getParam('fullscreen_new_window'))closeFullscreen();else{window.setTimeout(function(){tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format:'raw'}),{format:'raw'});tinyMCE.remove(ed);DOM.remove('mce_fullscreen_container');de.style.overflow=ed.getParam('fullscreen_html_overflow');DOM.setStyle(document.body,'overflow',ed.getParam('fullscreen_overflow'));window.scrollTo(ed.getParam('fullscreen_scrollx'),ed.getParam('fullscreen_scrolly'));},10);}return;}if(ed.getParam('fullscreen_new_window')){win=window.open(url+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=no,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{win.resizeTo(screen.availWidth,screen.availHeight);}catch(e){}}else{s.fullscreen_overflow=DOM.getStyle(document.body,'overflow',1)||'auto';s.fullscreen_html_overflow=DOM.getStyle(de,'overflow',1);vp=DOM.getViewPort();s.fullscreen_scrollx=vp.x;s.fullscreen_scrolly=vp.y;if(tinymce.isOpera&&s.fullscreen_overflow=='visible')s.fullscreen_overflow='auto';if(tinymce.isIE&&s.fullscreen_overflow=='scroll')s.fullscreen_overflow='auto';if(s.fullscreen_overflow=='0px')s.fullscreen_overflow='';DOM.setStyle(document.body,'overflow','hidden');de.style.overflow='hidden';vp=DOM.getViewPort();window.scrollTo(0,0);if(tinymce.isIE)vp.h-=1;n=DOM.add(document.body,'div',{id:'mce_fullscreen_container',style:'position:absolute;top:0;left:0;width:'+vp.w+'px;height:'+vp.h+'px;z-index:150;'});DOM.add(n,'div',{id:'mce_fullscreen'});tinymce.each(ed.settings,function(v,n){s[n]=v;});s.id='mce_fullscreen';s.width=n.clientWidth;s.height=n.clientHeight-15;s.fullscreen_is_enabled=true;s.fullscreen_editor_id=ed.id;s.theme_advanced_resizing=false;tinymce.each(ed.getParam('fullscreen_settings'),function(v,k){s[k]=v;});if(s.theme_advanced_toolbar_location==='external')s.theme_advanced_toolbar_location='top';t.fullscreenEditor=new tinymce.Editor('mce_fullscreen',s);t.fullscreenEditor.onInit.add(function(){t.fullscreenEditor.setContent(ed.getContent({format:'raw',no_events:1}),{format:'raw',no_events:1});});t.fullscreenEditor.render();tinyMCE.add(t.fullscreenEditor);t.fullscreenElement=new tinymce.dom.Element('mce_fullscreen_container');t.fullscreenElement.update();}});ed.addButton('fullscreen',{title:'fullscreen.desc',cmd:'mceFullScreen'});ed.onNodeChange.add(function(ed,cm){cm.setActive('fullscreen',ed.getParam('fullscreen_is_enabled'));});},getInfo:function(){return{longname:'Fullscreen',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('fullscreen',tinymce.plugins.FullScreenPlugin);})(); -
trunk/wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
r6689 r6694 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 1 2 <html xmlns="http://www.w3.org/1999/xhtml"> 2 3 <head> 3 <title> {$lang_fullscreen_title}</title>4 <title></title> 4 5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 5 6 <script type="text/javascript" src="../../tiny_mce.js"></script> … … 70 71 return false; 71 72 } 72 73 function init() {74 var e = document.getElementById('fullscreenarea');75 e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'});76 settings['width'] = e.clientWidth;77 settings['height'] = e.clientHeight;78 tinyMCE.init(settings);79 }80 73 </script> 81 74 <base target="_self" /> 82 75 </head> 83 <body onload="init();" style="margin:0; overflow:hidden; height:100%;" scrolling="no" scroll="no">84 <form onsubmit="doParentSubmit();" style="height: 100%">76 <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no"> 77 <form onsubmit="doParentSubmit();"> 85 78 <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea> 86 79 </form> 80 81 <script type="text/javascript"> 82 var e = document.getElementById('fullscreenarea'); 83 e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'}); 84 settings['width'] = window.innerWidth || document.body.clientWidth; 85 settings['height'] = (window.innerHeight || document.body.clientHeight) - 18; 86 tinyMCE.init(settings); 87 </script> 88 87 89 </body> 88 90 </html> -
trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js
r6632 r6694 1 /** 2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; 10 11 tinymce.create('tinymce.plugins.InlinePopups', { 12 init : function(ed, url) { 13 // Replace window manager 14 ed.onBeforeRenderUI.add(function() { 15 ed.windowManager = new tinymce.InlineWindowManager(ed); 16 DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css"); 17 }); 18 }, 19 20 getInfo : function() { 21 return { 22 longname : 'InlinePopups', 23 author : 'Moxiecode Systems AB', 24 authorurl : 'http://tinymce.moxiecode.com', 25 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', 26 version : tinymce.majorVersion + "." + tinymce.minorVersion 27 }; 28 } 29 }); 30 31 tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', { 32 InlineWindowManager : function(ed) { 33 var t = this; 34 35 t.parent(ed); 36 t.zIndex = 1000; 37 }, 38 39 open : function(f, p) { 40 var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w; 41 42 f = f || {}; 43 p = p || {}; 44 45 // Run native windows 46 if (!f.inline) 47 return t.parent(f, p); 48 49 t.bookmark = ed.selection.getBookmark('simple'); 50 id = DOM.uniqueId(); 51 vp = DOM.getViewPort(); 52 f.width = parseInt(f.width || 320); 53 f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); 54 f.min_width = parseInt(f.min_width || 150); 55 f.min_height = parseInt(f.min_height || 100); 56 f.max_width = parseInt(f.max_width || 2000); 57 f.max_height = parseInt(f.max_height || 2000); 58 f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0))); 59 f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0))); 60 f.movable = f.resizable = true; 61 p.mce_width = f.width; 62 p.mce_height = f.height; 63 p.mce_inline = true; 64 p.mce_window_id = id; 65 66 // Transpose 67 // po = DOM.getPos(ed.getContainer()); 68 // f.left -= po.x; 69 // f.top -= po.y; 70 71 t.features = f; 72 t.params = p; 73 t.onOpen.dispatch(t, f, p); 74 75 if (f.type) { 76 opt += ' modal ' + f.type; 77 f.resizable = false; 78 } 79 80 if (f.statusbar) 81 opt += ' statusbar'; 82 83 if (f.resizable) 84 opt += ' resizable'; 85 86 if (f.minimizable) 87 opt += ' minimizable'; 88 89 if (f.maximizable) 90 opt += ' maximizable'; 91 92 if (f.movable) 93 opt += ' movable'; 94 95 // Create DOM objects 96 t._addAll(document.body, 97 ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'}, 98 ['div', {id : id + '_wrapper', 'class' : 'wrapper' + opt}, 99 ['div', {id : id + '_top', 'class' : 'top'}, 100 ['div', {'class' : 'left'}], 101 ['div', {'class' : 'center'}], 102 ['div', {'class' : 'right'}], 103 ['span', {id : id + '_title'}, f.title || ''] 104 ], 105 106 ['div', {id : id + '_middle', 'class' : 'middle'}, 107 ['div', {id : id + '_left', 'class' : 'left'}], 108 ['span', {id : id + '_content'}], 109 ['div', {id : id + '_right', 'class' : 'right'}] 110 ], 111 112 ['div', {id : id + '_bottom', 'class' : 'bottom'}, 113 ['div', {'class' : 'left'}], 114 ['div', {'class' : 'center'}], 115 ['div', {'class' : 'right'}], 116 ['span', {id : id + '_status'}, 'Content'] 117 ], 118 119 ['a', {'class' : 'move', href : 'javascript:;'}], 120 ['a', {'class' : 'min', href : 'javascript:;', onmousedown : 'return false;'}], 121 ['a', {'class' : 'max', href : 'javascript:;', onmousedown : 'return false;'}], 122 ['a', {'class' : 'med', href : 'javascript:;', onmousedown : 'return false;'}], 123 ['a', {'class' : 'close', href : 'javascript:;', onmousedown : 'return false;'}], 124 ['a', {id : id + '_resize_n', 'class' : 'resize resize-n', href : 'javascript:;'}], 125 ['a', {id : id + '_resize_s', 'class' : 'resize resize-s', href : 'javascript:;'}], 126 ['a', {id : id + '_resize_w', 'class' : 'resize resize-w', href : 'javascript:;'}], 127 ['a', {id : id + '_resize_e', 'class' : 'resize resize-e', href : 'javascript:;'}], 128 ['a', {id : id + '_resize_nw', 'class' : 'resize resize-nw', href : 'javascript:;'}], 129 ['a', {id : id + '_resize_ne', 'class' : 'resize resize-ne', href : 'javascript:;'}], 130 ['a', {id : id + '_resize_sw', 'class' : 'resize resize-sw', href : 'javascript:;'}], 131 ['a', {id : id + '_resize_se', 'class' : 'resize resize-se', href : 'javascript:;'}] 132 ] 133 ] 134 ); 135 136 DOM.setStyles(id, {top : -10000, left : -10000}); 137 138 // Fix gecko rendering bug, where the editors iframe messed with window contents 139 if (tinymce.isGecko) 140 DOM.setStyle(id, 'overflow', 'auto'); 141 142 // Measure borders 143 if (!f.type) { 144 dw += DOM.get(id + '_left').clientWidth; 145 dw += DOM.get(id + '_right').clientWidth; 146 dh += DOM.get(id + '_top').clientHeight; 147 dh += DOM.get(id + '_bottom').clientHeight; 148 } 149 150 // Resize window 151 DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh}); 152 153 if (!f.type) { 154 DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'}); 155 DOM.setStyles(id + '_ifr', {width : f.width, height : f.height}); 156 DOM.setAttrib(id + '_ifr', 'src', f.url || f.file); 157 } else { 158 DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'button ok', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok'); 159 160 if (f.type == 'confirm') 161 DOM.add(id + '_wrapper', 'a', {'class' : 'button cancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel'); 162 163 DOM.add(id + '_middle', 'div', {'class' : 'icon'}); 164 DOM.setHTML(id + '_content', f.content.replace('\n', '<br />')); 165 } 166 167 // Register events 168 mdf = Event.add(id, 'mousedown', function(e) { 169 var n = e.target, w, vp; 170 171 w = t.windows[id]; 172 t.focus(id); 173 174 if (n.nodeName == 'A' || n.nodeName == 'a') { 175 if (n.className == 'max') { 176 w.oldPos = w.element.getXY(); 177 w.oldSize = w.element.getSize(); 178 179 vp = DOM.getViewPort(); 180 181 // Reduce viewport size to avoid scrollbars 182 vp.w -= 2; 183 vp.h -= 2; 184 185 w.element.moveTo(vp.x, vp.y); 186 w.element.resizeTo(vp.w, vp.h); 187 DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight}); 188 DOM.addClass(id + '_wrapper', 'maximized'); 189 } else if (n.className == 'med') { 190 // Reset to old size 191 w.element.moveTo(w.oldPos.x, w.oldPos.y); 192 w.element.resizeTo(w.oldSize.w, w.oldSize.h); 193 w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight); 194 195 DOM.removeClass(id + '_wrapper', 'maximized'); 196 } else if (n.className == 'move') 197 return t._startDrag(id, e, n.className); 198 else if (DOM.hasClass(n, 'resize')) 199 return t._startDrag(id, e, n.className.substring(7)); 200 } 201 }); 202 203 clf = Event.add(id, 'click', function(e) { 204 var n = e.target; 205 206 t.focus(id); 207 208 if (n.nodeName == 'A' || n.nodeName == 'a') { 209 switch (n.className) { 210 case 'close': 211 t.close(null, id); 212 return Event.cancel(e); 213 214 case 'button ok': 215 case 'button cancel': 216 f.button_func(n.className == 'button ok'); 217 return Event.cancel(e); 218 } 219 } 220 }); 221 222 // Add window 223 t.windows = t.windows || {}; 224 w = t.windows[id] = { 225 id : id, 226 mousedown_func : mdf, 227 click_func : clf, 228 element : new Element(id, {blocker : 1, container : ed.getContainer()}), 229 iframeElement : new Element(id + '_ifr'), 230 features : f, 231 deltaWidth : dw, 232 deltaHeight : dh 233 }; 234 235 w.iframeElement.on('focus', function() { 236 t.focus(id); 237 }); 238 239 t.focus(id); 240 t._fixIELayout(id, 1); 241 242 // if (DOM.get(id + '_ok')) 243 // DOM.get(id + '_ok').focus(); 244 245 return w; 246 }, 247 248 focus : function(id) { 249 var t = this, w = t.windows[id]; 250 251 w.zIndex = this.zIndex++; 252 w.element.setStyle('zIndex', w.zIndex); 253 w.element.update(); 254 255 id = id + '_wrapper'; 256 DOM.removeClass(t.lastId, 'focus'); 257 DOM.addClass(id, 'focus'); 258 t.lastId = id; 259 }, 260 261 _addAll : function(te, ne) { 262 var i, n, t = this, dom = tinymce.DOM; 263 264 if (is(ne, 'string')) 265 te.appendChild(dom.doc.createTextNode(ne)); 266 else if (ne.length) { 267 te = te.appendChild(dom.create(ne[0], ne[1])); 268 269 for (i=2; i<ne.length; i++) 270 t._addAll(te, ne[i]); 271 } 272 }, 273 274 _startDrag : function(id, se, ac) { 275 var t = this, mu, mm, d = document, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh; 276 277 // Get positons and sizes 278 // cp = DOM.getPos(t.editor.getContainer()); 279 cp = {x : 0, y : 0}; 280 vp = DOM.getViewPort(); 281 282 // Reduce viewport size to avoid scrollbars 283 vp.w -= 2; 284 vp.h -= 2; 285 286 sex = se.screenX; 287 sey = se.screenY; 288 dx = dy = dw = dh = 0; 289 290 // Handle mouse up 291 mu = Event.add(d, 'mouseup', function(e) { 292 Event.remove(d, 'mouseup', mu); 293 Event.remove(d, 'mousemove', mm); 294 295 if (eb) 296 eb.remove(); 297 298 we.moveBy(dx, dy); 299 we.resizeBy(dw, dh); 300 sz = we.getSize(); 301 DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight}); 302 t._fixIELayout(id, 1); 303 304 return Event.cancel(e); 305 }); 306 307 if (ac != 'move') 308 startMove(); 309 310 function startMove() { 311 if (eb) 312 return; 313 314 t._fixIELayout(id, 0); 315 316 // Setup event blocker 317 DOM.add(d.body, 'div', { 318 id : 'mceEventBlocker', 319 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'), 320 style : {left : vp.x, top : vp.y, width : vp.w - 20, height : vp.h - 20, zIndex : 20001} 321 }); 322 eb = new Element('mceEventBlocker'); 323 eb.update(); 324 325 // Setup placeholder 326 p = we.getXY(); 327 sz = we.getSize(); 328 sx = cp.x + p.x - vp.x; 329 sy = cp.y + p.y - vp.y; 330 DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'placeholder', style : {left : sx, top : sy, width : sz.w, height : sz.h}}); 331 ph = new Element('mcePlaceHolder'); 332 }; 333 334 // Handle mouse move/drag 335 mm = Event.add(d, 'mousemove', function(e) { 336 var x, y, v; 337 338 startMove(); 339 340 x = e.screenX - sex; 341 y = e.screenY - sey; 342 343 switch (ac) { 344 case 'resize-w': 345 dx = x; 346 dw = 0 - x; 347 break; 348 349 case 'resize-e': 350 dw = x; 351 break; 352 353 case 'resize-n': 354 case 'resize-nw': 355 case 'resize-ne': 356 if (ac == "resize-nw") { 357 dx = x; 358 dw = 0 - x; 359 } else if (ac == "resize-ne") 360 dw = x; 361 362 dy = y; 363 dh = 0 - y; 364 break; 365 366 case 'resize-s': 367 case 'resize-sw': 368 case 'resize-se': 369 if (ac == "resize-sw") { 370 dx = x; 371 dw = 0 - x; 372 } else if (ac == "resize-se") 373 dw = x; 374 375 dh = y; 376 break; 377 378 case 'move': 379 dx = x; 380 dy = y; 381 break; 382 } 383 384 // Boundary check 385 if (dw < (v = w.features.min_width - sz.w)) { 386 if (dx !== 0) 387 dx += dw - v; 388 389 dw = v; 390 } 391 392 if (dh < (v = w.features.min_height - sz.h)) { 393 if (dy !== 0) 394 dy += dh - v; 395 396 dh = v; 397 } 398 399 dw = Math.min(dw, w.features.max_width - sz.w); 400 dh = Math.min(dh, w.features.max_height - sz.h); 401 dx = Math.max(dx, vp.x - (sx + vp.x)); 402 dy = Math.max(dy, vp.y - (sy + vp.y)); 403 dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x)); 404 dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y)); 405 406 // Move if needed 407 if (dx + dy !== 0) { 408 if (sx + dx < 0) 409 dx = 0; 410 411 if (sy + dy < 0) 412 dy = 0; 413 414 ph.moveTo(sx + dx, sy + dy); 415 } 416 417 // Resize if needed 418 if (dw + dh !== 0) 419 ph.resizeTo(sz.w + dw, sz.h + dh); 420 421 return Event.cancel(e); 422 }); 423 424 return Event.cancel(se); 425 }, 426 427 resizeBy : function(dw, dh, id) { 428 var w = this.windows[id]; 429 430 if (w) { 431 w.element.resizeBy(dw, dh); 432 w.iframeElement.resizeBy(dw, dh); 433 } 434 }, 435 436 close : function(win, id) { 437 var t = this, w, d = document, ix = 0, fw; 438 439 // Probably not inline 440 if (!id && win) { 441 t.parent(win); 442 return; 443 } 444 445 if (w = t.windows[id]) { 446 t.onClose.dispatch(t); 447 Event.remove(d, 'mousedown', w.mousedownFunc); 448 Event.remove(d, 'click', w.clickFunc); 449 450 DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak 451 w.element.remove(); 452 delete t.windows[id]; 453 454 // Find front most window and focus that 455 each (t.windows, function(w) { 456 if (w.zIndex > ix) { 457 fw = w; 458 ix = w.zIndex; 459 } 460 }); 461 462 if (fw) 463 t.focus(fw.id); 464 } 465 }, 466 467 setTitle : function(ti, id) { 468 DOM.get(id + '_title').innerHTML = DOM.encode(ti); 469 }, 470 471 alert : function(txt, cb, s) { 472 var t = this, w; 473 474 w = t.open({ 475 title : t, 476 type : 'alert', 477 button_func : function(s) { 478 if (cb) 479 cb.call(s || t, s); 480 481 t.close(null, w.id); 482 }, 483 content : DOM.encode(t.editor.getLang(txt, txt)), 484 inline : 1, 485 width : 400, 486 height : 130 487 }); 488 }, 489 490 confirm : function(txt, cb, s) { 491 var t = this, w; 492 493 w = t.open({ 494 title : t, 495 type : 'confirm', 496 button_func : function(s) { 497 if (cb) 498 cb.call(s || t, s); 499 500 t.close(null, w.id); 501 }, 502 content : DOM.encode(t.editor.getLang(txt, txt)), 503 inline : 1, 504 width : 400, 505 height : 130 506 }); 507 }, 508 509 // Internal functions 510 511 _fixIELayout : function(id, s) { 512 var w, img; 513 514 if (!tinymce.isIE6) 515 return; 516 517 // Fixes the bug where hover flickers and does odd things in IE6 518 each(['n','s','w','e','nw','ne','sw','se'], function(v) { 519 var e = DOM.get(id + '_resize_' + v); 520 521 DOM.setStyles(e, { 522 width : s ? e.clientWidth : '', 523 height : s ? e.clientHeight : '', 524 cursor : DOM.getStyle(e, 'cursor', 1) 525 }); 526 527 DOM.setStyle(id + "_bottom", 'bottom', '-1px'); 528 529 e = 0; 530 }); 531 532 // Fixes graphics glitch 533 if (w = this.windows[id]) { 534 // Fixes rendering bug after resize 535 w.element.hide(); 536 w.element.show(); 537 538 // Forced a repaint of the window 539 //DOM.get(id).style.filter = ''; 540 541 // IE has a bug where images used in CSS won't get loaded 542 // sometimes when the cache in the browser is disabled 543 // This fix tries to solve it by loading the images using the image object 544 each(DOM.select('div,a', id), function(e, i) { 545 if (e.currentStyle.backgroundImage != 'none') { 546 img = new Image(); 547 img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1'); 548 } 549 }); 550 551 DOM.get(id).style.filter = ''; 552 } 553 } 554 }); 555 556 // Register plugin 557 tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups); 558 })(); 559 1 (function(){var DOM=tinymce.DOM,Element=tinymce.dom.Element,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.InlinePopups',{init:function(ed,url){ed.onBeforeRenderUI.add(function(){ed.windowManager=new tinymce.InlineWindowManager(ed);DOM.loadCSS(url+'/skins/'+(ed.settings.inlinepopups_skin||'clearlooks2')+"/window.css");});},getInfo:function(){return{longname:'InlinePopups',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager',{InlineWindowManager:function(ed){var t=this;t.parent(ed);t.zIndex=1000;},open:function(f,p){var t=this,id,opt='',ed=t.editor,dw=0,dh=0,vp,po,mdf,clf,we,w;f=f||{};p=p||{};if(!f.inline)return t.parent(f,p);t.bookmark=ed.selection.getBookmark('simple');id=DOM.uniqueId();vp=DOM.getViewPort();f.width=parseInt(f.width||320);f.height=parseInt(f.height||240)+(tinymce.isIE?8:0);f.min_width=parseInt(f.min_width||150);f.min_height=parseInt(f.min_height||100);f.max_width=parseInt(f.max_width||2000);f.max_height=parseInt(f.max_height||2000);f.left=f.left||Math.round(Math.max(vp.x,vp.x+(vp.w/ 2.0) - (f.width /2.0)));f.top=f.top||Math.round(Math.max(vp.y,vp.y+(vp.h/ 2.0) - (f.height /2.0)));f.movable=f.resizable=true;p.mce_width=f.width;p.mce_height=f.height;p.mce_inline=true;p.mce_window_id=id;t.features=f;t.params=p;t.onOpen.dispatch(t,f,p);if(f.type){opt+=' modal '+f.type;f.resizable=false;}if(f.statusbar)opt+=' statusbar';if(f.resizable)opt+=' resizable';if(f.minimizable)opt+=' minimizable';if(f.maximizable)opt+=' maximizable';if(f.movable)opt+=' movable';t._addAll(document.body,['div',{id:id,'class':ed.settings.inlinepopups_skin||'clearlooks2',style:'width:100px;height:100px'},['div',{id:id+'_wrapper','class':'wrapper'+opt},['div',{id:id+'_top','class':'top'},['div',{'class':'left'}],['div',{'class':'center'}],['div',{'class':'right'}],['span',{id:id+'_title'},f.title||'']],['div',{id:id+'_middle','class':'middle'},['div',{id:id+'_left','class':'left'}],['span',{id:id+'_content'}],['div',{id:id+'_right','class':'right'}]],['div',{id:id+'_bottom','class':'bottom'},['div',{'class':'left'}],['div',{'class':'center'}],['div',{'class':'right'}],['span',{id:id+'_status'},'Content']],['a',{'class':'move',href:'javascript:;'}],['a',{'class':'min',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'max',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'med',href:'javascript:;',onmousedown:'return false;'}],['a',{'class':'close',href:'javascript:;',onmousedown:'return false;'}],['a',{id:id+'_resize_n','class':'resize resize-n',href:'javascript:;'}],['a',{id:id+'_resize_s','class':'resize resize-s',href:'javascript:;'}],['a',{id:id+'_resize_w','class':'resize resize-w',href:'javascript:;'}],['a',{id:id+'_resize_e','class':'resize resize-e',href:'javascript:;'}],['a',{id:id+'_resize_nw','class':'resize resize-nw',href:'javascript:;'}],['a',{id:id+'_resize_ne','class':'resize resize-ne',href:'javascript:;'}],['a',{id:id+'_resize_sw','class':'resize resize-sw',href:'javascript:;'}],['a',{id:id+'_resize_se','class':'resize resize-se',href:'javascript:;'}]]]);DOM.setStyles(id,{top:-10000,left:-10000});if(tinymce.isGecko)DOM.setStyle(id,'overflow','auto');if(!f.type){dw+=DOM.get(id+'_left').clientWidth;dw+=DOM.get(id+'_right').clientWidth;dh+=DOM.get(id+'_top').clientHeight;dh+=DOM.get(id+'_bottom').clientHeight;}DOM.setStyles(id,{top:f.top,left:f.left,width:f.width+dw,height:f.height+dh});if(!f.type){DOM.add(id+'_content','iframe',{id:id+'_ifr',src:'javascript:""',frameBorder:0,style:'border:0;width:10px;height:10px'});DOM.setStyles(id+'_ifr',{width:f.width,height:f.height});DOM.setAttrib(id+'_ifr','src',f.url||f.file);}else{DOM.add(id+'_wrapper','a',{id:id+'_ok','class':'button ok',href:'javascript:;',onmousedown:'return false;'},'Ok');if(f.type=='confirm')DOM.add(id+'_wrapper','a',{'class':'button cancel',href:'javascript:;',onmousedown:'return false;'},'Cancel');DOM.add(id+'_middle','div',{'class':'icon'});DOM.setHTML(id+'_content',f.content.replace('\n','<br />'));}mdf=Event.add(id,'mousedown',function(e){var n=e.target,w,vp;w=t.windows[id];t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){if(n.className=='max'){w.oldPos=w.element.getXY();w.oldSize=w.element.getSize();vp=DOM.getViewPort();vp.w-=2;vp.h-=2;w.element.moveTo(vp.x,vp.y);w.element.resizeTo(vp.w,vp.h);DOM.setStyles(id+'_ifr',{width:vp.w-w.deltaWidth,height:vp.h-w.deltaHeight});DOM.addClass(id+'_wrapper','maximized');}else if(n.className=='med'){w.element.moveTo(w.oldPos.x,w.oldPos.y);w.element.resizeTo(w.oldSize.w,w.oldSize.h);w.iframeElement.resizeTo(w.oldSize.w-w.deltaWidth,w.oldSize.h-w.deltaHeight);DOM.removeClass(id+'_wrapper','maximized');}else if(n.className=='move')return t._startDrag(id,e,n.className);else if(DOM.hasClass(n,'resize'))return t._startDrag(id,e,n.className.substring(7));}});clf=Event.add(id,'click',function(e){var n=e.target;t.focus(id);if(n.nodeName=='A'||n.nodeName=='a'){switch(n.className){case'close':t.close(null,id);return Event.cancel(e);case'button ok':case'button cancel':f.button_func(n.className=='button ok');return Event.cancel(e);}}});t.windows=t.windows||{};w=t.windows[id]={id:id,mousedown_func:mdf,click_func:clf,element:new Element(id,{blocker:1,container:ed.getContainer()}),iframeElement:new Element(id+'_ifr'),features:f,deltaWidth:dw,deltaHeight:dh};w.iframeElement.on('focus',function(){t.focus(id);});t.focus(id);t._fixIELayout(id,1);return w;},focus:function(id){var t=this,w=t.windows[id];w.zIndex=this.zIndex++;w.element.setStyle('zIndex',w.zIndex);w.element.update();id=id+'_wrapper';DOM.removeClass(t.lastId,'focus');DOM.addClass(id,'focus');t.lastId=id;},_addAll:function(te,ne){var i,n,t=this,dom=tinymce.DOM;if(is(ne,'string'))te.appendChild(dom.doc.createTextNode(ne));else if(ne.length){te=te.appendChild(dom.create(ne[0],ne[1]));for(i=2;i<ne.length;i++)t._addAll(te,ne[i]);}},_startDrag:function(id,se,ac){var t=this,mu,mm,d=document,eb,w=t.windows[id],we=w.element,sp=we.getXY(),p,sz,ph,cp,vp,sx,sy,sex,sey,dx,dy,dw,dh;cp={x:0,y:0};vp=DOM.getViewPort();vp.w-=2;vp.h-=2;sex=se.screenX;sey=se.screenY;dx=dy=dw=dh=0;mu=Event.add(d,'mouseup',function(e){Event.remove(d,'mouseup',mu);Event.remove(d,'mousemove',mm);if(eb)eb.remove();we.moveBy(dx,dy);we.resizeBy(dw,dh);sz=we.getSize();DOM.setStyles(id+'_ifr',{width:sz.w-w.deltaWidth,height:sz.h-w.deltaHeight});t._fixIELayout(id,1);return Event.cancel(e);});if(ac!='move')startMove();function startMove(){if(eb)return;t._fixIELayout(id,0);DOM.add(d.body,'div',{id:'mceEventBlocker','class':'mceEventBlocker '+(t.editor.settings.inlinepopups_skin||'clearlooks2'),style:{left:vp.x,top:vp.y,width:vp.w-20,height:vp.h-20,zIndex:20001}});eb=new Element('mceEventBlocker');eb.update();p=we.getXY();sz=we.getSize();sx=cp.x+p.x-vp.x;sy=cp.y+p.y-vp.y;DOM.add(eb.get(),'div',{id:'mcePlaceHolder','class':'placeholder',style:{left:sx,top:sy,width:sz.w,height:sz.h}});ph=new Element('mcePlaceHolder');};mm=Event.add(d,'mousemove',function(e){var x,y,v;startMove();x=e.screenX-sex;y=e.screenY-sey;switch(ac){case'resize-w':dx=x;dw=0-x;break;case'resize-e':dw=x;break;case'resize-n':case'resize-nw':case'resize-ne':if(ac=="resize-nw"){dx=x;dw=0-x;}else if(ac=="resize-ne")dw=x;dy=y;dh=0-y;break;case'resize-s':case'resize-sw':case'resize-se':if(ac=="resize-sw"){dx=x;dw=0-x;}else if(ac=="resize-se")dw=x;dh=y;break;case'move':dx=x;dy=y;break;}if(dw<(v=w.features.min_width-sz.w)){if(dx!==0)dx+=dw-v;dw=v;}if(dh<(v=w.features.min_height-sz.h)){if(dy!==0)dy+=dh-v;dh=v;}dw=Math.min(dw,w.features.max_width-sz.w);dh=Math.min(dh,w.features.max_height-sz.h);dx=Math.max(dx,vp.x-(sx+vp.x));dy=Math.max(dy,vp.y-(sy+vp.y));dx=Math.min(dx,(vp.w+vp.x)-(sx+sz.w+vp.x));dy=Math.min(dy,(vp.h+vp.y)-(sy+sz.h+vp.y));if(dx+dy!==0){if(sx+dx<0)dx=0;if(sy+dy<0)dy=0;ph.moveTo(sx+dx,sy+dy);}if(dw+dh!==0)ph.resizeTo(sz.w+dw,sz.h+dh);return Event.cancel(e);});return Event.cancel(se);},resizeBy:function(dw,dh,id){var w=this.windows[id];if(w){w.element.resizeBy(dw,dh);w.iframeElement.resizeBy(dw,dh);}},close:function(win,id){var t=this,w,d=document,ix=0,fw;if(!id&&win){t.parent(win);return;}if(w=t.windows[id]){t.onClose.dispatch(t);Event.remove(d,'mousedown',w.mousedownFunc);Event.remove(d,'click',w.clickFunc);DOM.setAttrib(id+'_ifr','src','javascript:""');w.element.remove();delete t.windows[id];each(t.windows,function(w){if(w.zIndex>ix){fw=w;ix=w.zIndex;}});if(fw)t.focus(fw.id);}},setTitle:function(ti,id){DOM.get(id+'_title').innerHTML=DOM.encode(ti);},alert:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'alert',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},confirm:function(txt,cb,s){var t=this,w;w=t.open({title:t,type:'confirm',button_func:function(s){if(cb)cb.call(s||t,s);t.close(null,w.id);},content:DOM.encode(t.editor.getLang(txt,txt)),inline:1,width:400,height:130});},_fixIELayout:function(id,s){var w,img;if(!tinymce.isIE6)return;each(['n','s','w','e','nw','ne','sw','se'],function(v){var e=DOM.get(id+'_resize_'+v);DOM.setStyles(e,{width:s?e.clientWidth:'',height:s?e.clientHeight:'',cursor:DOM.getStyle(e,'cursor',1)});DOM.setStyle(id+"_bottom",'bottom','-1px');e=0;});if(w=this.windows[id]){w.element.hide();w.element.show();each(DOM.select('div,a',id),function(e,i){if(e.currentStyle.backgroundImage!='none'){img=new Image();img.src=e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,'$1');}});DOM.get(id).style.filter='';}}});tinymce.PluginManager.add('inlinepopups',tinymce.plugins.InlinePopups);})(); -
trunk/wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css
r6632 r6694 9 9 10 10 /* Top */ 11 .clearlooks2 .top, .clearlooks2 .top div {top:0; width:100%; height:23px} 12 .clearlooks2 .top .left {width:6px; background:url(img/corners.gif)} 13 .clearlooks2 .top .center {right:6px; width:100%; height:23px; background:url(img/horizontal.gif) 12px 0; clip:rect(auto auto auto 12px)} 14 .clearlooks2 .top .right {right:0; width:6px; height:23px; background:url(img/corners.gif) -12px 0} 15 .clearlooks2 .top span {width:100%; text-align:center; vertical-align:middle; line-height:23px; font-weight:bold} 16 .clearlooks2 .focus .top .left {background:url(img/corners.gif) -6px 0} 17 .clearlooks2 .focus .top .center {background:url(img/horizontal.gif) 0 -23px} 18 .clearlooks2 .focus .top .right {background:url(img/corners.gif) -18px 0} 19 .clearlooks2 .focus .top span {color:#FFF} 11 .clearlooks2 .top, 12 .clearlooks2 .top div { 13 top:0; 14 width:100%; 15 height:23px 16 } 17 .clearlooks2 .top .left { 18 width:55%; 19 background: #cee1ef; 20 border-left: 1px solid #c6d9e9; 21 border-top: 1px solid #c6d9e9; 22 } 23 .clearlooks2 .top .center { 24 /*right:6px; 25 width:100%; 26 height:23px; 27 background: #dedede; 28 border-top: 1px solid #ccc;*/ 29 } 30 .clearlooks2 .top .right { 31 right:0; 32 width:55%; 33 height:23px; 34 background: #cee1ef; 35 border-right: 1px solid #c6d9e9; 36 border-top: 1px solid #c6d9e9; 37 } 38 .clearlooks2 .top span { 39 width:100%; 40 font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; 41 text-align:center; 42 vertical-align:middle; 43 line-height:23px; 44 font-weight:bold 45 } 46 .clearlooks2 .focus .top .left { 47 background: #2683ae; 48 border-left: 1px solid #464646; 49 border-top: 1px solid #464646; 50 } 51 .clearlooks2 .focus .top .center { 52 /*background: #2683ae; 53 border-top: 1px solid #454545;*/ 54 } 55 .clearlooks2 .focus .top .right { 56 background: #2683ae; 57 border-right: 1px solid #464646; 58 border-top: 1px solid #464646; 59 } 60 .clearlooks2 .focus .top span { 61 color:#FFF 62 } 20 63 21 64 /* Middle */ 22 65 .clearlooks2 .middle, .clearlooks2 .middle div {top:0} 23 66 .clearlooks2 .middle {width:100%; height:100%; clip:rect(23px auto auto auto)} 24 .clearlooks2 .middle .left {left:0; width:5px; height:100%; background: url(img/vertical.gif) -5px 0}67 .clearlooks2 .middle .left {left:0; width:5px; height:100%; background:#eaf3ea;border-left:1px solid #c6d9e9;} 25 68 .clearlooks2 .middle span {top:23px; left:5px; width:100%; height:100%; background:#FFF} 26 .clearlooks2 .middle .right {right:0; width:5px; height:100%; background: url(img/vertical.gif)}69 .clearlooks2 .middle .right {right:0; width:5px; height:100%; background:#eaf3ea;border-right:1px solid #c6d9e9;} 27 70 28 71 /* Bottom */ 29 72 .clearlooks2 .bottom, .clearlooks2 .bottom div {height:6px} 30 .clearlooks2 .bottom {left:0; bottom:0; width:100% }31 .clearlooks2 .bottom div {top:0 }32 .clearlooks2 .bottom .left {left:0; width:5px; background: url(img/corners.gif) -34px -6px}33 .clearlooks2 .bottom .center {left:5px; width:100%; background:url(img/horizontal.gif) 0 -46px}34 .clearlooks2 .bottom .right {right:0; width: 5px; background: url(img/corners.gif) -34px 0}73 .clearlooks2 .bottom {left:0; bottom:0; width:100%;background:#eaf3ea;border-bottom:1px solid #c6d9e9;} 74 .clearlooks2 .bottom div {top:0;} 75 .clearlooks2 .bottom .left {left:0; width:5px; background:#eaf3ea;border-left:1px solid #c6d9e9;} 76 .clearlooks2 .bottom .center {left:5px; width:100%; } 77 .clearlooks2 .bottom .right {right:0; width:6px; background:#eaf3ea url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9;} 35 78 .clearlooks2 .bottom span {display:none} 36 79 .clearlooks2 .statusbar .bottom, .clearlooks2 .statusbar .bottom div {height:23px} -
trunk/wp-includes/js/tinymce/plugins/media/editor_plugin.js
r6632 r6694 1 /** 2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var each = tinymce.each; 10 11 tinymce.create('tinymce.plugins.MediaPlugin', { 12 init : function(ed, url) { 13 var t = this; 14 15 t.editor = ed; 16 t.url = url; 17 18 function isMediaElm(n) { 19 return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className); 20 }; 21 22 // Register commands 23 ed.addCommand('mceMedia', function() { 24 ed.windowManager.open({ 25 file : url + '/media.htm', 26 width : 430 + parseInt(ed.getLang('media.delta_width', 0)), 27 height : 470 + parseInt(ed.getLang('media.delta_height', 0)), 28 inline : 1 29 }, { 30 plugin_url : url 31 }); 32 }); 33 34 // Register buttons 35 ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'}); 36 37 ed.onNodeChange.add(function(ed, cm, n) { 38 cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n)); 39 }); 40 41 ed.onInit.add(function() { 42 var lo = { 43 mceItemFlash : 'flash', 44 mceItemShockWave : 'shockwave', 45 mceItemWindowsMedia : 'windowsmedia', 46 mceItemQuickTime : 'quicktime', 47 mceItemRealMedia : 'realmedia' 48 }; 49 50 ed.dom.loadCSS(url + "/css/content.css"); 51 52 if (ed.theme.onResolveName) { 53 ed.theme.onResolveName.add(function(th, o) { 54 if (o.name == 'img') { 55 each(lo, function(v, k) { 56 if (ed.dom.hasClass(o.node, k)) { 57 o.name = v; 58 o.title = ed.dom.getAttrib(o.node, 'title'); 59 return false; 60 } 61 }); 62 } 63 }); 64 } 65 66 if (ed && ed.plugins.contextmenu) { 67 ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) { 68 if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) { 69 m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'}); 70 } 71 }); 72 } 73 }); 74 75 ed.onBeforeSetContent.add(function(ed, o) { 76 var h = o.content; 77 78 h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) { 79 var o = eval("({" + c + "})"); 80 81 return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />' 82 }); 83 84 h = h.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>'); 85 h = h.replace(/<embed([^>]*)>/gi, '<div class="mceItemEmbed" $1>'); 86 h = h.replace(/<\/(object|embed)([^>]*)>/gi, '</div>'); 87 h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<div ' + b.replace(/value=/g, '_value=') + ' class="mceItemParam"></div>'}); 88 h = h.replace(/\/ class=\"mceItemParam\"><\/div>/gi, 'class="mceItemParam"></div>'); 89 90 o.content = h; 91 }); 92 93 ed.onSetContent.add(function() { 94 t._divsToImgs(ed.getBody()); 95 }); 96 97 ed.onPreProcess.add(function(ed, o) { 98 var dom = ed.dom; 99 100 if (o.set) { 101 t._divsToImgs(o.node); 102 103 each(dom.select('IMG', o.node), function(n) { 104 var p; 105 106 if (isMediaElm(n)) { 107 p = t._parse(n.title); 108 dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100)); 109 dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100)); 110 } 111 }); 112 } 113 114 if (o.get) { 115 each(dom.select('IMG', o.node), function(n) { 116 var ci, cb, mt; 117 118 if (ed.getParam('media_use_script')) { 119 if (isMediaElm(n)) 120 n.className = n.className.replace(/mceItem/g, 'mceTemp'); 121 122 return; 123 } 124 125 switch (n.className) { 126 case 'mceItemFlash': 127 ci = 'd27cdb6e-ae6d-11cf-96b8-444553540000'; 128 cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; 129 mt = 'application/x-shockwave-flash'; 130 break; 131 132 case 'mceItemShockWave': 133 ci = '166b1bca-3f9c-11cf-8075-444553540000'; 134 cb = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; 135 mt = 'application/x-director'; 136 break; 137 138 case 'mceItemWindowsMedia': 139 ci = ed.getParam('media_wmp6_compatible') ? '05589fa1-c356-11ce-bf01-00aa0055595a' : '6bf52a52-394a-11d3-b153-00c04f79faa6'; 140 cb = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; 141 mt = 'application/x-mplayer2'; 142 break; 143 144 case 'mceItemQuickTime': 145 ci = '02bf25d5-8c17-4b23-bc80-d3488abddc6b'; 146 cb = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; 147 mt = 'video/quicktime'; 148 break; 149 150 case 'mceItemRealMedia': 151 ci = 'cfcdaa03-8be4-11cf-b84b-0020afbbccfa'; 152 cb = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; 153 mt = 'audio/x-pn-realaudio-plugin'; 154 break; 155 } 156 157 if (ci) { 158 dom.replace(t._buildObj({ 159 classid : ci, 160 codebase : cb, 161 type : mt 162 }, n), n); 163 } 164 }); 165 } 166 }); 167 168 ed.onPostProcess.add(function(ed, o) { 169 o.content = o.content.replace(/_value=/g, 'value='); 170 }); 171 172 if (ed.getParam('media_use_script')) { 173 function getAttr(s, n) { 174 n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s); 175 176 return n ? ed.dom.decode(n[1]) : ''; 177 }; 178 179 ed.onPostProcess.add(function(ed, o) { 180 o.content = o.content.replace(/<img[^>]+>/g, function(im) { 181 var cl = getAttr(im, 'class'); 182 183 if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) { 184 at = t._parse(getAttr(im, 'title')); 185 at.width = getAttr(im, 'width'); 186 at.height = getAttr(im, 'height'); 187 im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>'; 188 } 189 190 return im; 191 }); 192 }); 193 } 194 }, 195 196 getInfo : function() { 197 return { 198 longname : 'Media', 199 author : 'Moxiecode Systems AB', 200 authorurl : 'http://tinymce.moxiecode.com', 201 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media', 202 version : tinymce.majorVersion + "." + tinymce.minorVersion 203 }; 204 }, 205 206 // Private methods 207 208 _buildObj : function(o, n) { 209 var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title); 210 211 p.width = o.width = dom.getAttrib(n, 'width') || 100; 212 p.height = o.height = dom.getAttrib(n, 'height') || 100; 213 214 ob = dom.create('div', { 215 mce_name : 'object', 216 classid : "clsid:" + o.classid, 217 codebase : o.codebase, 218 width : o.width, 219 height : o.height 220 }); 221 222 if (p.src) 223 p.src = ed.convertURL(p.src, 'src', n); 224 225 each (p, function(v, k) { 226 if (v && !/^(width|height|codebase|classid)$/.test(k)) 227 dom.add(ob, 'div', {mce_name : 'param', name : k, '_value' : v}); 228 }); 229 230 dom.add(ob, 'div', tinymce.extend({mce_name : 'embed', type : o.type}, p)); 231 232 return ob; 233 }, 234 235 _divsToImgs : function(p) { 236 var t = this, dom = t.editor.dom, im, ci; 237 238 each(dom.select('div', p), function(n) { 239 // Convert object into image 240 if (dom.getAttrib(n, 'class') == 'mceItemObject') { 241 ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, ''); 242 243 switch (ci) { 244 case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': 245 dom.replace(t._createImg('mceItemFlash', n), n); 246 break; 247 248 case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': 249 dom.replace(t._createImg('mceItemShockWave', n), n); 250 break; 251 252 case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': 253 case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': 254 case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': 255 dom.replace(t._createImg('mceItemWindowsMedia', n), n); 256 break; 257 258 case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': 259 dom.replace(t._createImg('mceItemQuickTime', n), n); 260 break; 261 262 case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': 263 dom.replace(t._createImg('mceItemRealMedia', n), n); 264 break; 265 266 default: 267 dom.replace(t._createImg('mceItemFlash', n), n); 268 } 269 } 270 }); 271 }, 272 273 _createImg : function(cl, n) { 274 var im, dom = this.editor.dom, pa = {}, ti = ''; 275 276 // Create image 277 im = dom.create('img', { 278 src : this.url + '/img/trans.gif', 279 width : dom.getAttrib(n, 'width') || 100, 280 height : dom.getAttrib(n, 'height') || 100, 281 'class' : cl 282 }); 283 284 // Setup base parameters 285 each(['id', 'name', 'width', 'height', 'bgcolor', 'align'], function(n) { 286 var v = dom.getAttrib(n, 'align'); 287 288 if (v) 289 pa[v] = v; 290 }); 291 292 // Add optional parameters 293 each(dom.select('div', n), function(n) { 294 if (dom.hasClass(n, 'mceItemParam')) 295 pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value'); 296 }); 297 298 // Use src not movie 299 if (pa.movie) { 300 pa.src = pa.movie; 301 delete pa.movie; 302 } 303 304 delete pa.width; 305 delete pa.height; 306 307 im.title = this._serialize(pa); 308 309 return im; 310 }, 311 312 _parse : function(s) { 313 return tinymce.util.JSON.parse('{' + s + '}'); 314 }, 315 316 _serialize : function(o) { 317 return tinymce.util.JSON.serialize(o).replace(/[{}]/g, ''); 318 } 319 }); 320 321 // Register plugin 322 tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin); 323 })(); 1 (function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=eval("({"+c+"})");return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'</span>');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/g,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166b1bca-3f9c-11cf-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=ed.getParam('media_wmp6_compatible')?'05589fa1-c356-11ce-bf01-00aa0055595a':'6bf52a52-394a-11d3-b153-00c04f79faa6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02bf25d5-8c17-4b23-bc80-d3488abddc6b';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='cfcdaa03-8be4-11cf-b84b-0020afbbccfa';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break;}if(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(v&&!/^(width|height|codebase|classid)$/.test(k))dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align'],function(n){var v=dom.getAttrib(n,'align');if(v)pa[v]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})(); -
trunk/wp-includes/js/tinymce/plugins/media/media.htm
r6632 r6694 3 3 <head> 4 4 <title>{#media_dlg.title}</title> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="js/media.js"></script> 7 7 <script type="text/javascript" src="../../utils/mctabs.js"></script> … … 10 10 <script type="text/javascript" src="../../utils/editable_selects.js"></script> 11 11 <link href="css/media.css" rel="stylesheet" type="text/css" /> 12 <base target="_self" /> 12 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('src').focus();},500);});</script> 13 <base target="_self" /> 13 14 </head> 14 15 <body style="display: none"> … … 812 813 <div class="mceActionPanel"> 813 814 <div style="float: left"> 814 <input type="button" id=" insert" name="insert" value="{#insert}" onclick="insertMedia();" />815 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 815 816 </div> 816 817 817 818 <div style="float: right"> 818 <input type=" button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />819 <input type="submit" id="insert" name="insert" value="{#insert}" onclick="insertMedia();" /> 819 820 </div> 820 821 </div> -
trunk/wp-includes/js/tinymce/plugins/paste/editor_plugin.js
r6632 r6694 1 /** 2 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var Event = tinymce.dom.Event; 10 11 tinymce.create('tinymce.plugins.PastePlugin', { 12 init : function(ed, url) { 13 var t = this; 14 15 t.editor = ed; 16 17 // Register commands 18 ed.addCommand('mcePasteText', function(ui, v) { 19 if (ui) { 20 ed.windowManager.open({ 21 file : url + '/pastetext.htm', 22 width : 450, 23 height : 400, 24 inline : 1 25 }, { 26 plugin_url : url 27 }); 28 } else 29 t._insertText(v.html, v.linebreaks); 30 }); 31 32 ed.addCommand('mcePasteWord', function(ui, v) { 33 if (ui) { 34 ed.windowManager.open({ 35 file : url + '/pasteword.htm', 36 width : 450, 37 height : 400, 38 inline : 1 39 }, { 40 plugin_url : url 41 }); 42 } else 43 t._insertWordContent(v); 44 }); 45 46 ed.addCommand('mceSelectAll', function() { 47 ed.execCommand('selectall'); 48 }); 49 50 // Register buttons 51 ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true}); 52 ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true}); 53 ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'}); 54 55 if (ed.getParam("paste_auto_cleanup_on_paste", false)) { 56 ed.onPaste.add(function(ed, e) { 57 return t._handlePasteEvent(e) 58 }); 59 } 60 61 if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) { 62 // Force paste dialog if non IE browser 63 ed.onKeyDown.add(function(ed, e) { 64 if (e.ctrlKey && e.keyCode == 86) { 65 window.setTimeout(function() { 66 ed.execCommand("mcePasteText", true); 67 }, 1); 68 69 Event.cancel(e); 70 } 71 }); 72 } 73 }, 74 75 getInfo : function() { 76 return { 77 longname : 'Paste text/word', 78 author : 'Moxiecode Systems AB', 79 authorurl : 'http://tinymce.moxiecode.com', 80 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', 81 version : tinymce.majorVersion + "." + tinymce.minorVersion 82 }; 83 }, 84 85 // Private methods 86 87 _handlePasteEvent : function(e) { 88 var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r; 89 90 // Removes italic, strong etc, the if was needed due to bug #1437114 91 if (ed && (r = sel.getRng()) && r.text.length > 0) 92 ed.execCommand('delete'); 93 94 if (html && html.length > 0) 95 ed.execCommand('mcePasteWord', false, html); 96 97 return Event.cancel(e); 98 }, 99 100 _insertText : function(content, bLinebreaks) { 101 if (content && content.length > 0) { 102 if (bLinebreaks) { 103 // Special paragraph treatment 104 if (this.editor.getParam("paste_create_paragraphs", true)) { 105 var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); 106 for (var i=0; i<rl.length; i+=2) 107 content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]); 108 109 content = content.replace(/\r\n\r\n/g, '</p><p>'); 110 content = content.replace(/\r\r/g, '</p><p>'); 111 content = content.replace(/\n\n/g, '</p><p>'); 112 113 // Has paragraphs 114 if ((pos = content.indexOf('</p><p>')) != -1) { 115 this.editor.execCommand("Delete"); 116 117 var node = this.editor.selection.getNode(); 118 119 // Get list of elements to break 120 var breakElms = []; 121 122 do { 123 if (node.nodeType == 1) { 124 // Don't break tables and break at body 125 if (node.nodeName == "TD" || node.nodeName == "BODY") 126 break; 127 128 breakElms[breakElms.length] = node; 129 } 130 } while(node = node.parentNode); 131 132 var before = "", after = "</p>"; 133 before += content.substring(0, pos); 134 135 for (var i=0; i<breakElms.length; i++) { 136 before += "</" + breakElms[i].nodeName + ">"; 137 after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">"; 138 } 139 140 before += "<p>"; 141 content = before + content.substring(pos+7) + after; 142 } 143 } 144 145 if (this.editor.getParam("paste_create_linebreaks", true)) { 146 content = content.replace(/\r\n/g, '<br />'); 147 content = content.replace(/\r/g, '<br />'); 148 content = content.replace(/\n/g, '<br />'); 149 } 150 } 151 152 this.editor.execCommand("mceInsertRawHTML", false, content); 153 } 154 }, 155 156 _insertWordContent : function(content) { 157 var t = this, ed = t.editor; 158 159 if (content && content.length > 0) { 160 // Cleanup Word content 161 var bull = String.fromCharCode(8226); 162 var middot = String.fromCharCode(183); 163 var cb; 164 165 if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "") 166 content = eval(cb + "('before', content)"); 167 168 var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(','); 169 for (var i=0; i<rl.length; i+=2) 170 content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]); 171 172 if (this.editor.getParam("paste_convert_headers_to_strong", false)) { 173 content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>'); 174 } 175 176 content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--"); 177 content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>"); 178 content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list 179 content = content.replace(/<o:p><\/o:p>/gi, ""); 180 content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks 181 content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments 182 183 if (this.editor.getParam("paste_remove_spans", true)) 184 content = content.replace(/<\/?span[^>]*>/gi, ""); 185 186 if (this.editor.getParam("paste_remove_styles", true)) 187 content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3"); 188 189 content = content.replace(/<\/?font[^>]*>/gi, ""); 190 191 // Strips class attributes. 192 switch (this.editor.getParam("paste_strip_class_attributes", "all")) { 193 case "all": 194 content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3"); 195 break; 196 197 case "mso": 198 content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3"); 199 break; 200 } 201 202 content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI()); 203 content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3"); 204 content = content.replace(/<\\?\?xml[^>]*>/gi, ""); 205 content = content.replace(/<\/?\w+:[^>]*>/gi, ""); 206 content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks 207 content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks 208 209 // content = content.replace(/\/? */gi, ""); 210 // content = content.replace(/<p> <\/p>/gi, ''); 211 212 if (!this.editor.getParam('force_p_newlines')) { 213 content = content.replace('', '' ,'gi'); 214 content = content.replace('</p>', '<br /><br />' ,'gi'); 215 } 216 217 if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) { 218 content = content.replace(/<\/?p[^>]*>/gi, ""); 219 } 220 221 content = content.replace(/<\/?div[^>]*>/gi, ""); 222 223 // Convert all middlot lists to UL lists 224 if (this.editor.getParam("paste_convert_middot_lists", true)) { 225 var div = ed.dom.create("div", null, content); 226 227 // Convert all middot paragraphs to li elements 228 var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList"); 229 230 while (this._convertMiddots(div, "--list--")) ; // bull 231 while (this._convertMiddots(div, middot, className)) ; // Middot 232 while (this._convertMiddots(div, bull)) ; // bull 233 234 content = div.innerHTML; 235 } 236 237 // Replace all headers with strong and fix some other issues 238 if (this.editor.getParam("paste_convert_headers_to_strong", false)) { 239 content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>'); 240 content = content.replace(/<h[1-6]>/gi, '<p><b>'); 241 content = content.replace(/<\/h[1-6]>/gi, '</b></p>'); 242 content = content.replace(/<b> <\/b>/gi, '<b> </b>'); 243 content = content.replace(/^( )*/gi, ''); 244 } 245 246 content = content.replace(/--list--/gi, ""); // Remove --list-- 247 248 if ((cb = this.editor.getParam("paste_insert_word_content_callback", "")) != "") 249 content = eval(cb + "('after', content)"); 250 251 // Insert cleaned content 252 this.editor.execCommand("mceInsertContent", false, content); 253 254 if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) { 255 var ed = this.editor; 256 257 window.setTimeout(function() { 258 ed.execCommand("mceCleanup"); 259 }, 1); // Do normal cleanup detached from this thread 260 } 261 } 262 }, 263 264 _reEscape : function(s) { 265 var l = "?.\\*[](){}+^$:"; 266 var o = ""; 267 268 for (var i=0; i<s.length; i++) { 269 var c = s.charAt(i); 270 271 if (l.indexOf(c) != -1) 272 o += '\\' + c; 273 else 274 o += c; 275 } 276 277 return o; 278 }, 279 280 _convertMiddots : function(div, search, class_name) { 281 var mdot = String.fromCharCode(183); 282 var bull = String.fromCharCode(8226); 283 284 var nodes = div.getElementsByTagName("p"); 285 var prevul; 286 for (var i=0; i<nodes.length; i++) { 287 var p = nodes[i]; 288 289 // Is middot 290 if (p.innerHTML.indexOf(search) == 0) { 291 var ul = document.createElement("ul"); 292 293 if (class_name) 294 ul.className = class_name; 295 296 // Add the first one 297 var li = document.createElement("li"); 298 li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), ''); 299 ul.appendChild(li); 300 301 // Add the rest 302 var np = p.nextSibling; 303 while (np) { 304 // If the node is whitespace, then 305 // ignore it and continue on. 306 if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) { 307 np = np.nextSibling; 308 continue; 309 } 310 311 if (search == mdot) { 312 if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) { 313 // Second level of nesting 314 if (!prevul) { 315 prevul = ul; 316 ul = document.createElement("ul"); 317 prevul.appendChild(ul); 318 } 319 np.innerHTML = np.innerHTML.replace(/^o/, ''); 320 } else { 321 // Pop the stack if we're going back up to the first level 322 if (prevul) { 323 ul = prevul; 324 prevul = null; 325 } 326 // Not element or middot paragraph 327 if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0) 328 break; 329 } 330 } else { 331 // Not element or middot paragraph 332 if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0) 333 break; 334 } 335 336 var cp = np.nextSibling; 337 var li = document.createElement("li"); 338 li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), ''); 339 np.parentNode.removeChild(np); 340 ul.appendChild(li); 341 np = cp; 342 } 343 344 p.parentNode.replaceChild(ul, p); 345 346 return true; 347 } 348 } 349 350 return false; 351 }, 352 353 _clipboardHTML : function() { 354 var div = document.getElementById('_TinyMCE_clipboardHTML'); 355 356 if (!div) { 357 var div = document.createElement('DIV'); 358 div.id = '_TinyMCE_clipboardHTML'; 359 360 with (div.style) { 361 visibility = 'hidden'; 362 overflow = 'hidden'; 363 position = 'absolute'; 364 width = 1; 365 height = 1; 366 } 367 368 document.body.appendChild(div); 369 } 370 371 div.innerHTML = ''; 372 var rng = document.body.createTextRange(); 373 rng.moveToElementText(div); 374 rng.execCommand('Paste'); 375 var html = div.innerHTML; 376 div.innerHTML = ''; 377 return html; 378 } 379 }); 380 381 // Register plugin 382 tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin); 383 })(); 1 (function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);var cb;if((cb=this.editor.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('before', content)");var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p> <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]> <\/h[1-6]>/gi,'<p> </p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b> <\/b>/gi,'<b> </b>');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if((cb=this.editor.getParam("paste_insert_word_content_callback",""))!="")content=eval(cb+"('after', content)");this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var mdot=String.fromCharCode(183);var bull=String.fromCharCode(8226);var nodes=div.getElementsByTagName("p");var prevul;for(var i=0;i<nodes.length;i++){var p=nodes[i];if(p.innerHTML.indexOf(search)==0){var ul=document.createElement("ul");if(class_name)ul.className=class_name;var li=document.createElement("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');ul.appendChild(li);var np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+| )').test(np.innerHTML)){if(!prevul){prevul=ul;ul=document.createElement("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}var cp=np.nextSibling;var li=document.createElement("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})(); -
trunk/wp-includes/js/tinymce/plugins/paste/pastetext.htm
r6632 r6694 3 3 <title>{#paste.paste_text_desc}</title> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="js/pastetext.js"></script> 7 <base target="_self" /> 7 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('htmlSource').focus();},500);});</script> 8 <base target="_self" /> 8 9 </head> 9 10 <body onresize="resizeInputs();" style="display:none; overflow:hidden;"> … … 23 24 <div class="mceActionPanel"> 24 25 <div style="float: left"> 25 <input type="button" name=" insert" value="{#insert}" onclick="saveContent();" id="insert" />26 <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> 26 27 </div> 27 28 28 29 <div style="float: right"> 29 <input type=" button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />30 <input type="submit" name="insert" value="{#insert}" onclick="saveContent();" id="insert" /> 30 31 </div> 31 32 </div> -
trunk/wp-includes/js/tinymce/plugins/paste/pasteword.htm
r6632 r6694 18 18 <div class="mceActionPanel"> 19 19 <div style="float: left"> 20 <input type="button" id=" insert" name="insert" value="{#insert}" onclick="saveContent();" />20 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 21 21 </div> 22 22 23 23 <div style="float: right"> 24 <input type=" button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />24 <input type="submit" id="insert" name="insert" value="{#insert}" onclick="saveContent();" /> 25 25 </div> 26 26 </div> -
trunk/wp-includes/js/tinymce/plugins/safari/editor_plugin.js
r6632 r6694 1 /** 2 * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray, isOldWebKit = tinymce.isOldWebKit; 10 11 tinymce.create('tinymce.plugins.Safari', { 12 init : function(ed) { 13 var t = this, dom; 14 15 // Ignore on non webkit 16 if (!tinymce.isWebKit) 17 return; 18 19 t.editor = ed; 20 t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large']; 21 t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; 22 23 // Safari will crash if the build in createlink command is used 24 /* ed.addCommand('CreateLink', function(u, v) { 25 ed.execCommand("mceInsertContent", false, '<a href="' + dom.encode(v) + '">' + ed.selection.getContent() + '</a>'); 26 });*/ 27 28 // Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004 29 ed.addCommand('FormatBlock', function(u, v) { 30 var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock); 31 32 if (e) 33 dom.replace(dom.create(v), e, 1); 34 else 35 ed.getDoc().execCommand("FormatBlock", false, v); 36 }); 37 38 // Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382 39 ed.addCommand('mceInsertContent', function(u, v) { 40 ed.getDoc().execCommand("InsertText", false, 'mce_marker'); 41 ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, v + '<span id="_mce_tmp">XX</span>'); 42 ed.selection.select(ed.dom.get('_mce_tmp')); 43 ed.getDoc().execCommand("Delete", false, ' '); 44 }); 45 46 // Workaround for List ID bug, http://bugs.webkit.org/show_bug.cgi?id=16004 47 /* function addList(c) { 48 var cb = Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { 49 e = e.target; 50 51 if (e.nodeName == 'OL' || e.nodeName == 'UL') 52 e.id = ''; 53 }); 54 55 ed.getDoc().execCommand(c, false, false); 56 Event.remove(ed.getDoc(), 'DOMNodeInserted', cb); 57 }; 58 59 ed.addCommand('InsertUnorderedList', function() {addList('InsertUnorderedList');}); 60 ed.addCommand('InsertOrderedList', function() {addList('InsertOrderedList');});*/ 61 62 // Safari returns incorrect values 63 ed.addQueryValueHandler('FontSize', function(u, v) { 64 var e, v; 65 66 // Check for the real font size at the start of selection 67 if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontSize)) 68 return tinymce.inArray(t.namedFontSizes, v) + 1; 69 70 // Check for the real font size at the end of selection 71 if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontSize)) 72 return tinymce.inArray(t.namedFontSizes, v) + 1; 73 74 // Return default value it's better than nothing right! 75 return ed.getDoc().queryCommandValue('FontSize'); 76 }); 77 78 // Safari returns incorrect values 79 ed.addQueryValueHandler('FontName', function(u, v) { 80 var e, v; 81 82 // Check for the real font name at the start of selection 83 if ((e = ed.dom.getParent(ed.selection.getStart(), 'span')) && (v = e.style.fontFamily)) 84 return v.replace(/, /g, ','); 85 86 // Check for the real font name at the end of selection 87 if ((e = ed.dom.getParent(ed.selection.getEnd(), 'span')) && (v = e.style.fontFamily)) 88 return v.replace(/, /g, ','); 89 90 // Return default value it's better than nothing right! 91 return ed.getDoc().queryCommandValue('FontName'); 92 }); 93 94 // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250 95 ed.onClick.add(function(ed, e) { 96 e = e.target; 97 98 if (e.nodeName == 'IMG') { 99 t.selElm = e; 100 ed.selection.select(e); 101 } else 102 t.selElm = null; 103 }); 104 105 ed.onBeforeExecCommand.add(function(ed, c, b) { 106 var r = t.bookmarkRng; 107 108 // Restore selection 109 if (r) { 110 ed.selection.setRng(r); 111 t.bookmarkRng = null; 112 //console.debug('restore', r.startContainer, r.startOffset, r.endContainer, r.endOffset); 113 } 114 }); 115 116 ed.onInit.add(function() { 117 t._fixWebKitSpans(); 118 119 ed.windowManager.onOpen.add(function() { 120 var r = ed.selection.getRng(); 121 122 // Store selection if valid 123 if (r.startContainer != ed.getDoc()) { 124 t.bookmarkRng = r.cloneRange(); 125 //console.debug('store', r.startContainer, r.startOffset, r.endContainer, r.endOffset); 126 } 127 }); 128 129 ed.windowManager.onClose.add(function() { 130 t.bookmarkRng = null; 131 }); 132 133 if (isOldWebKit) 134 t._patchSafari2x(ed); 135 }); 136 137 ed.onSetContent.add(function() { 138 dom = ed.dom; 139 140 // Convert strong,b,em,u,strike to spans 141 each(['strong','b','em','u','strike','sub','sup','a'], function(v) { 142 each(grep(dom.select(v)).reverse(), function(n) { 143 var nn = n.nodeName.toLowerCase(), st; 144 145 // Convert anchors into images 146 if (nn == 'a') { 147 if (n.name) 148 dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n); 149 150 return; 151 } 152 153 switch (nn) { 154 case 'b': 155 case 'strong': 156 if (nn == 'b') 157 nn = 'strong'; 158 159 st = 'font-weight: bold;'; 160 break; 161 162 case 'em': 163 st = 'font-style: italic;'; 164 break; 165 166 case 'u': 167 st = 'text-decoration: underline;'; 168 break; 169 170 case 'sub': 171 st = 'vertical-align: sub;'; 172 break; 173 174 case 'sup': 175 st = 'vertical-align: super;'; 176 break; 177 178 case 'strike': 179 st = 'text-decoration: line-through;'; 180 break; 181 } 182 183 dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1); 184 }); 185 }); 186 }); 187 188 ed.onPreProcess.add(function(ed, o) { 189 dom = ed.dom; 190 191 each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) { 192 var v, bg; 193 194 if (o.get) { 195 if (dom.hasClass(n, 'Apple-style-span')) { 196 bg = n.style.backgroundColor; 197 198 switch (dom.getAttrib(n, 'mce_name')) { 199 case 'font': 200 if (!ed.settings.convert_fonts_to_spans) 201 dom.setAttrib(n, 'style', ''); 202 break; 203 204 case 'strong': 205 case 'em': 206 case 'sub': 207 case 'sup': 208 dom.setAttrib(n, 'style', ''); 209 break; 210 211 case 'strike': 212 case 'u': 213 if (!ed.settings.inline_styles) 214 dom.setAttrib(n, 'style', ''); 215 else 216 dom.setAttrib(n, 'mce_name', ''); 217 218 break; 219 220 default: 221 if (!ed.settings.inline_styles) 222 dom.setAttrib(n, 'style', ''); 223 } 224 225 226 if (bg) 227 n.style.backgroundColor = bg; 228 } 229 } 230 231 if (dom.hasClass(n, 'mceItemRemoved')) 232 dom.remove(n, 1); 233 }); 234 }); 235 236 ed.onPostProcess.add(function(ed, o) { 237 // Safari adds BR at end of all block elements 238 o.content = o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g, '</$1>'); 239 240 // Safari adds id="undefined" to HR elements 241 o.content = o.content.replace(/ id=\"undefined\"/g, ''); 242 }); 243 }, 244 245 _fixWebKitSpans : function() { 246 var t = this, ed = t.editor; 247 248 if (!isOldWebKit) { 249 // Use mutator events on new WebKit 250 Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) { 251 e = e.target; 252 253 if (e && e.nodeType == 1) 254 t._fixAppleSpan(e); 255 }); 256 } else { 257 // Do post command processing in old WebKit since the browser crashes on Mutator events :( 258 ed.onExecCommand.add(function() { 259 each(ed.dom.select('span'), function(n) { 260 t._fixAppleSpan(n); 261 }); 262 263 ed.nodeChanged(); 264 }); 265 } 266 }, 267 268 _fixAppleSpan : function(e) { 269 var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p; 270 271 if (dom.getAttrib(e, 'mce_fixed')) 272 return; 273 274 // Handle Apple style spans 275 if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') { 276 st = e.style; 277 278 if (!s.convert_fonts_to_spans) { 279 if (st.fontSize) { 280 dom.setAttrib(e, 'mce_name', 'font'); 281 dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1); 282 } 283 284 if (st.fontFamily) { 285 dom.setAttrib(e, 'mce_name', 'font'); 286 dom.setAttrib(e, 'face', st.fontFamily); 287 } 288 289 if (st.color) { 290 dom.setAttrib(e, 'mce_name', 'font'); 291 dom.setAttrib(e, 'color', dom.toHex(st.color)); 292 } 293 294 if (st.backgroundColor) { 295 dom.setAttrib(e, 'mce_name', 'font'); 296 dom.setStyle(e, 'background-color', st.backgroundColor); 297 } 298 } else { 299 if (st.fontSize) 300 dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]); 301 } 302 303 if (st.fontWeight == 'bold') 304 dom.setAttrib(e, 'mce_name', 'strong'); 305 306 if (st.fontStyle == 'italic') 307 dom.setAttrib(e, 'mce_name', 'em'); 308 309 if (st.textDecoration == 'underline') 310 dom.setAttrib(e, 'mce_name', 'u'); 311 312 if (st.textDecoration == 'line-through') 313 dom.setAttrib(e, 'mce_name', 'strike'); 314 315 if (st.verticalAlign == 'super') 316 dom.setAttrib(e, 'mce_name', 'sup'); 317 318 if (st.verticalAlign == 'sub') 319 dom.setAttrib(e, 'mce_name', 'sub'); 320 321 dom.setAttrib(e, 'mce_fixed', '1'); 322 } 323 }, 324 325 _patchSafari2x : function(ed) { 326 var t = this, setContent, getNode, dom = ed.dom, lr; 327 328 // Inline dialogs 329 if (ed.windowManager.onBeforeOpen) { 330 ed.windowManager.onBeforeOpen.add(function() { 331 r = ed.selection.getRng(); 332 }); 333 } 334 335 // Fake select on 2.x 336 ed.selection.select = function(n) { 337 this.getSel().setBaseAndExtent(n, 0, n, 1); 338 }; 339 340 getNode = ed.selection.getNode; 341 ed.selection.getNode = function() { 342 return t.selElm || getNode.call(this); 343 }; 344 345 // Fake range on Safari 2.x 346 ed.selection.getRng = function() { 347 var t = this, s = t.getSel(), d = ed.getDoc(), r, rb, ra, di; 348 349 // Fake range on Safari 2.x 350 if (s.anchorNode) { 351 r = d.createRange(); 352 353 try { 354 // Setup before range 355 rb = d.createRange(); 356 rb.setStart(s.anchorNode, s.anchorOffset); 357 rb.collapse(1); 358 359 // Setup after range 360 ra = d.createRange(); 361 ra.setStart(s.focusNode, s.focusOffset); 362 ra.collapse(1); 363 364 // Setup start/end points by comparing locations 365 di = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0; 366 r.setStart(di ? s.anchorNode : s.focusNode, di ? s.anchorOffset : s.focusOffset); 367 r.setEnd(di ? s.focusNode : s.anchorNode, di ? s.focusOffset : s.anchorOffset); 368 369 lr = r; 370 } catch (ex) { 371 // Sometimes fails, at least we tried to do it by the book. I hope Safari 2.x will go disappear soooon!!! 372 } 373 } 374 375 return r || lr; 376 }; 377 378 // Fix setContent so it works 379 setContent = ed.selection.setContent; 380 ed.selection.setContent = function(h, s) { 381 var r = this.getRng(), b; 382 383 try { 384 setContent.call(this, h, s); 385 } catch (ex) { 386 // Workaround for Safari 2.x 387 b = dom.create('body'); 388 b.innerHTML = h; 389 390 each(b.childNodes, function(n) { 391 r.insertNode(n.cloneNode(true)); 392 }); 393 } 394 }; 395 } 396 }); 397 398 // Register plugin 399 tinymce.PluginManager.add('safari', tinymce.plugins.Safari); 400 })(); 401 1 (function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;tinymce.create('tinymce.plugins.Safari',{init:function(ed){var t=this,dom;if(!tinymce.isWebKit)return;t.editor=ed;t.webKitFontSizes=['x-small','small','medium','large','x-large','xx-large','-webkit-xxx-large'];t.namedFontSizes=['xx-small','x-small','small','medium','large','x-large','xx-large'];ed.addCommand('FormatBlock',function(u,v){var dom=ed.dom,e=dom.getParent(ed.selection.getNode(),dom.isBlock);if(e)dom.replace(dom.create(v),e,1);else ed.getDoc().execCommand("FormatBlock",false,v);});ed.addCommand('mceInsertContent',function(u,v){ed.getDoc().execCommand("InsertText",false,'mce_marker');ed.getBody().innerHTML=ed.getBody().innerHTML.replace(/mce_marker/g,v+'<span id="_mce_tmp">XX</span>');ed.selection.select(ed.dom.get('_mce_tmp'));ed.getDoc().execCommand("Delete",false,' ');});ed.onKeyPress.add(function(ed,e){if(e.keyCode==13&&e.shiftKey){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName=='IMG'){t.selElm=e;ed.selection.select(e);}else t.selElm=null;});ed.onBeforeExecCommand.add(function(ed,c,b){var r=t.bookmarkRng;if(r){ed.selection.setRng(r);t.bookmarkRng=null;}});ed.onInit.add(function(){t._fixWebKitSpans();ed.windowManager.onOpen.add(function(){var r=ed.selection.getRng();if(r.startContainer!=ed.getDoc()){t.bookmarkRng=r.cloneRange();}});ed.windowManager.onClose.add(function(){t.bookmarkRng=null;});if(isOldWebKit)t._patchSafari2x(ed);});ed.onSetContent.add(function(){dom=ed.dom;each(['strong','b','em','u','strike','sub','sup','a'],function(v){each(grep(dom.select(v)).reverse(),function(n){var nn=n.nodeName.toLowerCase(),st;if(nn=='a'){if(n.name)dom.replace(dom.create('img',{mce_name:'a',name:n.name,'class':'mceItemAnchor'}),n);return;}switch(nn){case'b':case'strong':if(nn=='b')nn='strong';st='font-weight: bold;';break;case'em':st='font-style: italic;';break;case'u':st='text-decoration: underline;';break;case'sub':st='vertical-align: sub;';break;case'sup':st='vertical-align: super;';break;case'strike':st='text-decoration: line-through;';break;}dom.replace(dom.create('span',{mce_name:nn,style:st,'class':'Apple-style-span'}),n,1);});});});ed.onPreProcess.add(function(ed,o){dom=ed.dom;each(grep(o.node.getElementsByTagName('span')).reverse(),function(n){var v,bg;if(o.get){if(dom.hasClass(n,'Apple-style-span')){bg=n.style.backgroundColor;switch(dom.getAttrib(n,'mce_name')){case'font':if(!ed.settings.convert_fonts_to_spans)dom.setAttrib(n,'style','');break;case'strong':case'em':case'sub':case'sup':dom.setAttrib(n,'style','');break;case'strike':case'u':if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');else dom.setAttrib(n,'mce_name','');break;default:if(!ed.settings.inline_styles)dom.setAttrib(n,'style','');}if(bg)n.style.backgroundColor=bg;}}if(dom.hasClass(n,'mceItemRemoved'))dom.remove(n,1);});});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<br \/><\/(h[1-6]|div|p|address|pre)>/g,'</$1>');o.content=o.content.replace(/ id=\"undefined\"/g,'');});},_fixWebKitSpans:function(){var t=this,ed=t.editor;if(!isOldWebKit){Event.add(ed.getDoc(),'DOMNodeInserted',function(e){e=e.target;if(e&&e.nodeType==1)t._fixAppleSpan(e);});}else{ed.onExecCommand.add(function(){each(ed.dom.select('span'),function(n){t._fixAppleSpan(n);});ed.nodeChanged();});}},_fixAppleSpan:function(e){var ed=this.editor,dom=ed.dom,fz=this.webKitFontSizes,fzn=this.namedFontSizes,s=ed.settings,st,p;if(dom.getAttrib(e,'mce_fixed'))return;if(e.nodeName=='SPAN'&&e.className=='Apple-style-span'){st=e.style;if(!s.convert_fonts_to_spans){if(st.fontSize){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'size',inArray(fz,st.fontSize)+1);}if(st.fontFamily){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'face',st.fontFamily);}if(st.color){dom.setAttrib(e,'mce_name','font');dom.setAttrib(e,'color',dom.toHex(st.color));}if(st.backgroundColor){dom.setAttrib(e,'mce_name','font');dom.setStyle(e,'background-color',st.backgroundColor);}}else{if(st.fontSize)dom.setStyle(e,'fontSize',fzn[inArray(fz,st.fontSize)]);}if(st.fontWeight=='bold')dom.setAttrib(e,'mce_name','strong');if(st.fontStyle=='italic')dom.setAttrib(e,'mce_name','em');if(st.textDecoration=='underline')dom.setAttrib(e,'mce_name','u');if(st.textDecoration=='line-through')dom.setAttrib(e,'mce_name','strike');if(st.verticalAlign=='super')dom.setAttrib(e,'mce_name','sup');if(st.verticalAlign=='sub')dom.setAttrib(e,'mce_name','sub');dom.setAttrib(e,'mce_fixed','1');}},_patchSafari2x:function(ed){var t=this,setContent,getNode,dom=ed.dom,lr;if(ed.windowManager.onBeforeOpen){ed.windowManager.onBeforeOpen.add(function(){r=ed.selection.getRng();});}ed.selection.select=function(n){this.getSel().setBaseAndExtent(n,0,n,1);};getNode=ed.selection.getNode;ed.selection.getNode=function(){return t.selElm||getNode.call(this);};ed.selection.getRng=function(){var t=this,s=t.getSel(),d=ed.getDoc(),r,rb,ra,di;if(s.anchorNode){r=d.createRange();try{rb=d.createRange();rb.setStart(s.anchorNode,s.anchorOffset);rb.collapse(1);ra=d.createRange();ra.setStart(s.focusNode,s.focusOffset);ra.collapse(1);di=rb.compareBoundaryPoints(rb.START_TO_END,ra)<0;r.setStart(di?s.anchorNode:s.focusNode,di?s.anchorOffset:s.focusOffset);r.setEnd(di?s.focusNode:s.anchorNode,di?s.focusOffset:s.anchorOffset);lr=r;}catch(ex){}}return r||lr;};setContent=ed.selection.setContent;ed.selection.setContent=function(h,s){var r=this.getRng(),b;try{setContent.call(this,h,s);}catch(ex){b=dom.create('body');b.innerHTML=h;each(b.childNodes,function(n){r.insertNode(n.cloneNode(true));});}};},_insertBR:function(ed){var dom=ed.dom,s=ed.selection,r=s.getRng(),br;r.insertNode(br=dom.create('br'));r.setStartAfter(br);r.setEndAfter(br);s.setRng(r);if(s.getSel().focusNode==br.previousSibling){s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'),br));s.collapse(1);}ed.getWin().scrollTo(0,dom.getPos(s.getRng().startContainer).y);}});tinymce.PluginManager.add('safari',tinymce.plugins.Safari);})(); -
trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
r6632 r6694 1 /* Import plugin specific language pack */ 2 //tinyMCE.importPluginLanguagePack('wordpress', 'en'); 1 /** 2 * Wordpress plugin. 3 */ 3 4 4 var TinyMCE_wordpressPlugin = { 5 getInfo : function() { 6 return { 7 longname : 'WordPress Plugin', 8 author : 'WordPress', 9 authorurl : 'http://wordpress.org', 10 infourl : 'http://wordpress.org', 11 version : '1' 12 }; 13 }, 5 (function() { 6 var DOM = tinymce.DOM; 14 7 15 getControlHTML : function(control_name) { 16 switch (control_name) { 17 case "wp_more": 18 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_more_button', '{$pluginurl}/images/more.gif', 'wpMore'); 19 case "wp_page": 20 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_page_button', '{$pluginurl}/images/page.gif', 'wpPage'); 21 case "wp_help": 22 var buttons = tinyMCE.getButtonHTML(control_name, 'lang_help_button_title', '{$pluginurl}/images/help.gif', 'wpHelp'); 23 var hiddenControls = '<div class="zerosize">' 24 + '<input type="button" accesskey="n" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSpellCheck\',false);" />' 25 + '<input type="button" accesskey="k" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />' 26 + '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />' 27 + '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />' 28 + '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />' 29 + '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />' 30 + '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />' 31 + '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />' 32 + '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />' 33 + '<input type="button" accesskey="j" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyFull\',false);" />' 34 + '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />' 35 + '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />' 36 + '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />' 37 + '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpMore\');" />' 38 + '<input type="button" accesskey="g" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpPage\');" />' 39 + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />' 40 + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />' 41 + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />' 42 + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />' 43 + '<input type="button" accesskey="v" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',false);" />' 44 + '</div>'; 45 return buttons+hiddenControls; 46 case "wp_adv": 47 return tinyMCE.getButtonHTML(control_name, 'lang_wordpress_adv_button', '{$pluginurl}/images/toolbars.gif', 'wpAdv'); 48 case "wp_adv_start": 49 return '<div id="wpadvbar" style="display:none;"><br />'; 50 case "wp_adv_end": 51 return '</div>'; 52 } 53 return ''; 54 }, 8 // Load plugin specific language pack 9 tinymce.PluginManager.requireLangPack('wordpress'); 55 10 56 execCommand : function(editor_id, element, command, user_interface, value) { 57 var inst = tinyMCE.getInstanceById(editor_id); 58 var focusElm = inst.getFocusElement(); 59 var doc = inst.getDoc(); 11 tinymce.create('tinymce.plugins.WordPress', { 12 init : function(ed, url) { 13 var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'); 14 var moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />'; 15 var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />'; 60 16 61 function getAttrib(elm, name) { 62 return elm.getAttribute(name) ? elm.getAttribute(name) : ""; 63 } 17 // Hides the specified toolbar and resizes the iframe 18 ed.onPostRender.add(function() { 19 DOM.hide(ed.controlManager.get(tbId).id); 20 t._resizeIframe(ed, tbId, 28); 21 }); 64 22 65 // Handle commands 66 switch (command) { 67 case "wpMore": 68 var flag = ""; 69 var template = new Array(); 70 var altMore = tinyMCE.getLang('lang_wordpress_more_alt'); 23 // Register buttons 24 ed.addButton('wp_more', { 25 title : 'wordpress.wp_more_desc', 26 image : url + '/img/more.gif', 27 onclick : function() { 28 ed.execCommand('mceInsertContent', 0, moreHTML); 29 } 30 }); 71 31 72 // Is selection a image 73 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { 74 flag = getAttrib(focusElm, 'class'); 32 ed.addButton('wp_page', { 33 title : 'wordpress.wp_page_desc', 34 image : url + '/img/page.gif', 35 onclick : function() { 36 // ed.execCommand('mcePageBreak'); 37 ed.execCommand('mceInsertContent', 0, nextpageHTML); 38 } 39 }); 75 40 76 if (flag != 'mce_plugin_wordpress_more') // Not a wordpress 77 return true; 41 ed.addButton('wp_help', { 42 title : 'wordpress.wp_help_desc', 43 image : url + '/img/help.gif', 44 onclick : function() { 45 ed.windowManager.open({ 46 url : tinymce.baseURL + '/wp-mce-help.php', 47 width : 450, 48 height : 420, 49 inline : 1 50 }); 51 } 52 }); 78 53 79 action = "update"; 80 } 54 ed.addButton('wp_adv', { 55 title : 'wordpress.wp_adv_desc', 56 image : url + '/img/toolbars.gif', 57 onclick : function() { 58 var id = ed.controlManager.get(tbId).id, cm = ed.controlManager; 81 59 82 html = '' 83 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' 84 + ' width="100%" height="10px" ' 85 + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />'; 86 tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, html); 87 tinyMCE.selectedInstance.repaint(); 88 return true; 89 90 case "wpPage": 91 var flag = ""; 92 var template = new Array(); 93 var altPage = tinyMCE.getLang('lang_wordpress_more_alt'); 94 95 // Is selection a image 96 if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { 97 flag = getAttrib(focusElm, 'name'); 98 99 if (flag != 'mce_plugin_wordpress_page') // Not a wordpress 100 return true; 101 102 action = "update"; 103 } 104 105 html = '' 106 + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' 107 + ' width="100%" height="10px" ' 108 + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />'; 109 tinyMCE.execCommand("mceInsertContent",true,html); 110 tinyMCE.selectedInstance.repaint(); 111 return true; 112 113 case "wpHelp": 114 var template = new Array(); 115 116 template['file'] = tinyMCE.baseURL + '/wp-mce-help.php'; 117 template['width'] = 480; 118 template['height'] = 380; 119 120 args = { 121 resizable : 'yes', 122 scrollbars : 'yes' 123 }; 124 125 tinyMCE.openWindow(template, args); 126 return true; 127 case "wpAdv": 128 var adv = document.getElementById('wpadvbar'); 129 if ( adv.style.display == 'none' ) { 130 adv.style.display = 'block'; 131 tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonSelected'); 132 } else { 133 adv.style.display = 'none'; 134 tinyMCE.switchClass(editor_id + '_wp_adv', 'mceButtonNormal'); 135 } 136 return true; 137 } 138 139 // Pass to next handler in chain 140 return false; 141 }, 142 143 cleanup : function(type, content) { 144 switch (type) { 145 146 case "insert_to_editor": 147 var startPos = 0; 148 var altMore = tinyMCE.getLang('lang_wordpress_more_alt'); 149 var altPage = tinyMCE.getLang('lang_wordpress_page_alt'); 150 151 // Parse all <!--more--> tags and replace them with images 152 while ((startPos = content.indexOf('<!--more', startPos)) != -1) { 153 var endPos = content.indexOf('-->', startPos) + 3; 154 // Insert image 155 var moreText = content.substring(startPos + 8, endPos - 3); 156 var contentAfter = content.substring(endPos); 157 content = content.substring(0, startPos); 158 content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '; 159 content += ' width="100%" height="10px" moretext="'+moreText+'" '; 160 content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />'; 161 content += contentAfter; 162 163 startPos++; 164 } 165 var startPos = 0; 166 167 // Parse all <!--page--> tags and replace them with images 168 while ((startPos = content.indexOf('<!--nextpage-->', startPos)) != -1) { 169 // Insert image 170 var contentAfter = content.substring(startPos + 15); 171 content = content.substring(0, startPos); 172 content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '; 173 content += ' width="100%" height="10px" '; 174 content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />'; 175 content += contentAfter; 176 177 startPos++; 178 } 179 180 // Look for \n in <pre>, replace with <br> 181 var startPos = -1; 182 while ((startPos = content.indexOf('<pre', startPos+1)) != -1) { 183 var endPos = content.indexOf('</pre>', startPos+1); 184 var innerPos = content.indexOf('>', startPos+1); 185 var chunkBefore = content.substring(0, innerPos); 186 var chunkAfter = content.substring(endPos); 187 188 var innards = content.substring(innerPos, endPos); 189 innards = innards.replace(/\n/g, '<br />'); 190 content = chunkBefore + innards + chunkAfter; 191 } 192 193 break; 194 195 case "get_from_editor": 196 // Parse all img tags and replace them with <!--more--> 197 var startPos = -1; 198 while ((startPos = content.indexOf('<img', startPos+1)) != -1) { 199 var endPos = content.indexOf('/>', startPos); 200 var attribs = this._parseAttributes(content.substring(startPos + 4, endPos)); 201 202 if (attribs['class'] == "mce_plugin_wordpress_more" || attribs['name'] == "mce_plugin_wordpress_more") { 203 endPos += 2; 204 205 var moreText = attribs['moretext'] ? attribs['moretext'] : ''; 206 var embedHTML = '<!--more'+moreText+'-->'; 207 208 // Insert embed/object chunk 209 chunkBefore = content.substring(0, startPos); 210 chunkAfter = content.substring(endPos); 211 content = chunkBefore + embedHTML + chunkAfter; 212 } 213 if (attribs['class'] == "mce_plugin_wordpress_page" || attribs['name'] == "mce_plugin_wordpress_page") { 214 endPos += 2; 215 216 var embedHTML = '<!--nextpage-->'; 217 218 // Insert embed/object chunk 219 chunkBefore = content.substring(0, startPos); 220 chunkAfter = content.substring(endPos); 221 content = chunkBefore + embedHTML + chunkAfter; 60 if (DOM.isHidden(id)) { 61 cm.setActive('wp_adv', 1); 62 DOM.show(id); 63 t._resizeIframe(ed, tbId, -28); 64 } else { 65 cm.setActive('wp_adv', 0); 66 DOM.hide(id); 67 t._resizeIframe(ed, tbId, 28); 222 68 } 223 69 } 70 }); 224 71 225 // Remove normal line breaks 226 content = content.replace(/\n|\r/g, ' '); 72 // Add listeners to handle more break 73 t._handleMoreBreak(ed, url); 74 }, 227 75 228 // Look for <br> in <pre>, replace with \n 229 var startPos = -1; 230 while ((startPos = content.indexOf('<pre', startPos+1)) != -1) { 231 var endPos = content.indexOf('</pre>', startPos+1); 232 var innerPos = content.indexOf('>', startPos+1); 233 var chunkBefore = content.substring(0, innerPos); 234 var chunkAfter = content.substring(endPos); 235 236 var innards = content.substring(innerPos, endPos); 237 innards = innards.replace(new RegExp('<br\\s?/?>', 'g'), '\n'); 238 innards = innards.replace(new RegExp('\\s$', ''), ''); 239 content = chunkBefore + innards + chunkAfter; 76 getInfo : function() { 77 return { 78 longname : 'WordPress Plugin', 79 author : 'WordPress', // add Moxiecode? 80 authorurl : 'http://wordpress.org', 81 infourl : 'http://wordpress.org', 82 version : '1.0a1' 83 }; 84 }, 85 86 // Internal functions 87 88 // Resizes the iframe by a relative height value 89 _resizeIframe : function(ed, tb_id, dy) { 90 var ifr = ed.getContentAreaContainer().firstChild; 91 92 DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe 93 ed.theme.deltaHeight += dy; // For resize cookie 94 }, 95 96 _handleMoreBreak : function(ed, url) { 97 var moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />'; 98 var nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />'; 99 100 // Load plugin specific CSS into editor 101 ed.onInit.add(function() { 102 ed.dom.loadCSS(url + '/css/content.css'); 103 }); 104 105 // Display morebreak instead if img in element path 106 ed.onPostRender.add(function() { 107 if (ed.theme.onResolveName) { 108 ed.theme.onResolveName.add(function(th, o) { 109 if (o.node.nodeName == 'IMG') { 110 if ( ed.dom.hasClass(o.node, 'mceWPmore') ) 111 o.name = 'wpmore'; 112 if ( ed.dom.hasClass(o.node, 'mceWPnextpage') ) 113 o.name = 'wppage'; 114 } 115 116 }); 240 117 } 118 }); 241 119 242 // Remove anonymous, empty paragraphs. 243 content = content.replace(new RegExp('<p>(\\s| )*</p>', 'mg'), ''); 120 // Replace morebreak with images 121 ed.onBeforeSetContent.add(function(ed, o) { 122 o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML); 123 o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML); 124 }); 244 125 245 // Handle table badness. 246 content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>'); 247 content = content.replace(new RegExp('<((?:tr|thead|tfoot)(?: [^>]*)?)>.*?<((td|th)( [^>]*)?)>', 'mg'), '<$1><$2>'); 248 content = content.replace(new RegExp('</(td|th)>.*?<(td( [^>]*)?|th( [^>]*)?|/tr|/thead|/tfoot)>', 'mg'), '</$1><$2>'); 249 content = content.replace(new RegExp('</tr>.*?<(tr( [^>]*)?|/table)>', 'mg'), '</tr><$1>'); 250 content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>'); 126 // Replace images with morebreak 127 ed.onPostProcess.add(function(ed, o) { 128 if (o.get) 129 o.content = o.content.replace(/<img[^>]+>/g, function(im) { 130 if (im.indexOf('class="mceWPmore') !== -1) { 131 var m; 132 var moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : ''; 251 133 252 // Pretty it up for the source editor. 253 var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p'; 254 content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); 255 content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>'); 256 content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>'); 257 content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>'); 258 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n'); 259 content = content.replace(new RegExp('^\\s*', ''), ''); 260 content = content.replace(new RegExp('\\s*$', ''), ''); 134 im = '<!--more'+moretext+'-->'; 135 } 136 if (im.indexOf('class="mceWPnextpage') !== -1) 137 im = '<!--nextpage-->'; 138 139 return im; 140 }); 141 }); 261 142 262 break; 143 // Set active buttons if user selected pagebreak or more break 144 ed.onNodeChange.add(function(ed, cm, n) { 145 cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage')); 146 cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore')); 147 }); 263 148 } 149 }); 264 150 265 // Pass through to next handler in chain 266 return content; 267 }, 268 269 handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 270 271 tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonNormal'); 272 tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonNormal'); 273 274 if (node == null) 275 return; 276 277 do { 278 if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0) 279 tinyMCE.switchClass(editor_id + '_wp_more', 'mceButtonSelected'); 280 if (node.nodeName.toLowerCase() == "img" && tinyMCE.getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0) 281 tinyMCE.switchClass(editor_id + '_wp_page', 'mceButtonSelected'); 282 } while ((node = node.parentNode)); 283 284 return true; 285 }, 286 287 saveCallback : function(el, content, body) { 288 // We have a TON of cleanup to do. 289 290 if ( tinyMCE.activeEditor.isHidden() ) { 291 // return content; 292 } 293 294 // Mark </p> if it has any attributes. 295 content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>'); 296 297 // Decode the ampersands of time. 298 // content = content.replace(new RegExp('&', 'g'), '&'); 299 300 // Get it ready for wpautop. 301 content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 302 content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 303 content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 304 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 305 306 // Fix some block element newline issues 307 var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre'; 308 content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); 309 content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); 310 content = content.replace(new RegExp('<li>', 'g'), '\t<li>'); 311 312 if ( content.indexOf('<object') != -1 ) { 313 content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed 314 content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>'); 315 } 316 317 // Unmark special paragraph closing tags 318 content = content.replace(new RegExp('</p#>', 'g'), '</p>\n'); 319 content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); 320 321 // Trim trailing whitespace 322 content = content.replace(new RegExp('\\s*$', ''), ''); 323 324 // Hope. 325 return content; 326 327 }, 328 329 _parseAttributes : function(attribute_string) { 330 var attributeName = ""; 331 var attributeValue = ""; 332 var withInName; 333 var withInValue; 334 var attributes = new Array(); 335 var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g'); 336 var titleText = tinyMCE.getLang('lang_wordpress_more'); 337 var titleTextPage = tinyMCE.getLang('lang_wordpress_page'); 338 339 if (attribute_string == null || attribute_string.length < 2) 340 return null; 341 342 withInName = withInValue = false; 343 344 for (var i=0; i<attribute_string.length; i++) { 345 var chr = attribute_string.charAt(i); 346 347 if ((chr == '"' || chr == "'") && !withInValue) 348 withInValue = true; 349 else if ((chr == '"' || chr == "'") && withInValue) { 350 withInValue = false; 351 352 var pos = attributeName.lastIndexOf(' '); 353 if (pos != -1) 354 attributeName = attributeName.substring(pos+1); 355 356 attributes[attributeName.toLowerCase()] = attributeValue.substring(1); 357 358 attributeName = ""; 359 attributeValue = ""; 360 } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue) 361 withInName = true; 362 363 if (chr == '=' && withInName) 364 withInName = false; 365 366 if (withInName) 367 attributeName += chr; 368 369 if (withInValue) 370 attributeValue += chr; 371 } 372 373 return attributes; 374 } 375 }; 376 377 //tinyMCE.addPlugin("wordpress", TinyMCE_wordpressPlugin); 378 379 /* This little hack protects our More and Page placeholders from the removeformat command */ 380 tinyMCE.orgExecCommand = tinyMCE.execCommand; 381 tinyMCE.execCommand = function (command, user_interface, value) { 382 re = this.orgExecCommand(command, user_interface, value); 383 384 if ( command == 'removeformat' ) { 385 var inst = tinyMCE.getInstanceById('mce_editor_0'); 386 doc = inst.getDoc(); 387 var imgs = doc.getElementsByTagName('img'); 388 for (i=0;img=imgs[i];i++) 389 img.className = img.name; 390 } 391 return re; 392 }; 393 wpInstTriggerSave = function (skip_cleanup, skip_callback) { 394 var e, nl = new Array(), i, s; 395 396 this.switchSettings(); 397 s = tinyMCE.settings; 398 399 // Force hidden tabs visible while serializing 400 if (tinyMCE.isMSIE && !tinyMCE.isOpera) { 401 e = this.iframeElement; 402 403 do { 404 if (e.style && e.style.display == 'none') { 405 e.style.display = 'block'; 406 nl[nl.length] = {elm : e, type : 'style'}; 407 } 408 409 if (e.style && s.hidden_tab_class.length > 0 && e.className.indexOf(s.hidden_tab_class) != -1) { 410 e.className = s.display_tab_class; 411 nl[nl.length] = {elm : e, type : 'class'}; 412 } 413 } while ((e = e.parentNode) != null) 414 } 415 416 tinyMCE.settings['preformatted'] = false; 417 418 // Default to false 419 if (typeof(skip_cleanup) == "undefined") 420 skip_cleanup = false; 421 422 // Default to false 423 if (typeof(skip_callback) == "undefined") 424 skip_callback = false; 425 426 // tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML); 427 428 // Remove visual aids when cleanup is disabled 429 if (this.settings['cleanup'] == false) { 430 tinyMCE.handleVisualAid(this.getBody(), true, false, this); 431 tinyMCE._setEventsEnabled(this.getBody(), true); 432 } 433 434 tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body); 435 tinyMCE.selectedInstance.getWin().oldfocus=tinyMCE.selectedInstance.getWin().focus; 436 tinyMCE.selectedInstance.getWin().focus=function() {}; 437 var htm = tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true); 438 tinyMCE.selectedInstance.getWin().focus=tinyMCE.selectedInstance.getWin().oldfocus; 439 htm = tinyMCE._customCleanup(this, "submit_content", htm); 440 441 if (!skip_callback && tinyMCE.settings['save_callback'] != "") 442 var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());"); 443 444 // Use callback content if available 445 if ((typeof(content) != "undefined") && content != null) 446 htm = content; 447 448 // Replace some weird entities (Bug: #1056343) 449 htm = tinyMCE.regexpReplace(htm, "(", "(", "gi"); 450 htm = tinyMCE.regexpReplace(htm, ")", ")", "gi"); 451 htm = tinyMCE.regexpReplace(htm, ";", ";", "gi"); 452 htm = tinyMCE.regexpReplace(htm, """, """, "gi"); 453 htm = tinyMCE.regexpReplace(htm, "^", "^", "gi"); 454 455 if (this.formElement) 456 this.formElement.value = htm; 457 458 if (tinyMCE.isSafari && this.formElement) 459 this.formElement.innerText = htm; 460 461 // Hide them again (tabs in MSIE) 462 for (i=0; i<nl.length; i++) { 463 if (nl[i].type == 'style') 464 nl[i].elm.style.display = 'none'; 465 else 466 nl[i].elm.className = s.hidden_tab_class; 467 } 468 } 469 tinyMCE.wpTriggerSave = function () { 470 var inst, n; 471 for (n in tinyMCE.instances) { 472 inst = tinyMCE.instances[n]; 473 if (!tinyMCE.isInstance(inst)) 474 continue; 475 inst.wpTriggerSave = wpInstTriggerSave; 476 inst.wpTriggerSave(false, false); 477 } 478 } 479 480 function switchEditors(id) { 481 var inst = tinyMCE.getInstanceById(id); 482 var qt = document.getElementById('quicktags'); 483 var H = document.getElementById('edButtonHTML'); 484 var P = document.getElementById('edButtonPreview'); 485 var ta = document.getElementById(id); 486 var pdr = ta.parentNode; 487 488 if ( ! inst.isHidden(id) ) { 489 edToggle(H, P); 490 491 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 492 // IE rejects the later overflow assignment so we skip this step. 493 // Alternate code might be nice. Until then, IE reflows. 494 } else { 495 // Lock the fieldset's height to prevent reflow/flicker 496 pdr.style.height = pdr.clientHeight + 'px'; 497 pdr.style.overflow = 'hidden'; 498 } 499 500 // Save the coords of the bottom right corner of the rich editor 501 var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0]; 502 var y1 = table.offsetTop + table.offsetHeight; 503 504 if ( tinymce.util.Cookie.get("TinyMCE_" + inst.editorId + "_height") == null ) { 505 var expires = new Date(); 506 expires.setTime(expires.getTime() + 3600000 * 24 * 30); 507 var offset = tinyMCE.isMSIE ? 1 : 2; 508 tinymce.util.Cookie.set("TinyMCE_" + inst.editorId + "_height", "" + (table.offsetHeight - offset), expires); 509 } 510 511 // Unload the rich editor 512 // inst.triggerSave(false, false); 513 // inst.formElement.value; 514 inst.hide(); // tinyMCE.removeMCEControl(id); 515 // document.getElementById(id).value = htm; 516 // --tinyMCE.idCounter; 517 518 // Reveal Quicktags and textarea 519 qt.style.display = 'block'; 520 ta.style.display = 'inline'; 521 522 // Set the textarea height to match the rich editor 523 y2 = ta.offsetTop + ta.offsetHeight; 524 ta.style.height = (ta.clientHeight + y1 - y2) + 'px'; 525 526 // Tweak the widths 527 ta.parentNode.style.paddingRight = '12px'; 528 529 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 530 } else { 531 // Unlock the fieldset's height 532 pdr.style.height = 'auto'; 533 pdr.style.overflow = 'display'; 534 } 535 wpSetDefaultEditor( 'html' ); 536 } else { 537 edToggle(P, H); 538 edCloseAllTags(); // :-( 539 540 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 541 } else { 542 // Lock the fieldset's height 543 pdr.style.height = pdr.clientHeight + 'px'; 544 pdr.style.overflow = 'hidden'; 545 } 546 547 // Hide Quicktags and textarea 548 qt.style.display = 'none'; 549 ta.style.display = 'none'; 550 551 // Tweak the widths 552 ta.parentNode.style.paddingRight = '0px'; 553 554 // Load the rich editor with formatted html 555 //if ( tinyMCE.isMSIE ) { 556 // ta.value = wpautop(ta.value); 557 // tinyMCE.addMCEControl(ta, id); 558 //} else { 559 ta.value = wpautop(ta.value); 560 inst.show() // tinyMCE.addMCEControl(ta, id); 561 //tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm); 562 //} 563 564 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 565 } else { 566 // Unlock the fieldset's height 567 pdr.style.height = 'auto'; 568 pdr.style.overflow = 'display'; 569 } 570 wpSetDefaultEditor( 'tinymce' ); 571 } 572 } 573 574 function edToggle(A, B) { 575 A.className = 'active'; 576 B.className = ''; 577 578 B.onclick = A.onclick; 579 A.onclick = null; 580 } 581 582 function wpSetDefaultEditor( editor ) { 583 try { 584 editor = escape( editor.toString() ); 585 } catch(err) { 586 editor = 'tinymce'; 587 } 588 589 var userID = document.getElementById('user-id'); 590 var date = new Date(); 591 date.setTime(date.getTime()+(10*365*24*60*60*1000)); 592 document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString(); 593 } 594 595 function wpautop(pee) { 596 pee = pee + "\n\n"; 597 pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 598 pee = pee.replace(new RegExp('(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "\n$1"); 599 pee = pee.replace(new RegExp('(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)', 'gi'), "$1\n\n"); 600 pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 601 pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 602 pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n"); 603 pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 604 pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1"); 605 pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 606 pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 607 pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>'); 608 pee = pee.replace(new RegExp('<p>\\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)', 'gi'), "$1"); 609 pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*</p>', 'gi'), "$1"); 610 pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 611 pee = pee.replace(new RegExp('(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\\s*<br />', 'gi'), "$1"); 612 pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 613 pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); 614 //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm... 615 return pee; 616 } 151 // Register plugin 152 tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress); 153 })(); -
trunk/wp-includes/js/tinymce/plugins/wordpress/langs/en.js
r6641 r6694 1 // EN lang variables 2 3 if (navigator.userAgent.indexOf('Mac OS') != -1) { 4 // Mac OS browsers use Ctrl to hit accesskeys 5 var metaKey = 'Ctrl'; 6 } 7 else if (navigator.userAgent.indexOf('Firefox/2') != -1) { 8 // Firefox 2.x uses Alt+Shift to hit accesskeys 9 var metaKey = 'Alt+Shift'; 10 } 11 else { 12 var metaKey = 'Alt'; 13 } 14 15 tinyMCE.addI18n('',{ 16 wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)', 17 wordpress_page_button : 'Split post with Page tag', 18 wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+v)', 19 wordpress_more_alt : 'More...', 20 wordpress_page_alt : '...page...', 21 help_button_title : 'Help (' + metaKey + '+h)', 22 bold_desc : 'Bold (Ctrl+B)', 23 italic_desc : 'Italic (Ctrl+I)', 24 underline_desc : 'Underline (Ctrl+U)', 25 link_desc : 'Insert/edit link (' + metaKey + '+a)', 26 unlink_desc : 'Unlink (' + metaKey + '+s)', 27 image_desc : 'Insert/edit image (' + metaKey + '+m)', 28 striketrough_desc : 'Strikethrough (' + metaKey + '+k)', 29 justifyleft_desc : 'Align left (' + metaKey + '+f)', 30 justifycenter_desc : 'Align center (' + metaKey + '+c)', 31 justifyright_desc : 'Align right (' + metaKey + '+r)', 32 justifyfull_desc : 'Align full (' + metaKey + '+j)', 33 bullist_desc : 'Unordered list (' + metaKey + '+l)', 34 numlist_desc : 'Ordered list (' + metaKey + '+o)', 35 outdent_desc : 'Outdent (' + metaKey + '+w)', 36 indent_desc : 'Indent list/blockquote (' + metaKey + '+q)' 1 tinyMCE.addI18n('en.wordpress',{ 2 wp_adv_desc : 'Show/Hide Advanced Toolbar', 3 wp_more_desc : 'Split post with More tag', 4 wp_page_desc : 'Split post with Page tag', 5 wp_help_desc : 'Help', 6 wp_more_alt : 'More...', 7 wp_page_alt : 'Next page...' 37 8 }); -
trunk/wp-includes/js/tinymce/themes/advanced/anchor.htm
r6632 r6694 3 3 <head> 4 4 <title>{#advanced_dlg.anchor_title}</title> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="js/anchor.js"></script> 7 <base target="_self" /> 7 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('anchorName').focus();},500);});</script> 8 <base target="_self" /> 8 9 </head> 9 10 <body style="display: none"> … … 21 22 <div class="mceActionPanel"> 22 23 <div style="float: left"> 23 <input type="button" id=" insert" name="insert" value="{#update}" onclick="AnchorDialog.update();" />24 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 24 25 </div> 25 26 26 27 <div style="float: right"> 27 <input type=" button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />28 <input type="submit" id="insert" name="insert" value="{#update}" onclick="AnchorDialog.update();" /> 28 29 </div> 29 30 </div> -
trunk/wp-includes/js/tinymce/themes/advanced/charmap.htm
r6632 r6694 8 8 </head> 9 9 <body style="display: none"> 10 <table align="center" border="0" cellspacing="0" cellpadding="2">10 <table style="background:#fff;" align="center" border="0" cellspacing="0" cellpadding="2"> 11 11 <tr> 12 12 <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td> -
trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js
r6632 r6694 1 /** 2 * $Id: editor_template_src.js 520 2008-01-07 16:30:32Z spocke $ 3 * 4 * @author Moxiecode 5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. 6 */ 7 8 (function() { 9 var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID; 10 11 // Tell it to load theme specific language pack(s) 12 tinymce.ThemeManager.requireLangPack('advanced'); 13 14 tinymce.create('tinymce.themes.AdvancedTheme', { 15 // Control name lookup, format: title, command 16 controls : { 17 bold : ['bold_desc', 'Bold'], 18 italic : ['italic_desc', 'Italic'], 19 underline : ['underline_desc', 'Underline'], 20 strikethrough : ['striketrough_desc', 'Strikethrough'], 21 justifyleft : ['justifyleft_desc', 'JustifyLeft'], 22 justifycenter : ['justifycenter_desc', 'JustifyCenter'], 23 justifyright : ['justifyright_desc', 'JustifyRight'], 24 justifyfull : ['justifyfull_desc', 'JustifyFull'], 25 bullist : ['bullist_desc', 'InsertUnorderedList'], 26 numlist : ['numlist_desc', 'InsertOrderedList'], 27 outdent : ['outdent_desc', 'Outdent'], 28 indent : ['indent_desc', 'Indent'], 29 cut : ['cut_desc', 'Cut'], 30 copy : ['copy_desc', 'Copy'], 31 paste : ['paste_desc', 'Paste'], 32 undo : ['undo_desc', 'Undo'], 33 redo : ['redo_desc', 'Redo'], 34 link : ['link_desc', 'mceLink'], 35 unlink : ['unlink_desc', 'unlink'], 36 image : ['image_desc', 'mceImage'], 37 cleanup : ['cleanup_desc', 'mceCleanup'], 38 help : ['help_desc', 'mceHelp'], 39 code : ['code_desc', 'mceCodeEditor'], 40 hr : ['hr_desc', 'InsertHorizontalRule'], 41 removeformat : ['removeformat_desc', 'RemoveFormat'], 42 sub : ['sub_desc', 'subscript'], 43 sup : ['sup_desc', 'superscript'], 44 forecolor : ['forecolor_desc', 'ForeColor'], 45 forecolorpicker : ['forecolor_desc', 'mceForeColor'], 46 backcolor : ['backcolor_desc', 'HiliteColor'], 47 backcolorpicker : ['backcolor_desc', 'mceBackColor'], 48 charmap : ['charmap_desc', 'mceCharMap'], 49 visualaid : ['visualaid_desc', 'mceToggleVisualAid'], 50 anchor : ['anchor_desc', 'mceInsertAnchor'], 51 newdocument : ['newdocument_desc', 'mceNewDocument'], 52 blockquote : ['blockquote_desc', 'mceBlockQuote'] 53 }, 54 55 stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'], 56 57 init : function(ed, url) { 58 var t = this, s; 59 60 t.editor = ed; 61 t.url = url; 62 t.onResolveName = new tinymce.util.Dispatcher(this); 63 64 // Default settings 65 t.settings = s = extend({ 66 theme_advanced_path : true, 67 theme_advanced_toolbar_location : 'bottom', 68 theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect", 69 theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code", 70 theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap", 71 theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6", 72 theme_advanced_toolbar_align : "center", 73 theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats", 74 theme_advanced_font_sizes : "1,2,3,4,5,6,7", 75 theme_advanced_more_colors : 1, 76 theme_advanced_row_height : 23, 77 theme_advanced_resize_horizontal : 1, 78 theme_advanced_resizing_use_cookie : 1 79 }, ed.settings); 80 81 if (s.theme_advanced_statusbar_location == 'none') 82 s.theme_advanced_statusbar_location = 0; 83 84 // Init editor 85 ed.onInit.add(function() { 86 ed.onNodeChange.add(t._nodeChanged, t); 87 ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/" + ed.settings.skin + "/content.css")); 88 }); 89 90 ed.onSetProgressState.add(function(ed, b, ti) { 91 var co, id = ed.id, tb; 92 93 if (b) { 94 t.progressTimer = setTimeout(function() { 95 co = ed.getContainer(); 96 co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild); 97 tb = DOM.get(ed.id + '_tbl'); 98 99 DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}}); 100 DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}}); 101 }, ti || 0); 102 } else { 103 DOM.remove(id + '_blocker'); 104 DOM.remove(id + '_progress'); 105 clearTimeout(t.progressTimer); 106 } 107 }); 108 109 DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css || "themes/advanced/skins/" + ed.settings.skin + "/ui.css")); 110 }, 111 112 createControl : function(n, cf) { 113 var cd, c; 114 115 if (c = cf.createControl(n)) 116 return c; 117 118 switch (n) { 119 case "styleselect": 120 return this._createStyleSelect(); 121 122 case "formatselect": 123 return this._createBlockFormats(); 124 125 case "fontselect": 126 return this._createFontSelect(); 127 128 case "fontsizeselect": 129 return this._createFontSizeSelect(); 130 131 case "forecolor": 132 return this._createForeColorMenu(); 133 134 case "backcolor": 135 return this._createBackColorMenu(); 136 } 137 138 if ((cd = this.controls[n])) 139 return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]}); 140 }, 141 142 execCommand : function(cmd, ui, val) { 143 var f = this['_' + cmd]; 144 145 if (f) { 146 f.call(this, ui, val); 147 return true; 148 } 149 150 return false; 151 }, 152 153 _importClasses : function() { 154 var ed = this.editor, c = ed.controlManager.get('styleselect'); 155 156 if (c.getLength() == 0) { 157 each(ed.dom.getClasses(), function(o) { 158 c.add(o['class'], o['class']); 159 }); 160 } 161 }, 162 163 _createStyleSelect : function(n) { 164 var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', { 165 title : 'advanced.style_select', 166 onselect : function(v) { 167 if (c.selectedValue === v) { 168 ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'}); 169 c.select(); 170 return false; 171 } else 172 ed.execCommand('mceSetCSSClass', 0, v); 173 } 174 }); 175 176 each((t.settings.theme_advanced_styles || '').split(';'), function(v) { 177 var p = v.split('='); 178 179 if (v) 180 c.add(t.editor.translate(p[0]), p[1]); 181 }); 182 183 c.onPostRender.add(function(ed, n) { 184 Event.add(n, 'focus', t._importClasses, t); 185 Event.add(n, 'mousedown', t._importClasses, t); 186 }); 187 188 return c; 189 }, 190 191 _createFontSelect : function() { 192 var c, t = this; 193 194 c = t.editor.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'}); 195 196 each(t.settings.theme_advanced_fonts.split(';'), function(v) { 197 var p = v.split('='), st; 198 199 if (p[1].indexOf('dings') == -1) 200 st = 'font-family:' + p[1]; 201 202 c.add(t.editor.translate(p[0]), p[1], {style : st}); 203 }); 204 205 return c; 206 }, 207 208 _createFontSizeSelect : function() { 209 var c, t = this, lo = [ 210 "1 (8 pt)", 211 "2 (10 pt)", 212 "3 (12 pt)", 213 "4 (14 pt)", 214 "5 (18 pt)", 215 "6 (24 pt)", 216 "7 (36 pt)" 217 ], fz = [8, 10, 12, 14, 18, 24, 36]; 218 219 c = t.editor.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', cmd : 'FontSize'}); 220 221 each(t.settings.theme_advanced_font_sizes.split(','), function(v) { 222 c.add(lo[parseInt(v) - 1], v, {'style' : 'font-size:' + fz[v - 1] + 'pt', 'class' : 'fontSize' + v}); 223 }); 224 225 return c; 226 }, 227 228 _createBlockFormats : function() { 229 var c, fmts = { 230 p : 'advanced.paragraph', 231 address : 'advanced.address', 232 pre : 'advanced.pre', 233 h1 : 'advanced.h1', 234 h2 : 'advanced.h2', 235 h3 : 'advanced.h3', 236 h4 : 'advanced.h4', 237 h5 : 'advanced.h5', 238 h6 : 'advanced.h6', 239 div : 'advanced.div', 240 blockquote : 'advanced.blockquote', 241 code : 'advanced.code', 242 dt : 'advanced.dt', 243 dd : 'advanced.dd', 244 samp : 'advanced.samp' 245 }, t = this; 246 247 c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'}); 248 249 each(t.settings.theme_advanced_blockformats.split(','), function(v) { 250 c.add(t.editor.translate(fmts[v]), v, {element : v, 'class' : v.indexOf('h') == 0 ? '' : 'preview'}); 251 }); 252 253 return c; 254 }, 255 256 _createForeColorMenu : function() { 257 var c, t = this, s = t.settings, o = {}, v; 258 259 if (s.theme_advanced_more_colors) { 260 o.more_colors_func = function() { 261 t._mceColorPicker(0, { 262 color : c.value, 263 func : function(co) { 264 c.setColor(co); 265 } 266 }); 267 }; 268 } 269 270 if (v = s.theme_advanced_text_colors) 271 o.colors = v; 272 273 o.title = 'advanced.forecolor_desc'; 274 o.cmd = 'ForeColor'; 275 o.scope = this; 276 277 c = t.editor.controlManager.createColorSplitButton('forecolor', o); 278 279 return c; 280 }, 281 282 _createBackColorMenu : function() { 283 var c, t = this, s = t.settings, o = {}, v; 284 285 if (s.theme_advanced_more_colors) { 286 o.more_colors_func = function() { 287 t._mceColorPicker(0, { 288 color : c.value, 289 func : function(co) { 290 c.setColor(co); 291 } 292 }); 293 }; 294 } 295 296 if (v = s.theme_advanced_background_colors) 297 o.colors = v; 298 299 o.title = 'advanced.backcolor_desc'; 300 o.cmd = 'HiliteColor'; 301 o.scope = this; 302 303 c = t.editor.controlManager.createColorSplitButton('backcolor', o); 304 305 return c; 306 }, 307 308 renderUI : function(o) { 309 var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl; 310 311 n = p = DOM.create('div', {id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin'}); 312 313 if (!DOM.boxModel) 314 n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'}); 315 316 n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0}); 317 n = tb = DOM.add(n, 'tbody'); 318 319 switch ((s.theme_advanced_layout_manager || '').toLowerCase()) { 320 case "rowlayout": 321 ic = t._rowLayout(s, tb, o); 322 break; 323 324 case "customlayout": 325 ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p); 326 break; 327 328 default: 329 ic = t._simpleLayout(s, tb, o, p); 330 } 331 332 n = o.targetNode; 333 334 // Add classes to first and last TRs 335 nl = sc.rows; 336 DOM.addClass(nl[0], 'first'); 337 DOM.addClass(nl[nl.length - 1], 'last'); 338 339 // Add classes to first and last TDs 340 each(DOM.select('tr', tb), function(n) { 341 DOM.addClass(n.firstChild, 'first'); 342 DOM.addClass(n.childNodes[n.childNodes.length - 1], 'last'); 343 }); 344 345 if (DOM.get(s.theme_advanced_toolbar_container)) 346 DOM.get(s.theme_advanced_toolbar_container).appendChild(p); 347 else 348 DOM.insertAfter(p, n); 349 350 Event.add(ed.id + '_path_row', 'click', function(e) { 351 e = e.target; 352 353 if (e.nodeName == 'A') { 354 t._sel(e.href.replace(/^[^#]*#/, '')); 355 356 return Event.cancel(e); 357 } 358 }); 359 /* 360 if (DOM.get(ed.id + '_path_row')) { 361 Event.add(ed.id + '_tbl', 'mouseover', function(e) { 362 var re; 363 364 e = e.target; 365 366 if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) { 367 re = DOM.get(ed.id + '_path_row'); 368 t.lastPath = re.innerHTML; 369 DOM.setHTML(re, e.parentNode.title); 370 } 371 }); 372 373 Event.add(ed.id + '_tbl', 'mouseout', function(e) { 374 if (t.lastPath) { 375 DOM.setHTML(ed.id + '_path_row', t.lastPath); 376 t.lastPath = 0; 377 } 378 }); 379 } 380 */ 381 if (s.theme_advanced_toolbar_location == 'external') 382 o.deltaHeight = 0; 383 384 t.deltaHeight = o.deltaHeight; 385 o.targetNode = null; 386 387 return { 388 iframeContainer : ic, 389 editorContainer : ed.id + '_parent', 390 sizeContainer : sc, 391 deltaHeight : o.deltaHeight 392 }; 393 }, 394 395 getInfo : function() { 396 return { 397 longname : 'Simple theme', 398 author : 'Moxiecode Systems AB', 399 authorurl : 'http://tinymce.moxiecode.com', 400 version : tinymce.majorVersion + "." + tinymce.minorVersion 401 } 402 }, 403 404 _simpleLayout : function(s, tb, o, p) { 405 var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c; 406 407 // Create toolbar container at top 408 if (lo == 'top') 409 t._addToolbars(tb, o); 410 411 // Create external toolbar 412 if (lo == 'external') { 413 n = c = DOM.create('div', {style : 'position:relative'}); 414 n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'}); 415 DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'}); 416 n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0}); 417 etb = DOM.add(n, 'tbody'); 418 419 if (p.firstChild.className == 'mceOldBoxModel') 420 p.firstChild.appendChild(c); 421 else 422 p.insertBefore(c, p.firstChild); 423 424 t._addToolbars(etb, o); 425 426 ed.onMouseUp.add(function() { 427 var e = DOM.get(ed.id + '_external'); 428 DOM.show(e); 429 430 DOM.hide(lastExtID); 431 432 var f = Event.add(ed.id + '_external_close', 'click', function() { 433 DOM.hide(ed.id + '_external'); 434 Event.remove(ed.id + '_external_close', 'click', f); 435 }); 436 437 DOM.show(e); 438 DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1); 439 440 // Fixes IE rendering bug 441 DOM.hide(e); 442 DOM.show(e); 443 e.style.filter = ''; 444 445 lastExtID = ed.id + '_external'; 446 447 e = null; 448 }); 449 } 450 451 if (sl == 'top') 452 t._addStatusBar(tb, o); 453 454 // Create iframe container 455 if (!s.theme_advanced_toolbar_container) { 456 n = DOM.add(tb, 'tr'); 457 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); 458 } 459 460 // Create toolbar container at bottom 461 if (lo == 'bottom') 462 t._addToolbars(tb, o); 463 464 if (sl == 'bottom') 465 t._addStatusBar(tb, o); 466 467 return ic; 468 }, 469 470 _rowLayout : function(s, tb, o) { 471 var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to; 472 473 dc = s.theme_advanced_containers_default_class || ''; 474 da = s.theme_advanced_containers_default_align || 'center'; 475 476 each((s.theme_advanced_containers || '').split(','), function(c, i) { 477 var v = s['theme_advanced_container_' + c].toLowerCase(); 478 479 switch (v) { 480 case 'mceeditor': 481 n = DOM.add(tb, 'tr'); 482 n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'}); 483 break; 484 485 case 'mceelementpath': 486 t._addStatusBar(tb, o); 487 break; 488 489 default: 490 n = DOM.add(DOM.add(tb, 'tr'), 'td', { 491 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc), 492 align : s['theme_advanced_container_' + c + '_align'] || da 493 }); 494 495 to = cf.createToolbar("toolbar" + i); 496 t._addControls(v, to); 497 DOM.setHTML(n, to.renderHTML()); 498 o.deltaHeight -= s.theme_advanced_row_height; 499 } 500 }); 501 502 return ic; 503 }, 504 505 _addControls : function(v, tb) { 506 var t = this, s = t.settings, di, cf = t.editor.controlManager; 507 508 if (s.theme_advanced_disable && !t._disabled) { 509 di = {}; 510 511 each(s.theme_advanced_disable.split(','), function(v) { 512 di[v] = 1; 513 }); 514 515 t._disabled = di; 516 } else 517 di = t._disabled; 518 519 each(v.split(','), function(n) { 520 var c; 521 522 if (di && di[n]) 523 return; 524 525 // Compatiblity with 2.x 526 if (n == 'tablecontrols') { 527 each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) { 528 n = t.createControl(n, cf); 529 530 if (n) 531 tb.add(n); 532 }); 533 534 return; 535 } 536 537 c = t.createControl(n, cf); 538 539 if (c) 540 tb.add(c); 541 }); 542 }, 543 544 _addToolbars : function(c, o) { 545 var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = []; 546 547 n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar', align : s.theme_advanced_toolbar_align}); 548 549 if (!ed.getParam('accessibility_focus') || ed.getParam('tab_focus')) 550 h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); 551 552 h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->')); 553 554 // Create toolbar and add the controls 555 for (i=1; (v = s['theme_advanced_buttons' + i]); i++) { 556 tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i}); 557 558 if (s['theme_advanced_buttons' + i + '_add']) 559 v += ',' + s['theme_advanced_buttons' + i + '_add']; 560 561 if (s['theme_advanced_buttons' + i + '_add_before']) 562 v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v; 563 564 t._addControls(v, tb, di); 565 566 //n.appendChild(n = tb.render()); 567 h.push(tb.renderHTML()); 568 569 o.deltaHeight -= s.theme_advanced_row_height; 570 } 571 572 h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->')); 573 DOM.setHTML(n, h.join('')); 574 }, 575 576 _addStatusBar : function(tb, o) { 577 var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td; 578 579 n = DOM.add(tb, 'tr'); 580 n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); 581 n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : ' '); 582 DOM.add(n, 'a', {href : '#', accesskey : 'x'}); 583 584 if (s.theme_advanced_resizing && !tinymce.isOldWebKit) { 585 DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'resize'}); 586 587 if (s.theme_advanced_resizing_use_cookie) { 588 ed.onPostRender.add(function() { 589 var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl'); 590 591 if (!o) 592 return; 593 594 if (s.theme_advanced_resize_horizontal) 595 c.style.width = o.cw + 'px'; 596 597 c.style.height = o.ch + 'px'; 598 DOM.get(ed.id + '_ifr').style.height = (parseInt(o.ch) + t.deltaHeight) + 'px'; 599 }); 600 } 601 602 ed.onPostRender.add(function() { 603 Event.add(ed.id + '_resize', 'mousedown', function(e) { 604 var c, p, w, h, n, pa; 605 606 // Measure container 607 c = DOM.get(ed.id + '_tbl'); 608 w = c.clientWidth; 609 h = c.clientHeight; 610 611 miw = s.theme_advanced_resizing_min_width || 100; 612 mih = s.theme_advanced_resizing_min_height || 100; 613 maw = s.theme_advanced_resizing_max_width || 0xFFFF; 614 mah = s.theme_advanced_resizing_max_height || 0xFFFF; 615 616 // Setup placeholder 617 p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'}); 618 DOM.setStyles(p, {width : w, height : h}); 619 620 // Replace with placeholder 621 DOM.hide(c); 622 DOM.show(p); 623 624 // Create internal resize obj 625 r = { 626 x : e.screenX, 627 y : e.screenY, 628 w : w, 629 h : h, 630 dx : null, 631 dy : null 632 }; 633 634 // Start listening 635 mf = Event.add(document, 'mousemove', function(e) { 636 var w, h; 637 638 // Calc delta values 639 r.dx = e.screenX - r.x; 640 r.dy = e.screenY - r.y; 641 642 // Boundery fix box 643 w = Math.max(miw, r.w + r.dx); 644 h = Math.max(mih, r.h + r.dy); 645 w = Math.min(maw, w); 646 h = Math.min(mah, h); 647 648 // Resize placeholder 649 if (s.theme_advanced_resize_horizontal) 650 p.style.width = w + 'px'; 651 652 p.style.height = h + 'px'; 653 654 return Event.cancel(e); 655 }); 656 657 me = Event.add(document, 'mouseup', function(e) { 658 var ifr; 659 660 // Stop listening 661 Event.remove(document, 'mousemove', mf); 662 Event.remove(document, 'mouseup', me); 663 664 c.style.display = ''; 665 DOM.remove(p); 666 667 if (r.dx === null) 668 return; 669 670 ifr = DOM.get(ed.id + '_ifr'); 671 672 if (s.theme_advanced_resize_horizontal) 673 c.style.width = (r.w + r.dx) + 'px'; 674 675 c.style.height = (r.h + r.dy) + 'px'; 676 ifr.style.height = (ifr.clientHeight + r.dy) + 'px'; 677 678 if (s.theme_advanced_resizing_use_cookie) { 679 Cookie.setHash("TinyMCE_" + ed.id + "_size", { 680 cw : r.w + r.dx, 681 ch : r.h + r.dy 682 }); 683 } 684 }); 685 686 return Event.cancel(e); 687 }); 688 }); 689 } 690 691 o.deltaHeight -= 21; 692 n = tb = null; 693 }, 694 695 _nodeChanged : function(ed, cm, n, co) { 696 var t = this, p, de = 0, v, c, s = t.settings; 697 698 tinymce.each(t.stateControls, function(c) { 699 cm.setActive(c, ed.queryCommandState(t.controls[c][1])); 700 }); 701 702 cm.setActive('visualaid', ed.hasVisual); 703 cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing); 704 cm.setDisabled('redo', !ed.undoManager.hasRedo()); 705 cm.setDisabled('outdent', !ed.queryCommandState('Outdent')); 706 707 p = DOM.getParent(n, 'A'); 708 if (c = cm.get('link')) { 709 if (!p || !p.name) { 710 c.setDisabled(!p && co); 711 c.setActive(!!p); 712 } 713 } 714 715 if (c = cm.get('unlink')) { 716 c.setDisabled(!p && co); 717 c.setActive(!!p && !p.name); 718 } 719 720 if (c = cm.get('anchor')) { 721 c.setActive(!!p && p.name); 722 723 if (tinymce.isWebKit) { 724 p = DOM.getParent(n, 'IMG'); 725 c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a'); 726 } 727 } 728 729 p = DOM.getParent(n, 'IMG'); 730 if (c = cm.get('image')) 731 c.setActive(!!p && n.className.indexOf('mceItem') == -1); 732 733 if (c = cm.get('styleselect')) { 734 if (n.className) { 735 t._importClasses(); 736 c.select(n.className); 737 } else 738 c.select(); 739 } 740 741 if (c = cm.get('formatselect')) { 742 p = DOM.getParent(n, DOM.isBlock); 743 744 if (p) 745 c.select(p.nodeName.toLowerCase()); 746 } 747 748 if (c = cm.get('fontselect')) 749 c.select(ed.queryCommandValue('FontName')); 750 751 if (c = cm.get('fontsizeselect')) 752 c.select(ed.queryCommandValue('FontSize')); 753 754 if (s.theme_advanced_path && s.theme_advanced_statusbar_location) { 755 p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'}); 756 DOM.setHTML(p, ''); 757 758 ed.dom.getParent(n, function(n) { 759 var na = n.nodeName.toLowerCase(), u, pi, ti = ''; 760 761 // Ignore non element and hidden elements 762 if (n.nodeType != 1 || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))) 763 return; 764 765 // Fake name 766 if (v = DOM.getAttrib(n, 'mce_name')) 767 na = v; 768 769 // Handle prefix 770 if (tinymce.isIE && n.scopeName !== 'HTML') 771 na = n.scopeName + ':' + na; 772 773 // Remove internal prefix 774 na = na.replace(/mce\:/g, ''); 775 776 // Handle node name 777 switch (na) { 778 case 'b': 779 na = 'strong'; 780 break; 781 782 case 'i': 783 na = 'em'; 784 break; 785 786 case 'img': 787 if (v = DOM.getAttrib(n, 'src')) 788 ti += 'src: ' + v + ' '; 789 790 break; 791 792 case 'a': 793 if (v = DOM.getAttrib(n, 'name')) { 794 ti += 'name: ' + v + ' '; 795 na += '#' + v; 796 } 797 798 if (v = DOM.getAttrib(n, 'href')) 799 ti += 'href: ' + v + ' '; 800 801 break; 802 803 case 'font': 804 if (s.convert_fonts_to_spans) 805 na = 'span'; 806 807 if (v = DOM.getAttrib(n, 'face')) 808 ti += 'font: ' + v + ' '; 809 810 if (v = DOM.getAttrib(n, 'size')) 811 ti += 'size: ' + v + ' '; 812 813 if (v = DOM.getAttrib(n, 'color')) 814 ti += 'color: ' + v + ' '; 815 816 break; 817 818 case 'span': 819 if (v = DOM.getAttrib(n, 'style')) 820 ti += 'style: ' + v + ' '; 821 822 break; 823 } 824 825 if (v = DOM.getAttrib(n, 'id')) 826 ti += 'id: ' + v + ' '; 827 828 if (v = n.className) { 829 v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, ''); 830 831 if (v && v.indexOf('mceItem') == -1) { 832 ti += 'class: ' + v + ' '; 833 834 if (DOM.isBlock(n) || na == 'img' || na == 'span') 835 na += '.' + v; 836 } 837 } 838 839 na = na.replace(/(html:)/g, ''); 840 na = {name : na, node : n, title : ti}; 841 t.onResolveName.dispatch(t, na); 842 ti = na.title; 843 na = na.name; 844 845 //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');"; 846 pi = DOM.create('a', {'href' : "#" + (de++) + "", onmousedown : "return false;", title : ti}, na); 847 848 if (p.hasChildNodes()) { 849 p.insertBefore(document.createTextNode(' \u00bb '), p.firstChild); 850 p.insertBefore(pi, p.firstChild); 851 } else 852 p.appendChild(pi); 853 }, ed.getBody()); 854 } 855 }, 856 857 // Commands gets called by execCommand 858 859 _sel : function(v) { 860 this.editor.execCommand('mceSelectNodeDepth', false, v); 861 }, 862 863 _mceInsertAnchor : function(ui, v) { 864 var ed = this.editor; 865 866 ed.windowManager.open({ 867 url : tinymce.baseURL + '/themes/advanced/anchor.htm', 868 width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)), 869 height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)), 870 inline : true 871 }, { 872 theme_url : this.url 873 }); 874 }, 875 876 _mceCharMap : function() { 877 var ed = this.editor; 878 879 ed.windowManager.open({ 880 url : tinymce.baseURL + '/themes/advanced/charmap.htm', 881 width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)), 882 height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)), 883 inline : true 884 }, { 885 theme_url : this.url 886 }); 887 }, 888 889 _mceHelp : function() { 890 var ed = this.editor; 891 892 ed.windowManager.open({ 893 url : tinymce.baseURL + '/themes/advanced/about.htm', 894 width : 480, 895 height : 380, 896 inline : true 897 }, { 898 theme_url : this.url 899 }); 900 }, 901 902 _mceColorPicker : function(u, v) { 903 var ed = this.editor; 904 905 v = v || {}; 906 907 ed.windowManager.open({ 908 url : tinymce.baseURL + '/themes/advanced/color_picker.htm', 909 width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)), 910 height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)), 911 close_previous : false, 912 inline : true 913 }, { 914 input_color : v.color, 915 func : v.func, 916 theme_url : this.url 917 }); 918 }, 919 920 _mceCodeEditor : function(ui, val) { 921 var ed = this.editor; 922 923 ed.windowManager.open({ 924 url : tinymce.baseURL + '/themes/advanced/source_editor.htm', 925 width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)), 926 height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)), 927 inline : true, 928 resizable : true, 929 maximizable : true 930 }, { 931 theme_url : this.url 932 }); 933 }, 934 935 _mceImage : function(ui, val) { 936 var ed = this.editor; 937 938 ed.windowManager.open({ 939 url : tinymce.baseURL + '/themes/advanced/image.htm', 940 width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)), 941 height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)), 942 inline : true 943 }, { 944 theme_url : this.url 945 }); 946 }, 947 948 _mceLink : function(ui, val) { 949 var ed = this.editor; 950 951 ed.windowManager.open({ 952 url : tinymce.baseURL + '/themes/advanced/link.htm', 953 width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)), 954 height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)), 955 inline : true 956 }, { 957 theme_url : this.url 958 }); 959 }, 960 961 _mceNewDocument : function() { 962 var ed = this.editor; 963 964 ed.windowManager.confirm('advanced.newdocument', function(s) { 965 if (s) 966 ed.execCommand('mceSetContent', false, ''); 967 }); 968 }, 969 970 _mceForeColor : function() { 971 var t = this; 972 973 this._mceColorPicker(0, { 974 func : function(co) { 975 t.editor.execCommand('ForeColor', false, co); 976 } 977 }); 978 }, 979 980 _mceBackColor : function() { 981 var t = this; 982 983 this._mceColorPicker(0, { 984 func : function(co) { 985 t.editor.execCommand('HiliteColor', false, co); 986 } 987 }); 988 } 989 }); 990 991 tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme); 992 }()); 1 (function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,extend=tinymce.extend,each=tinymce.each,Cookie=tinymce.util.Cookie,lastExtID;tinymce.ThemeManager.requireLangPack('advanced');tinymce.create('tinymce.themes.AdvancedTheme',{controls:{bold:['bold_desc','Bold'],italic:['italic_desc','Italic'],underline:['underline_desc','Underline'],strikethrough:['striketrough_desc','Strikethrough'],justifyleft:['justifyleft_desc','JustifyLeft'],justifycenter:['justifycenter_desc','JustifyCenter'],justifyright:['justifyright_desc','JustifyRight'],justifyfull:['justifyfull_desc','JustifyFull'],bullist:['bullist_desc','InsertUnorderedList'],numlist:['numlist_desc','InsertOrderedList'],outdent:['outdent_desc','Outdent'],indent:['indent_desc','Indent'],cut:['cut_desc','Cut'],copy:['copy_desc','Copy'],paste:['paste_desc','Paste'],undo:['undo_desc','Undo'],redo:['redo_desc','Redo'],link:['link_desc','mceLink'],unlink:['unlink_desc','unlink'],image:['image_desc','mceImage'],cleanup:['cleanup_desc','mceCleanup'],help:['help_desc','mceHelp'],code:['code_desc','mceCodeEditor'],hr:['hr_desc','InsertHorizontalRule'],removeformat:['removeformat_desc','RemoveFormat'],sub:['sub_desc','subscript'],sup:['sup_desc','superscript'],forecolor:['forecolor_desc','ForeColor'],forecolorpicker:['forecolor_desc','mceForeColor'],backcolor:['backcolor_desc','HiliteColor'],backcolorpicker:['backcolor_desc','mceBackColor'],charmap:['charmap_desc','mceCharMap'],visualaid:['visualaid_desc','mceToggleVisualAid'],anchor:['anchor_desc','mceInsertAnchor'],newdocument:['newdocument_desc','mceNewDocument'],blockquote:['blockquote_desc','mceBlockQuote']},stateControls:['bold','italic','underline','strikethrough','bullist','numlist','justifyleft','justifycenter','justifyright','justifyfull','sub','sup','blockquote'],init:function(ed,url){var t=this,s;t.editor=ed;t.url=url;t.onResolveName=new tinymce.util.Dispatcher(this);t.settings=s=extend({theme_advanced_path:true,theme_advanced_toolbar_location:'bottom',theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,|,sub,sup,|,charmap",theme_advanced_blockformats:"p,address,pre,h1,h2,h3,h4,h5,h6",theme_advanced_toolbar_align:"center",theme_advanced_fonts:"Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",theme_advanced_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);if(s.theme_advanced_path_location)s.theme_advanced_statusbar_location=s.theme_advanced_path_location;if(s.theme_advanced_statusbar_location=='none')s.theme_advanced_statusbar_location=0;ed.onInit.add(function(){ed.onNodeChange.add(t._nodeChanged,t);ed.dom.loadCSS(ed.baseURI.toAbsolute("themes/advanced/skins/"+ed.settings.skin+"/content.css"));});ed.onSetProgressState.add(function(ed,b,ti){var co,id=ed.id,tb;if(b){t.progressTimer=setTimeout(function(){co=ed.getContainer();co=co.insertBefore(DOM.create('DIV',{style:'position:relative'}),co.firstChild);tb=DOM.get(ed.id+'_tbl');DOM.add(co,'div',{id:id+'_blocker','class':'mceBlocker',style:{width:tb.clientWidth+2,height:tb.clientHeight+2}});DOM.add(co,'div',{id:id+'_progress','class':'mceProgress',style:{left:tb.clientWidth/ 2, top : tb.clientHeight /2}});},ti||0);}else{DOM.remove(id+'_blocker');DOM.remove(id+'_progress');clearTimeout(t.progressTimer);}});DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));},createControl:function(n,cf){var cd,c;if(c=cf.createControl(n))return c;switch(n){case"styleselect":return this._createStyleSelect();case"formatselect":return this._createBlockFormats();case"fontselect":return this._createFontSelect();case"fontsizeselect":return this._createFontSizeSelect();case"forecolor":return this._createForeColorMenu();case"backcolor":return this._createBackColorMenu();}if((cd=this.controls[n]))return cf.createButton(n,{title:"advanced."+cd[0],cmd:cd[1],ui:cd[2],value:cd[3]});},execCommand:function(cmd,ui,val){var f=this['_'+cmd];if(f){f.call(this,ui,val);return true;}return false;},_importClasses:function(){var ed=this.editor,c=ed.controlManager.get('styleselect');if(c.getLength()==0){each(ed.dom.getClasses(),function(o){c.add(o['class'],o['class']);});}},_createStyleSelect:function(n){var t=this,ed=t.editor,cf=ed.controlManager,c=cf.createListBox('styleselect',{title:'advanced.style_select',onselect:function(v){if(c.selectedValue===v){ed.execCommand('mceSetStyleInfo',0,{command:'removeformat'});c.select();return false;}else ed.execCommand('mceSetCSSClass',0,v);}});each((t.settings.theme_advanced_styles||'').split(';'),function(v){var p=v.split('=');if(v)c.add(t.editor.translate(p[0]),p[1]);});c.onPostRender.add(function(ed,n){Event.add(n,'focus',t._importClasses,t);Event.add(n,'mousedown',t._importClasses,t);});return c;},_createFontSelect:function(){var c,t=this;c=t.editor.controlManager.createListBox('fontselect',{title:'advanced.fontdefault',cmd:'FontName'});each(t.settings.theme_advanced_fonts.split(';'),function(v){var p=v.split('='),st;if(p[1].indexOf('dings')==-1)st='font-family:'+p[1];c.add(t.editor.translate(p[0]),p[1],{style:st});});return c;},_createFontSizeSelect:function(){var c,t=this,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=t.editor.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});each(t.settings.theme_advanced_font_sizes.split(','),function(v){c.add(lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'fontSize'+v});});return c;},_createBlockFormats:function(){var c,fmts={p:'advanced.paragraph',address:'advanced.address',pre:'advanced.pre',h1:'advanced.h1',h2:'advanced.h2',h3:'advanced.h3',h4:'advanced.h4',h5:'advanced.h5',h6:'advanced.h6',div:'advanced.div',blockquote:'advanced.blockquote',code:'advanced.code',dt:'advanced.dt',dd:'advanced.dd',samp:'advanced.samp'},t=this;c=t.editor.controlManager.createListBox('formatselect',{title:'advanced.block',cmd:'FormatBlock'});each(t.settings.theme_advanced_blockformats.split(','),function(v){c.add(t.editor.translate(fmts[v]),v,{element:v,'class':v.indexOf('h')==0?'':'preview'});});return c;},_createForeColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_text_colors)o.colors=v;o.title='advanced.forecolor_desc';o.cmd='ForeColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('forecolor',o);return c;},_createBackColorMenu:function(){var c,t=this,s=t.settings,o={},v;if(s.theme_advanced_more_colors){o.more_colors_func=function(){t._mceColorPicker(0,{color:c.value,func:function(co){c.setColor(co);}});};}if(v=s.theme_advanced_background_colors)o.colors=v;o.title='advanced.backcolor_desc';o.cmd='HiliteColor';o.scope=this;c=t.editor.controlManager.createColorSplitButton('backcolor',o);return c;},renderUI:function(o){var n,ic,tb,t=this,ed=t.editor,s=t.settings,sc,p,nl;n=p=DOM.create('div',{id:ed.id+'_parent','class':'mceEditor '+ed.settings.skin+'Skin'});if(!DOM.boxModel)n=DOM.add(n,'div',{'class':'mceOldBoxModel'});n=sc=DOM.add(n,'table',{id:ed.id+'_tbl','class':'mceLayout',cellSpacing:0,cellPadding:0});n=tb=DOM.add(n,'tbody');switch((s.theme_advanced_layout_manager||'').toLowerCase()){case"rowlayout":ic=t._rowLayout(s,tb,o);break;case"customlayout":ic=ed.execCallback("theme_advanced_custom_layout",s,tb,o,p);break;default:ic=t._simpleLayout(s,tb,o,p);}n=o.targetNode;nl=sc.rows;DOM.addClass(nl[0],'first');DOM.addClass(nl[nl.length-1],'last');each(DOM.select('tr',tb),function(n){DOM.addClass(n.firstChild,'first');DOM.addClass(n.childNodes[n.childNodes.length-1],'last');});if(DOM.get(s.theme_advanced_toolbar_container))DOM.get(s.theme_advanced_toolbar_container).appendChild(p);else DOM.insertAfter(p,n);Event.add(ed.id+'_path_row','click',function(e){e=e.target;if(e.nodeName=='A'){t._sel(e.href.replace(/^[^#]*#/,''));return Event.cancel(e);}});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))Event.add(DOM.add(p,'a',{href:'#'},'<!-- IE -->'),'focus',function(){tinyMCE.get(ed.id).focus();});if(s.theme_advanced_toolbar_location=='external')o.deltaHeight=0;t.deltaHeight=o.deltaHeight;o.targetNode=null;return{iframeContainer:ic,editorContainer:ed.id+'_parent',sizeContainer:sc,deltaHeight:o.deltaHeight};},getInfo:function(){return{longname:'Simple theme',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}},_simpleLayout:function(s,tb,o,p){var t=this,ed=t.editor,lo=s.theme_advanced_toolbar_location,sl=s.theme_advanced_statusbar_location,n,ic,etb,c;if(lo=='top')t._addToolbars(tb,o);if(lo=='external'){n=c=DOM.create('div',{style:'position:relative'});n=DOM.add(n,'div',{id:ed.id+'_external','class':'mceExternalToolbar'});DOM.add(n,'a',{id:ed.id+'_external_close',href:'javascript:;','class':'mceExternalClose'});n=DOM.add(n,'table',{id:ed.id+'_tblext',cellSpacing:0,cellPadding:0});etb=DOM.add(n,'tbody');if(p.firstChild.className=='mceOldBoxModel')p.firstChild.appendChild(c);else p.insertBefore(c,p.firstChild);t._addToolbars(etb,o);ed.onMouseUp.add(function(){var e=DOM.get(ed.id+'_external');DOM.show(e);DOM.hide(lastExtID);var f=Event.add(ed.id+'_external_close','click',function(){DOM.hide(ed.id+'_external');Event.remove(ed.id+'_external_close','click',f);});DOM.show(e);DOM.setStyle(e,'top',0-DOM.getRect(ed.id+'_tblext').h-1);DOM.hide(e);DOM.show(e);e.style.filter='';lastExtID=ed.id+'_external';e=null;});}if(sl=='top')t._addStatusBar(tb,o);if(!s.theme_advanced_toolbar_container){n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});}if(lo=='bottom')t._addToolbars(tb,o);if(sl=='bottom')t._addStatusBar(tb,o);return ic;},_rowLayout:function(s,tb,o){var t=this,ed=t.editor,dc,da,cf=ed.controlManager,n,ic,to;dc=s.theme_advanced_containers_default_class||'';da=s.theme_advanced_containers_default_align||'center';each((s.theme_advanced_containers||'').split(','),function(c,i){var v=s['theme_advanced_container_'+c]||'';switch(c.toLowerCase()){case'mceeditor':n=DOM.add(tb,'tr');n=ic=DOM.add(n,'td',{'class':'mceIframeContainer'});break;case'mceelementpath':t._addStatusBar(tb,o);break;default:n=DOM.add(DOM.add(tb,'tr'),'td',{'class':'mceToolbar '+(s['theme_advanced_container_'+c+'_class']||dc),align:s['theme_advanced_container_'+c+'_align']||da});to=cf.createToolbar("toolbar"+i);t._addControls(v,to);DOM.setHTML(n,to.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}});return ic;},_addControls:function(v,tb){var t=this,s=t.settings,di,cf=t.editor.controlManager;if(s.theme_advanced_disable&&!t._disabled){di={};each(s.theme_advanced_disable.split(','),function(v){di[v]=1;});t._disabled=di;}else di=t._disabled;each(v.split(','),function(n){var c;if(di&&di[n])return;if(n=='tablecontrols'){each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"],function(n){n=t.createControl(n,cf);if(n)tb.add(n);});return;}c=t.createControl(n,cf);if(c)tb.add(c);});},_addToolbars:function(c,o){var t=this,i,tb,ed=t.editor,s=t.settings,v,cf=ed.controlManager,di,n,h=[];n=DOM.add(DOM.add(c,'tr'),'td',{'class':'mceToolbar',align:s.theme_advanced_toolbar_align});if(!ed.getParam('accessibility_focus')||ed.getParam('tab_focus'))h.push(DOM.createHTML('a',{href:'#',onfocus:'tinyMCE.get(\''+ed.id+'\').focus();'},'<!-- IE -->'));h.push(DOM.createHTML('a',{href:'#',accesskey:'q',title:ed.getLang("advanced.toolbar_focus")},'<!-- IE -->'));for(i=1;(v=s['theme_advanced_buttons'+i]);i++){tb=cf.createToolbar("toolbar"+i,{'class':'mceToolbarRow'+i});if(s['theme_advanced_buttons'+i+'_add'])v+=','+s['theme_advanced_buttons'+i+'_add'];if(s['theme_advanced_buttons'+i+'_add_before'])v=s['theme_advanced_buttons'+i+'_add_before']+','+v;t._addControls(v,tb);h.push(tb.renderHTML());o.deltaHeight-=s.theme_advanced_row_height;}h.push(DOM.createHTML('a',{href:'#',accesskey:'z',title:ed.getLang("advanced.toolbar_focus"),onfocus:'tinyMCE.getInstanceById(\''+ed.id+'\').focus();'},'<!-- IE -->'));DOM.setHTML(n,h.join(''));},_addStatusBar:function(tb,o){var n,t=this,ed=t.editor,s=t.settings,r,mf,me,td;n=DOM.add(tb,'tr');n=td=DOM.add(n,'td',{'class':'mceStatusbar'});n=DOM.add(n,'div',{id:ed.id+'_path_row'},s.theme_advanced_path?ed.translate('advanced.path')+': ':' ');DOM.add(n,'a',{href:'#',accesskey:'x'});if(s.theme_advanced_resizing&&!tinymce.isOldWebKit){DOM.add(td,'a',{id:ed.id+'_resize',href:'javascript:;',onclick:"return false;",'class':'resize'});if(s.theme_advanced_resizing_use_cookie){ed.onPostRender.add(function(){var o=Cookie.getHash("TinyMCE_"+ed.id+"_size"),c=DOM.get(ed.id+'_tbl');if(!o)return;if(s.theme_advanced_resize_horizontal)c.style.width=o.cw+'px';c.style.height=o.ch+'px';DOM.get(ed.id+'_ifr').style.height=(parseInt(o.ch)+t.deltaHeight)+'px';});}ed.onPostRender.add(function(){Event.add(ed.id+'_resize','mousedown',function(e){var c,p,w,h,n,pa;c=DOM.get(ed.id+'_tbl');w=c.clientWidth;h=c.clientHeight;miw=s.theme_advanced_resizing_min_width||100;mih=s.theme_advanced_resizing_min_height||100;maw=s.theme_advanced_resizing_max_width||0xFFFF;mah=s.theme_advanced_resizing_max_height||0xFFFF;p=DOM.add(DOM.get(ed.id+'_parent'),'div',{'class':'mcePlaceHolder'});DOM.setStyles(p,{width:w,height:h});DOM.hide(c);DOM.show(p);r={x:e.screenX,y:e.screenY,w:w,h:h,dx:null,dy:null};mf=Event.add(document,'mousemove',function(e){var w,h;r.dx=e.screenX-r.x;r.dy=e.screenY-r.y;w=Math.max(miw,r.w+r.dx);h=Math.max(mih,r.h+r.dy);w=Math.min(maw,w);h=Math.min(mah,h);if(s.theme_advanced_resize_horizontal)p.style.width=w+'px';p.style.height=h+'px';return Event.cancel(e);});me=Event.add(document,'mouseup',function(e){var ifr;Event.remove(document,'mousemove',mf);Event.remove(document,'mouseup',me);c.style.display='';DOM.remove(p);if(r.dx===null)return;ifr=DOM.get(ed.id+'_ifr');if(s.theme_advanced_resize_horizontal)c.style.width=(r.w+r.dx)+'px';c.style.height=(r.h+r.dy)+'px';ifr.style.height=(ifr.clientHeight+r.dy)+'px';if(s.theme_advanced_resizing_use_cookie){Cookie.setHash("TinyMCE_"+ed.id+"_size",{cw:r.w+r.dx,ch:r.h+r.dy});}});return Event.cancel(e);});});}o.deltaHeight-=21;n=tb=null;},_nodeChanged:function(ed,cm,n,co){var t=this,p,de=0,v,c,s=t.settings;tinymce.each(t.stateControls,function(c){cm.setActive(c,ed.queryCommandState(t.controls[c][1]));});cm.setActive('visualaid',ed.hasVisual);cm.setDisabled('undo',!ed.undoManager.hasUndo()&&!ed.typing);cm.setDisabled('redo',!ed.undoManager.hasRedo());cm.setDisabled('outdent',!ed.queryCommandState('Outdent'));p=DOM.getParent(n,'A');if(c=cm.get('link')){if(!p||!p.name){c.setDisabled(!p&&co);c.setActive(!!p);}}if(c=cm.get('unlink')){c.setDisabled(!p&&co);c.setActive(!!p&&!p.name);}if(c=cm.get('anchor')){c.setActive(!!p&&p.name);if(tinymce.isWebKit){p=DOM.getParent(n,'IMG');c.setActive(!!p&&DOM.getAttrib(p,'mce_name')=='a');}}p=DOM.getParent(n,'IMG');if(c=cm.get('image'))c.setActive(!!p&&n.className.indexOf('mceItem')==-1);if(c=cm.get('styleselect')){if(n.className){t._importClasses();c.select(n.className);}else c.select();}if(c=cm.get('formatselect')){p=DOM.getParent(n,DOM.isBlock);if(p)c.select(p.nodeName.toLowerCase());}if(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(ed.queryCommandValue('FontSize'));if(s.theme_advanced_path&&s.theme_advanced_statusbar_location){p=DOM.get(ed.id+'_path')||DOM.add(ed.id+'_path_row','span',{id:ed.id+'_path'});DOM.setHTML(p,'');ed.dom.getParent(n,function(n){var na=n.nodeName.toLowerCase(),u,pi,ti='';if(n.nodeType!=1||(DOM.hasClass(n,'mceItemHidden')||DOM.hasClass(n,'mceItemRemoved')))return;if(v=DOM.getAttrib(n,'mce_name'))na=v;if(tinymce.isIE&&n.scopeName!=='HTML')na=n.scopeName+':'+na;na=na.replace(/mce\:/g,'');switch(na){case'b':na='strong';break;case'i':na='em';break;case'img':if(v=DOM.getAttrib(n,'src'))ti+='src: '+v+' ';break;case'a':if(v=DOM.getAttrib(n,'name')){ti+='name: '+v+' ';na+='#'+v;}if(v=DOM.getAttrib(n,'href'))ti+='href: '+v+' ';break;case'font':if(s.convert_fonts_to_spans)na='span';if(v=DOM.getAttrib(n,'face'))ti+='font: '+v+' ';if(v=DOM.getAttrib(n,'size'))ti+='size: '+v+' ';if(v=DOM.getAttrib(n,'color'))ti+='color: '+v+' ';break;case'span':if(v=DOM.getAttrib(n,'style'))ti+='style: '+v+' ';break;}if(v=DOM.getAttrib(n,'id'))ti+='id: '+v+' ';if(v=n.className){v=v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g,'');if(v&&v.indexOf('mceItem')==-1){ti+='class: '+v+' ';if(DOM.isBlock(n)||na=='img'||na=='span')na+='.'+v;}}na=na.replace(/(html:)/g,'');na={name:na,node:n,title:ti};t.onResolveName.dispatch(t,na);ti=na.title;na=na.name;pi=DOM.create('a',{'href':"#"+(de++)+"",onmousedown:"return false;",title:ti},na);if(p.hasChildNodes()){p.insertBefore(document.createTextNode(' \u00bb '),p.firstChild);p.insertBefore(pi,p.firstChild);}else p.appendChild(pi);},ed.getBody());}},_sel:function(v){this.editor.execCommand('mceSelectNodeDepth',false,v);},_mceInsertAnchor:function(ui,v){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/anchor.htm',width:320+parseInt(ed.getLang('advanced.anchor_delta_width',0)),height:90+parseInt(ed.getLang('advanced.anchor_delta_height',0)),inline:true},{theme_url:this.url});},_mceCharMap:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/charmap.htm',width:550+parseInt(ed.getLang('advanced.charmap_delta_width',0)),height:250+parseInt(ed.getLang('advanced.charmap_delta_height',0)),inline:true},{theme_url:this.url});},_mceHelp:function(){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/about.htm',width:480,height:380,inline:true},{theme_url:this.url});},_mceColorPicker:function(u,v){var ed=this.editor;v=v||{};ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/color_picker.htm',width:375+parseInt(ed.getLang('advanced.colorpicker_delta_width',0)),height:250+parseInt(ed.getLang('advanced.colorpicker_delta_height',0)),close_previous:false,inline:true},{input_color:v.color,func:v.func,theme_url:this.url});},_mceCodeEditor:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/source_editor.htm',width:parseInt(ed.getParam("theme_advanced_source_editor_width",720)),height:parseInt(ed.getParam("theme_advanced_source_editor_height",580)),inline:true,resizable:true,maximizable:true},{theme_url:this.url});},_mceImage:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/image.htm',width:355+parseInt(ed.getLang('advanced.image_delta_width',0)),height:275+parseInt(ed.getLang('advanced.image_delta_height',0)),inline:true},{theme_url:this.url});},_mceLink:function(ui,val){var ed=this.editor;ed.windowManager.open({url:tinymce.baseURL+'/themes/advanced/link.htm',width:310+parseInt(ed.getLang('advanced.link_delta_width',0)),height:200+parseInt(ed.getLang('advanced.link_delta_height',0)),inline:true},{theme_url:this.url});},_mceNewDocument:function(){var ed=this.editor;ed.windowManager.confirm('advanced.newdocument',function(s){if(s)ed.execCommand('mceSetContent',false,'');});},_mceForeColor:function(){var t=this;this._mceColorPicker(0,{func:function(co){t.editor.execCommand('ForeColor',false,co);}});},_mceBackColor:function(){var t=this;this._mceColorPicker(0,{func:function(co){t.editor.execCommand('HiliteColor',false,co);}});}});tinymce.ThemeManager.add('advanced',tinymce.themes.AdvancedTheme);}()); -
trunk/wp-includes/js/tinymce/themes/advanced/image.htm
r6632 r6694 3 3 <head> 4 4 <title>{#advanced_dlg.image_title}</title> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="../../utils/mctabs.js"></script> 7 7 <script type="text/javascript" src="../../utils/form_utils.js"></script> 8 8 <script type="text/javascript" src="js/image.js"></script> 9 <base target="_self" /> 9 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('src').focus();},500);});</script> 10 <base target="_self" /> 10 11 </head> 11 12 <body id="image" style="display: none"> … … 75 76 <div class="mceActionPanel"> 76 77 <div style="float: left"> 77 <input type="button" id=" insert" name="insert" value="{#insert}" onclick="ImageDialog.update();" />78 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 78 79 </div> 79 80 80 81 <div style="float: right"> 81 <input type=" button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />82 <input type="submit" id="insert" name="insert" value="{#insert}" onclick="ImageDialog.update();" /> 82 83 </div> 83 84 </div> -
trunk/wp-includes/js/tinymce/themes/advanced/js/charmap.js
r6632 r6694 307 307 window.focus(); 308 308 309 tinyMCEPopup.editor.focus(); 309 310 tinyMCEPopup.close(); 310 311 } -
trunk/wp-includes/js/tinymce/themes/advanced/link.htm
r6632 r6694 3 3 <head> 4 4 <title>{#advanced_dlg.link_title}</title> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="../../utils/mctabs.js"></script> 7 7 <script type="text/javascript" src="../../utils/form_utils.js"></script> 8 8 <script type="text/javascript" src="../../utils/validate.js"></script> 9 9 <script type="text/javascript" src="js/link.js"></script> 10 <base target="_self" /> 10 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('href').focus();},500);});</script> 11 <base target="_self" /> 11 12 </head> 12 13 <body id="link" style="display: none"> … … 53 54 <div class="mceActionPanel"> 54 55 <div style="float: left"> 55 <input type="button" id=" insert" name="insert" value="{#insert}" onclick="LinkDialog.update();" />56 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 56 57 </div> 57 58 58 59 <div style="float: right"> 59 <input type=" button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />60 <input type="submit" id="insert" name="insert" value="{#insert}" onclick="LinkDialog.update();" /> 60 61 </div> 61 62 </div> -
trunk/wp-includes/js/tinymce/themes/advanced/skins/default/content.css
r6632 r6694 1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; }1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px; } 2 2 body {background:#FFF;} 3 3 .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;} -
trunk/wp-includes/js/tinymce/themes/advanced/skins/default/ui.css
r6632 r6694 1 1 /* Reset */ 2 .defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline}2 .defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .text {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate} 3 3 .defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} 4 4 .defaultSkin table td {vertical-align:middle} … … 24 24 .defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC} 25 25 .defaultSkin .mceStatusbar {position:relative; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; padding:2px; color:#000; display:block} 26 .defaultSkin .mceStatusbar a.resize {display:block; position:absolute; top:0; right:0; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px }26 .defaultSkin .mceStatusbar a.resize {display:block; position:absolute; top:0; right:0; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} 27 27 .defaultSkin .mceStatusbar a:hover {text-decoration:underline} 28 28 .defaultSkin table.mceToolbar {margin-left:3px} -
trunk/wp-includes/js/tinymce/themes/advanced/skins/o2k7/content.css
r6632 r6694 1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; }1 body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;} 2 2 body {background:#FFF;} 3 3 .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceVisualAid {border: 1px dashed #BBB;} -
trunk/wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
r6632 r6694 1 1 /* Reset */ 2 .o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline}2 .o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .text {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate} 3 3 .o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000} 4 4 .o2k7Skin table td {vertical-align:middle} … … 22 22 .o2k7Skin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px;} 23 23 .o2k7Skin .mceStatusbar div {float:left; padding:2px;} 24 .o2k7Skin .mceStatusbar a.resize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px }24 .o2k7Skin .mceStatusbar a.resize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize} 25 25 .o2k7Skin .mceStatusbar a:hover {text-decoration:underline} 26 26 .o2k7Skin table.mceToolbar {margin-left:3px} -
trunk/wp-includes/js/tinymce/themes/advanced/source_editor.htm
r6632 r6694 3 3 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 4 4 <title>{#advanced_dlg.code_title}</title> 5 5 <script type="text/javascript" src="../../tiny_mce_popup.js"></script> 6 6 <script type="text/javascript" src="js/source_editor.js"></script> 7 <base target="_self" /> 7 <script type="text/javascript">tinyMCEPopup.onInit.add(function(){window.setTimeout(function(){document.getElementById('htmlSource').focus();},500);});</script> 8 <base target="_self" /> 8 9 </head> 9 10 <body onresize="resizeInputs();" style="display:none; overflow:hidden;"> … … 21 22 <div class="mceActionPanel"> 22 23 <div style="float: left"> 23 <input type="button" name=" insert" value="{#update}" onclick="saveContent();" id="insert" />24 <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" /> 24 25 </div> 25 26 26 27 <div style="float: right"> 27 <input type=" button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />28 <input type="submit" name="insert" value="{#update}" onclick="saveContent();" id="insert" /> 28 29 </div> 29 30 </div> -
trunk/wp-includes/js/tinymce/tiny_mce.js
r6632 r6694 1 2 /* file:jscripts/tiny_mce/classes/tinymce.js */ 3 4 var tinymce = { 5 majorVersion : '3', 6 minorVersion : '0rc2', 7 releaseDate : '2008-01-xx', 8 9 _init : function() { 10 var t = this, ua = navigator.userAgent, i, nl, n, base; 11 12 // Browser checks 13 t.isOpera = window.opera && opera.buildNumber; 14 t.isWebKit = /WebKit/.test(ua); 15 t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt; 16 t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName); 17 t.isIE6 = t.isIE && /MSIE [56]/.test(ua); 18 t.isGecko = !t.isWebKit && /Gecko/.test(ua); 19 // t.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua); 20 t.isMac = ua.indexOf('Mac') != -1; 21 22 // TinyMCE .NET webcontrol might be setting the values for TinyMCE 23 if (window.tinyMCEPreInit) { 24 t.suffix = tinyMCEPreInit.suffix; 25 t.baseURL = tinyMCEPreInit.base; 26 return; 27 } 28 29 // Get suffix and base 30 t.suffix = ''; 31 32 // If base element found, add that infront of baseURL 33 nl = document.getElementsByTagName('base'); 34 for (i=0; i<nl.length; i++) { 35 if (nl[i].href) 36 base = nl[i].href; 37 } 38 39 function getBase(n) { 40 if (n.src && /tiny_mce(|_dev|_src|_gzip|_jquery|_prototype).js/.test(n.src)) { 41 if (/_(src|dev)\.js/g.test(n.src)) 42 t.suffix = '_src'; 43 44 t.baseURL = n.src.substring(0, n.src.lastIndexOf('/')); 45 46 // If path to script is relative and a base href was found add that one infront 47 if (base && t.baseURL.indexOf('://') == -1) 48 t.baseURL = base + t.baseURL; 49 50 return t.baseURL; 51 } 52 53 return null; 54 }; 55 56 // Check document 57 nl = document.getElementsByTagName('script'); 58 for (i=0; i<nl.length; i++) { 59 if (getBase(nl[i])) 60 return; 61 } 62 63 // Check head 64 n = document.getElementsByTagName('head')[0]; 65 if (n) { 66 nl = n.getElementsByTagName('script'); 67 for (i=0; i<nl.length; i++) { 68 if (getBase(nl[i])) 69 return; 70 } 71 } 72 73 return; 74 }, 75 76 is : function(o, t) { 77 var n = typeof(o); 78 79 if (!t) 80 return n != 'undefined'; 81 82 if (t == 'array' && (o instanceof Array)) 83 return true; 84 85 return n == t; 86 }, 87 88 // #if !jquery 89 90 each : function(o, cb, s) { 91 var n, l; 92 93 if (!o) 94 return 0; 95 96 s = s || o; 97 98 if (typeof(o.length) != 'undefined') { 99 // Indexed arrays, needed for Safari 100 for (n=0, l = o.length; n<l; n++) { 101 if (cb.call(s, o[n], n, o) === false) 102 return 0; 103 } 104 } else { 105 // Hashtables 106 for (n in o) { 107 if (o.hasOwnProperty(n)) { 108 if (cb.call(s, o[n], n, o) === false) 109 return 0; 110 } 111 } 112 } 113 114 return 1; 115 }, 116 117 map : function(a, f) { 118 var o = []; 119 120 tinymce.each(a, function(v) { 121 o.push(f(v)); 122 }); 123 124 return o; 125 }, 126 127 grep : function(a, f) { 128 var o = []; 129 130 tinymce.each(a, function(v) { 131 if (!f || f(v))<