130 * @return {function} Devuelve el BlockEdit modificado.
131 */
132const withAdvancedControlsBtnCollapse = createHigherOrderComponent( ( BlockEdit ) => {
133 return ( props ) => {134135 if( allowedBlocks.includes( props.name ) ){136137 return (138139 <Fragment>140 <BlockEdit {...props} />141 {props.attributes.url && (142 <InspectorControls>143 <PanelBody title={ __( 'Button to Popover (Ekiline)', 'ekiline-collection' ) } initialOpen={ true }>144 <TextControl145 label={ __( 'Popover text to show.', 'ekiline-collection' ) }146 value={props.attributes.addDataLnkPopover}147 onChange={newData => props.setAttributes({addDataLnkPopover: newData})}148 />149 {/* Posicion. */}150 <SelectControl151 label={ __( 'Popover position', 'ekiline-collection' ) }152 value={ props.attributes.addPositionLnkPopover }153 options={ [154 { label: __( 'Popover position', 'ekiline-collection' ), value: 'auto' },155 { label: __( 'Top', 'ekiline-collection' ), value: 'top' },156 { label: __( 'Right', 'ekiline-collection' ), value: 'right' },157 { label: __( 'Bottom', 'ekiline-collection' ), value: 'bottom' },158 { label: __( 'Left', 'ekiline-collection' ), value: 'left' },159 ] }160 onChange={ ( addPositionLnkPopover ) =>161 props.setAttributes( { addPositionLnkPopover } )162 }163 />164 {/* cambiar formato */}165 <ToggleControl166 label={ __( 'Is tooltip', 'ekiline-collection' ) }167 checked={ props.attributes.defineTooltip }168 onChange={ ( defineTooltip ) =>169 props.setAttributes( { defineTooltip } )170 }171 />172 </PanelBody>173 </InspectorControls>174 )}175 </Fragment>176 );177178 }179 return <BlockEdit {...props} />;180 };181}, 'withAdvancedControlsBtnCollapse');
182
183/**
80 * @return {function} Devuelve el BlockEdit modificado.
81 */
82const withAdvancedControlsBsButtonLink = createHigherOrderComponent( ( BlockEdit ) => {
83 return ( props ) => { 84 85 // Cerrar Bslink. 86 const{ attributes, setAttributes } = props; 87 const{ dissmissBsComponent } = attributes; 88 89 if( bsBtnAllowedBlocks.includes( props.name ) ){ 90 91 return ( 92 93 <Fragment> 94 <BlockEdit {...props} /> 95 {/** 96 * Nota: Los botones ocupan: props.attributes.url 97 * Las imagenes ocupan: props.attributes.href 98 **/} 99 {props.attributes.url && (100 <InspectorControls>101 <PanelBody title={ __( 'Link to Block (Ekiline)', 'ekiline-collection' ) } initialOpen={ true }>102 {/* Anchor */}103 <TextControl104 label={ __( 'Anchor block name', 'ekiline-collection' ) }105 value={props.attributes.anchorBsComponent}106 onChange={newData => props.setAttributes({anchorBsComponent: newData})}107 />108 {/* Tipo de componente */}109 <SelectControl110 label={ __( 'Choose block', 'ekiline-collection' ) }111 value={ attributes.selectBsComponent }112 options={ [113 { label: __( 'None', 'ekiline-collection' ), value: '' },114 { label: __( 'Collapse', 'ekiline-collection' ), value: 'collapse' },115 { label: __( 'Modal', 'ekiline-collection' ), value: 'modal' },116 { label: __( 'Offcanvas', 'ekiline-collection' ), value: 'offcanvas' },117 ] }118 onChange={ ( selectBsComponent ) =>119 setAttributes( { selectBsComponent } )120 }121 />122 {/* Cerrar Bslink */}123 <ToggleControl124 label={ __( 'Is close button?', 'ekiline-collection' ) }125 checked={ ! dissmissBsComponent }126 onChange={ () => setAttributes( { dissmissBsComponent: ! dissmissBsComponent } ) }127 help={ ! dissmissBsComponent ? __( 'Yes.', 'ekiline-collection' ) : __( 'No.', 'ekiline-collection' ) }128 />129 </PanelBody>130 </InspectorControls>131 )}132 </Fragment>133 );134135 }136 return <BlockEdit {...props} />;137 };138}, 'withAdvancedControlsBsButtonLink');
139
140/**
243 * @return {function} Devuelve el BlockEdit modificado.
244 */
245const withAdvancedControlsBsImageLink = createHigherOrderComponent( ( BlockEdit ) => {
246 return ( props ) => {247248 // Cerrar Bslink.249 const{ attributes, setAttributes } = props;250 const{ dissmissBsComponent } = attributes;251252 if( bsImgAllowedBlocks.includes( props.name ) ){253254 return (255256 <Fragment>257 <BlockEdit {...props} />258 {/**259 * Nota: Los botones ocupan: props.attributes.url260 * Las imagenes ocupan: props.attributes.href261 **/}262 {props.attributes.href && (263 <InspectorControls>264 <PanelBody title={ __( 'Link to Ekiline Block', 'ekiline-collection' ) } initialOpen={ true }>265 {/* Anchor */}266 <TextControl267 label={ __( 'Anchor block name', 'ekiline-collection' ) }268 value={props.attributes.anchorBsComponent}269 onChange={newData => props.setAttributes({anchorBsComponent: newData})}270 />271 {/* Tipo de componente */}272 <SelectControl273 label={ __( 'Choose block', 'ekiline-collection' ) }274 value={ attributes.selectBsComponent }275 options={ [276 { label: __( 'None', 'ekiline-collection' ), value: '' },277 { label: __( 'Collapse', 'ekiline-collection' ), value: 'collapse' },278 { label: __( 'Modal', 'ekiline-collection' ), value: 'modal' },279 { label: __( 'Offcanvas', 'ekiline-collection' ), value: 'offcanvas' },280 ] }281 onChange={ ( selectBsComponent ) =>282 setAttributes( { selectBsComponent } )283 }284 />285 {/* Cerrar Bslink */}286 <ToggleControl287 label={ __( 'Is close button?', 'ekiline-collection' ) }288 checked={ ! dissmissBsComponent }289 onChange={ () => setAttributes( { dissmissBsComponent: ! dissmissBsComponent } ) }290 help={ ! dissmissBsComponent ? __( 'Yes.', 'ekiline-collection' ) : __( 'No.', 'ekiline-collection' ) }291 />292 </PanelBody>293 </InspectorControls>294 )}295 </Fragment>296 );297298 }299 return <BlockEdit {...props} />;300 };301}, 'withAdvancedControlsBsImageLink');
302
303/**
296import { createHigherOrderComponent } from '@wordpress/compose'; // UI.
297
298const newWrapperAtts = createHigherOrderComponent( ( BlockListBlock ) => {
299 return ( props ) => {300301 // Aplicar solo a bloque item progress.302 if( props.name === 'ekiline-collection/ekiline-progress-item' ){303304 // Hook para maniobrar (wrapperProps).305 const wrapperProps = {306 ...props.wrapperProps,307 style : {308 width: props.attributes.progRange+'%',309 },310 };311312 return (313 <BlockListBlock { ...props }314 // className={ 'myfix-' + props.clientId }315 wrapperProps={ wrapperProps }316 />317 );318319 }320321 return ( <BlockListBlock { ...props } /> );322323 };324}, 'newWrapperAtts');
325
326addFilter(
DisplayName allows you to name your component. This name is used by React in debugging messages.
var Hello = createReactClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
var Hello = createReactClass({
displayName: 'Hello',
render: function() {
return <div>Hello {this.props.name}</div>;
}
});