Issue #2534💬 AnsweredOpened January 25, 2020by andy-aware0 reactions

Swap out Image src

快速解答by pouyamiralayi

@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)

pouyamiralayiJanuary 27, 2020

@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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.