Ticket #32197: 32197.2.patch
File 32197.2.patch, 2.3 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 pageYOffset, 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 pageYOffset = window.pageYOffset 132 124 133 $textEditorClone.width( $textEditor.width() - 22 );134 $textEditorClone.text( $textEditor.val() + ' ' );125 textEditor = $textEditor[0]; 126 height = textEditor.style.height; 135 127 136 hiddenHeight = $textEditorClone.height(); 128 textEditor.style.height = 'auto'; 129 textEditor.style.height = textEditor.scrollHeight + 'px'; 137 130 138 if ( hiddenHeight < autoresizeMinHeight ) { 139 hiddenHeight = autoresizeMinHeight; 140 } 131 window.scrollTo( window.pageXOffset, pageYOffset ); 141 132 142 if ( h iddenHeight === textEditorHeight ) {143 return;133 if ( height !== textEditor.style.height ) { 134 adjust(); 144 135 } 145 146 $textEditor.height( hiddenHeight );147 148 adjust();149 136 } 150 137 151 138 // We need to wait for TinyMCE to initialize. … … 603 590 $textEditor.css( { 604 591 marginTop: heights.textTopHeight 605 592 } ); 606 607 $textEditorClone.width( contentWrapWidth - 20 - ( borderWidth * 2 ) );608 593 } 609 594 } 610 595 }