Issue #2742πŸ’¬ AnsweredOpened April 28, 2020by ghost1 reactions

How to prevent unique ids generation?

Quick answerby pouyamiralayi❀ 1

Hi @nikita-balakirev see if #2706 comment can help you. Cheers!

Read full answer below ↓

Question

Hi! Thanks for your work @artf. This is a simplified code of how I use grapesjs, I want to save the styles and then want to apply them again. The problem is that ids already changed in DOM after first call of container.components() so styles will not be applied. How to prevent this behavior? What should I clear/reset?

Answers (3)

pouyamiralayiβ€’ April 30, 2020

Hi @nikita-balakirev see if #2706 comment can help you. Cheers!

ghostβ€’ April 28, 2020

I fixed it now using editor.DomComponents.componentsById = {}; but I think it can lead to collisions between blocks at some point what do you think?

artfβ€’ May 4, 2020

Sorry @nikita-balakirev can't help you here without a complete reproducible example. When you export components as JSON all IDs are preserved and reused if load correctly, so for sure you're doing something wrong with storing/loading data. Obviously you shouldn't prevent unique ids generation (or d...

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 β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.