grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Can i create multiple pages?

Open ionic666 opened this issue 8 years ago • 3 comments

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?

ionic666 avatar Aug 01 '18 08:08 ionic666

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 avatar Aug 01 '18 11:08 inventorbit

@inventorbit It's a really great solution

ionic666 avatar Aug 02 '18 03:08 ionic666

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.

lock[bot] avatar Sep 17 '19 08:09 lock[bot]