Grapesjs: Custom component, Need 4 Columns at a time when I drag

Created on 19 Feb 2020  路  4Comments  路  Source: artf/grapesjs

Hello @artf, I have created custom component, where I need to display 4 columns with specific style when I drag a component to the canvas and in each column again I have some html content with specific styles and again i have to give user to edit the content or image but not the styles. Can I have a example where anybody does this kind of functionality? as of now I have created a custom type for a column and static content with in the column, but I am stuck with remaining functionalities. please help to achieve this

Most helpful comment

@PKRekha you can prevent the styling by setting stylable property to false and for having 4 instances of your component type, just go like this:

const bm = editor.BlockManager;

    bm.add('COLUMN', {
        label:'Column',
        content:`
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
        `
    })

Cheers!

All 4 comments

Please adjust title and follow the contents of the issue template

Hello @artf , I have created custom component, where I need to display 4 columns with specific style when I drag a component to the canvas and in each column again I have some html content with specific styles and again i have to give user to edit the content or image but not the styles. Can I have a example where anybody does this kind of functionality? as of now I have created a custom type for a column and static content with in the column, but I am stuck with remaining functionalities. please help to achieve this

@PKRekha you can prevent the styling by setting stylable property to false and for having 4 instances of your component type, just go like this:

const bm = editor.BlockManager;

    bm.add('COLUMN', {
        label:'Column',
        content:`
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
            <div data-gjs-type="column-type"></div>   
        `
    })

Cheers!

Hey @pouyamiralayi thanks for giving me an idea on how can I approach to this.. I got it now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YashPrince picture YashPrince  路  3Comments

kosirm picture kosirm  路  3Comments

kawika-connell picture kawika-connell  路  3Comments

ionic666 picture ionic666  路  3Comments

mathiasbc picture mathiasbc  路  3Comments