How to use the @webiny/app-page-builder/editor/actions.elementCreated 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 / elements / row / index.js View on Github external
// Add new child element
            let row = addElementToParent(column || element, target, position);

            // Recalculate column widths
            row = distributeColumnWidths(row);

            // Dispatch update action
            dispatch(updateElement({ element: row }));

            if (source.path) {
                dispatch(deleteElement({ element: source }));
            }

            if (dispatchNew) {
                dispatch(elementCreated({ element, source }));
            }
        },
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / block / index.js View on Github external
dispatchNew = true;
                element = createElement(source.type, {}, target);
            }

            const block = addElementToParent(element, target, position);

            // Dispatch update action
            redux.store.dispatch(updateElement({ element: block }));

            // Delete exiting element
            if (source.path) {
                redux.store.dispatch(deleteElement({ element: source }));
            }

            if (dispatchNew) {
                redux.store.dispatch(elementCreated({ element, source }));
            }
        },
        onChildDeleted({ element }) {
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / column / index.js View on Github external
dispatchNew = true;
        newColumn = createColumn();
    }

    // $FlowFixMe
    newColumn = set(newColumn, "data.width", row.elements[targetIndex].data.width);

    row = addElementToParent(newColumn, row, targetIndex + 1);
    redux.store.dispatch(updateElement({ element: row }));

    if (source.path) {
        redux.store.dispatch(deleteElement({ element: source }));
    }

    if (dispatchNew) {
        redux.store.dispatch(elementCreated({ element: newColumn, source }));
    }
};

@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