Custom DomComponent & Block let all elements duplicated
@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)
@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...
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,...
@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.
Issue #1220
[Question] Manipulate elements into a selected block in command
How can I manipulate elements into a block content? For example: My block: My component: Command:
Issue #1471
[Question] Blockmanager and Image
Hi! I use this code to add a new block: blockManager.add("image", { label: 'Image', category: 'Basic', attributes: { class: "gjs-fonts gjs-...
Issue #494
Place block as component programmatically
I've created a custom type, and a block is it possible to insert it into DomComponents by name or any other means? I don't want to be drag'...
Issue #1290
[BUG]Set href for link block not editable once initialized
#1277 is closed but issue still exist so i have to post as new issue Thank you for the help for earlier @maryia-kabash @artf I have made a...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.