Issue #1432πŸ’¬ AnsweredOpened September 17, 2018by JulyanoF2 reactions

Custom DomComponent & Block let all elements duplicated

Quick answerby artf❀ 1

@JulyanoF you should never do this editor.DomComponents.render() if you feel like you need that function, probably you're doing something wrong... then in your custom component, you don't set isComponent method, so please review this guide: https://grapesjs.com/docs/modules/Components.html for the rest, provide a live...

Read full answer below ↓

Question

I created a Custom Block: and a Custom DomComponent: And a Custom Command (I found where error is happening): When I set the new link for child img, any block I add to editor, is adding twice, and when I select this duplicated block, both are selected and changed:

Answers (3)

artfβ€’ September 17, 2018

@JulyanoF you should never do this editor.DomComponents.render() if you feel like you need that function, probably you're doing something wrong... then in your custom component, you don't set isComponent method, so please review this guide: https://grapesjs.com/docs/modules/Components.html for the...

artfβ€’ September 20, 2018

I'm trying getting html of selected element (editor.getSelected().toHTML()), manipulating it and changing original content This is wrong... You should use Component's API, don't touch the view or even worse, its HTML. If you don't understand this concept (you should EDIT the MODEL of the component,...

JulyanoFβ€’ September 17, 2018

@artf you are right. the problem is using render() function, that is duplicating the elements.. but, if I remove this function, the editor html didn't change.. it still showing old content and not the new. How can I avoid it? I will provide a live demo

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.