REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.17 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Agent/hooks/useResizable.js
Text
Base64
import { clamp } from '@agent/lib/util'; import { useLayoutEffect, useRef } from '@wordpress/element'; export const useResizable = ({ el, open, initialSize, onResizeEnd, minWidth = 250, minHeight = 400, maxWidth = 500, maxHeight = window.innerHeight, }) => { const start = useRef({ x: 0, y: 0, width: 0, height: 0 }); const pointerIdRef = useRef(null); useLayoutEffect(() => { const bg = document.getElementById('wpwrap') || // TODO: is this on all block themes? document.querySelector('.wp-site-blocks'); if (!el || !open || !bg) return; el.style.width = `${initialSize.width}px`; el.style.height = `${initialSize.height}px`; const handle = el.querySelector('[data-extendify-agent-resize]'); if (!(handle instanceof HTMLElement)) return; const onPointerDown = (e) => { e.preventDefault(); e.stopPropagation(); bg.style.pointerEvents = 'none'; if (pointerIdRef.current !== null) { return; } pointerIdRef.current = e.pointerId; handle.setPointerCapture(e.pointerId); start.current = { x: e.clientX, y: e.clientY, width: el.offsetWidth, height: el.offsetHeight, }; document.addEventListener('pointermove', onPointerMove); document.addEventListener('pointerup', onPointerUp); }; const onPointerMove = (e) => { const rect = el.getBoundingClientRect(); const maxAllowedWidth = Math.min(maxWidth, window.innerWidth - rect.left); const maxAllowedHeight = Math.min( maxHeight, window.innerHeight - rect.top, ); const width = clamp( start.current.width + (e.clientX - start.current.x), minWidth, maxAllowedWidth, ); const height = clamp( start.current.height + (e.clientY - start.current.y), minHeight, maxAllowedHeight, ); el.style.width = `${width}px`; el.style.height = `${height}px`; }; const onPointerUp = (e) => { bg.style.pointerEvents = 'auto'; if (pointerIdRef.current !== e.pointerId) { return; } pointerIdRef.current = null; handle.releasePointerCapture(e.pointerId); document.removeEventListener('pointermove', onPointerMove); document.removeEventListener('pointerup', onPointerUp); const rect = el.getBoundingClientRect(); const maxAllowedWidth = Math.min(maxWidth, window.innerWidth - rect.left); const maxAllowedHeight = Math.min( maxHeight, window.innerHeight - rect.top, ); const width = clamp( start.current.width + (e.clientX - start.current.x), minWidth, maxAllowedWidth, ); const height = clamp( start.current.height + (e.clientY - start.current.y), minHeight, maxAllowedHeight, ); onResizeEnd(width, height); }; handle.addEventListener('pointerdown', onPointerDown); return () => { handle.removeEventListener('pointerdown', onPointerDown); document.removeEventListener('pointermove', onPointerMove); document.removeEventListener('pointerup', onPointerUp); bg.style.pointerEvents = 'auto'; if (pointerIdRef.current !== null) { handle.releasePointerCapture(pointerIdRef.current); pointerIdRef.current = null; } }; }, [ el, open, initialSize.width, initialSize.height, onResizeEnd, minWidth, minHeight, maxWidth, maxHeight, ]); };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 12
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
useDraggable.js
3.77 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useFontVariationOverride.js
3.92 KB
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useIframeScale.js
1.11 KB
lrw-r--r--
2026-04-16 23:02:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useLockPost.js
607 B
lrw-r--r--
2026-03-24 18:55:54
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
usePortal.js
478 B
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useResizable.js
3.17 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useSiteVibesOverride.js
2.39 KB
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useSiteVibesVariations.js
1.82 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useThemeFontsVariations.js
1.17 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useThemeVariations.js
1.14 KB
lrw-r--r--
2025-09-09 19:55:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useVariationOverride.js
3.14 KB
lrw-r--r--
2026-03-19 23:35:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
useWhenFinishedToolProps.js
2.20 KB
lrw-r--r--
2026-03-05 22:57:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).