HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/confeduphaar/public_html/wp-content/plugins/essential-blocks/src/blocks/notice/src/edit.js
/**
 * WordPress dependencies
 */
import { RichText } from "@wordpress/block-editor";
import { memo } from "@wordpress/element";
/**
 * Internal depenencies
 */
import Inspector from "./inspector";
import Style from "./style";
import defaultAttributes from "./attributes";
import {
    BlockProps,
    withBlockContext
} from "@essential-blocks/controls";

const Edit = (props) => {
    const {
        attributes,
        setAttributes,
        isSelected,
    } = props;
    const {
        blockId,
        blockMeta,
        resOption,
        title,
        text,
        classHook,
    } = attributes;

    // you must declare this variable
    const enhancedProps = {
        ...props,
        blockPrefix: 'eb-notice',
        style: <Style {...props} />
    };

    return (
        <>
            {isSelected && <Inspector {...props} />}
            <BlockProps.Edit {...enhancedProps}>
                <div
                    className={`eb-parent-wrapper eb-parent-${blockId} ${classHook}`}
                >
                    <div
                        className={`eb-notice-wrapper ${blockId}`}
                        data-id={blockId}
                    >
                        <div className="eb-notice-title-wrapper">
                            <RichText
                                className="eb-notice-title"
                                value={title}
                                onChange={(newTitle) =>
                                    setAttributes({ title: newTitle })
                                }
                                placeholder="Add Title..."
                            />
                        </div>
                        <span className="eb-notice-dismiss" />
                        <div>
                            <RichText
                                className="eb-notice-text"
                                value={text}
                                onChange={(newText) =>
                                    setAttributes({ text: newText })
                                }
                                placeholder="Add Text..."
                            />
                        </div>
                    </div>
                </div>
            </BlockProps.Edit>
        </>
    );
}
export default memo(withBlockContext(defaultAttributes)(Edit))