Is it possible to create a component using react components?
Question
is it possible to create or get a react component from some library and insert as a allowed component for create a template?
import React from 'react';
import CustomButton from './components/CustomButton'
import grapesjs from 'grapesjs'
const editor = grapesjs.init({
...
});
editor.addComponents(<CustomButton color="red" otherProp={...somepros}/>);
//or
editor.BlockManager.add('CustomButton', {
label: 'button',
content: <CustomButton color="red" otherProp={...somepros}/>,
});
Answers (1)
@TRUEND here is an example Cheers!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #951
[QUESTION] Selection of custom components not possible from canvas.
Hey, I tried to figure this out by myself, but I'm feeling I'm going a little bit in circles. So I hope you will have some time to read thi...
Issue #1960
[QUESTION] Dynamic class generation with a template
Hi there ! I am wondering if there is a way to force the dynamic class generation (of the form cXXXXX which happens when I drag'n'drop a co...
Issue #384
Create and Edit Template into Database
This is my code to Create a new template and insert the inline html with style into the database : I am able to insert the template-data in...
Issue #438
Imported HTML, I can move components but not edit them
All I did was import HTML, except I can't modify the text in the HTML I can't type anything or remove any text
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.