How to use the @webiny/app-page-builder/editor/redux.connect function in @webiny/app-page-builder

To help you get started, we’ve selected a few @webiny/app-page-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / defaultBar / components / PreviewPageButton.js View on Github external
import { Icon } from "@webiny/ui/Icon";
import { ReactComponent as PreviewIcon } from "@webiny/app-page-builder/admin/assets/visibility.svg";

const PreviewPageButton = ({ page }: Object) => {
    const { getPagePreviewUrl } = usePageBuilderSettings();
    return (
        <menuitem> window.open(getPagePreviewUrl(page), "_blank")}&gt;
            
                } /&gt;
            
            Preview
        </menuitem>
    );
};

export default connect(
    state =&gt; ({ page: omit(getPage(state), ["content"]) }),
    null,
    null,
    { areStatePropsEqual: isEqual }
)(withRouter(PreviewPageButton));
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / toolbar / addElement / AddElement.js View on Github external
{plugin.toolbar.preview({ theme })}
                                        
                                    
                                ,
                                plugin
                            );
                        })}
                
            
        );
    }
}

export default compose(
    connect(
        state =&gt; {
            const getParams = getActivePluginParams("pb-editor-toolbar-add-element");
            return {
                params: getParams ? getParams(state) : null
            };
        },
        { dragStart, dragEnd, deactivatePlugin, dropElement }
    ),
    withPageBuilder(),
    withHandlers({
        enableDragOverlay: () =&gt; () =&gt; {
            const el = document.querySelector(".pb-editor");
            if (el) {
                el.classList.add("pb-editor-dragging");
            }
        },
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / button / ButtonContainer.js View on Github external
"webiny-pb-page-element-button__icon--" + position
                )}
            &gt;
                {svg &amp;&amp; <span>}
                
            
        
    );
};

export default compose(
    connect(
        (state, props) =&gt; ({ element: getElement(state, props.elementId) }),
        { updateElement }
    ),
    withHandlers({
        onChange: ({ element, updateElement }) =&gt; (value: string) =&gt; {
            updateElement({ element: set(element, "data.text", value) });
        }
    })
)(ButtonContainer);
</span>
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / columnWidth / Settings.js View on Github external
<input>
                                        
                                    
                                
                            
                        
                    
                )}
            
        );
    }
}

export default compose(
    connect(
        state =&gt; ({ element: getActiveElement(state) }),
        { updateElement }
    )
)(Settings);
github webiny / webiny-js / packages / app-page-builder / src / editor / components / Editor / Content.js View on Github external
{content}
                
            
        
    );
};

const stateToProps = state =&gt; ({
    rootElement: state.elements[getContent(state).id],
    layout: get(getPage(state), "settings.general.layout"),
    renderLayout: isPluginActive("pb-editor-toolbar-preview")(state)
});

export default compose(
    connect(stateToProps),
    withPageBuilder()
)(Content);
github webiny / webiny-js / packages / app-page-builder / src / editor / components / Element.js View on Github external
{plugin.render({ element })}
                        
                        {/*
                        <div>+</div>
                        <div>+</div>
                        */}
                    
                )}
            
        );
    }
);

export default compose(
    setDisplayName("Element"),
    connect(
        (state, props) =&gt; {
            return {
                ...getElementProps(state, props),
                element: getElement(state, props.id)
            };
        },
        { dragStart, dragEnd, activateElement, highlightElement },
        null,
        { areStatePropsEqual: isEqual }
    ),
    withProps(({ element }) =&gt; ({
        plugin: element
            ? getPlugins("pb-page-element").find(pl =&gt; pl.elementType === element.type)
            : null
    })),
    withHandlers({
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / blockEditing / AddBlock.js View on Github external
bottom: 20,
    right: 20
});

const AddBlock = ({ togglePlugin }) =&gt; {
    return (
        
             togglePlugin({ name: "pb-editor-search-blocks-bar" })}
                icon={}
            /&gt;
        
    );
};

export default connect(
    null,
    { togglePlugin }
)(AddBlock);
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / image / ImageContainer.js View on Github external
imgStyle.height = isNumeric(height) ? parseInt(height) : height;
    }

    return (
        
            
        
    );
});

export default compose(
    connect(
        (state, { elementId }) =&gt; {
            const element = getElement(state, elementId);
            const { image = {}, settings = {} } = element.data;

            return {
                element: { id: element.id, type: element.type, path: element.path },
                image,
                horizontalAlign: settings.horizontalAlign || "center"
            };
        },
        { updateElement },
        null,
        { areStatePropsEqual: isEqual }
    ),
    withHandlers({
        onChange: ({ updateElement, element }) =&gt; async data =&gt; {
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / width / Settings.js View on Github external
<input>
                                        
                                    
                                
                            
                        
                    
                )}
            
        );
    }
}

export default compose(
    connect(
        state =&gt; ({ element: getActiveElement(state) }),
        { updateElement }
    )
)(Settings);
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / align / HorizontalAlignAction.js View on Github external
const HorizontalAlignAction = ({ element, children, alignElement, align }: Object) => {
    const plugin = getPlugins("pb-page-element").find(
        pl => pl.elementType === element.type
    );

    if (!plugin) {
        return null;
    }

    return React.cloneElement(children, { onClick: alignElement, icon: icons[align] });
};

const defaultOptions = { alignments: ["left", "center", "right", "justify"] };

export default compose(
    connect(
        state => ({ element: getActiveElement(state) }),
        { updateElement }
    ),
    withProps(({ element }) => ({
        align: get(element, "data.settings.horizontalAlign") || "left"
    })),
    withHandlers({
        alignElement: ({
            updateElement,
            element,
            align,
            options: { alignments } = defaultOptions
        }) => {
            return () => {
                const types = Object.keys(icons).filter(key =>
                    alignments ? alignments.includes(key) : true

@webiny/app-page-builder

[![](https://img.shields.io/npm/dw/@webiny/app-page-builder.svg)](https://www.npmjs.com/package/@webiny/app-page-builder) [![](https://img.shields.io/npm/v/@webiny/app-page-builder.svg)](https://www.npmjs.com/package/@webiny/app-page-builder) [![code sty

MIT
Latest version published 2 days ago

Package Health Score

80 / 100
Full package analysis

Similar packages