__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
import {
	createElement,
	Component,
	useState,
	useRef,
	Fragment,
} from '@wordpress/element'
import cls from 'classnames'
import { __, sprintf } from 'ct-i18n'
import OutsideClickHandler from './react-outside-click-handler'
import RatioModal from './ratio/RatioModal'
import OptionsPanel from '../OptionsPanel'
import { getValueFromInput } from '../helpers/get-value-from-input'

const Ratio = ({ option, value, onChange, onChangeFor, values }) => {
	const [isForcedReversed, setIsReversed] = useState(false)
	let {
		hasOriginalRatio = true,
		// popup | inline
		view = 'popup',
		preview_width_key = null,
	} = option || {}

	let normal_ratios = ['4/3', '16/9', '2/1']
	let reversed_ratios = ['3/4', '9/16', '1/2']

	const el = useRef()

	const [{ isPicking, isTransitioning }, setAnimationState] = useState({
		isPicking: false,
		isTransitioning: false,
	})

	const isReversed =
		normal_ratios.indexOf(value) > -1
			? false
			: reversed_ratios.indexOf(value) > -1
			? true
			: isForcedReversed

	let currentTab =
		value === 'original'
			? 'original'
			: value.indexOf('/') === -1
			? 'custom'
			: 'predefined'

	let isCustom = value.indexOf('/') === -1

	const inlineRatioView = (
		<Fragment>
			<div className="ct-ratio-content">
				<div
					className={cls('ct-ratio-picker', {
						reversed: isReversed,
					})}>
					<ul className="ct-radio-option ct-buttons-group">
						{hasOriginalRatio && (
							<li
								className={cls({
									active: currentTab === 'original',
								})}
								onClick={() => {
									if (value !== 'original') {
										onChange('original')
									}
								}}>
								{__('Original', 'blocksy')}
							</li>
						)}
						<li
							className={cls({
								active: currentTab === 'predefined',
							})}
							onClick={() => {
								if (
									value.indexOf('/') === -1 ||
									value === 'original'
								) {
									onChange(
										option.value === 'original'
											? '1/1'
											: option.value
									)
								}
							}}>
							{__('Predefined', 'blocksy')}
						</li>
						<li
							className={cls({
								active: currentTab === 'custom',
							})}
							onClick={() => {
								if (
									value.indexOf('/') !== -1 ||
									value === 'original'
								) {
									let [first, second] = (
										value === 'original'
											? option.value === 'original'
												? '1/1'
												: option.value
											: value
									).split('/')
									onChange(`${first}:${second}`)
								}
							}}>
							{__('Custom', 'blocksy')}
						</li>
					</ul>

					{currentTab === 'predefined' && (
						<div className="ct-ratio-predefined">
							<ul className="ct-buttons-group">
								{[
									'1/1',
									...(isReversed
										? reversed_ratios
										: normal_ratios),
								].map((ratio) => (
									<li
										key={ratio}
										className={cls({
											active: ratio === value,
										})}
										onClick={() => {
											if (ratio === '1/1') {
												setIsReversed(false)
											}

											onChange(ratio)
										}}>
										{ratio}
									</li>
								))}
							</ul>

							<button
								data-tooltip-reveal="top"
								onClick={(e) => {
									e.preventDefault()

									if (value === '1/1') {
										setIsReversed(!isReversed)
										return
									}

									let [first_component, second_component] =
										value.split('/')

									setIsReversed(
										+first_component < +second_component
									)

									onChange(
										value.split('/').reverse().join('/')
									)
								}}>
								<span />
								<i className="ct-tooltip">Reverse</i>
							</button>
						</div>
					)}

					{currentTab === 'custom' && (
						<div className="ct-ratio-custom">
							<div className="ct-option-input">
								<input
									type="text"
									value={value.split(':')[0]}
									onChange={({ target: { value: val } }) => {
										onChange(
											`${val}:${value.split(':')[1]}`
										)
									}}
								/>
							</div>
							<span>:</span>
							<div className="ct-option-input">
								<input
									type="text"
									value={value.split(':')[1]}
									onChange={({ target: { value: val } }) => {
										onChange(
											`${value.split(':')[0]}:${val}`
										)
									}}
								/>
							</div>

							<div
								className="ct-notification"
								dangerouslySetInnerHTML={{
									__html: sprintf(
										__(
											'Use %sthis tool%s for calculating a custom image ratio based on your image size.',
											'blocksy'
										),
										'<a href="https://www.digitalrebellion.com/webapps/aspectcalc" target="_blank">',
										'</a>'
									),
								}}
							/>
						</div>
					)}

					{currentTab === 'original' && (
						<div className="ct-ratio-original">
							<div className="ct-notification">
								{__(
									'Displays the image using the aspect ratio in which they were uploaded.',
									'blocksy'
								)}
							</div>
						</div>
					)}
				</div>
				{option['inner-options'] && (
					<OptionsPanel
						onChange={(key, val) => {
							onChangeFor(key, val)
						}}
						options={option['inner-options']}
						value={values}
					/>
				)}
			</div>
		</Fragment>
	)

	if (view === 'inline') {
		return inlineRatioView
	}

	return (
		<div ref={el} className={cls('ct-ratio-picker-container', {})}>
			<OutsideClickHandler
				useCapture={false}
				disabled={!isPicking}
				className="ct-ratio-preview"
				onOutsideClick={() => {
					if (!isPicking) {
						return
					}

					setAnimationState({
						isTransitioning: false,
						isPicking: false,
					})
				}}
				wrapperProps={{
					onClick: (e) => {
						e.preventDefault()

						setAnimationState({
							isTransitioning: true,
							isPicking: !isPicking,
						})
					},
				}}>
				{value.indexOf(':') > -1 && (
					<span className="ct-ratio-key">
						{__('Custom', 'blocksy')}
					</span>
				)}

				{value.indexOf('/') > -1 && (
					<span className="ct-ratio-key">
						{__('Predefined', 'blocksy')}
					</span>
				)}

				{value === 'original'
					? __('Original Ratio', 'blocksy')
					: value.replace('/', ':')}

				{preview_width_key && (
					<span className="ct-width-key">
						{values[preview_width_key]}
					</span>
				)}
			</OutsideClickHandler>

			<RatioModal
				el={el}
				value={value}
				onChange={onChange}
				option={option}
				isPicking={isPicking}
				isTransitioning={isTransitioning}
				onPickingChange={(isPicking) => {
					setAnimationState({
						isTransitioning: true,
						isPicking,
					})
				}}
				stopTransitioning={() =>
					setAnimationState({
						isPicking,
						isTransitioning: false,
					})
				}
				renderContent={() => inlineRatioView}
			/>
		</div>
	)
}

