Ticket #21718: 21718.patch
File 21718.patch, 8.2 KB (added by , 12 years ago) |
---|
-
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-includes/class-wp-editor.php
28 28 private function __construct() {} 29 29 30 30 public static function parse_settings($editor_id, $settings) { 31 $editor_height = (int) get_user_setting( $editor_id . '_ed_size', 200 ); // default height 32 $editor_height < 50 ? 50 : $editor_height; // min height (for TinyMCE) 33 31 34 $set = wp_parse_args( $settings, array( 32 35 'wpautop' => true, // use wpautop? 33 36 'media_buttons' => true, // show insert/upload button(s) 34 37 '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="..."38 'editor_height' => $editor_height, // editor height in px (replaces textarea rows) 36 39 'tabindex' => '', 37 40 'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE 38 41 'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped". … … 67 70 $set = self::parse_settings($editor_id, $settings); 68 71 $editor_class = ' class="' . trim( $set['editor_class'] . ' wp-editor-area' ) . '"'; 69 72 $tabindex = $set['tabindex'] ? ' tabindex="' . (int) $set['tabindex'] . '"' : ''; 70 $ rows = ' rows="' . (int) $set['textarea_rows'] . '"';73 $editor_height = ' style="height: ' . (int) $set['editor_height'] . 'px;"'; 71 74 $switch_class = 'html-active'; 72 75 $toolbar = $buttons = ''; 73 76 … … 116 119 echo "</div>\n"; 117 120 } 118 121 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>');122 $the_editor = apply_filters('the_editor', '<div id="wp-' . $editor_id . '-editor-container" class="wp-editor-container"><textarea' . $editor_class . $editor_height . $tabindex . ' cols="40" name="' . $set['textarea_name'] . '" id="' . $editor_id . '">%s</textarea></div>'); 120 123 $content = apply_filters('the_editor_content', $content); 121 124 122 125 printf($the_editor, $content); … … 287 290 'theme_advanced_statusbar_location' => 'bottom', 288 291 'theme_advanced_resizing' => true, 289 292 'theme_advanced_resize_horizontal' => false, 293 'theme_advanced_resizing_use_cookie' => false, 290 294 'dialog_type' => 'modal', 291 295 'formats' => "{ 292 296 alignleft : [ … … 553 557 ?> 554 558 555 559 <script type="text/javascript"> 560 var wpActiveEditor; 561 556 562 (function(){ 557 var init, ed, qt, first_init, mce = <?php echo wp_default_editor() == 'tinymce' ? 'true' : 'false'; ?>;563 var init, ed, qt, first_init, DOM, el, i, mce = <?php 558 564 565 if ( ( self::$has_tinymce && wp_default_editor() == 'tinymce' ) || !self::$has_quicktags ) 566 echo 'true;'; 567 else 568 echo 'false;'; 569 570 ?>; 571 559 572 if ( typeof(tinymce) == 'object' ) { 573 DOM = tinymce.DOM; 560 574 // mark wp_theme/ui.css as loaded 561 tinymce.DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true;575 DOM.files[tinymce.baseURI.getURI() + '/themes/advanced/skins/wp_theme/ui.css'] = true; 562 576 577 DOM.events.add( DOM.select('.wp-editor-wrap'), 'mousedown', function(e){ 578 if ( this.id ) 579 wpActiveEditor = this.id.slice(3, -5); 580 }); 581 563 582 for ( ed in tinyMCEPreInit.mceInit ) { 564 583 if ( first_init ) { 565 584 init = tinyMCEPreInit.mceInit[ed] = tinymce.extend( {}, first_init, tinyMCEPreInit.mceInit[ed] ); … … 570 589 if ( mce ) 571 590 try { tinymce.init(init); } catch(e){} 572 591 } 592 } else { 593 el = document.getElementsByClassName('wp-editor-wrap'); 594 for ( i in el ) { 595 if ( typeof(el[i]) == 'object' ) 596 el[i].onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); } 597 } 573 598 } 574 599 575 600 if ( typeof(QTags) == 'function' ) { … … 578 603 } 579 604 } 580 605 })(); 606 <?php 581 607 582 var wpActiveEditor;583 584 jQuery('.wp-editor-wrap').mousedown(function(e){585 wpActiveEditor = this.id.slice(3, -5);586 });587 588 <?php589 590 608 if ( self::$ext_plugins ) 591 609 echo self::$ext_plugins . "\n"; 592 610 593 611 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 <?php612 ?> 613 (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');}});})(); 614 <?php 597 615 } 598 616 599 617 if ( !is_admin() ) 600 618 echo 'var ajaxurl = "' . admin_url( 'admin-ajax.php', 'relative' ) . '";'; 601 ?>602 </script>603 <?php604 619 620 ?> 621 </script> 622 <?php 623 605 624 if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) ) 606 625 self::wp_link_dialog(); 607 626 -
wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
3 3 */ 4 4 5 5 (function() { 6 var DOM = tinymce.DOM ;6 var DOM = tinymce.DOM, win = window; 7 7 8 8 tinymce.create('tinymce.plugins.WordPress', { 9 9 mceTout : 0, … … 234 234 } 235 235 }); 236 236 237 // resize TinyMCE to match the textarea height when switching Text -> Visual 238 ed.onLoadContent.add( function(ed, o) { 239 var height, tb_height, ifr_height, txt = ed.getElement(), 240 ed_toolbar = DOM.select('#'+ed.id + '_tbl tr.mceFirst'); 241 242 if ( txt && txt.style && txt.style.height ) 243 height = parseInt( txt.style.height, 10 ); 244 245 if ( ed_toolbar && ed_toolbar[0] ) 246 tb_height = ed_toolbar[0].clientHeight; 247 248 if ( height && tb_height ) { 249 ifr_height = height - tb_height + 13; // compensate for the 10px padding in the textarea 250 251 DOM.setStyle( DOM.get(ed.id + '_tbl'), 'height', '' ); 252 DOM.setStyle( DOM.get(ed.id + '_ifr'), 'height', ifr_height ); 253 if ( win.setUserSetting ) 254 win.setUserSetting( ed.id + '_ed_size', height ); 255 } 256 }); 257 258 // resize the textarea to match TinyMCE's height when switching Visual -> Text 259 ed.onSaveContent.add( function(ed, o) { 260 var height = DOM.get(ed.id+'_tbl').clientHeight; 261 262 if ( height && height > 84 ) { 263 height -= 34; 264 DOM.setStyle( ed.getElement(), 'height', height ); 265 266 if ( win.setUserSetting ) 267 win.setUserSetting( ed.id + '_ed_size', height ); 268 } 269 }); 270 271 // save on uoload 272 DOM.bind(win, 'unload', function(e){ 273 var height = document.getElementById('wp-'+ed.id+'-editor-container').clientHeight; 274 275 if ( document.getElementById(ed.id).clientHeight ) 276 height -= 35; 277 else 278 height -= 34; 279 280 if ( !win.setUserSetting || height < 50 ) 281 return; 282 283 win.setUserSetting( ed.id + '_ed_size', height ); 284 }); 285 237 286 /* disable for now 238 287 ed.onBeforeSetContent.add(function(ed, o) { 239 288 o.content = t._setEmbed(o.content);