Swap out Image src
@awaredigital you can perform operations like text replacement for your specific case before the grapesjs try to store the components & html. `editor.on('storage:start:store', objToStore => {} )` Cheers!
Read full answer below ↓Question
Hi,
I've been doing so much reading on GrapesJs to find out how to build a component and assign it to a block. But after some time, I've figured using components isn't the right way to go.
I'm looking to swap out the image src and set a data-src to the image, however, I only want to do this on the save.
I have a storage manager setup, which passes data simply using the data['html'] into a text area.
editor.StorageManager.add('simple-storage', {
store(data, clb, clbErr) {
const html = data['gjs-html'];
}
});
Is there any route that Grapes can do this?
Thanks
Answers (1)
@awaredigital you can perform operations like text replacement for your specific case before the grapesjs try to store the components & html.
editor.on('storage:start:store', objToStore => {} )
Cheers!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #913
[Question] Using Style tag instead of css
Hi, I've been taking a look inside of the dom_components, but cant seem to figure out how to manually override the styling aspect. I need a...
Issue #6269
Component model and view inits every time it's dragged over every component present in Canvas on which it can be dropped into
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 130.0.6723.59 (Official Bui...
Issue #5263
Deleting a component without deleting its corresponding style, will adding new components later cause style conflicts?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? latest version of Chrome Reproducible demo...
Issue #3579
RTE misplaced when opened right after dropping `activeOnRender` component
Version: 0.17.4 Are you able to reproduce the bug from the demo?[x] Yes[ ] No Steps to reproduce:Go to the demoDrop a "Text" block inside t...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.