HEX
Server: LiteSpeed
System: Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User: swifizcd (1555)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/swifizcd/buyease.com.ng/wp-content/plugins/essential-blocks/src/blocks/tab/src/edit.js
/**
 * WordPress dependencies
 */
import { __ } from "@wordpress/i18n";
import {
    InnerBlocks
} from "@wordpress/block-editor";
import { useSelect } from "@wordpress/data";
import { memo, useEffect } from '@wordpress/element'
import {
    BlockProps,
    withBlockContext
} from "@essential-blocks/controls";
import defaultAttributes from "./attributes";

const Edit = (props) => {
    const { attributes, setAttributes, clientId, context } = props;
    const {
        tabId,
        tabParentId
    } = attributes;

    // you must declare this variable
    const enhancedProps = {
        ...props,
        blockPrefix: 'eb-tab',
        rootClass: `eb-guten-block-main-parent-wrapper eb-tab-editor-wrap`,
    };

    const { blocks } = useSelect((select) => ({
        blocks: select("core/block-editor").getBlockOrder(clientId)
    }), []);

    useEffect(() => {
        setAttributes({
            tabParentId : context['eb/tabParentId'],
        })
    }, [context['eb/tabParentId']])

    return (
        <BlockProps.Edit {...enhancedProps}>
            <div
                className={`eb-tab-wrapper eb-tab-wrapper-editor`}
                data-tab-id={tabId}
                data-tab-parent-id={tabParentId}
            >
                <div className="eb-tab-inner">
                    <InnerBlocks
                        orientation={"vertical"}
                        templateLock={
                            // templateLock ? templateLock :
                            false
                        }
                        renderAppender={
                            blocks.length > 0
                                ? undefined
                                : InnerBlocks.ButtonBlockAppender
                        }
                    />
                </div>
            </div>
        </BlockProps.Edit>
    );
}

export default memo(withBlockContext(defaultAttributes)(Edit))