CMS: Grapesjs is not defined
I just copy pasted your code and everything works as expected https://jsfiddle.net/mxdLpe0k/
Read full answer below ↓Question
I am trying to use basic Grapesjs editor to CMS. Here's my code:
<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/dist/grapes.js"></script>
<style>
body,
html {
height: 100%;
margin: 0;
}
</style>
<div id="gjs" style="height:0px; overflow:hidden">
<div style="margin:100px 100px 25px; padding:25px; font:caption"> This is a sample text</div>
</div>
<script type="text/javascript">
alert('Start');
var editor = grapesjs.init({
height: '100%',
showOffsets: 1,
noticeOnUnload: 0,
storageManager: {autoload: 0},
container: '#gjs',
fromElement: true,
plugins: ['gjs-blocks-basic', 'gjs-plugin-actions'],
pluginsOpts: {
'gjs-plugin-actions': {},
'gjs-blocks-basic': {
flexGrid: 1
}
}
});
window.editor = editor;
alert('end');
</script>
I have installed the grapesjs using NPM. Later I tried running this html file in the local, as expected the output was Grapesjs editor. I used this same file in CMS and I am getting grapesjs is not defined.
Answers (2)
I just copy pasted your code and everything works as expected https://jsfiddle.net/mxdLpe0k/
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 #890
[Question]: I cannot get the simple example working
I am not new to Javascript but when I try the example: I get a blank page. That is with adding the CSS and Javascript library. Any suggesti...
Issue #418
Can't replace image if it's inside a link
Hi, If import this code inside the editor: And double click the image to change it, when I choose a new image from the modal, nothing happe...
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 #1757
Remote storagemanager not working
Hello, For 2 days I am fighting with the storageManager. I couldn't load template from remote file. Finaly I discovered that it is working...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.