Issue with grapjs.init()
Question
Apparently options passed to grapjs.init() are not being deep cloned and same object is being mutated which was originally passed. This is creating a weird issue, I cannot do this
this._builder = grapesjs.init({
container : '#gjs',
plugins: ['gjs-preset-newsletter'],
pluginsOpts: myOptions
});
Mutation can be seen by logging myOptions before init and the result is very weird, editor without any components
I had to fix it using cloneDeep of lodash like
this._builder = grapesjs.init({
container : '#gjs',
plugins: ['gjs-preset-newsletter'],
pluginsOpts: cloneDeep(myOptions)
});
My version is "grapesjs": "^0.14.43",
Answers (2)
The option object is passed to the plugin as it is and there is no reason to clone it
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 #507
uploadFile being called twice on drop file?
I have an editor initialized as so: If I add an image to the canvas and try to upload a new image by dragging it into the drop area in the...
Issue #1620
[Question] Can't edit Text on Block
I wrote a plugin that defines a new Block for a simple headline. However when I drag and drop this block to the canvas I get the placeholde...
Issue #2073
[QUESTIONS] Trouble using urlLoad
I've got an issue calling to my endpoint to load a template, it's doing a pre flight OPTIONS request but I cant find how to continue after...
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...
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.