diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js --- a/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js Tue Dec 15 13:49:49 2020 +0100 @@ -61,13 +61,13 @@ if ( ! body || ( e && e.type === 'setcontent' && e.initial ) || isFullscreen() ) { if ( body && docElm ) { body.style.overflowY = 'auto'; - docElm.style.overflowY = 'auto'; // Old IE + docElm.style.overflowY = 'auto'; // Old IE. } return; } - // Calculate outer height of the body element using CSS styles + // Calculate outer height of the body element using CSS styles. marginTop = editor.dom.getStyle( body, 'margin-top', true ); marginBottom = editor.dom.getStyle( body, 'margin-bottom', true ); paddingTop = editor.dom.getStyle( body, 'padding-top', true ); @@ -83,36 +83,36 @@ myHeight = docElm.offsetHeight; } - // Make sure we have a valid height + // Make sure we have a valid height. if ( isNaN( myHeight ) || myHeight <= 0 ) { - // Get height differently depending on the browser used + // Get height differently depending on the browser used. myHeight = tinymce.Env.ie ? body.scrollHeight : ( tinymce.Env.webkit && body.clientHeight === 0 ? 0 : body.offsetHeight ); } - // Don't make it smaller than the minimum height + // Don't make it smaller than the minimum height. if ( myHeight > settings.autoresize_min_height ) { resizeHeight = myHeight; } - // If a maximum height has been defined don't exceed this height + // If a maximum height has been defined don't exceed this height. if ( settings.autoresize_max_height && myHeight > settings.autoresize_max_height ) { resizeHeight = settings.autoresize_max_height; body.style.overflowY = 'auto'; - docElm.style.overflowY = 'auto'; // Old IE + docElm.style.overflowY = 'auto'; // Old IE. } else { body.style.overflowY = 'hidden'; - docElm.style.overflowY = 'hidden'; // Old IE + docElm.style.overflowY = 'hidden'; // Old IE. body.scrollTop = 0; } - // Resize content element + // Resize content element. if (resizeHeight !== oldSize) { deltaSize = resizeHeight - oldSize; DOM.setStyle( editor.iframeElement, 'height', resizeHeight + 'px' ); oldSize = resizeHeight; - // WebKit doesn't decrease the size of the body element until the iframe gets resized - // So we need to continue to resize the iframe down until the size gets fixed + // WebKit doesn't decrease the size of the body element until the iframe gets resized. + // So we need to continue to resize the iframe down until the size gets fixed. if ( tinymce.isWebKit && deltaSize < 0 ) { resize( e ); } @@ -137,17 +137,17 @@ }, interval ); } - // Define minimum height + // Define minimum height. settings.autoresize_min_height = parseInt(editor.getParam( 'autoresize_min_height', editor.getElement().offsetHeight), 10 ); - // Define maximum height + // Define maximum height. settings.autoresize_max_height = parseInt(editor.getParam( 'autoresize_max_height', 0), 10 ); function on() { if ( ! editor.dom.hasClass( editor.getBody(), 'wp-autoresize' ) ) { isActive = true; editor.dom.addClass( editor.getBody(), 'wp-autoresize' ); - // Add appropriate listeners for resizing the content area + // Add appropriate listeners for resizing the content area. editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize ); resize(); } @@ -156,20 +156,20 @@ function off() { var doc; - // Don't turn off if the setting is 'on' + // Don't turn off if the setting is 'on'. if ( ! settings.wp_autoresize_on ) { isActive = false; doc = editor.getDoc(); editor.dom.removeClass( editor.getBody(), 'wp-autoresize' ); editor.off( 'nodechange setcontent keyup FullscreenStateChanged', resize ); doc.body.style.overflowY = 'auto'; - doc.documentElement.style.overflowY = 'auto'; // Old IE + doc.documentElement.style.overflowY = 'auto'; // Old IE. oldSize = 0; } } if ( settings.wp_autoresize_on ) { - // Turn resizing on when the editor loads + // Turn resizing on when the editor loads. isActive = true; editor.on( 'init', function() { @@ -184,24 +184,24 @@ if ( editor.getParam( 'autoresize_on_init', true ) ) { editor.on( 'init', function() { - // Hit it 10 times in 200 ms intervals + // Hit it 10 times in 200 ms intervals. wait( 10, 200, function() { - // Hit it 5 times in 1 sec intervals + // Hit it 5 times in 1 sec intervals. wait( 5, 1000 ); }); }); } } - // Reset the stored size + // Reset the stored size. editor.on( 'show', function() { oldSize = 0; }); - // Register the command + // Register the command. editor.addCommand( 'wpAutoResize', resize ); - // On/off + // On/off. editor.addCommand( 'wpAutoResizeOn', on ); editor.addCommand( 'wpAutoResizeOff', off ); });