ronaldaug/gramateria

multipage manager [request]

jaronwanderley opened this issue ยท 7 comments

I do not know if it is possible, but I would like to request some implementation of pages manager, duplicating them or creating new ones from the beginning.

@jaronwanderley Sorry for late response.
Yea, It's the option that I want GrapesJs to implement too.
As Gramateria is based on GrapesJs, I'm still trying figure out how to implement the multipage option.
I hope @artf (grapesjs core developer) adds it soon.
The multipage option is on their roadmap, you can read here.

But currently you can try a newly launched "Gramateria dashboard" here
There is no multipage option yet but you can still save your projects on cloud.

artf commented

Hi @ronaldaug, first of all, thanks for using GrapesJS in your project, I really like it. About Page Manager, unfortunately, we have not yet started working on it, but I think you could start creating something similar without much effort. For example, you can start from an array of pages and the index of the current one.

{
	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);

@artf
Oh, you're here, I'm really glad you like this little project. :D
Thank you for clearing it up. I really appreciate your help.
I will try it when I am free.
Btw, @artf you are such a hardworking person.

@artf do you have a complete code for the multi page plugin?

@artf Could you sent some sample code for multiple page?

Where do you add the component in the new version of Newsletter ? In what file ?