Server IP : 103.119.228.120 / Your IP : 3.144.42.233 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/softaculous/sitepad/editor/site-inc/js/tinymce/plugins/wpautoresize/ |
Upload File : |
/** * plugin.js * * Copyright, Moxiecode Systems AB * Released under LGPL License. * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ // Forked for WordPress so it can be turned on/off after loading. /*global tinymce:true */ /*eslint no-nested-ternary:0 */ /** * Auto Resize * * This plugin automatically resizes the content area to fit its content height. * It will retain a minimum height, which is the height of the content area when * it's initialized. */ tinymce.PluginManager.add( 'wpautoresize', function( editor ) { var settings = editor.settings, oldSize = 300, isActive = false; if ( editor.settings.inline || tinymce.Env.iOS ) { return; } function isFullscreen() { return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen(); } function getInt( n ) { return parseInt( n, 10 ) || 0; } /** * This method gets executed each time the editor needs to resize. */ function resize( e ) { var deltaSize, doc, body, docElm, DOM = tinymce.DOM, resizeHeight, myHeight, marginTop, marginBottom, paddingTop, paddingBottom, borderTop, borderBottom; if ( ! isActive ) { return; } doc = editor.getDoc(); if ( ! doc ) { return; } e = e || {}; body = doc.body; docElm = doc.documentElement; resizeHeight = settings.autoresize_min_height; if ( ! body || ( e && e.type === 'setcontent' && e.initial ) || isFullscreen() ) { if ( body && docElm ) { body.style.overflowY = 'auto'; docElm.style.overflowY = 'auto'; // Old IE } return; } // 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 ); paddingBottom = editor.dom.getStyle( body, 'padding-bottom', true ); borderTop = editor.dom.getStyle( body, 'border-top-width', true ); borderBottom = editor.dom.getStyle( body, 'border-bottom-width', true ); myHeight = body.offsetHeight + getInt( marginTop ) + getInt( marginBottom ) + getInt( paddingTop ) + getInt( paddingBottom ) + getInt( borderTop ) + getInt( borderBottom ); // IE < 11, other? if ( myHeight && myHeight < docElm.offsetHeight ) { myHeight = docElm.offsetHeight; } // Make sure we have a valid height if ( isNaN( myHeight ) || myHeight <= 0 ) { // 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 if ( myHeight > settings.autoresize_min_height ) { resizeHeight = myHeight; } // 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 } else { body.style.overflowY = 'hidden'; docElm.style.overflowY = 'hidden'; // Old IE body.scrollTop = 0; } // 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 if ( tinymce.isWebKit && deltaSize < 0 ) { resize( e ); } editor.fire( 'wp-autoresize', { height: resizeHeight, deltaHeight: e.type === 'nodechange' ? deltaSize : null } ); } } /** * Calls the resize x times in 100ms intervals. We can't wait for load events since * the CSS files might load async. */ function wait( times, interval, callback ) { setTimeout( function() { resize(); if ( times-- ) { wait( times, interval, callback ); } else if ( callback ) { callback(); } }, interval ); } // Define minimum height settings.autoresize_min_height = parseInt(editor.getParam( 'autoresize_min_height', editor.getElement().offsetHeight), 10 ); // 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 editor.on( 'nodechange setcontent keyup FullscreenStateChanged', resize ); resize(); } } function off() { var doc; // 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 oldSize = 0; } } if ( settings.wp_autoresize_on ) { // Turn resizing on when the editor loads isActive = true; editor.on( 'init', function() { editor.dom.addClass( editor.getBody(), 'wp-autoresize' ); }); editor.on( 'nodechange keyup FullscreenStateChanged', resize ); editor.on( 'setcontent', function() { wait( 3, 100 ); }); if ( editor.getParam( 'autoresize_on_init', true ) ) { editor.on( 'init', function() { // Hit it 10 times in 200 ms intervals wait( 10, 200, function() { // Hit it 5 times in 1 sec intervals wait( 5, 1000 ); }); }); } } // Reset the stored size editor.on( 'show', function() { oldSize = 0; }); // Register the command editor.addCommand( 'wpAutoResize', resize ); // On/off editor.addCommand( 'wpAutoResizeOn', on ); editor.addCommand( 'wpAutoResizeOff', off ); });