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

Customize extension ai-cms-grapesjs #11

Closed
godadada opened this issue Aug 29, 2021 · 3 comments
Closed

Customize extension ai-cms-grapesjs #11

godadada opened this issue Aug 29, 2021 · 3 comments

Comments

@godadada
Copy link

I would like to customize it. any references, examples, instructions I can use.

Thanks

@aimeos
Copy link
Owner

aimeos commented Aug 29, 2021

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:

@aimeos aimeos pinned this issue Aug 29, 2021
@aimeos aimeos transferred this issue from aimeos/aimeos Aug 29, 2021
@aimeos aimeos pinned this issue Aug 29, 2021
@aimeos aimeos closed this as completed Feb 19, 2022
@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

@aimeos
Copy link
Owner

aimeos commented Oct 18, 2023

Most likely because of a JS error because your code is wrong. Check the examples to see how they must look like:
Blocks: https://github.com/aimeos/ai-cms-grapesjs/blob/master/themes/admin/jqadm/custom.js#L229-L238
Components: https://github.com/aimeos/ai-cms-grapesjs/blob/master/themes/admin/jqadm/custom.js#L383-L412

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

3 participants