Changeset 38487
- Timestamp:
- 08/31/2016 11:12:55 PM (8 years ago)
- Location:
- branches/4.6
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.6
-
branches/4.6/src/wp-admin/js/editor-expand.js
r37684 r38487 54 54 }; 55 55 56 var shrinkTextarea = window._.throttle( function() { 57 var x = window.scrollX || document.documentElement.scrollLeft; 58 var y = window.scrollY || document.documentElement.scrollTop; 59 var height = parseInt( textEditor.style.height, 10 ); 60 61 textEditor.style.height = autoresizeMinHeight + 'px'; 62 63 if ( textEditor.scrollHeight > autoresizeMinHeight ) { 64 textEditor.style.height = textEditor.scrollHeight + 'px'; 65 } 66 67 if ( typeof x !== 'undefined' ) { 68 window.scrollTo( x, y ); 69 } 70 71 if ( textEditor.scrollHeight < height ) { 72 adjust(); 73 } 74 }, 300 ); 75 76 function textEditorResize() { 77 var length = textEditor.value.length; 78 79 if ( mceEditor && ! mceEditor.isHidden() ) { 80 return; 81 } 82 83 if ( ! mceEditor && initialMode === 'tinymce' ) { 84 return; 85 } 86 87 if ( length < oldTextLength ) { 88 shrinkTextarea(); 89 } else if ( parseInt( textEditor.style.height, 10 ) < textEditor.scrollHeight ) { 90 textEditor.style.height = Math.ceil( textEditor.scrollHeight ) + 'px'; 91 adjust(); 92 } 93 94 oldTextLength = length; 95 } 96 56 97 function getHeights() { 57 98 var windowWidth = $window.width(); … … 74 115 heights.menuBarHeight = 0; 75 116 } 76 }77 78 function textEditorResize() {79 if ( mceEditor && ! mceEditor.isHidden() ) {80 return;81 }82 83 if ( ! mceEditor && initialMode === 'tinymce' ) {84 return;85 }86 87 var length = textEditor.value.length;88 var height = parseInt( textEditor.style.height, 10 );89 var top = window.scrollTop;90 91 if ( length < oldTextLength ) {92 // textEditor.scrollHeight is not adjusted until the next line.93 textEditor.style.height = 'auto';94 95 if ( textEditor.scrollHeight > autoresizeMinHeight ) {96 textEditor.style.height = textEditor.scrollHeight + 'px';97 } else {98 textEditor.style.height = autoresizeMinHeight + 'px';99 }100 101 // Prevent scroll-jumping in Firefox and IE.102 window.scrollTop = top;103 104 if ( textEditor.scrollHeight < height ) {105 adjust();106 }107 } else if ( height < textEditor.scrollHeight ) {108 textEditor.style.height = textEditor.scrollHeight + 'px';109 adjust();110 }111 112 oldTextLength = length;113 117 } 114 118 -
branches/4.6/src/wp-includes/script-loader.php
r38339 r38487 564 564 ) ); 565 565 566 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );566 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); 567 567 568 568 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.