Ratio.ControlEnd = () => (
	<div
		className="ct-color-modal-wrapper"
		onMouseDown={(e) => e.stopPropagation()}
		onMouseUp={(e) => e.stopPropagation()}
	/>
)

export default Ratio

Filemanager

Name Type Size Permission Actions
background Folder 0750
box-shadow Folder 0750
color-palettes Folder 0750
color-picker Folder 0750
ct-addable-box Folder 0750
ct-layers Folder 0750
ct-number Folder 0750
ct-radio Folder 0750
ct-select Folder 0750
ct-slider Folder 0750
ct-spacing Folder 0750
ct-switch Folder 0750
ratio Folder 0750
text Folder 0750
typography Folder 0750
ct-addable-box.js File 6.16 KB 0640
ct-background.js File 5.46 KB 0640
ct-border.js File 2.75 KB 0640
ct-box-shadow.js File 2.64 KB 0640
ct-button.js File 456 B 0640
ct-checkboxes.js File 1.91 KB 0640
ct-color-palettes-mirror.js File 1000 B 0640
ct-color-palettes-picker.js File 6.71 KB 0640
ct-color-picker.js File 2.71 KB 0640
ct-customize-section-title-actions.js File 6.74 KB 0640
ct-customizer-reset-options.js File 1.83 KB 0640
ct-divider.js File 328 B 0640
ct-entity-picker.js File 2.38 KB 0640
ct-file-uploader.js File 2 KB 0640
ct-footer-builder.js File 5.96 KB 0640
ct-header-builder.js File 272 B 0640
ct-image-picker.js File 1.81 KB 0640
ct-image-uploader.js File 10.12 KB 0640
ct-layers-combined.js File 2.22 KB 0640
ct-layers-mirror.js File 1.15 KB 0640
ct-layers.js File 5.39 KB 0640
ct-multi-image-uploader.js File 3.14 KB 0640
ct-notification.js File 378 B 0640
ct-number.js File 454 B 0640
ct-panel.js File 8.88 KB 0640
ct-radio.js File 401 B 0640
ct-ratio.js File 6.87 KB 0640
ct-select.js File 669 B 0640
ct-slider.js File 14.14 KB 0640
ct-spacer.js File 386 B 0640
ct-spacing.js File 5.09 KB 0640
ct-switch.js File 508 B 0640
ct-timer.js File 3.27 KB 0640
ct-title.js File 562 B 0640
ct-typography.js File 7.35 KB 0640
ct-visibility.js File 4.76 KB 0640
ct-woocommerce-columns-and-rows.js File 3 KB 0640
ct-woocommerce-ratio.js File 1.66 KB 0640
date-time-picker.js File 811 B 0640
hidden.js File 243 B 0640
html.js File 264 B 0640
jsx.js File 237 B 0640
react-outside-click-handler.js File 3.17 KB 0640
text.js File 384 B 0640
textarea.js File 518 B 0640
wp-editor.js File 3.67 KB 0640
Filemanager