Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> Not yet. This is the most interesting part for customization because it adds new blocks and components: https://github.com/aimeos/ai-cms-grapesjs/blob/master/admin/jqadm/themes/custom.js#L206-L626 #32

Closed
Alababdiy opened this issue Oct 17, 2023 · 0 comments

Comments

@Alababdiy
Copy link

          > Not yet. This is the most interesting part for customization because it adds new blocks and components: https://github.com/aimeos/ai-cms-grapesjs/blob/master/admin/jqadm/themes/custom.js#L206-L626

You can add your own ones in the custom.js file of your own extension by adding:

Aimeos.CMSContent.GrapesJS.blocks.yourblock = {
    // ...
};

Aimeos.CMSContent.GrapesJS.components.yourcomponent = {
    // ...
};

For how GrapesJS works and what you can do, read the GrapesJS documentation:

how i c

Aimeos.CMSContent.GrapesJS.blocks.yourblock = {
// ...
};

Aimeos.CMSContent.GrapesJS.components.yourcomponent = {
// ...
};

Thanks @aimeos but when I try to add my custom component, is not showing and all the existing default elements disappear

*
 * Custom myext JS
 */
Aimeos.CMSContent.GrapesJS.blocks.yourblock = {
    label: "Your Block",
    category: "Custom Blocks",
    content: {
        type: "yourblock",
        components: {
            yourcomponent: {}
        },
        activeOnRender: true
    },
    render: ({ el }) => {
        el.innerHTML = "<div>Your Block Content Goes Here</div>";
    }
};

Aimeos.CMSContent.GrapesJS.components.yourcomponent = {
    label: "Your Component",
    content: {
        type: "yourcomponent",
        components: {},
    },
    render: ({ el }) => {
        el.innerHTML = "<div>Your Component Content Goes Here</div>";
    }
};

JFGq4wJ.md.png

Originally posted by @Alababdiy in #11 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant