javascript - 将 GrapesJS 与 React JS 集成

标签 javascript reactjs grapesjs

我正在尝试将 GrapesJS 功能与我的 React APP 集成。

I get an error while implementing like `Uncaught TypeError: Cannot read property 'forEach' of undefined grapesjs react`

I would like to have a feature like in this URL

https://grapesjs.com/demo.html



npm i grapesjs-react

import React, {Component} from 'react';
import GEditor from 'grapesjs-react';

class GEditorExample extends Component {
 render() {
   return (
         <GEditor/>
     );
   }
}

export default GEditorExample;
  • 如何为我的 React 应用程序获取此功能以构建 HTML Web Builder。

任何帮助都会很棒。 谢谢。*

最佳答案

你必须指定 blocks 属性,这个 block 将通过 grapes-js 的 blockmanager.add 方法添加到编辑器中。 如果不需要 block ,请尝试提供一个空数组,例如:

<GEditor id="gjs" blocks={[]} />

关于javascript - 将 GrapesJS 与 React JS 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57566967/

相关文章:

javascript - React Native map 函数无法使用同一类中的函数

javascript - 使用 React-Bootstrap ListGroup 通过 onClick 触发函数

grapesjs - 是否可以在同一页面上有多个grapesjs 实例?

javascript - 从 Javascript 中的 grapes.js 时事通讯编辑器获取 HTML 和 CSS

javascript - JS 中的正则表达式

javascript - React 将 props 对象转换为数组然后设置状态

javascript - jquery 无法设置变量

javascript - Skrollr 添加空格

javascript - React 表单不更新 mongo 数据库

javascript - 在 GrapesJS 上配置 tailwind.css