HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux sci 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: tpdc (1002)
PHP: 7.4.3-4ubuntu2.29
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/nsci/wp-content/plugins/tablepress/admin/js/codemirror.js
/**
 * JavaScript code for the CodeMirror handling on the "Options" screen.
 *
 * @package TablePress
 * @subpackage Views JavaScript
 * @author Tobias Bäthge
 * @since 1.9.0
 */

/* globals wp */

/* jshint strict: global */
'use strict'; // Necessary as this file does not use "import".

/**
 * Invoke CodeMirror on the "Custom CSS" textarea.
 *
 * @since 1.9.0
 */
const CM_custom_css = wp.codeEditor.initialize( 'option-custom-css', {} ).codemirror;
const $CM_wrapper = CM_custom_css.getWrapperElement();

/**
 * Let CodeMirror textarea grow on first focus (with mouse click), if it is not disabled.
 *
 * @since 1.0.0
 */
const CM_wrapper_mousedown_handler = function () {
	if ( ! this.classList.contains( 'disabled' ) ) {
		this.classList.add( 'large' );
		CM_custom_css.refresh();
		this.removeEventListener( 'mousedown', CM_wrapper_mousedown_handler ); // No need to keep checking for clicks after the textarea height was increased.
	}
};
$CM_wrapper.addEventListener( 'mousedown', CM_wrapper_mousedown_handler );

/**
 * Enable/disable CodeMirror according to state of "Load Custom CSS" checkbox.
 *
 * @since 1.0.0
 */
const $cb_use_custom_css = document.getElementById( 'option-use-custom-css' );
$cb_use_custom_css.addEventListener( 'change', function () {
	CM_custom_css.setOption( 'readOnly', ! this.checked );
	$CM_wrapper.classList.toggle( 'disabled', ! this.checked );
} );
$cb_use_custom_css.dispatchEvent( new Event( 'change' ) );