Changeset 4206
- Timestamp:
- 09/22/06 07:04:41 (2 years ago)
- Files:
-
- trunk/wp-admin/admin-functions.php (modified) (1 diff)
- trunk/wp-admin/inline-uploading.php (modified) (2 diffs)
- trunk/wp-admin/wp-admin.css (modified) (5 diffs)
- trunk/wp-includes/general-template.php (modified) (5 diffs)
- trunk/wp-includes/js/autosave.js.php (modified) (2 diffs)
- trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js (modified) (6 diffs)
- trunk/wp-includes/js/tinymce/tiny_mce_config.php (modified) (2 diffs)
- trunk/wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-functions.php
r4202 r4206 1251 1251 } 1252 1252 1253 function the_quicktags() {1254 echo '1255 <div id="quicktags">1256 ';1257 wp_print_scripts( 'quicktags' );1258 echo ' <script type="text/javascript">1259 //<![CDATA[1260 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) edToolbar();1261 //]]>1262 </script>1263 </div>1264 ';1265 echo '1266 <script type="text/javascript">1267 function edInsertContent(myField, myValue) {1268 //IE support1269 if (document.selection) {1270 myField.focus();1271 sel = document.selection.createRange();1272 sel.text = myValue;1273 myField.focus();1274 }1275 //MOZILLA/NETSCAPE support1276 else if (myField.selectionStart || myField.selectionStart == "0") {1277 var startPos = myField.selectionStart;1278 var endPos = myField.selectionEnd;1279 myField.value = myField.value.substring(0, startPos)1280 + myValue1281 + myField.value.substring(endPos, myField.value.length);1282 myField.focus();1283 myField.selectionStart = startPos + myValue.length;1284 myField.selectionEnd = startPos + myValue.length;1285 } else {1286 myField.value += myValue;1287 myField.focus();1288 }1289 }1290 </script>1291 ';1292 }1293 1294 1253 function get_broken_themes() { 1295 1254 global $wp_broken_themes; trunk/wp-admin/inline-uploading.php
r4144 r4206 411 411 if (!win) win = top; 412 412 tinyMCE = win.tinyMCE; 413 richedit = ( typeof tinyMCE == 'object' && tinyMCE.configs.length > 0 );414 413 function sendToEditor(n) { 415 414 o = document.getElementById('div'+n); … … 421 420 h = h.replace(new RegExp('<IMG', 'g'), '<img'); // Lowercase again 422 421 h = h.replace(new RegExp('(<img .+?")>', 'g'), '$1 />'); // XHTML 423 if ( richedit)422 if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) 424 423 win.tinyMCE.execCommand('mceInsertContent', false, h); 425 424 else trunk/wp-admin/wp-admin.css
r4196 r4206 1 * html #poststuff {1 z* html #poststuff { 2 2 height: 100%; /* kill peekaboo bug in IE */ 3 3 } … … 491 491 } 492 492 493 #quicktags {494 margin-left: -1px;495 }496 497 493 #currenttheme img { 498 494 float: left; … … 513 509 } 514 510 511 #postdivrich #quicktags { 512 background: #f0f0ee; 513 padding: 0px; 514 border: 1px solid #ccc; 515 border-bottom: none; 516 } 517 #postdiv #quicktags { 518 padding-right: 6px; 519 } 520 #postdivrich #quicktags { 521 display: none; 522 } 523 #quicktags #ed_toolbar { 524 padding: 0px 2px; 525 } 526 527 #ed_toolbar input { 528 background: #fff url( images/fade-butt.png ) repeat-x 0px -2px; 529 margin: 3px 2px 2px; 530 } 531 515 532 #quicktags #ed_strong { 516 533 font-weight: bold; … … 532 549 #quicktags #ed_code { 533 550 font-family: "Courier New", Courier, mono; 551 margin-bottom: 3px; 534 552 } 535 553 … … 1119 1137 margin-left: 2em; 1120 1138 } 1139 #postdivrich #edButtons { 1140 padding-left: 3px; 1141 } 1142 #postdivrich #content, #postdivrich #content:active { 1143 border: 1px solid #ccc; 1144 } 1145 #edButtons input, #edButtons input:active { 1146 margin: 0px 2px -1px; 1147 } 1148 #edButtons input.edButtonFore, #edButtons input.edButtonFore:active { 1149 background: #f0f0ee; 1150 border-bottom: 1px solid #f0f0ee; 1151 } 1152 #edButtons input.edButtonBack, #edButtons input.edButtonBack:active { 1153 background: #fff url( images/fade-butt.png ) repeat-x 0px 15px; 1154 border-bottom: 1px solid #ccc; 1155 } trunk/wp-includes/general-template.php
r4172 r4206 736 736 } 737 737 738 /**739 * Places a textarea according to the current user's preferences, filled with $content.740 * Also places a script block that enables tabbing between Title and Content.741 *742 * @param string Editor contents743 * @param string (optional) Previous form field's ID (for tabbing support)744 */745 738 function the_editor($content, $id = 'content', $prev_id = 'title') { 746 739 $rows = get_option('default_post_edit_rows'); … … 750 743 $rows = "rows='$rows'"; 751 744 752 the_quicktags(); 753 754 if ( user_can_richedit() ) 745 if ( user_can_richedit() ) : 755 746 add_filter('the_editor_content', 'wp_richedit_pre'); 747 748 // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. 749 ?> 750 <!--[if IE]><style type="text/css"> 751 #postdivrich table, #postdivrich #quicktags {border-top: none;} 752 #quicktags {border-bottom: none; padding-bottom: 2px; margin-bottom: -1px;} 753 #edButtons {border-bottom: 1px solid #ccc;} 754 </style><![endif]--> 755 <div id='edButtons' style='display:none;'> 756 <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> 757 <input id='edButtonPreview' class='edButtonFore' type='button' value='<?php _e('Compose'); ?>' /> 758 <input id='edButtonHTML' class='edButtonBack' type='button' value='<?php _e('HTML'); ?>' onclick='switchEditors("<?php echo $id; ?>")' /> 759 </div> 760 <script type="text/javascript"> 761 if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) 762 document.getElementById('edButtons').style.display = 'block'; 763 </script> 764 765 <?php endif; ?> 766 <div id="quicktags"> 767 <?php wp_print_scripts( 'quicktags' ); ?> 768 <script type="text/javascript">edToolbar()</script> 769 </div> 770 <script type="text/javascript"> 771 if ( typeof tinyMCE != "undefined" && tinyMCE.configs.length > 0 ) 772 document.getElementById("quicktags").style.display="none"; 773 774 function edInsertContent(myField, myValue) { 775 //IE support 776 if (document.selection) { 777 myField.focus(); 778 sel = document.selection.createRange(); 779 sel.text = myValue; 780 myField.focus(); 781 } 782 //MOZILLA/NETSCAPE support 783 else if (myField.selectionStart || myField.selectionStart == "0") { 784 var startPos = myField.selectionStart; 785 var endPos = myField.selectionEnd; 786 myField.value = myField.value.substring(0, startPos) 787 + myValue 788 + myField.value.substring(endPos, myField.value.length); 789 myField.focus(); 790 myField.selectionStart = startPos + myValue.length; 791 myField.selectionEnd = startPos + myValue.length; 792 } else { 793 myField.value += myValue; 794 myField.focus(); 795 } 796 } 797 </script> 798 <?php 756 799 757 800 $the_editor = apply_filters('the_editor', "<div><textarea class='mceEditor' $rows cols='40' name='$id' tabindex='2' id='$id'>%s</textarea></div>\n"); … … 764 807 //<!-- 765 808 edCanvas = document.getElementById('<?php echo $id; ?>'); 766 <?php if ( user_can_richedit() ) : ?>809 <?php if ( $prev_id && user_can_richedit() ) : ?> 767 810 // This code is meant to allow tabbing from Title to Post (TinyMCE). 768 811 if ( tinyMCE.isMSIE ) … … 771 814 e = e ? e : window.event; 772 815 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 773 var i = tinyMCE. selectedInstance;816 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 774 817 if(typeof i == 'undefined') 775 818 return true; 776 tinyMCE.execCommand("mceStartTyping");819 tinyMCE.execCommand("mceStartTyping"); 777 820 this.blur(); 778 821 i.contentWindow.focus(); … … 786 829 e = e ? e : window.event; 787 830 if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 788 var i = tinyMCE. selectedInstance;831 var i = tinyMCE.getInstanceById('<?php echo $id; ?>'); 789 832 if(typeof i == 'undefined') 790 833 return true; 791 tinyMCE.execCommand("mceStartTyping");834 tinyMCE.execCommand("mceStartTyping"); 792 835 this.blur(); 793 836 i.contentWindow.focus(); trunk/wp-includes/js/autosave.js.php
r4185 r4206 73 73 function autosave() { 74 74 var form = $('post'); 75 var rich = tinyMCE.getInstanceById('content') ? true : false; 75 76 76 77 autosaveAjax = new sack(); 77 78 78 79 /* Gotta do this up here so we can check the length when tinyMCE is in use */ 79 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {80 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 80 81 autosaveAjax.setVar("content", form.content.value); 81 82 } else { … … 111 112 autosaveAjax.setVar("excerpt", form.excerpt.value); 112 113 113 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 ) {114 if ( typeof tinyMCE == "undefined" || tinyMCE.configs.length < 1 || rich == false ) { 114 115 autosaveAjax.setVar("content", form.content.value); 115 116 } else { trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
r4101 r4206 39 39 + '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />' 40 40 + '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />' 41 + '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'42 41 + '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpHelp\',false);" />' 43 + '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'wpAdv\',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 44 + '</div>'; 45 45 return buttons+hiddenControls; … … 242 242 // Remove anonymous, empty paragraphs. 243 243 content = content.replace(new RegExp('<p>(\\s| )*</p>', 'mg'), ''); 244 244 245 245 // Handle table badness. 246 246 content = content.replace(new RegExp('<(table( [^>]*)?)>.*?<((tr|thead)( [^>]*)?)>', 'mg'), '<$1><$3>'); … … 249 249 content = content.replace(new RegExp('</tr>.*?<(tr|/table)>', 'mg'), '</tr><$1>'); 250 250 content = content.replace(new RegExp('<(/?(table|tbody|tr|th|td)[^>]*)>(\\s*|(<br ?/?>)*)*', 'g'), '<$1>'); 251 251 252 252 // Pretty it up for the source editor. 253 253 var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre|p'; 254 254 content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n'); 255 content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)> \\s*', 'mg'), '\n<$1>');255 content = content.replace(new RegExp('\\s*<(('+blocklist+')[^>]*)>', 'mg'), '\n<$1>'); 256 256 content = content.replace(new RegExp('<((li|/?tr|/?thead|/?tfoot)( [^>]*)?)>', 'g'), '\t<$1>'); 257 257 content = content.replace(new RegExp('<((td|th)( [^>]*)?)>', 'g'), '\t\t<$1>'); … … 295 295 296 296 // Get it ready for wpautop. 297 content = content.replace(new RegExp(' [\\s]*<p>[\\s]*', 'mgi'), '');298 content = content.replace(new RegExp(' [\\s]*</p>[\\s]*', 'mgi'), '\n\n');299 content = content.replace(new RegExp('\\n\\s*\\n \\s*\\n*', 'mgi'), '\n\n');297 content = content.replace(new RegExp('\\s*<p>', 'mgi'), ''); 298 content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n'); 299 content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n'); 300 300 content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n'); 301 301 … … 310 310 content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1'); 311 311 312 // Trim any whitespace 313 content = content.replace(new RegExp('^\\s*', ''), ''); 312 // Trim trailing whitespace 314 313 content = content.replace(new RegExp('\\s*$', ''), ''); 315 314 … … 469 468 } 470 469 } 470 471 function switchEditors(id) { 472 var inst = tinyMCE.getInstanceById(id); 473 var qt = document.getElementById('quicktags'); 474 var H = document.getElementById('edButtonHTML'); 475 var P = document.getElementById('edButtonPreview'); 476 var pdr = document.getElementById('postdivrich'); 477 var ta = document.getElementById(id); 478 479 if ( inst ) { 480 edToggle(H, P); 481 482 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 483 // IE rejects the later overflow assignment so we skip this step. 484 // Alternate code might be nice. Until then, IE reflows. 485 } else { 486 // Lock the fieldset's height to prevent reflow/flicker 487 pdr.style.height = pdr.clientHeight + 'px'; 488 pdr.style.overflow = 'hidden'; 489 } 490 491 // Save the coords of the bottom right corner of the rich editor 492 var table = document.getElementById(inst.editorId + '_parent').getElementsByTagName('table')[0]; 493 var y1 = table.offsetTop + table.offsetHeight; 494 495 // Unload the rich editor 496 inst.triggerSave(false, false); 497 htm = inst.formElement.value; 498 tinyMCE.removeMCEControl(id); 499 document.getElementById(id).value = htm; 500 --tinyMCE.idCounter; 501 502 // Reveal Quicktags and textarea 503 qt.style.display = 'block'; 504 ta.style.display = 'inline'; 505 506 // Set the textarea height to match the rich editor 507 y2 = ta.offsetTop + ta.offsetHeight; 508 ta.style.height = (ta.clientHeight + y1 - y2) + 'px'; 509 510 // Tweak the widths 511 ta.parentNode.style.paddingRight = '2px'; 512 513 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 514 } else { 515 // Unlock the fieldset's height 516 pdr.style.height = 'auto'; 517 pdr.style.overflow = 'display'; 518 } 519 } else { 520 edToggle(P, H); 521 edCloseAllTags(); // :-( 522 523 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 524 } else { 525 // Lock the fieldset's height 526 pdr.style.height = pdr.clientHeight + 'px'; 527 pdr.style.overflow = 'hidden'; 528 } 529 530 // Hide Quicktags and textarea 531 qt.style.display = 'none'; 532 ta.style.display = 'none'; 533 534 // Tweak the widths 535 ta.parentNode.style.paddingRight = '0px'; 536 537 // Load the rich editor with formatted html 538 if ( tinyMCE.isMSIE ) { 539 ta.value = wpautop(ta.value); 540 tinyMCE.addMCEControl(ta, id); 541 } else { 542 htm = wpautop(ta.value); 543 tinyMCE.addMCEControl(ta, id); 544 tinyMCE.getInstanceById(id).execCommand('mceSetContent', null, htm); 545 } 546 547 if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 548 } else { 549 // Unlock the fieldset's height 550 pdr.style.height = 'auto'; 551 pdr.style.overflow = 'display'; 552 } 553 } 554 } 555 556 function edToggle(A, B) { 557 A.className = 'edButtonFore'; 558 B.className = 'edButtonBack'; 559 560 B.onclick = A.onclick; 561 A.onclick = null; 562 } 563 564 function wpautop(pee) { 565 pee = pee + "\n\n"; 566 pee = pee.replace(new RegExp('<br />\\s*<br />', 'gi'), "\n\n"); 567 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"); 568 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"); 569 pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n"); 570 pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n"); 571 pee = pee.replace(new RegExp('\n*([^\Z]+?)\\n{2}', 'mg'), "<p>$1</p>\n"); 572 pee = pee.replace(new RegExp('<p>\\s*?</p>', 'gi'), ''); 573 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"); 574 pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1"); 575 pee = pee.replace(new RegExp('<p><blockquote([^>]*)>', 'gi'), "<blockquote$1><p>"); 576 pee = pee.replace(new RegExp('</blockquote></p>', 'gi'), '</p></blockquote>'); 577 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"); 578 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"); 579 pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 580 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"); 581 pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 582 pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); 583 //pee = pee.replace(new RegExp('(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' "); // Hmm... 584 return pee; 585 } trunk/wp-includes/js/tinymce/tiny_mce_config.php
r4080 r4206 22 22 23 23 // Set up init variables 24 $valid_elements = 'p/-div[*],- b[*],-font[*],-ul[*],-ol[*],-li[*],*[*]';24 $valid_elements = 'p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]'; 25 25 $valid_elements = apply_filters('mce_valid_elements', $valid_elements); 26 26 … … 29 29 $plugins = implode($plugins, ','); 30 30 31 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', ' code', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end'));31 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'separator', 'bullist', 'numlist', 'outdent', 'indent', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'separator', 'link', 'unlink', 'image', 'wp_more', 'separator', 'spellchecker', 'separator', 'wp_help', 'wp_adv_start', 'wp_adv', 'separator', 'formatselect', 'underline', 'justifyfull', 'forecolor', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo', 'wp_adv_end')); 32 32 $mce_buttons = implode($mce_buttons, ','); 33 33 trunk/wp-includes/script-loader.php
r4188 r4206 16 16 $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' ); 17 17 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 18 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '0 8152006' );19 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '0 4162006' );18 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '09212006' ); 19 $this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' ); 20 20 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); 21 $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4 183');21 $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206'); 22 22 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187'); 23 23 $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187');
