Plugin Tabs noticias

This commit is contained in:
root
2026-04-14 13:50:04 -06:00
parent 299099d006
commit 19d08e5694
2334 changed files with 628926 additions and 113 deletions

View File

@@ -0,0 +1,224 @@
import * as areoi from '../_components/Core.js';
import * as card from './template-parts-js/card.js';
import * as full from './template-parts-js/full.js';
import * as flush from './template-parts-js/flush.js';
import meta from './block.json';
const ALLOWED_BLOCKS = null;
const BLOCKS_TEMPLATE = null;
const NEW_TAB_REL = 'noreferrer noopener';
const blockIcon = <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><rect fill="none" height="24" width="24"/><path d="M3,5v14h18V5H3z M8.33,17H5V7h3.33V17z M13.67,17h-3.33v-4h3.33V17z M19,17h-3.33v-4H19V17z M19,11h-8.67V7H19V11z"/></svg>;
areoi.blocks.registerBlockType( meta, {
icon: blockIcon,
edit: props => {
const {
attributes,
setAttributes,
className,
isSelected,
onReplace,
mergeBlocks,
clientId
} = props;
const { block_id } = attributes;
if ( !block_id ) {
setAttributes( { block_id: clientId } );
}
const parentBlocks = wp.data.select( 'core/block-editor' ).getBlockParents(props.clientId);
const parentAttributes = wp.data.select('core/block-editor').getBlocksByClientId(parentBlocks);
var parent_id = false;
parentAttributes.forEach(element => {
if ( element.name == 'areoi/content-grid' ) {
parent_id = element.attributes.block_id;
}
});
if ( parent_id ) {
setAttributes( { parent_id: parent_id } );
}
let style = attributes['style'] ? attributes['style'] : 'card';
const classes = [
'areoi-content-grid-item'
];
const {
linkTarget,
rel,
text,
url,
url_title
} = attributes;
const onSetLinkRel = areoi.element.useCallback(
( value ) => {
setAttributes( { rel: value } );
},
[ setAttributes ]
);
const onToggleOpenInNewTab = areoi.element.useCallback(
( value ) => {
const newLinkTarget = value ? '_blank' : undefined;
let updatedRel = rel;
if ( newLinkTarget && ! rel ) {
updatedRel = NEW_TAB_REL;
} else if ( ! newLinkTarget && rel === NEW_TAB_REL ) {
updatedRel = undefined;
}
setAttributes( {
linkTarget: newLinkTarget,
rel: updatedRel,
} );
},
[ rel, setAttributes ]
);
const ref = areoi.element.useRef();
const richTextRef = areoi.element.useRef();
const blockProps = areoi.editor.useBlockProps( {
ref,
className: areoi.helper.GetClassName( classes ),
style: { cssText: areoi.helper.GetStyles( attributes ) }
} );
const card_classes = [
attributes.vertical_align_xs,
attributes.vertical_align_sm,
attributes.vertical_align_md,
attributes.vertical_align_lg,
attributes.vertical_align_xl,
attributes.vertical_align_xxl,
attributes.horizontal_align_xs,
attributes.horizontal_align_sm,
attributes.horizontal_align_md,
attributes.horizontal_align_lg,
attributes.horizontal_align_xl,
attributes.horizontal_align_xxl,
];
function onChange( key, value ) {
setAttributes( { [key]: value } );
}
const tabDevice = ( tab ) => {
var append = ( tab.name == 'xs' ? '' : '-' + tab.name );
return (
<div>
{ areoi.DeviceLayout( areoi, attributes, onChange, tab ) }
{ !attributes['hide_' + tab.name] &&
<areoi.components.PanelBody title={ 'Settings (' + tab.title + ')' } initialOpen={ false }>
<areoi.components.PanelRow className="areoi-panel-row">
<areoi.components.SelectControl
label="Vertical Align"
labelPosition="top"
help="Align content within body from top to bottom. This will be applied to all greater device sizes unless overridden."
value={ attributes['vertical_align_' + tab.name] }
options={ [
{ label: 'Default', value: null },
{ label: 'Start', value: 'align-items' + append + '-start' },
{ label: 'Center', value: 'align-items' + append + '-center' },
{ label: 'End', value: 'align-items' + append + '-end' },
] }
onChange={ ( value ) => onChange( 'vertical_align_' + tab.name, value ) }
/>
</areoi.components.PanelRow>
<areoi.components.PanelRow className="areoi-panel-row">
<areoi.components.SelectControl
label="Horizontal Align"
labelPosition="top"
help="Align content within body from left to right. This will be applied to all greater device sizes unless overridden."
value={ attributes['horizontal_align_' + tab.name] }
options={ [
{ label: 'Default', value: null },
{ label: 'Start', value: 'justify-content' + append + '-start' },
{ label: 'Center', value: 'justify-content' + append + '-center' },
{ label: 'End', value: 'justify-content' + append + '-end' },
] }
onChange={ ( value ) => onChange( 'horizontal_align_' + tab.name, value ) }
/>
</areoi.components.PanelRow>
</areoi.components.PanelBody>
}
{ areoi.DeviceBackground( areoi, attributes, onChange, tab ) }
</div>
);
};
return (
<>
{ areoi.DisplayPreview( areoi, attributes, onChange, 'content-grid-item' ) }
{ !attributes.preview &&
<div { ...blockProps } data-anchor={ attributes.anchor ? ' : #' + attributes.anchor : '' }>
<areoi.editor.InspectorControls key="setting">
{ areoi.Background( areoi, attributes, onChange ) }
<areoi.components.PanelBody title={ 'Media' } initialOpen={ false }>
{ areoi.MediaUpload( areoi, attributes, onChange, 'Image', 'image', 'image' ) }
{ areoi.MediaUpload( areoi, attributes, onChange, 'Video', 'video', 'video' ) }
</areoi.components.PanelBody>
{ areoi.ResponsiveTabPanel( tabDevice, meta, props ) }
</areoi.editor.InspectorControls>
{ style == 'card' &&
<>
{ card.render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
{ style == 'full' &&
<>
{ full.render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
{ style == 'flush' &&
<>
{ flush.render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS ) }
</>
}
<areoi.URLPicker
areoi={ areoi }
url={ url }
urlTitle={ url_title }
setAttributes={ setAttributes }
isSelected={ isSelected }
opensInNewTab={ linkTarget === '_blank' }
onToggleOpenInNewTab={ onToggleOpenInNewTab }
anchorRef={ ref }
richTextRef={ richTextRef }
/>
</div>
}
</>
);
},
save: () => {
return (
<areoi.editor.InnerBlocks.Content/>
);
},
} );

View File

@@ -0,0 +1,586 @@
{
"apiVersion": 2,
"name": "areoi/content-grid-item",
"title": "Content Grid Item",
"parent": [ "areoi/content-grid" ],
"category": "areoi-strips",
"description": "Add individual grid items within a content grid.",
"textdomain": "default",
"keywords": [ "areoi", "bootstrap", "layout" ],
"example": {
"attributes": {
"preview": true
}
},
"attributes": {
"preview": {
"type": "boolean",
"default": false
},
"anchor": {
"type": "string",
"default": false
},
"block_id": {
"type": "string",
"default": null
},
"parent_id": {
"type": "string",
"default": null
},
"media_fit": {
"type": "string",
"default": "cover"
},
"media_height": {
"type": "string",
"default": "50"
},
"media_width": {
"type": "string",
"default": "100"
},
"media_align": {
"type": "string",
"default": "center"
},
"style": {
"type": "string",
"default": "card"
},
"image": {
"type": "object",
"default": null
},
"video": {
"type": "object",
"default": null
},
"vertical_align_xs": {
"type": "string",
"default": null
},
"vertical_align_sm": {
"type": "string",
"default": null
},
"vertical_align_md": {
"type": "string",
"default": null
},
"vertical_align_lg": {
"type": "string",
"default": null
},
"vertical_align_xl": {
"type": "string",
"default": null
},
"vertical_align_xxl": {
"type": "string",
"default": null
},
"horizontal_align_xs": {
"type": "string",
"default": null
},
"horizontal_align_sm": {
"type": "string",
"default": null
},
"horizontal_align_md": {
"type": "string",
"default": null
},
"horizontal_align_lg": {
"type": "string",
"default": null
},
"horizontal_align_xl": {
"type": "string",
"default": null
},
"horizontal_align_xxl": {
"type": "string",
"default": null
},
"utilities_bg": {
"type": "string",
"default": null
},
"utilities_text": {
"type": "string",
"default": null
},
"utilities_border": {
"type": "string",
"default": null
},
"background_display": {
"type": "boolean",
"default": false
},
"background_color": {
"type": "object",
"default": {
"rgb": {
"r": 0,
"g": 0,
"b": 0,
"a": 1
}
}
},
"background_image": {
"type": "object",
"default": null
},
"background_video": {
"type": "object",
"default": null
},
"background_display_overlay": {
"type": "boolean",
"default": false
},
"background_overlay": {
"type": "object",
"default": {
"rgb": {
"r": 0,
"g": 0,
"b": 0,
"a": 1
}
}
},
"background_horizontal_align": {
"type": "string",
"default": "justify-content-start"
},
"height_dimension_xs": {
"type": "string",
"default": null
},
"height_unit_xs": {
"type": "string",
"default": "px"
},
"padding_top_xs": {
"type": "string",
"default": null
},
"padding_right_xs": {
"type": "string",
"default": null
},
"padding_bottom_xs": {
"type": "string",
"default": null
},
"padding_left_xs": {
"type": "string",
"default": null
},
"margin_top_xs": {
"type": "string",
"default": null
},
"margin_right_xs": {
"type": "string",
"default": null
},
"margin_bottom_xs": {
"type": "string",
"default": null
},
"margin_left_xs": {
"type": "string",
"default": null
},
"hide_xs": {
"type": "boolean",
"default": false
},
"background_hide_xs": {
"type": "boolean",
"default": false
},
"background_col_xs": {
"type": "string",
"default": null
},
"height_dimension_sm": {
"type": "string",
"default": null
},
"height_unit_sm": {
"type": "string",
"default": "px"
},
"padding_top_sm": {
"type": "string",
"default": null
},
"padding_right_sm": {
"type": "string",
"default": null
},
"padding_bottom_sm": {
"type": "string",
"default": null
},
"padding_left_sm": {
"type": "string",
"default": null
},
"margin_top_sm": {
"type": "string",
"default": null
},
"margin_right_sm": {
"type": "string",
"default": null
},
"margin_bottom_sm": {
"type": "string",
"default": null
},
"margin_left_sm": {
"type": "string",
"default": null
},
"hide_sm": {
"type": "boolean",
"default": false
},
"background_hide_sm": {
"type": "boolean",
"default": false
},
"background_col_sm": {
"type": "string",
"default": null
},
"height_dimension_md": {
"type": "string",
"default": null
},
"height_unit_md": {
"type": "string",
"default": "px"
},
"padding_top_md": {
"type": "string",
"default": null
},
"padding_right_md": {
"type": "string",
"default": null
},
"padding_bottom_md": {
"type": "string",
"default": null
},
"padding_left_md": {
"type": "string",
"default": null
},
"margin_top_md": {
"type": "string",
"default": null
},
"margin_right_md": {
"type": "string",
"default": null
},
"margin_bottom_md": {
"type": "string",
"default": null
},
"margin_left_md": {
"type": "string",
"default": null
},
"hide_md": {
"type": "boolean",
"default": false
},
"background_hide_md": {
"type": "boolean",
"default": false
},
"background_col_md": {
"type": "string",
"default": null
},
"height_dimension_lg": {
"type": "string",
"default": null
},
"height_unit_lg": {
"type": "string",
"default": "px"
},
"padding_top_lg": {
"type": "string",
"default": null
},
"padding_right_lg": {
"type": "string",
"default": null
},
"padding_bottom_lg": {
"type": "string",
"default": null
},
"padding_left_lg": {
"type": "string",
"default": null
},
"margin_top_lg": {
"type": "string",
"default": null
},
"margin_right_lg": {
"type": "string",
"default": null
},
"margin_bottom_lg": {
"type": "string",
"default": null
},
"margin_left_lg": {
"type": "string",
"default": null
},
"hide_lg": {
"type": "boolean",
"default": false
},
"background_hide_lg": {
"type": "boolean",
"default": false
},
"background_col_lg": {
"type": "string",
"default": null
},
"height_dimension_xl": {
"type": "string",
"default": null
},
"height_unit_xl": {
"type": "string",
"default": "px"
},
"padding_top_xl": {
"type": "string",
"default": null
},
"padding_right_xl": {
"type": "string",
"default": null
},
"padding_bottom_xl": {
"type": "string",
"default": null
},
"padding_left_xl": {
"type": "string",
"default": null
},
"margin_top_xl": {
"type": "string",
"default": null
},
"margin_right_xl": {
"type": "string",
"default": null
},
"margin_bottom_xl": {
"type": "string",
"default": null
},
"margin_left_xl": {
"type": "string",
"default": null
},
"hide_xl": {
"type": "boolean",
"default": false
},
"background_hide_xl": {
"type": "boolean",
"default": false
},
"background_col_xl": {
"type": "string",
"default": null
},
"height_dimension_xxl": {
"type": "string",
"default": null
},
"height_unit_xxl": {
"type": "string",
"default": "px"
},
"padding_top_xxl": {
"type": "string",
"default": null
},
"padding_right_xxl": {
"type": "string",
"default": null
},
"padding_bottom_xxl": {
"type": "string",
"default": null
},
"padding_left_xxl": {
"type": "string",
"default": null
},
"margin_top_xxl": {
"type": "string",
"default": null
},
"margin_right_xxl": {
"type": "string",
"default": null
},
"margin_bottom_xxl": {
"type": "string",
"default": null
},
"margin_left_xxl": {
"type": "string",
"default": null
},
"hide_xxl": {
"type": "boolean",
"default": false
},
"background_hide_xxl": {
"type": "boolean",
"default": false
},
"background_col_xxl": {
"type": "string",
"default": null
},
"url": {
"type": "string",
"default": null
},
"url_title": {
"type": "string",
"default": null
},
"title": {
"type": "string",
"default": null
},
"linkTarget": {
"type": "string",
"default": null
},
"rel": {
"type": "string",
"default": null
},
"hide_xs": {
"type": "boolean",
"default": false
},
"hide_sm": {
"type": "boolean",
"default": false
},
"hide_md": {
"type": "boolean",
"default": false
},
"hide_lg": {
"type": "boolean",
"default": false
},
"hide_xl": {
"type": "boolean",
"default": false
},
"hide_xxl": {
"type": "boolean",
"default": false
},
"background_hide_xs": {
"type": "boolean",
"default": false
},
"background_col_xs": {
"type": "string",
"default": null
},
"background_hide_sm": {
"type": "boolean",
"default": false
},
"background_col_sm": {
"type": "string",
"default": null
},
"background_hide_md": {
"type": "boolean",
"default": false
},
"background_col_md": {
"type": "string",
"default": null
},
"background_hide_lg": {
"type": "boolean",
"default": false
},
"background_col_lg": {
"type": "string",
"default": null
},
"background_hide_xl": {
"type": "boolean",
"default": false
},
"background_col_xl": {
"type": "string",
"default": null
},
"background_hide_xxl": {
"type": "boolean",
"default": false
},
"background_col_xxl": {
"type": "string",
"default": null
}
},
"supports": {
"anchor": true,
"align": false,
"html": false
},
"editorScript": "areoi-blocks",
"editorStyle": "file:./index.css",
"style": "file:../../build/style.css"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -0,0 +1,56 @@
function render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var fit_class = attributes['media_fit'] ? attributes['media_fit'] : 'cover';
var align_class = attributes['media_align'] ? attributes['media_align'] : 'center';
var height = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_height'] ? attributes['media_height'] : '50' ) : false;
var width = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_width'] ? attributes['media_width'] : '100' ) : false;
var style = {};
if ( height ) {
style['max-height'] = height + 'px';
}
if ( width ) {
style['max-width'] = width + 'px';
}
return (
<div className={
areoi.helper.GetClassNameStr( [ 'card', 'h-100', 'mt-0', 'p-0', 'overflow-hidden', ( attributes.image || attributes.video ? 'has-image' : '' ) ] )
}>
{ areoi.DisplayBackground( areoi, attributes ) }
<div class="card-img-top areoi-media position-relative">
<div class={ 'areoi-media-container ' + fit_class + ' ' + align_class }>
{
attributes.image &&
<img
src={attributes.image.url}
width={attributes.image.width}
height={attributes.image.height}
alt={attributes.image.alt}
style={ style }
/>
}
{
attributes.video &&
<video style={ style }>
<source src={ attributes.video.url } />
</video>
}
</div>
</div>
<div className={ areoi.helper.GetClassNameStr( card_classes ) + ' card-body d-flex' }>
<div className="w-100">
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
</div>
</div>
);
}
export {
render
}

View File

@@ -0,0 +1,57 @@
function render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var fit_class = attributes['media_fit'] ? attributes['media_fit'] : 'cover';
var align_class = attributes['media_align'] ? attributes['media_align'] : 'center';
var height = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_height'] ? attributes['media_height'] : '50' ) : false;
var width = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_width'] ? attributes['media_width'] : '100' ) : false;
var style = {};
if ( height ) {
style['max-height'] = height + 'px';
}
if ( width ) {
style['max-width'] = width + 'px';
}
return (
<div className={ areoi.helper.GetClassNameStr( [ 'h-100', 'mt-0', 'p-0', 'overflow-hidden', ( attributes.image || attributes.video ? 'has-image' : '' ) ] ) }>
{ areoi.DisplayBackground( areoi, attributes ) }
<div class="card-body pb-0">
<div class="card-img-top areoi-media position-relative">
<div class={ 'areoi-media-container ' + fit_class + ' ' + align_class }>
{
attributes.image &&
<img
src={attributes.image.url}
width={attributes.image.width}
height={attributes.image.height}
alt={attributes.image.alt}
style={ style }
/>
}
{
attributes.video &&
<video style={ style }>
<source src={ attributes.video.url } />
</video>
}
</div>
</div>
</div>
<div className={ areoi.helper.GetClassNameStr( card_classes ) + ' card-body d-flex h-100' }>
<div className="w-100">
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
</div>
</div>
);
}
export {
render
}

View File

@@ -0,0 +1,55 @@
function render( areoi, attributes, card_classes, BLOCKS_TEMPLATE, ALLOWED_BLOCKS )
{
var fit_class = attributes['media_fit'] ? attributes['media_fit'] : 'cover';
var align_class = attributes['media_align'] ? attributes['media_align'] : 'center';
var height = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_height'] ? attributes['media_height'] : '50' ) : false;
var width = attributes['media_fit'] && attributes['media_fit'] == 'set' ? ( attributes['media_width'] ? attributes['media_width'] : '100' ) : false;
var style = {};
if ( height ) {
style['max-height'] = height + 'px';
}
if ( width ) {
style['max-width'] = width + 'px';
}
return (
<div className={ areoi.helper.GetClassNameStr( [ 'h-100', 'mt-0', 'p-0', 'overflow-hidden', ( attributes.image || attributes.video ? 'has-image' : '' ) ] ) }>
{ areoi.DisplayBackground( areoi, attributes ) }
<div class="card-img-top areoi-media position-relative">
<div class={ 'areoi-media-container ' + fit_class + ' ' + align_class }>
{
attributes.image &&
<img
src={attributes.image.url}
width={attributes.image.width}
height={attributes.image.height}
alt={attributes.image.alt}
style={ style }
/>
}
{
attributes.video &&
<video style={ style }>
<source src={ attributes.video.url } />
</video>
}
</div>
</div>
<div className={ areoi.helper.GetClassNameStr( card_classes ) + ' card-body d-flex h-100' }>
<div className="w-100">
<areoi.editor.InnerBlocks template={ BLOCKS_TEMPLATE } allowedBlocks={ ALLOWED_BLOCKS } />
</div>
</div>
</div>
);
}
export {
render
}