Cannot read property 'indexOf' of undefined
Question
Hello,
I am spinning up a new instance of grapeJS, and immediately everything breaks and I get the following error:
Cannot read property 'indexOf' of undefined at grapes.js:6477
My code looks like the following:
<link href="//unpkg.com/grapesjs/dist/css/grapes.min.css" />
<script src="//unpkg.com/grapesjs"></script>
<div id="gjs">
<h1>Hello World Component!</h1>
</div>
<div id="blocks"></div>
<script>
$(document).ready(function () {
grapesjs.init({
// Indicate where to init the editor. You can also pass an HTMLElement
container: '#gjs',
// Get the content for the canvas directly from the element
// As an alternative we could use: `components: '<h1>Hello World Component!</h1>'`,
components: '<h1>Hello World component!</h1>'
});
});
</script>
It looks like it is trying to return indexOf on self, but self isn't defined. Can you quickly help me resolve this?
return self.indexOf(item) === index;
Answers (2)
Try to disable (and then probably clean) the storage with passing storageManager: {type: null}
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 #1520
[Bug] On this.components() Error : Uncaught TypeError: Cannot read property 'each' of undefined
Get below error for this.components() not sure if it is bug or I am doing something wrong. Uncaught TypeError: Cannot read property 'each'...
Issue #1589
[Bug] Cannot read property '_cash(some random numbers)' of undefined on newsletter demo.
I'm having some issue when I load some templates and modify. and it looks like grapesjs newsletter demo is also having this issue. I have c...
Issue #1908
[question] Cannot read property 'indexOf' of undefined
I found a previous result here: https://github.com/artf/grapesjs/issues/1772 however I can still not get it to work, using the most basic s...
Issue #1661
I've created html table and cannot drag new elements to table cells
Hello. if I create html table with next block of code, everything works, I'm able to drop a Quote, for example, to any cell: But next code...
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.