first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,48 @@
/**
* WordPress dependencies
*/
const {
addFilter,
} = wp.hooks;
/**
* Internal dependencies
*/
import SectionContentBlockEdit from './edit.jsx';
import SectionContentBlockSave from './save.jsx';
/**
* Custom block Edit output for Section block.
*
* @param {JSX} edit Original block edit.
* @param {Object} blockProps Block data.
*
* @return {JSX} Block edit.
*/
function editRender( edit, blockProps ) {
if ( 'canvas/section-content' === blockProps.name ) {
return (
<SectionContentBlockEdit { ...blockProps } />
);
}
return edit;
}
/**
* Custom block register data for Section block.
*
* @param {Object} blockData Block data.
*
* @return {Object} Block data.
*/
function registerData( blockData ) {
if ( 'canvas/section-content' === blockData.name ) {
blockData.save = SectionContentBlockSave;
}
return blockData;
}
addFilter( 'canvas.customBlock.editRender', 'canvas/section-content/editRender', editRender );
addFilter( 'canvas.customBlock.registerData', 'canvas/section-content/registerData', registerData );
@@ -0,0 +1,65 @@
/**
* External dependencies
*/
import classnames from 'classnames';
/**
* WordPress dependencies
*/
const { Component } = wp.element;
const {
InnerBlocks,
} = wp.blockEditor;
const {
withSelect,
} = wp.data;
/**
* Component
*/
class SectionContentBlockEdit extends Component {
render() {
const {
hasChildBlocks,
attributes,
} = this.props;
let {
className,
} = this.props;
className = classnames(
'cnvs-block-section-content',
attributes.canvasClassName,
className
);
return (
<div className={ className }>
<div className="cnvs-block-section-content-inner">
<InnerBlocks
templateLock={ false }
renderAppender={ (
hasChildBlocks ?
undefined :
() => <InnerBlocks.ButtonBlockAppender />
) }
/>
</div>
</div>
);
}
}
const SectionContentBlockEditWithSelect = withSelect( ( select, ownProps ) => {
const { clientId } = ownProps;
const blockEditor = select( 'core/block-editor' );
return {
hasChildBlocks: blockEditor ? blockEditor.getBlockOrder( clientId ).length > 0 : false,
};
} )( SectionContentBlockEdit );
export default SectionContentBlockEditWithSelect;
@@ -0,0 +1,18 @@
<?php
/**
* Section Content block template
*
* @var $attributes - block attributes
* @var $content - inner blocks
* @var $options - layout options
*
* @package Canvas
*/
?>
<div class="<?php echo esc_attr( $attributes['className'] ); ?>" <?php echo ( isset( $attributes['anchor'] ) ? ' id="' . esc_attr( $attributes['anchor'] ) . '"' : '' ); ?>>
<div class="cnvs-block-section-content-inner">
<?php echo (string) $content; // XSS. ?>
</div>
</div>
@@ -0,0 +1,19 @@
/**
* WordPress dependencies
*/
const {
Component,
} = wp.element;
const {
InnerBlocks,
} = wp.blockEditor;
/**
* Component
*/
export default class SectionContentBlockSave extends Component {
render() {
return <InnerBlocks.Content />;
}
}