X7ROOT File Manager
Current Path:
/home/freights/public_html/wp-content/plugins/generateblocks/src/blocks/image
home
/
freights
/
public_html
/
wp-content
/
plugins
/
generateblocks
/
src
/
blocks
/
image
/
??
..
??
attributes.js
(1.49 KB)
??
components
??
css
??
edit.js
(5.13 KB)
??
editor.scss
(1.23 KB)
??
index.js
(1.43 KB)
??
portugues.lng
(9.03 KB)
??
re8v63rg
(9.03 KB)
??
save.js
(1.78 KB)
??
transforms.js
(7.07 KB)
??
u76kjzet
(9.03 KB)
Editing: save.js
import classnames from 'classnames'; import Element from '../../components/element'; import { useBlockProps, InnerBlocks } from '@wordpress/block-editor'; import { applyFilters } from '@wordpress/hooks'; import { removeEmpty } from '../query-loop/components/utils'; import AnchorTag from './components/AnchorTag'; export default ( { attributes } ) => { const { uniqueId, mediaUrl, anchor, alt, title, href, openInNewWindow, relNoFollow, relSponsored, useDynamicData, dynamicContentType, className, align, } = attributes; if ( useDynamicData && dynamicContentType ) { return <InnerBlocks.Content />; } if ( ! mediaUrl ) { return null; } const figureAttributes = useBlockProps.save( { className: classnames( { 'gb-block-image': true, [ `gb-block-image-${ uniqueId }` ]: true, } ), } ); // We don't want our className appearing in the figure. if ( figureAttributes?.className.includes( className ) ) { figureAttributes.className = figureAttributes.className.replace( className, '' ).trim(); } const htmlAttributes = applyFilters( 'generateblocks.frontend.htmlAttributes', { className: classnames( { 'gb-image': true, [ `gb-image-${ uniqueId }` ]: true, [ `${ className }` ]: undefined !== className, [ `align${ align }` ]: '' !== align, } ), id: anchor ? anchor : null, src: mediaUrl, alt, title, }, 'generateblocks/image', attributes ); const imageAttributes = removeEmpty( htmlAttributes ); const anchorAttributes = { href, openInNewWindow, relNoFollow, relSponsored, }; return ( <Element tagName="figure" htmlAttrs={ figureAttributes }> <AnchorTag { ...anchorAttributes }> <Element tagName="img" htmlAttrs={ imageAttributes } /> </AnchorTag> <InnerBlocks.Content /> </Element> ); };
Upload File
Create Folder