Ticket #5674: tmce3_extra.patch
File tmce3_extra.patch, 14.5 KB (added by , 17 years ago) |
---|
-
wp-admin/js/post.js
178 178 } ); 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 } -
wp-admin/wp-admin.css
370 370 width: 100%; 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; 376 377 } 377 378 379 #editorcontainer { 380 padding: 6px; 381 } 382 378 383 #currenttheme img { 379 384 float: left; 380 385 border: 1px solid #666; … … 394 399 } 395 400 396 401 #postdivrich #quicktags { 397 background: # f0f0ee;402 background: #cee1ef; 398 403 padding: 0; 399 border: 1px solid #ccc; 400 border-bottom: none; 404 border: 0 none; 401 405 } 402 406 403 407 #postdiv #quicktags { … … 1178 1182 padding: 2px; 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; 1184 1188 border-right: 1px solid #ccc; … … 1188 1192 } 1189 1193 1190 1194 #poststuff .postarea { 1191 margin-left: 20px;1192 1195 margin-right: 8px; 1193 1196 } 1194 1197 … … 1223 1226 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; 1229 1232 float: right; … … 1235 1238 background: #cee1ef; 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 1241 1245 #poststuff #media-buttons { -
wp-includes/general-template.php
928 928 if ( user_can_richedit() ) : 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> 946 947 … … 973 974 </script> 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 979 980 printf($the_editor, $the_editor_content); … … 986 987 // If tinyMCE is defined. 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; ?> 1024 1004 //--> -
wp-includes/js/autosave.js
82 82 } 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", 88 88 post_ID: jQuery("#post_ID").val() || 0, … … 93 93 }; 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) { 106 105 return; … … 122 121 if( jQuery("#excerpt")) 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) { 133 130 post_data["temp_ID"] = post_data["post_ID"]; -
wp-includes/script-loader.php
30 30 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 31 31 32 32 // Modify this version when tinyMCE plugins are changed 33 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '200801 05' );33 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20080129' ); 34 34 35 35 $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); 36 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '200801 05' );36 $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20080129' ); 37 37 38 38 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); 39 39