%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/1857783/root/home/maraton/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/src/js/
Upload File :
Create Path :
Current File : //proc/1857783/root/home/maraton/maraton.eco-n-tech.co.uk/wp-content/themes/maraton/src/js/admin.js

import '../scss/admin.scss';

document.addEventListener( 'DOMContentLoaded', function() {
    const { createHigherOrderComponent } = wp.compose;
    const { Fragment } = wp.element;
    const { InspectorControls } = wp.blockEditor;
    const { PanelBody, SelectControl } = wp.components;

    // Extend the "core/columns" block editor to add a custom block attribute
    wp.hooks.addFilter('editor.BlockEdit', 'core/columns', createHigherOrderComponent((BlockEdit) => {
        return (props) => {
            if (props.name !== 'core/columns') {
                return <BlockEdit {...props} />;
            }

            const { attributes, setAttributes } = props;
            const { className } = attributes;

            return (
                <Fragment>
                    <BlockEdit {...props} />
                    <InspectorControls {...props}>
                        <PanelBody title="Contauner Width">
                            <SelectControl
                                label="Container Width"
                                value={className}
                                onChange={(className) => setAttributes({ className })}
                                options={[
                                    { label: 'wide', value: 'container-wide' },
                                    { label: 'fluid', value: 'container-fluid' },
                                ]}
                            />
                        </PanelBody>
                    </InspectorControls>
                </Fragment>
            );
        };
    }));

    // Add container class to core/columns block
    wp.hooks.addFilter('blocks.getSaveContent.extraProps', 'core/columns', (props, blockType, attributes) => {
        if (blockType.name !== 'core/columns') {
            return props;
        }

        props.className = props.className ? props.className : '';

        return props;
    });
});

Zerion Mini Shell 1.0