How to use the webiny-plugins.getPlugin function in webiny-plugins

To help you get started, we’ve selected a few webiny-plugins 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 / webiny-app-cms / src / editor / plugins / elementSettings / advanced / index.js View on Github external
middleware: ({ store, action, next }: Object) => {
            const { element, source } = action.payload;

            next(action);

            // Check the source of the element (could be `saved` element which behaves differently from other elements)
            const sourcePlugin = getPlugin(source.type);
            if (!sourcePlugin) {
                return;
            }
            const { onCreate } = sourcePlugin;
            if (!onCreate || onCreate !== "skip") {
                // If source element does not define a specific `onCreate` behavior - continue with the actual element plugin
                const plugin = getPlugin(element.type);
                if (!plugin) {
                    return;
                }
                const { onCreate } = plugin;
                if (onCreate && onCreate === "open-settings") {
                    store.dispatch(activateElement({ element: element.id }));
                    store.dispatch(togglePlugin({ name: "cms-element-settings-advanced" }));
                }
            }
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / align / HorizontalAlignFlex.js View on Github external
const HorizontalAlignActionFlex = ({ element, children, alignElement, align }: Object) => {
    const plugin = getPlugin(element.type);
    if (!plugin) {
        return null;
    }

    return React.cloneElement(children, { onClick: alignElement, icon: icons[align] });
};
github webiny / webiny-js / packages / webiny-app-cms / src / admin / views / Menus / MenusForm / MenuItems / MenuItemsList.js View on Github external
static canHaveChildren(node: Object) {
        const plugin = getPlugin(node.type);
        return plugin ? plugin.canHaveChildren : false;
    }
github webiny / webiny-js / packages / webiny-app-cms / src / editor / utils.js View on Github external
export const createElement = (type: string, options: Object = {}, parent: ?ElementType) => {
    const plugin = getPlugin(type);

    invariant(plugin, `Missing element plugin "${type}"!`);

    return {
        id: shortid.generate(),
        data: {},
        elements: [],
        path: "",
        ...plugin.create(options, parent)
    };
};
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / bar / ElementSettingsBar.js View on Github external
const actions = plugin.settings.map(pl => {
        if (typeof pl === "string") {
            return { plugin: getPlugin(pl || divider), options: {} };
        }

        if (Array.isArray(pl)) {
            return { plugin: getPlugin(pl[0] || divider), options: pl[1] };
        }

        return null;
    });
github webiny / webiny-js / packages / webiny-app-cms / src / editor / plugins / elementSettings / clone / CloneAction.js View on Github external
const CloneAction = ({ element, children, duplicate }: Object) => {
    const plugin = getPlugin(element.type);
    if (!plugin) {
        return null;
    }

    return React.cloneElement(children, { onClick: duplicate });
};
github webiny / webiny-js / packages / webiny-app-page-builder / src / admin / components / withSavedElements / EditElementDialog.js View on Github external
const EditElementDialog = (props: Props) => {
    const { open, onClose, onSubmit, plugin: pluginName } = props;

    const plugin = getPlugin(pluginName);

    return (
        <dialog open="{open}">
            {plugin &amp;&amp; (
                <form>
                    {({ submit, Bind }) =&gt; (
                        
                            
                                Update {plugin.title}
                            
                            
                                
                                    
                                        
                                            <input label="{&quot;Name&quot;}">
                                        </form></dialog>
github webiny / webiny-js / packages / webiny-app / src / components / withFileUpload.js View on Github external
const getFileUploader = () => {
    const withFileUploadPlugin = getPlugin("with-file-upload-uploader");

    invariant(
        withFileUploadPlugin,
        `"withFileUpload" component's uploader plugin (type "webiny-file-upload-uploader") not found.`
    );

    return file => {
        return withFileUploadPlugin.upload(file);
    };
};

webiny-plugins

A simple registry that stores all plugins in a shared object.

MIT
Latest version published 6 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages