Issue #1227πŸ’¬ AnsweredOpened June 22, 2018by smaqeelkazmi0 reactions

Re-render view in editor's canvas whenever Trait value changes

Quick answerby artf

Update your view in this way

Read full answer below ↓

Question

Is there any possible way in grapesjs that whenever a user changes the value of a Trait of a custom component the render function should listening or be re-render? I'm building a custom component for dynamic contents. The custom component code is: I want that whenever user change the value of Trait called Dummy Image the render function should run and effect the src value accordingly in the canvas result for img tag. This is to only effect the view in editor's canvas but not in model. Can somebody help me to solve this? Thanks in advance. :)

Answers (3)

artfβ€’ June 24, 2018

Update your view in this way

view: dView.extend({
	init() {
		this.listenTo(this.model, 'change:attributes:data-dummyimage', this.render)
	},
	...
})
mararn1618β€’ September 13, 2018

After 2 days this saved my life. Thanks to both of you!

vitanshuβ€’ December 27, 2018

But properties of html are not editable in canvas.

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.