Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5462 Added ability to preselect active page upon loading the project #5463

Closed
wants to merge 1 commit into from

Conversation

padcom
Copy link
Contributor

@padcom padcom commented Oct 13, 2023

This PR introduces a new configuration option for the PageManager:

pageManager: {
  activePage: 'initial-page-id-goes-here',
  pages: [ /*...*/ ],
},

It is useful when you want to start editing a specific page rather than the one with { type: 'main' }, e.g. when you use GrapesJS as the editor only and the page being edited is dictated by an external source.

To test it, add the following to your configuration:

        pageManager: {
          activePage: 'test-page-2',
          pages: [
            { id: 'test-page-1', type: 'main', component: { content: '<h1>Test page 1</h1>' } },
            { id: 'test-page-2', component: { content: '<h1>Test page 2</h1>' } },
          ]
        }

which will cause the second page to be active immediately rather than the first one, with { type: 'main' }

@artf
Copy link
Member

artf commented Oct 19, 2023

@padcom what do you think about following my suggestion here?

I'd say to simply try to find the selected page in onLoad (no need for getPreselectedPage method) as the project could be loaded from a remote storage

@artf artf closed this in b9fe69f Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants