Ticket #21718: 21718.3.diff
File 21718.3.diff, 13.1 KB (added by , 12 years ago) |
---|
-
wp-includes/css/editor.css
1018 1018 } 1019 1019 1020 1020 /* WP specific */ 1021 .wp-editor-wrap { 1022 position: relative; 1023 } 1024 1021 1025 .wp-editor-area { 1022 1026 font-family: Consolas, Monaco, monospace; 1023 1027 padding: 10px; 1028 margin: 1px 0 0; 1024 1029 line-height: 150%; 1025 1030 border: 0 none; 1026 1031 outline: none; 1032 display: block; 1027 1033 resize: vertical; 1028 1034 -moz-box-sizing: border-box; 1029 1035 -webkit-box-sizing: border-box; -
wp-includes/class-wp-editor.php
32 32 'wpautop' => true, // use wpautop? 33 33 'media_buttons' => true, // show insert/upload button(s) 34 34 'textarea_name' => $editor_id, // set the textarea name to something different, square brackets [] can be used here 35 'textarea_rows' => get_option('default_post_edit_rows', 10), // rows="..."35 'textarea_rows' => 20, 36 36 'tabindex' => '', 37 37 'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE 38 38 'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped". … … 52 52 if ( self::$this_quicktags ) 53 53 self::$has_quicktags = true; 54 54 55 if ( empty( $set['editor_height'] ) ) 56 return $set; 57 58 if ( 'content' === $editor_id ) { 59 // A cookie (set when a user resizes the editor) overrides the height. 60 $cookie = (int) get_user_setting( 'ed_size' ); 61 62 // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't. 63 if ( ! $cookie && isset( $_COOKIE['TinyMCE_content_size'] ) ) { 64 parse_str( $_COOKIE['TinyMCE_content_size'], $cookie ); 65 $cookie = $cookie['ch']; 66 } 67 68 if ( $cookie ) 69 $set['editor_height'] = $cookie; 70 } 71 72 if ( $set['editor_height'] < 50 ) 73 $set['editor_height'] = 50; 74 55 75 return $set; 56 76 } 57 77 … … 67 87 $set = self::parse_settings($editor_id, $settings); 68 88 $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"'; 69 89 $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; 70 $rows = ' rows="' . (int) $set['textarea_rows'] . '"';71 90 $switch_class = 'html-active'; 72 91 $toolbar = $buttons = ''; 73 92 93 if ( ! empty( $set['editor_height'] ) ) 94 $height = ' style="height: ' . $set['editor_height'] . 'px"'; 95 else 96 $height = ' rows="' . $set['textarea_rows'] . '"'; 97 74 98 if ( !current_user_can( 'upload_files' ) ) 75 99 $set['media_buttons'] = false; 76 100 … … 116 140 echo "</div>\n"; 117 141 } 118 142 119 $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $ rows. $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>');143 $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $height . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>'); 120 144 $content = apply_filters('the_editor_content', $content); 121 145 122 146 printf($the_editor, $content); … … 403 427 'body_class' => $body_class 404 428 ); 405 429 430 // The main editor doesn't use the TinyMCE resizing cookie. 431 $mceInit['theme_advanced_resizing_use_cookie'] = 'content' !== $editor_id || empty( $set['editor_height'] ); 432 406 433 if ( $first_run ) 407 434 $mceInit = array_merge(self::$first_init, $mceInit); 408 435 … … 550 577 else 551 578 echo "<script type='text/javascript' src='{$baseurl}/langs/wp-langs-en.js?$version'></script>\n"; 552 579 } 580 581 $mce = ( self::$has_tinymce && wp_default_editor() == 'tinymce' ) || ! self::$has_quicktags; 553 582 ?> 554 583 555 584 <script type="text/javascript"> 585 var wpActiveEditor; 586 556 587 (function(){ 557 var init, ed, qt, first_init, mce = <?php echo wp_default_editor() == 'tinymce' ? 'true' : 'false'; ?>;588 var init, ed, qt, first_init, DOM, el, i, mce = <?php echo (int) $mce; ?>; 558 589 559 590 if ( typeof(tinymce) == 'object' ) { 591 DOM = tinymce.DOM; 560 592 // mark wp_theme/ui.css as loaded 561 tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;593 DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true; 562 594 595 DOM.events.add( DOM.select('.wp-editor-wrap'), 'mousedown', function(e){ 596 if ( this.id ) 597 wpActiveEditor = this.id.slice(3, -5); 598 }); 599 563 600 for ( ed in tinyMCEPreInit.mceInit ) { 564 601 if ( first_init ) { 565 602 init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] ); … … 570 607 if ( mce ) 571 608 try { tinymce.init(init); } catch(e){} 572 609 } 610 } else { 611 el = document.getElementsByClassName('wp-editor-wrap'); 612 for ( i in el ) { 613 if ( typeof(el[i]) == 'object' ) 614 el[i].onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); } 615 } 573 616 } 574 617 575 618 if ( typeof(QTags) == 'function' ) { … … 578 621 } 579 622 } 580 623 })(); 624 <?php 581 625 582 var wpActiveEditor;583 584 jQuery('.wp-editor-wrap').mousedown(function(e){585 wpActiveEditor = this.id.slice(3, -5);586 });587 588 <?php589 590 626 if ( self::$ext_plugins ) 591 627 echo self::$ext_plugins . "\n"; 592 628 593 629 if ( ! $compressed && $tmce_on ) { 594 ?>595 (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})();596 <?php630 ?> 631 (function(){var t=tinyMCEPreInit,sl=tinymce.ScriptLoader,ln=t.ref.language,th=t.ref.theme,pl=t.ref.plugins;sl.markDone(t.base+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'.js');sl.markDone(t.base+'/themes/'+th+'/langs/'+ln+'_dlg.js');sl.markDone(t.base+'/themes/advanced/skins/wp_theme/ui.css');tinymce.each(pl.split(','),function(n){if(n&&n.charAt(0)!='-'){sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'.js');sl.markDone(t.base+'/plugins/'+n+'/langs/'+ln+'_dlg.js');}});})(); 632 <?php 597 633 } 598 634 599 635 if ( !is_admin() ) 600 636 echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";'; 601 ?>602 </script>603 <?php604 637 638 ?> 639 </script> 640 <?php 641 605 642 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) 606 643 self::wp_link_dialog(); 607 644 -
wp-admin/js/editor.js
49 49 if ( ed && ed.isHidden() ) 50 50 return false; 51 51 52 if ( ed ) { 53 txtarea_el.style.height = ed.getContentAreaContainer().offsetHeight + 20 + 'px'; 52 if ( ed ) 54 53 ed.hide(); 55 }56 54 57 55 dom.removeClass(wrap_id, 'tmce-active'); 58 56 dom.addClass(wrap_id, 'html-active'); -
wp-admin/js/post.js
667 667 } 668 668 669 669 wptitlehint(); 670 671 // resizable textarea#content 672 (function() { 673 var textarea = $('textarea#content'), offset = null, el; 674 675 function dragging(e) { 676 textarea.height( Math.max(50, offset + e.pageY) + 'px' ); 677 return false; 678 } 679 680 function endDrag(e) { 681 var height = $('#wp-content-editor-container').height(); 682 683 textarea.focus(); 684 $(document).unbind('mousemove', dragging).unbind('mouseup', endDrag); 685 686 if ( height > 83 ) { 687 height -= 33; // compensate for toolbars, padding... 688 setUserSetting( 'ed_size', height ); 689 } 690 } 691 692 textarea.css('resize', 'none'); 693 el = $('<div id="content-resize-handle"><br></div>'); 694 $('#wp-content-wrap').append(el); 695 el.on('mousedown', function(e) { 696 offset = textarea.height() - e.pageY; 697 textarea.blur(); 698 $(document).mousemove(dragging).mouseup(endDrag); 699 return false; 700 }); 701 })(); 702 703 tinymce.onAddEditor.add(function(mce, ed){ 704 if ( ed.id != 'content' ) 705 return; 706 707 // resize TinyMCE to match the textarea height when switching Text -> Visual 708 ed.onLoadContent.add( function(ed, o) { 709 var ifr_height, height = parseInt( $('#content').css('height'), 10 ), 710 tb_height = $('#content_tbl tr.mceFirst').height(); 711 712 if ( height && !isNaN(height) && tb_height ) { 713 ifr_height = (height - tb_height) + 12; // compensate for padding in the textarea 714 715 $('#content_tbl').css('height', '' ); 716 $('#content_ifr').css('height', ifr_height + 'px' ); 717 setUserSetting( 'ed_size', height ); 718 } 719 }); 720 721 // resize the textarea to match TinyMCE's height when switching Visual -> Text 722 ed.onSaveContent.add( function(ed, o) { 723 var height = $('#content_tbl').height(); 724 725 if ( height && height > 83 ) { 726 height -= 33; 727 728 $('#content').css( 'height', height + 'px' ); 729 setUserSetting( 'ed_size', height ); 730 } 731 }); 732 733 // save on resizing TinyMCE 734 ed.onPostRender.add(function() { 735 $('#content_resize').on('mousedown.wp-mce-resize', function(e){ 736 $(document).on('mouseup.wp-mce-resize', function(e){ 737 var height = $('#wp-content-editor-container').height(); 738 739 height -= 33; 740 if ( height > 50 && height != getUserSetting( 'ed_size' ) ) 741 setUserSetting( 'ed_size', height ); 742 743 $(document).off('mouseup.wp-mce-resize'); 744 }); 745 }); 746 }); 747 }); 748 670 749 }); -
wp-admin/edit-form-advanced.php
347 347 ?> 348 348 <div id="postdivrich" class="postarea"> 349 349 350 <?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'sample-permalink,post-preview' ) ); ?>350 <?php wp_editor($post->post_content, 'content', array('dfw' => true, 'tabfocus_elements' => 'sample-permalink,post-preview', 'editor_height' => 360) ); ?> 351 351 352 352 <table id="post-status-info" cellspacing="0"><tbody><tr> 353 353 <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> -
wp-admin/press-this.php
288 288 return false; 289 289 } 290 290 291 jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button "><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>');291 jQuery('#extra-fields').html('<div class="postbox"><h2><?php _e( 'Add Photos' ); ?> <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul class="actions"><li><a href="#" id="photo-add-url" class="button button-small"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>'); 292 292 jQuery('#img_container').html(strtoappend); 293 293 <?php break; 294 294 } -
wp-admin/css/wp-admin.css
3107 3107 background: transparent url(../images/resize.gif) no-repeat scroll right bottom; 3108 3108 width: 12px; 3109 3109 cursor: se-resize; 3110 margin: 0 2px;3110 margin: 0 1px; 3111 3111 position: relative; 3112 3112 top: -2px; 3113 3113 } … … 3116 3116 top: 20px; 3117 3117 } 3118 3118 3119 #content-resize-handle { 3120 background: transparent url(../images/resize.gif) no-repeat scroll right bottom; 3121 width: 12px; 3122 cursor: se-resize; 3123 position: absolute; 3124 right: 2px; 3125 height: 19px; 3126 } 3127 3128 .press-this #content-resize-handle { 3129 bottom: 2px; 3130 } 3131 3132 .tmce-active #content-resize-handle { 3133 display: none; 3134 } 3135 3119 3136 #wp-word-count { 3120 3137 display: block; 3121 3138 padding: 2px 10px; … … 4309 4326 box-shadow: none; 4310 4327 } 4311 4328 4329 .comment-php .wp-editor-area { 4330 height: 200px; 4331 } 4332 4312 4333 .comment-ays { 4313 4334 margin-bottom: 0; 4314 4335 border-style: solid; … … 7320 7341 /* Editor/Main Column */ 7321 7342 .press-this #poststuff { 7322 7343 margin: 0 10px 10px; 7344 padding: 0; 7323 7345 } 7324 7346 7325 7347 #poststuff #editor-toolbar { … … 7415 7437 } 7416 7438 7417 7439 .press-this #extra-fields .actions { 7418 margin: - 25px -7px 0 0;7440 margin: -32px -7px 0 0; 7419 7441 } 7420 7442 7421 7443 .press-this .actions li { … … 7515 7537 margin: 5px 0; 7516 7538 padding: 0 5px; 7517 7539 border: 0 none; 7518 height: 3 57px;7540 height: 345px; 7519 7541 font-family: Consolas, Monaco, monospace; 7520 7542 font-size: 13px; 7521 7543 line-height: 19px;