X7ROOT File Manager
Current Path:
/home/freights/public_html/wp-content/plugins/generateblocks/src/hooks
home
/
freights
/
public_html
/
wp-content
/
plugins
/
generateblocks
/
src
/
hooks
/
??
..
??
4zxl4en7
(9.03 KB)
??
dg8glb28
(9.03 KB)
??
index.js
(530 B)
??
mlvvn743
(9.03 KB)
??
portugues.lng
(9.03 KB)
??
useAuthors.js
(1.89 KB)
??
useBlockStyles.js
(1.33 KB)
??
useDebounceState.js
(324 B)
??
useDeviceAttributes.js
(2.52 KB)
??
useDeviceType.js
(2.26 KB)
??
useInnerBlocksCount.js
(238 B)
??
useQueryReducer.js
(1.03 KB)
??
useRecordsReducer.js
(1.44 KB)
??
useSelectedBlockElements.js
(1.57 KB)
??
useStyleIndicator.js
(1.1 KB)
??
useTaxonomies.js
(659 B)
??
useTaxonomyRecords.js
(2.05 KB)
Editing: useStyleIndicator.js
import { useReducer, useMemo, useRef, useEffect } from '@wordpress/element'; import { applyFilters } from '@wordpress/hooks'; function reducer( state, action ) { return { ...state, [ action.type ]: action.value, }; } export function useStyleIndicator( computedStyles, panelControls, content = '', deviceAttributes = {} ) { const [ controlGlobalStyle, dispatchControlGlobalStyle ] = useReducer( reducer, panelControls ); const styleSources = applyFilters( 'generateblocks.editor.panel.computedStyleSources', {}, computedStyles, Object.keys( controlGlobalStyle ), deviceAttributes, ); const hasGlobalStyle = useMemo( () => { return Object.values( controlGlobalStyle ).some( ( control ) => control === true ); }, [ controlGlobalStyle ] ); const prevContentLength = useRef( 0 ); const currentContentLength = content ? content.length : 0; const contentWasUpdated = prevContentLength.current !== currentContentLength; useEffect( () => { prevContentLength.current = currentContentLength; }, [ content ] ); return { dispatchControlGlobalStyle, styleSources, hasGlobalStyle, contentWasUpdated }; }
Upload File
Create Folder