$61 GRAYBYTE WORDPRESS FILE MANAGER $63

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.157
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components/

HOME
Current File : /var/softaculous/sitepad/editor/site-data/plugins/pagelayer/js/react/src/components//image.js
import { LabelControl } from './label';
import { MediaUpload } from '@wordpress/block-editor';
import { useState, useEffect, useRef } from '@wordpress/element';

const blankImg = pagelayer_url+'/images/default-image.png';

export const ImageControl = (props) =>{
		
	const { attributes, prop, value, setAttributes, allow = [ 'image' ]} = props;
	const { name } = prop['c'];
	const tmpAtts = attributes?.tmpAtts ?  {...attributes.tmpAtts} : {};
	
	var url = pagelayer_empty(tmpAtts[name+'-url']) ? '' : tmpAtts[name+'-url'];
	
	const onSelectImage = (imageProps) => {
		const { id, url, title, alt, sizes } = imageProps;
		
		var sizeUrls = {};
		
		// Keep a list of all sizes
		for(var x in sizes){
			sizeUrls[name+'-'+x+'-url'] = sizes[x].url;
		}
		
		const tmp = {
			...tmpAtts,
			[name+'-url']: url,
			[name+'-title']: title,
			[name+'-alt']: alt,
			[name+'-no-image-set']: '',
			...sizeUrls
		};
		
		setAttributes({
			[name]: id,
			tmpAtts: tmp
		});
		
		setAttributes({ ['pagelayer-srcset']: url+', '+url+' 1x'});
	}
	
	const onRemoveImage = (e) => {
		e.stopPropagation();
		
		const tmp = {...tmpAtts};
		
		Object.keys(tmp).forEach(key => {
		  if (key.startsWith(name + '-')) {
				delete tmp[key];
		  }
		});
		
		tmp[name+'-no-image-set'] = 1;
		tmp[name+'-url'] = blankImg;
		
		setAttributes({
			[name]: blankImg,
			tmpAtts: tmp
		});
	}
	
	const renderMediaUploader = (open) => {
		const hasImage = !pagelayer_empty(url) ? 'pagelayer-has-image' : '';
		return (
			<div
				className={`pagelayer-elp-image-div ${hasImage}`}
				style={ {backgroundImage: `url("${url}")`} }
				onClick={ () => {open()} }
			>
				<span 
					className="pagelayer-elp-remove-image"
					onClick={onRemoveImage}
				><i className="pli pli-cross" ></i></span>
				<span 
					className="pagelayer-elp-add-image"
				><i className="dashicons dashicons-plus-alt2" ></i></span>				
			</div>
		);
	}
	
	return (
		<div className="components-base-control pagelayer-base-control">
			<LabelControl {...props}/>
				<MediaUpload
					title="Select Image"
					onSelect={ onSelectImage }
					allowedTypes={ allow }
					value={ value }
					render={ ( { open } ) => renderMediaUploader( open ) }
				/>
		</div>
	);	
}


Current_dir [ NOT WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
21 Feb 2026 2.55 AM
root / root
0755
access.js
1.263 KB
18 Feb 2026 11.32 PM
root / root
0644
box-shadow.js
5.699 KB
18 Feb 2026 11.32 PM
root / root
0644
checkbox.js
0.638 KB
18 Feb 2026 11.32 PM
root / root
0644
color.js
4.903 KB
18 Feb 2026 11.32 PM
root / root
0644
datetime.js
0.977 KB
18 Feb 2026 11.32 PM
root / root
0644
dimension.js
1.818 KB
18 Feb 2026 11.32 PM
root / root
0644
filter.js
2.293 KB
18 Feb 2026 11.32 PM
root / root
0644
font_family.js
1.529 KB
18 Feb 2026 11.32 PM
root / root
0644
gradient.js
4.01 KB
18 Feb 2026 11.32 PM
root / root
0644
html-to-react.js
0.231 KB
18 Feb 2026 11.32 PM
root / root
0644
icon.js
5.162 KB
18 Feb 2026 11.32 PM
root / root
0644
image.js
2.26 KB
18 Feb 2026 11.32 PM
root / root
0644
label.js
1.317 KB
18 Feb 2026 11.32 PM
root / root
0644
link.js
7.388 KB
18 Feb 2026 11.32 PM
root / root
0644
media.js
1.905 KB
18 Feb 2026 11.32 PM
root / root
0644
modal.js
1.811 KB
18 Feb 2026 11.32 PM
root / root
0644
multi-image.js
2.964 KB
18 Feb 2026 11.32 PM
root / root
0644
multiselect.js
2.107 KB
18 Feb 2026 11.32 PM
root / root
0644
padding.js
2.134 KB
18 Feb 2026 11.32 PM
root / root
0644
radio.js
0.753 KB
18 Feb 2026 11.32 PM
root / root
0644
rich_text.js
4.202 KB
18 Feb 2026 11.32 PM
root / root
0644
screen-icon.js
1.081 KB
18 Feb 2026 11.32 PM
root / root
0644
select.js
2.181 KB
18 Feb 2026 11.32 PM
root / root
0644
setting-tabs-control.js
1.946 KB
18 Feb 2026 11.32 PM
root / root
0644
slider.js
1.472 KB
18 Feb 2026 11.32 PM
root / root
0644
spinner.js
0.826 KB
18 Feb 2026 11.32 PM
root / root
0644
text-shadow.js
7.212 KB
18 Feb 2026 11.32 PM
root / root
0644
textarea.js
0.677 KB
18 Feb 2026 11.32 PM
root / root
0644
typography.js
17.443 KB
18 Feb 2026 11.32 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF