Ticket #36482: 36482.10.patch
File 36482.10.patch, 1.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/editor-expand.js
16 16 $textTop = $( '#ed_toolbar' ), 17 17 $textEditor = $( '#content' ), 18 18 textEditor = $textEditor[0], 19 textEditorLength = 0,19 oldTextLength = 0, 20 20 $bottom = $( '#post-status-info' ), 21 21 $menuBar = $(), 22 22 $statusBar = $(), … … 76 76 } 77 77 78 78 function textEditorResize() { 79 var reduce, scrollHeight;80 81 79 if ( mceEditor && ! mceEditor.isHidden() ) { 82 80 return; 83 81 } … … 86 84 return; 87 85 } 88 86 89 reduce = textEditorLength > ( textEditorLength = textEditor.value.length ); 90 scrollHeight = textEditor.scrollHeight; 87 var length = textEditor.value.length; 91 88 92 if ( reduce ) { 89 if ( length < oldTextLength ) { 90 var oldHeight = textEditor.scrollHeight; 91 // textEditor.scrollHeight is not adjusted until the next line. 93 92 textEditor.style.height = 'auto'; 94 textEditor.style.height = scrollHeight + 'px'; 93 94 if ( textEditor.scrollHeight >= autoresizeMinHeight ) { 95 textEditor.style.height = textEditor.scrollHeight + 'px'; 96 adjust(); 97 } else { 98 textEditor.style.height = autoresizeMinHeight + 'px'; 99 100 if ( oldHeight !== autoresizeMinHeight ) { 101 adjust(); 102 } 103 } 104 } else if ( parseInt( textEditor.style.height, 10 ) < textEditor.scrollHeight ) { 105 textEditor.style.height = textEditor.scrollHeight + 'px'; 95 106 adjust(); 96 } else if ( parseInt( textEditor.style.height, 10 ) < scrollHeight ) {97 textEditor.style.height = scrollHeight + 'px';98 adjust();99 107 } 108 109 oldTextLength = length; 100 110 } 101 111 102 112 // We need to wait for TinyMCE to initialize.