BUG: Executing editor.load(x) on x = editor.store() results in error.
Question
Version: 0.16.18
Are you able to reproduce the bug from the demo? [X ] Yes [ ] No
What is the expected behavior? I would expect that assets, components, css, html, and styles would be repopulated.
Describe the bug detailed I am working on an existing system that has a database schema preventing me from using the StorageManager built into grapesjs. I am attempting to store the current state of the GrapesJS editor into a javascript variable, and then reload it - using editor.store() and editor.load() respectively. According to the documentation, these features are listed as part of the editor, not the storage manager (https://grapesjs.com/docs/api/editor.html#store) and would be expected to compliment each other.
What is the current behavior? var x = editor.store(); editor.load(x);
This results in an error. I would expect to just reload the current data.
Are you able to attach screenshots, screencasts or a live demo?
[X ] Yes (attach) [ ] No

Answers (3)
Yes, I see that .load takes a callback function. I'll admit, I'm probably doing this wrong. I only started using grapesJS a few days ago. If my bug report is not truly a bug, how would one store the current state of the editor (possibly as json), then reload it?
Is there a specific function to call that accepts a variable structured like the output from editor.store(), or must I call setHtml, setStyle, etc.. individually?
I'm investigating https://grapesjs.com/docs/modules/Storage.html#storage-api but I still would like to just be able to 'set and forget' :)
There is an example which illustrates exactly what you're looking for https://grapesjs.com/docs/modules/Storage.html#define-new-storage
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3343
BUG: Illegal Invocation error when using keepEmptyTextNodes
Version: 0.16.44 Are you able to reproduce the bug from the demo?[x] Yes[ ] No Set editor.Parser.getConfig().keepEmptyTextNodes = true; in...
Issue #3622
BUG: I18n functionality
Version: latest Are you able to reproduce the bug from the demo?[] Yes[ ] No What is the expected behavior? to editor.I18n.setLocale("es")...
Issue #3457
BUG: Custom trait input not working
Hi @artf ! Version: 0.17.3 Are you able to reproduce the bug from the demo?[ ] Yes[x] No What is the expected behavior? The input is create...
Issue #3731
BUG: Text element not able to be selected twice after extended with events
Version: 0.17.25 Are you able to reproduce the bug from the demo?[ ] Yes[x] No What is the expected behavior? Update a existing component o...
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.