403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.128.24.183
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/7779/task/7779/cwd/plugins/gutenkit-blocks-addon/src/blocks/back-to-top/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/7779/task/7779/cwd/plugins/gutenkit-blocks-addon/src/blocks/back-to-top/edit.js
import { __ } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor';
import { useRef, useEffect } from '@wordpress/element';
import Settings from './settings';
import classNames from 'classnames'
import './editor.scss';
import { clickHandler, scrollHandler, progressBarHandler } from './Event';
import Markup from './markup';


export default function Edit({ attributes, setAttributes, clientId, advancedControl }) {
	const { GkitStyle, GkitIcon } = window.gutenkit.components;
	const { useDeviceType } = window.gutenkit.helpers;

	const { btnAppearance, btnIcon, btnText, offsetTop, showBtnOnScroll, scrolledValue, lineFgColor, lineBgColor } = attributes;

	const options = {
		style: btnAppearance,
		offset_top: offsetTop,
		show_scroll: showBtnOnScroll,
		show_after: scrolledValue,
		foreground: lineFgColor,
		background: lineBgColor,
	};

	const ref = useRef(null);

	const blockProps = useBlockProps({
		className: classNames(
			btnAppearance,
			{
				[`show-on-scroll`]: showBtnOnScroll
			}
		),
		ref
	});

	const device = useDeviceType();

	useEffect(() => {
		// Get a relative document object from `ref`.
		const { ownerDocument } = ref.current;
		const btn = ref.current.querySelector('span');

		// click event
		btn.addEventListener('click', (e) => {
			clickHandler(btn, options);
		});

		// on scroll event
		ownerDocument.addEventListener('scroll', (e) => {
			if (options?.show_scroll) {
				scrollHandler(btn, options);
			}

			if (options?.style === 'progress-indicator') {
				progressBarHandler(btn, options);
			}
		}, true);

		// trigger on initial render
		if (options?.style === 'progress-indicator') {
			progressBarHandler(btn, options);
		}
	}, [btnAppearance, offsetTop, showBtnOnScroll, scrolledValue, lineFgColor, lineBgColor]);

	return (
		<>
			<GkitStyle
				blocksCSS={attributes?.blocksCSS}
			/>

			<Settings
				attributes={attributes}
				setAttributes={setAttributes}
				device={device}
				advancedControl={advancedControl}
			/>

			<div {...blockProps}>
				<Markup attributes={attributes} options={options} clientId={clientId}/>
			</div>
		</>
	);
}

Youez - 2016 - github.com/yon3zu
LinuXploit