Changeset 22007 for trunk/wp-includes/class-wp-editor.php
- Timestamp:
- 09/26/2012 03:30:21 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-editor.php
r21961 r22007 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 … … 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 } … … 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 = ''; 92 93 if ( ! empty( $set['editor_height'] ) ) 94 $height = ' style="height: ' . $set['editor_height'] . 'px"'; 95 else 96 $height = ' rows="' . $set['textarea_rows'] . '"'; 73 97 74 98 if ( !current_user_can( 'upload_files' ) ) … … 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 … … 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); … … 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; 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 }); 562 599 563 600 for ( ed in tinyMCEPreInit.mceInit ) { … … 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 … … 579 622 } 580 623 })(); 581 582 var wpActiveEditor; 583 584 jQuery('.wp-editor-wrap').mousedown(function(e){ 585 wpActiveEditor = this.id.slice(3, -5); 586 }); 587 588 <?php 624 <?php 589 625 590 626 if ( self::$ext_plugins ) … … 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 <?php 637 638 ?> 639 </script> 640 <?php 604 641 605 642 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) )
Note: See TracChangeset
for help on using the changeset viewer.