Issue #2392Opened November 8, 2019by asieraduriz2 reactions

[Bug] - Unable to nest <div id="gjs"> into any other tag

Question

It seems that the index.html structure needs to be the following:

<body>
      <div id="gjs" style="height:0px; overflow:hidden"></div>
<script ... >

I am not able to nest this div within another div like so:

<body>
    <div class="site-content">
        <main class="site-main">
            <div id="gjs" style="height:0px; overflow:hidden"></div>
        </main>
    </div>
</body>

Since my custom styles require the presence of the first div and the main, and I've tried updating the container property for the grapesjs.init to no success, I'm asking if this is possible

Answers (3)

asieradurizNovember 11, 20191 reactions

What I have done is to just clone this repo, and nest the <div id="gjs" style="height:0px; overflow:hidden;"> within another <div>, so it would be like

<div>
    <div id="gjs" style="height:0px; overflow:hidden;">
    </div>
</div>

When I run npm start, I am getting a blank page

pouyamiralayiNovember 11, 20191 reactions

@fasaas did you specify this in your html?

<style>
        body,
        html {
            height: 100%;
            margin: 0;
        }
</style>

BTW, make sure that your parent div has height:100% cheers!

asieradurizNovember 8, 20190 reactions

If this is not possible, is there a way to explicitly indicate that when I add a new Block into the BlockManager, the container should be a specific container that I can have previously define in index.html and leave the original div at the top level?

<body>
    <div id="gjs" style="height:0px; overflow:hidden">
        <div class="site-content">
            <main class="site-main">

            </main>
        </div>
    </div>
...

E.g. when adding a new block to a specific tag

  blockManager.add('whatever', {
    label: 'Content Label name',
    content: { type: 'my component type name' },
    category: 'category name',
    component: '.site-main`
  });

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.