Ticket #32197: 32197.patch
File 32197.patch, 2.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
15 15 $visualEditor = $(), 16 16 $textTop = $( '#ed_toolbar' ), 17 17 $textEditor = $( '#content' ), 18 $textEditorClone = $( '<div id="content-textarea-clone"></div>' ),19 18 $bottom = $( '#post-status-info' ), 20 19 $menuBar = $(), 21 20 $statusBar = $(), … … 52 51 sideSortablesHeight: 0 53 52 }; 54 53 55 $textEditorClone.insertAfter( $textEditor );56 57 $textEditorClone.css( {58 'font-family': $textEditor.css( 'font-family' ),59 'font-size': $textEditor.css( 'font-size' ),60 'line-height': $textEditor.css( 'line-height' ),61 'white-space': 'pre-wrap',62 'word-wrap': 'break-word'63 } );64 65 54 function getHeights() { 66 55 var windowWidth = $window.width(); 67 56 … … 85 74 } 86 75 87 76 function textEditorKeyup( event ) { 77 return; 78 88 79 var VK = jQuery.ui.keyCode, 89 80 key = event.keyCode, 90 81 range = document.createRange(), … … 123 114 } 124 115 125 116 function textEditorResize() { 117 var htmlTop, bodyTop, textEditor, height; 118 126 119 if ( ( mceEditor && ! mceEditor.isHidden() ) || ( ! mceEditor && initialMode === 'tinymce' ) ) { 127 120 return; 128 121 } 129 122 130 var textEditorHeight = $textEditor.height(),131 hiddenHeight;123 htmlTop = document.documentElement.scrollTop; 124 bodyTop = document.body.scrollTop; 132 125 133 $textEditorClone.width( $textEditor.width() - 22 );134 $textEditorClone.text( $textEditor.val() + ' ' );126 textEditor = $textEditor[0]; 127 height = textEditor.style.height; 135 128 136 hiddenHeight = $textEditorClone.height(); 129 textEditor.style.height = 'auto'; 130 textEditor.style.height = textEditor.scrollHeight + 'px'; 137 131 138 if ( hiddenHeight < autoresizeMinHeight ) { 139 hiddenHeight = autoresizeMinHeight; 140 } 132 document.documentElement.scrollTop = htmlTop; 133 document.body.scrollTop = bodyTop; 141 134 142 if ( h iddenHeight === textEditorHeight ) {143 return;135 if ( height !== textEditor.style.height ) { 136 adjust(); 144 137 } 145 146 $textEditor.height( hiddenHeight );147 148 adjust();149 138 } 150 139 151 140 // We need to wait for TinyMCE to initialize. … … 603 592 $textEditor.css( { 604 593 marginTop: heights.textTopHeight 605 594 } ); 606 607 $textEditorClone.width( contentWrapWidth - 20 - ( borderWidth * 2 ) );608 595 } 609 596 } 610 597 }