我正在尝试将GrapesJS功能集成到我的React应用程序中。
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;任何帮助都会很好。谢谢*
发布于 2019-08-20 05:27:31
您必须指定块支柱,此块将通过葡萄-js的blockmanager.add方法添加到编辑器中。如果不需要块,请尝试提供一个空数组,例如:
<GEditor id="gjs" blocks={[]} />发布于 2019-08-20 05:37:11
如果您将块传递给GEditor,它将工作。
参见下面的示例代码
import React, {Component} from 'react';
import GEditor from 'grapesjs-react';
class GEditorExample extends Component {
render() {
return (
<GEditor id="geditor" blocks={[]}/>
);
}
}
export default GEditorExample;发布于 2019-08-27 12:22:26
你用的是哪种版本的格列斯-反应?我配置了blocks道具的默认值:
GEditor.defaultProps = {
blockManager: {},
blocks: [],
components: [],
newsletter: false,
plugins: [],
storageManager: {},
styleManager: {},
webpage: false,
};如果仍然有此错误,请尝试将包更新为最新版本。
https://stackoverflow.com/questions/57566967
复制相似问题