QUESTION regarding JSON stored by the StorageManager
Question
Hey, @artf. I want to access the json that is generated when a template is stored without actually storing the template. The json object can be accessed using the events but I don't want to call editor.store() and then use the events.
Is there a way I can do get the json object (a function call on editor or some property)?
Or is there a way to stop editor.store() method so I can get the json being stored and abort the call?
Answers (3)
@theSC0RP Is this what you're looking for? editor.getComponents()
@theSC0RP it's not clear if you want the storage functionality or not, but what proposed Josh is correct or you can always add your storage (and do nothing inside if need to...) https://grapesjs.com/docs/modules/Storage.html#define-new-storage
you can always add your storage (and do nothing inside if need to...) https://grapesjs.com/docs/modules/Storage.html#define-new-storage
Thanks @artf. This is what I ended up doing. With editor.getComponents(), you get a cyclic structure structure right (model -> view -> model -> ...) and that isn't stored by the storageManager and it can't be used to load the template.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3268
QUESTION: How to add javascript in the html without sanitization?
Hey @artf, I am taking javascript input from the user. I need to add this javascript inside the template HTML but it gets sanitized. Is the...
Issue #1960
[QUESTION] Dynamic class generation with a template
Hi there ! I am wondering if there is a way to force the dynamic class generation (of the form cXXXXX which happens when I drag'n'drop a co...
Issue #2742
[QUESTION] How to prevent unique ids generation?
Hi! Thanks for your work @artf. This is a simplified code of how I use grapesjs, I want to save the styles and then want to apply them agai...
Issue #1741
[QUESTION]: Can't render GrapesJS HTML/CSS when viewing page on frontend v0.14.50
I have built a page and want to render it on frontend, the strategy I have implemented is to save my HTML and JSON style object and on fron...
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.