Ticket #36482: 36482.7.patch
File 36482.7.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,20 19 $bottom = $( '#post-status-info' ), 21 20 $menuBar = $(), 22 21 $statusBar = $(), … … 76 75 } 77 76 78 77 function textEditorResize() { 79 var reduce, scrollHeight;80 81 78 if ( mceEditor && ! mceEditor.isHidden() ) { 82 79 return; 83 80 } … … 86 83 return; 87 84 } 88 85 89 reduce = textEditorLength > ( textEditorLength = textEditor.value.length);90 scrollHeight = textEditor.scrollHeight;86 var height = parseInt( textEditor.style.height, 10 ); 87 var length = textEditor.value.length; 91 88 92 if ( reduce ) { 89 // If there's less characters, we have to remove the height to know the scrollHeight. 90 if ( length < textEditorResize.oldLength && height > autoresizeMinHeight ) { 93 91 textEditor.style.height = 'auto'; 94 textEditor.style.height = scrollHeight + 'px'; 95 adjust(); 96 } else if ( parseInt( textEditor.style.height, 10 ) < scrollHeight ) { 97 textEditor.style.height = scrollHeight + 'px'; 92 } 93 94 var scrollHeight = textEditor.scrollHeight; 95 96 if ( scrollHeight !== height ) { 97 if ( scrollHeight < autoresizeMinHeight ) { 98 textEditor.style.height = autoresizeMinHeight + 'px'; 99 } else { 100 textEditor.style.height = scrollHeight + 'px'; 101 } 102 103 if ( scrollHeight - height < 0 ) { 104 window.scrollBy( 0, scrollHeight - height ); 105 } 106 98 107 adjust(); 99 108 } 109 110 textEditorResize.oldLength = length; 100 111 } 101 112 102 113 // We need to wait for TinyMCE to initialize.