Issue #4249πŸ’¬ AnsweredOpened Apr 8, 2022by iamqinglong0 reactions

Image src won't change in exported HTML

Quick answerby m-jojo-s

either use selected.set('src', doc.url) or enable unsafe html attributes Refer to #4148

Read full answer below ↓

Question

GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome 100 Reproducible demo link https://grapesjs.com/demo.html Describe the bug How to reproduce the bug?I am using externalDrag an image block to canvasSelect an image from the custom modalView the codeCheck the model/target object attributes What is the expected behavior? The src attribute of the exported code should contain the actual url <img src="actual-url" /> What is the current behavior? I am using an external module for custom asset manager. The model/target src attribute should contain...

Answers (3)

m-jojo-sβ€’ Apr 8, 2022

either use selected.set('src', doc.url) or enable unsafe html attributes

Refer to #4148

artfβ€’ Apr 8, 2022

Yeah, I'd say you should simply switch to selected.set('src', doc.url) as already suggested.

GJSBlockβ€’ May 17, 2026

Thanks for reporting this, @iamqinglong. Great question about image src won't change in exported HTML. The recommended approach with ProseMirror 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 operati...

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.