undefined for multiple page manager in React
Question
Hi, please what is the best way to implement multiple page manager in a react app.
I have successfully implemented this without page manager like so:
useEffect(() => {
const editor = grapesjs.init({
container: "#editor",
storageManager: {
type: "remote",
stepsBeforeSave: 2,
contentTypeJson: true,
storeComponents: true,
storeStyles: true,
storeHtml: true,
storeCss: true,
// id: "my-",
urlStore: `some-url`,
urlLoad: `some-url`,
headers: {
"Content-Type": "application/json",
},
credentials: 'omit',
},
panels: { defaults: [] },
plugins: [gjsPresetWebpage],
pluginsOpts: {
gjsPresetWebpage: {},
},
});
editor.Panels.getButton('options', 'sw-visibility').set('active', true);
setEditor(editor);
}, []);
return (
<Wrapper bgColor={bgColor} hoverColor={hoverColor}>
<div id="editor"></div>
</Wrapper>
);
For the page manager implementation I try this:
useEffect(() => {
const editor = grapesjs.init({
container: "#editor",
storageManager: {
type: "remote",
stepsBeforeSave: 2,
contentTypeJson: true,
storeComponents: true,
storeStyles: true,
storeHtml: true,
storeCss: true,
// id: "my-",
urlStore: `some-url`,
urlLoad: `some-url`,
headers: {
"Content-Type": "application/json",
},
credentials: 'omit',
},
pageManager: true, // here
panels: { defaults: [] },
plugins: [gjsPresetWebpage],
pluginsOpts: {
gjsPresetWebpage: {},
},
});
editor.Panels.getButton('options', 'sw-visibility').set('active', true);
const pageManager = editor.Pages; // here
pageManager.getAll() // here
console.log(pageManager) // undefined
setEditor(editor);
}, []);
Here, I get undefined for page manager. I would appreciate any help please.
Thanks
Answers (1)
I think you're just using an old version of GrapesJS
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3446
Cannot Store Data Unexpected token '-'
Please Help Me, I Want To Store gjs data to mysql but i cannot get any data from front end to back end here my code: const editor = grapesj...
Issue #1985
[BUG] Autosave with remote storage doesn't send network requests
OS: Windows 10 Browser: Chrome 73 GrapesJS version: 0.14.57 I have remote storage configured using this call to grapesjs.init(): While I se...
Issue #620
Remote Storage
I'm trying to use the remote storage but no success, with the resolved issues I manage to adjust eveything as it best, but editor do not re...
Issue #2929
Keep getting CORS when using fake endpoint for remote storage
Hi everyone! I'm using grapesjs with vuejs and I'm struggling with CORS. I created my fake endpoint with beeceptor and I have the code belo...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.