Component properties configuration
Question
@artf Sorry to post it again, It will be the continuation of #952
I just discussed the approach with MJML community and our conversation went like this
https://github.com/mjmlio/mjml/issues/1063#issuecomment-374526777
Please have a look at this.
So in order to avoid heavy load time and other MJML limitations and I have chosen to use Custom approach, where I'm creating my own components.
Again some more questions to avoid some development bottlenecks in future with Grapesjs implementation.
Let's take a two column layout <img width="111" alt="screen shot 2018-03-20 at 3 38 56 pm" src="https://user-images.githubusercontent.com/25955939/37652999-66a6a74a-2c63-11e8-901d-96340910387c.png"> as an example , where i can drag and drop the component and it's respective html will be rendered. The html is a MJML converted html https://mjml.io/try-it-live and i'm hard coding that converted code like below.
I just stripped down some codes
bm.add('sect50', {
label: opt.sect50BlkLabel,
category: 'Structure' || opt.categoryLabel,
attributes: {class:'gjs-fonts gjs-f-b2'},
content: '
<div data-gjs-removable="false" data-gjs-highlightable="false" class="mj-container" >
<!--[if mso | IE]>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
<tr>
<td data-gjs-removable="false" data-gjs-highlightable="false" style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
<![endif]-->
<div data-gjs-removable="false" data-gjs-highlightable="false" style="margin:0 auto;max-width:600px">
<table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0;width:100%" align="center" border="0">
<tbody>
...........bla..............bla...............bla..........
<td style="vertical-align:top;width:600px;">
<![endif]-->
<div class="mj-column-per-100 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%">
<table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0">
<tbody>
...........bla..............bla...............bla..........
...........bla..............bla...............bla..........
<tr>
<td style="word-wrap:break-word;font-size:0;padding:10px 25px" align="left">
<div data-gjs-removable="true" data-gjs-highlightable="true" style="cursor:auto;color:#f45e43;font-family:helvetica;font-size:20px;line-height:22px;text-align:left">Hello World</div>
</td>
</tr>
...........bla..............bla...............bla..........
</table>
</div>
<!--[if mso | IE]>
</td>
</tr>
</table>
<![endif]-->
</div>
})
, and added some attributes to data-gjs-removable="false" data-gjs-highlightable="false" make some div td tr as selectable/removable/draggable/droppable.
It looks manual entry of data model and it may lead to buggy in future and I don't know whether we can achieve everything like this.
-
Is there any way to configure these things using Custom component https://github.com/artf/grapesjs/wiki/Components.
-
While creating a custom component or While importing a template

Is it possible to do the same level configuration to all it's children inorder to handle highlight, selectable, removable, draggable, droppable and others? -
I'm going to develop the other components as well using this approach. Is this fine or any alternative ways?

Thanks in advance
Answers (3)
@artf Can you please check this
You should definitely use Custom Components, which is exactly the same way I do in grapesjs-mjml but, in your case, instead of relying on MJML renderer you would do it on your own logic
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #518
change only component body not whole page body.
Hello @artf As we discussed in issue #374. setComponents will set the body and replace all the contents that are present on the page with a...
Issue #1735
Vuejs components builder
Hi, it would be nice to have vue components builder like mjml.. This user started project: https://github.com/Patrick-Spiegel/vue-grapesjs...
Issue #1629
Grapesjs- When i drag and drop the video into the canvas, i want it to be selected on Component Setting right away
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #774
Mimic customRTE behavior when parsing content
Hi @artf, I'd like to replicate this behavior when calling editor.setComponents("<div>This is a text component. <span style='font-size: 20p...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.