QUESTION regarding JSON stored by the StorageManager
@theSC0RP Is this what you're looking for? editor.getComponents()
Read full answer below β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 (4)
@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...
Thanks for reporting this, @theSC0RP. Great question about QUESTION regarding JSON stored by the StorageManager. The recommended approach with GrapesJS is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3367
Modal template
Is there a way for me to modify the template from a compiled state? https://github.com/artf/grapesjs/blob/d3256e621bb43a537213ffcd86b10dc0b...
Issue #3237
Add Trait For wrapper
Hi @artf I've added trait for wrapper this way. How can I perform the init function for the same Here is the code @artf Could you please he...
Issue #3268
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 #3169
Hi There I am trying to implement an editor where certain sections of the page are editable / droppable etc (i.e a mixed page where some el...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins β TinyMCE Inline Text Editor and Placeholder.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.