How to use the @webiny/plugins.getPlugins 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 / app-admin / src / plugins / GlobalSearch / SearchBar.js View on Github external
list: Array,
        current: ?GlobalSearch
    }
};

class SearchBar extends React.Component<*, State> {
    state = {
        active: false,
        searchTerm: {
            previous: "",
            current: ""
        },
        plugins: {
            // List of all registered "global-search" plugins.
            list: getPlugins("global-search"),
            hotKeys: getPlugins("global-search-prevent-hotkey"),
            // Current plugin - set by examining current route and its query params (on construct).
            current: undefined
        }
    };

    /**
     * Helps us trigger some of the downshift's methods (eg. clearSelection) and helps us to avoid adding state.
     */
    downshift: any = React.createRef();

    /**
     * At some point we must programmatically focus the input.
     */
    input: any = React.createRef();

    /**
github webiny / webiny-js / packages / app-security / src / admin / views / Users / UsersForm.js View on Github external
const UsersForm = () => {
    const { form: crudForm } = useCrud();

    const auth = getPlugins("security-authentication-provider")
        .filter(pl => pl.hasOwnProperty("renderUserForm"))
        .pop();

    if (!auth) {
        throw Error(
            `You must register a "security-authentication-provider" plugin to render User form!`
        );
    }

    return (
        <form>
            {({ data, form, Bind }) =&gt; (
                
                    {crudForm.loading &amp;&amp; }
                    
                    </form>
github webiny / webiny-js / packages / app-forms / src / admin / components / FormEditor / Fields.js View on Github external
function getGroups() {
        const presetFieldPlugins = getPlugins("form-editor-field-type")
            .filter(pl => pl.field.group)
            .filter(pl => {
                if (pl.field.unique) {
                    return !getField({ name: pl.field.name });
                }
                return true;
            });

        return getPlugins("form-editor-field-group").map(pl => ({
            ...pl.group,
            name: pl.name,
            fields: presetFieldPlugins.filter(f => f.field.group === pl.name).map(pl => pl.field)
        }));
    }
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / pagesList / PagesListDesignSettings.js View on Github external
const PagesListDesignSettings = ({ pageBuilder: { theme }, Bind, data }: Object) =&gt; {
    const components = getPlugins("pb-page-element-pages-list-component");

    return (
        
            
                
                    
                        <select label="{&quot;Design&quot;}">
                            {components.map(cmp =&gt; (
                                <option value="{cmp.componentName}">
                                    {cmp.title}</option></select>
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elementSettings / delete / DeleteAction.js View on Github external
const DeleteAction = ({ element, children, deleteElement }: Object) => {
    const plugin = getPlugins("pb-page-element").find(pl => pl.elementType === element.type);
    if (!plugin) {
        return null;
    }

    if (typeof plugin.canDelete === "function") {
        if (!plugin.canDelete({ element })) {
            return null;
        }
    }

    return React.cloneElement(children, { onClick: deleteElement });
};
github webiny / webiny-js / packages / app-forms / src / admin / components / FormEditor / Tabs / EditTab / EditFieldDialog / ValidatorsTab.js View on Github external
const validators = useMemo(() => {
        return getPlugins("form-editor-field-validator")
            .map(plugin => plugin.validator)
            .map(validator => {
                if (fieldType.field.validators.includes(validator.name)) {
                    return { optional: true, validator: validator };
                } else if (fieldType.field.validators.includes(`!${validator.name}`)) {
                    return { optional: false, validator: validator };
                }
                return null;
            })
            .filter(Boolean)
            .sort((a, b) => {
                if (!a.optional && b.optional) {
                    return -1;
                }

                if (a.optional && !b.optional) {
github webiny / webiny-js / packages / app-security / src / admin / views / Account.js View on Github external
const UsersForm = () => {
    const auth = getPlugins("security-authentication-provider")
        .filter(pl => pl.hasOwnProperty("renderUserAccountForm"))
        .pop();

    if (!auth) {
        throw Error(
            `You must register a "security-authentication-provider" plugin to render Account form!`
        );
    }

    const { renderUserAccountForm } = auth;

    const [{ loading, user }, setState] = useReducer((prev, next) => ({ ...prev, ...next }), {
        loading: true,
        user: { data: {} }
    });
github webiny / webiny-js / packages / app-page-builder / src / editor / components / Element.js View on Github external
withProps(({ element }) => ({
        plugin: element
            ? getPlugins("pb-page-element").find(pl => pl.elementType === element.type)
            : null
    })),
    withHandlers({
github webiny / webiny-js / packages / app-page-builder / src / editor / components / Editor / Toolbar.js View on Github external
const Toolbar = ({ activePluginsTop }: Object) =&gt; {
    const actionsTop = getPlugins("pb-editor-toolbar-top");
    const actionsBottom = getPlugins("pb-editor-toolbar-bottom");

    return (
        
            
                {actionsTop
                    .filter(plugin =&gt; typeof plugin.renderDrawer === "function")
                    .map(plugin =&gt; (
                        
                            {plugin.renderDrawer()}
                        
                    ))}
github webiny / webiny-js / packages / app-page-builder / src / admin / views / Menus / MenusForm / MenuItems / MenuItemRenderer.js View on Github external
canDrop,
            canDrag,
            node,
            title,
            draggedNode,
            path,
            treeIndex,
            editItem,
            deleteItem,
            className,
            style,
            didDrop
        } = this.props;
        const nodeTitle = title || node.title;

        const plugin = getPlugins("pb-menu-item").find(pl =&gt; pl.menuItem.type === node.type);
        if (!plugin) {
            return null;
        }

        const handle = connectDragSource(<div>{plugin.icon}</div>, {
            dropEffect: "copy"
        });

        const isDraggedDescendant = draggedNode &amp;&amp; isDescendant(draggedNode, node);
        const isLandingPadActive = !didDrop &amp;&amp; isDragging;

        let buttonStyle = { left: -0.5 * scaffoldBlockPxWidth };

        return (
            <div style="{{">
                {toggleChildrenVisibility &amp;&amp;</div>

@webiny/plugins

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

MIT
Latest version published 19 days ago

Package Health Score

86 / 100
Full package analysis

Similar packages