Issue #1044💬 AnsweredOpened April 15, 2018by adib182 reactions

Change src for image element in model

Quick answerby artf1

Correct your custom asset manager implementation, it's not reliable (eg. if the user double click on the image you'll still see the default one). Follow this #491 and the problem with the src will be fixed

Read full answer below ↓

Question

hello when a image block drop to editor i hide the default asset manager and display my custom asset manager: fot this i have no problem.but when a image select on my custom asset manager i change src from image element in the editor with jquery. jQuery('iframe').contents().find('img.ineditor').attr('src','customurl'); but when move the image element in the editor from a block to another block src attribute removed.I search and find out when change src with jquery only view changed but model must change for image element.now i want to know how i can change src for image element in model. than...

Answers (3)

artfApril 15, 2018

Correct your custom asset manager implementation, it's not reliable (eg. if the user double click on the image you'll still see the default one). Follow this #491 and the problem with the src will be fixed

adib18April 15, 2018

thanks a lot.i correct asset manager with this: and use this when select a image in custom asset manager assettarget.set('src', 'srcimagefromcustomasset_manager'); thanks for your great work.

StejsiSeptember 25, 2018

Hello, i am used this solution, and it works, but now i am not able to asset background-image in Style Manager. It use custom function spreadUrl(), but i dont know how to call it without modify Grapesjs core. Thanks for help!

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.