Changeset 38426
- Timestamp:
- 08/28/2016 06:40:00 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/editor-expand.js
r37684 r38426 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 -
trunk/src/wp-includes/script-loader.php
r38411 r38426 555 555 ) ); 556 556 557 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );557 $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); 558 558 559 559 $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.