BossBey File Manager
PHP:
8.2.30
OS:
Linux
User:
imagivibe
Root
/
.
/
wp-content
/
plugins
/
porto-functionality
/
builders
/
elements
/
type
/
elements
📤 Upload
📝 New File
📁 New Folder
Close
Editing: hover-container.js
/** * Post Type Builder - Hover Container * * @since 2.3.0 */ import PortoStyleOptionsControl, {portoGenerateStyleOptionsCSS} from '../../../../shortcodes/assets/blocks/controls/style-options'; ( function ( wpI18n, wpBlocks, wpBlockEditor, wpComponents ) { "use strict"; const __ = wpI18n.__, registerBlockType = wpBlocks.registerBlockType, InspectorControls = wpBlockEditor.InspectorControls, SelectControl = wpComponents.SelectControl, TextControl = wpComponents.TextControl, RangeControl = wpComponents.RangeControl, ToggleControl = wpComponents.ToggleControl, Disabled = wpComponents.Disabled, PanelBody = wpComponents.PanelBody, ServerSideRender = wp.serverSideRender; const PortoTBHoverContainer = function ( { attributes, setAttributes, name } ) { const content_type = document.getElementById( 'content_type' ).value; let content_type_value, attrs = { el_class: attributes.el_class, className: attributes.className }; if ( content_type ) { attrs.content_type = content_type; content_type_value = document.getElementById( 'content_type_' + content_type ); if ( content_type_value ) { content_type_value = content_type_value.value; attrs.content_type_value = content_type_value; } } let internalStyle = '', font_settings = Object.assign( {}, attributes.font_settings ); const style_options = Object.assign( {}, attributes.style_options ); let selectorCls; if ( attributes.el_class ) { selectorCls = attributes.el_class; } else { selectorCls = 'porto-tb-woo-desc-' + Math.ceil( Math.random() * 10000 ); setAttributes( { el_class: selectorCls } ); } return ( <> <InspectorControls key="inspector"> <PanelBody title={ __( 'Font Settings', 'porto-functionality' ) } initialOpen={ true }> <SelectControl label={ __( 'Alignment', 'porto-functionality' ) } value={ attributes.alignment } options={ [ { 'label': __( 'Inherit', 'porto-functionality' ), 'value': '' }, { 'label': __( 'Left', 'porto-functionality' ), 'value': 'left' }, { 'label': __( 'Center', 'porto-functionality' ), 'value': 'center' }, { 'label': __( 'Right', 'porto-functionality' ), 'value': 'right' }, { 'label': __( 'Justify', 'porto-functionality' ), 'value': 'justify' } ] } onChange={ ( value ) => { setAttributes( { alignment: value } ); } } /> <PortoTypographyControl label={ __( 'Typography', 'porto-functionality' ) } value={ font_settings } options={ { } } onChange={ ( value ) => { setAttributes( { font_settings: value } ); } } /> </PanelBody> <PortoStyleOptionsControl label={ __( 'Style Options', 'porto-functionality' ) } value={ style_options } options={ {} } onChange={ ( value ) => { setAttributes( { style_options: value } ); } } /> </InspectorControls> <Disabled> <style> { internalStyle } { portoGenerateStyleOptionsCSS( style_options, selectorCls ) } </style> <ServerSideRender block={ name } attributes={ attrs } /> </Disabled> </> ) } registerBlockType( 'porto-tb/porto-woo-desc', { title: __( 'Woo Short Description', 'porto-functionality' ), icon: 'porto', category: 'porto-tb', attributes: { content_type: { type: 'string', }, content_type_value: { type: 'string', }, font_settings: { type: 'object', default: {}, }, style_options: { type: 'object', }, el_class: { type: 'string', } }, edit: PortoTBHoverContainer, save: function () { return null; } } ); } )( wp.i18n, wp.blocks, wp.blockEditor, wp.components );
Save
Cancel