Ticket #36482: 36482.6.patch
File 36482.6.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; 78 var height; 79 var length; 80 var scrollHeight; 80 81 81 82 if ( mceEditor && ! mceEditor.isHidden() ) { 82 83 return; … … 86 87 return; 87 88 } 88 89 89 reduce = textEditorLength > ( textEditorLength = textEditor.value.length);90 scrollHeight = textEditor.scrollHeight;90 height = parseInt( textEditor.style.height, 10 ); 91 length = textEditor.value.length; 91 92 92 if ( reduce) {93 if ( length < textEditorResize.oldLength ) { 93 94 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'; 95 scrollHeight = textEditor.scrollHeight; 96 97 if ( scrollHeight < autoresizeMinHeight ) { 98 textEditor.style.height = autoresizeMinHeight + 'px'; 99 } else { 100 textEditor.style.height = scrollHeight + 'px'; 101 } 102 103 // When reducing the height, scroll up the difference. 104 if ( scrollHeight - height < 0 ) { 105 window.scrollBy( 0, scrollHeight - height ); 106 } 107 98 108 adjust(); 109 } else { 110 scrollHeight = textEditor.scrollHeight; 111 112 if ( height < scrollHeight ) { 113 textEditor.style.height = scrollHeight + 'px'; 114 adjust(); 115 } 99 116 } 117 118 textEditorResize.oldLength = length; 100 119 } 101 120 102 121 // We need to wait for TinyMCE to initialize.