Grapesjs: Can i create multiple pages?

Created on 1 Aug 2018  Â·  3Comments  Â·  Source: artf/grapesjs

This framework is great。It helped me a lot。
Now I want to create a project through this framework implementation that includes multiple pages.
can you give me some adivce?

outdated

Most helpful comment

You can make use of the following

{
    current: 1,
    pages: [
        { components: [], style: [] },
        { components: [], style: [] },
        ...
    ]
}

When you change the page, at first you store the current template:

const currentPage = pages[currentIndex];
currentPage.components = editor.getComponents();
currentPage.style = editor.getStyle();

and then you change the editor with the next one

const nextPage = pages[nextIndex];
editor.setComponents(nextPage.components);
editor.setStyle(nextPage.style);

Reference Link: https://github.com/ronaldaug/gramateria/issues/2

All 3 comments

You can make use of the following

{
    current: 1,
    pages: [
        { components: [], style: [] },
        { components: [], style: [] },
        ...
    ]
}

When you change the page, at first you store the current template:

const currentPage = pages[currentIndex];
currentPage.components = editor.getComponents();
currentPage.style = editor.getStyle();

and then you change the editor with the next one

const nextPage = pages[nextIndex];
editor.setComponents(nextPage.components);
editor.setStyle(nextPage.style);

Reference Link: https://github.com/ronaldaug/gramateria/issues/2

@inventorbit It's a really great solution

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryandeba picture ryandeba  Â·  3Comments

FlashPapa picture FlashPapa  Â·  3Comments

Geczy picture Geczy  Â·  3Comments

andre2 picture andre2  Â·  3Comments

Snarkly picture Snarkly  Â·  3Comments