Issue #1762💬 AnsweredOpened January 29, 2019by AkibDeraiya1230 reactions

Image not change while we fetch html using editor.getHtml()

Quick answerby artf

You didn't show any code but I guess you've just edited DOM elements of the component when instead you should change its Component model data (eg. imgModel.set('src', 'base64....'))

Read full answer below ↓

Question

Hello @artf I am using grapes.js for my website-builder tool into my website. While i double click on any image the asset-manager will open and i can choose the image from asset-manager. Now thing is that i putted the conditions like once user will choose any image from asset-manager i will replace that img tag with div tag and initialise one image-editor (It's cropper.js) at there. Now once i close the asset manager after selection of image the new path of image is set and also the new div will also set instead of img tag. Once user will click on done button inside the editor(i mean image ed...

Answers (3)

artfFebruary 6, 2019

You didn't show any code but I guess you've just edited DOM elements of the component when instead you should change its Component model data (eg. imgModel.set('src', 'base64....'))

AkibDeraiya123February 15, 2019

Hello @artf Thank you for your reply on my query. I am attaching my code here, please let me know at where i am going wrong. So, basically above code will be run while user will double-click on particular image. In this function i am going to add one random generated id attribute in selected image....

artfFebruary 16, 2019

In this function right now i am changing the image src using jQuery which is working fine. But when i get editor.getHtml() It's not reflacted.

... @AkibDeraiya123 this is exactlly what I told you in my previous comment... DON'T EDIT the DOM with JQuery... edit the model as I told you

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.