Can we have local and remote storage at the same time.
WARNING
READ and FOLLOW next 5 steps, then REMOVE them before posting the issue
- Follow CONTRIBUTING Guidelines https://github.com/artf/grapesjs/blob/master/CONTRIBUTING.md
- Use the GitHub Issues EXCLUSIVELY for BUGS, FEATURE REQUESTS or QUESTIONS. Prefix the title of the issue with its context, eg.
[Bug]: .... - Do a quick SEARCH first, to see if someone else didn't open the same issue
- DON'T ASK to create examples/code for you, read DOCS and APIs first, then you can post what you have tried (we'd like to see your code) and what you're unable to achieve
- All relative statements/questions have to be filled/answered, otherwise, the issue might be CLOSED
You're submitting a BUG
- Are you using the latest release (older versions are NOT supported)?
- If you're not sure, type
grapesjs.versionin console and press ENTER
- If you're not sure, type
- Are you facing the bug with your local copy of GrapesJS or with the current demo?
- If a local copy
- Indicate all informations about your OS, browser and GrapesJS version.
- Are you able to reproduce the bug from the demo?
- What is the expected behavior?
- What happens instead?
- If you're able to reproduce the bug indicate all the necessary steps
- Attach screenshots (using KAP/LICEcap), screencasts or live demo
- JSFiddle Starter template https://jsfiddle.net/szLp8h4n
- CodeSandbox Starter template https://codesandbox.io/s/1r0w2pk1vl
You're submitting a FEATURE REQUEST
- Be sure to work on the latest version, as the feature might be already there
- Keep in mind that the feature should be considered valid to use for everyone, not only for your case
In my case I want both local and remote storage at the same time. The data will be stored locally in localstorage( If he/she will refresh the page without saving the save button the data will be rendered from local storage ) and when user will hit save button then it will stored remotely. After a certain time local storage will get expire and data will be rendered from remote storage.
Yeah, just leave the default localStorage active and create a button which makes use of remote storage
editor.StorageManager.get('remote').set({
urlStore: 'somewhere', // set your configs
...
}).store({html: editor.getHtml()})
Thank you....
@artf I am trying to use this to generate auto save for both local and remote storage. Is this possible? I want the default local storage to stay the same, and on every 5th change to the editor save to remote storage. Here's what I tried:
const remoteStorageManager = (propData, stateData, Editor, GenerateHTML) => {
const json = JSON.stringify({
components: Editor.getComponents(),
style: Editor.getStyle(),
});
const css = Editor.getCss();
const html = Editor.getHtml();
console.log('HTMLfrom auto save', html);
const htmlPage = GenerateHTML(css, html);
const storageManager = Editor.StorageManager;
storageManager.add('remote', {
store() {
propData.autoUpdateTemplate(htmlPage, json);
},
});
storageManager.get('remote').set({
id: 'kw-',
autosave: true,
stepsBeforeSave: 5,
});
};
export default remoteStorageManager;
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.