-
Notifications
You must be signed in to change notification settings - Fork 228
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
Question: Is it possible to write an inline grapes-mjml
custom component? (ie. no build system)
#195
Comments
Are you looking to add a new mjml-component or do you just want to create a custom block that you can drag and drop into your editor? To add a custom block you can add it to the editor.BlockManager.add('custom-block', {
category: 'section',
label: '3/7 split',
attributes: {
title: '3/7 split',
class: 'gjs-fonts gjs-f-b37'
},
class: 'gjs-fonts gjs-f-b37',
content: `<mj-section background-color="#FFFFFF">
<mj-column width="30%" border-radius="0 0 0 0" padding="10px">
<mj-text font-family="Roboto, Helvetica, sans-serif" font-size="17px" line-height="24px" color="#616161" align="center">
default text
</mj-text>
</mj-column>
<mj-column width="70%" border-radius="0 0 0 0" padding="10px">
<mj-text font-family="Roboto, Helvetica, sans-serif" font-size="17px" line-height="24px" color="#616161" align="center">
default text
</mj-text>
</mj-column>
</mj-section>`
}) If you want to add a new mjml component (for example |
@DRoet actually, I think a custom block would work just fine. My use case is adding static custom placeholders (ex. const block_manager = editor.BlockManager;
block_manager.add('placeholder-location', {
category: 'Placeholders',
label: 'Location',
content: '<mj-text>[: location :]</mj-text>',
attributes: { class: 'gjs-fonts gjs-f-text' },
}); Is there a way to make a block like that not editable? |
Ok feel free to close this issue if it's resolved by using custom blocks |
I will. Thanks @DRoet Daan. Just a real quick question- how do I make the block read only? |
Have you tried using the |
I will look into it, thanks for the pointer! |
@DRoet Hi Daan. I am using GrapesJS block_manager.add('appointment-location-email', {
category: 'Appointment Placeholders',
label: 'Location - Email',
content: '<mj-text>[:appointment_location_email:]</mj-text>',
attributes: {
class: 'gjs-fonts gjs-f-text',
title: 'Drag to insert the appointment location email address placeholder.',
disable: true
},
}); But the block continues to be editable (ie. I can double-click on it in the canvas and change the content). Am I configuring the block incorrectly? I did not see any documentation regarding making blocks read only in the GrapesJS docs or GrapesJS MJML Git site. Additionally, I thought that the |
Hmm block_manager.add('appointment-location-email', {
category: 'Appointment Placeholders',
label: 'Location - Email',
content: `<mj-text data-gjs-draggable="false" data-gjs-droppable="false" data-gjs-editable="false" data-gjs-hoverable="false" data-gjs-selectable="false" data-gjs-propagate="['draggable', 'droppable', 'editable', 'hoverable', 'selectable']">[:appointment_location_email:]</mj-text>`,
attributes: {
class: 'gjs-fonts gjs-f-text',
title: 'Drag to insert the appointment location email address placeholder.'
},
}); You can read more on the properties here |
@DRoet Daan, that did it. Thank for the help! It was very much appreciated! |
hey @DRoet I am looking for creating something like this A MJML CUSTOM COMPONENT and i need all mj-text stylables to mj-coupon and also i have doubt i need to create this tag through mjml after that i need to use the tag in grapesjs mjml but by default in grapesjs mjml in supported tag there is no option to support for custom tags |
Hello,
I'm working in an environment without a build system, so as a result I have to use the pre-built
grapesjs-mjml
plugin in mygrapesjs.init()
. I am trying to write a customgrapejs-mjml
component as a function expression (ie.const customComponentTypes = (editor) => {};
that can then be included via thegrapesjs.init()
plugins
list.However, I'm running into the obvious problems of not having access to the
coreMjmlModel
andcoreMjmlView
expressions along with other utilities such asmjmlConvert
since those are part of the pre-built plugin script and I have no way of importing them separately for inline use.Is there any way to gain a reference to the utilities and expressions required to create an inline
grapesjs-mjml
component? Or, am I going to have to find a way to incorporate a build system into my project, clone the fullgrapesjs-mjml
, write the component as a stand-alone component js file, and run a build to get a complete minified file?The text was updated successfully, but these errors were encountered: