GrapesJS / GrapesJS/grapesjs

BUG: Symbols and IDs

Open
#6,675 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
26.2k
Forks
4.6k
Avg merge
2d 21h
Merged PRs (30d)
6

Description

@artf
The elements with an ID in the symbols have different ID in the different instances of the symbol. It makes sense because it's bad to have multiple elements with the same ID in an HTML document

## Issue 1

Users who have a symbol on different pages are confused because the styles they "add" to an element ID is "lost". Did you think of a clean way to work around this in this use case?

## Issue 2

Another problematic use case is when I have multiple occurences of a symbole, with in side it
1. an element with an ID
2. a reference to this ID, e.g. ``

## Solutions

Then it breaks and there is no way to make it work right? I have other similar use cases unfortunately. For those I'm thinking I could implement a workaround in my `grapesjs-symbols` plugin (a wrapper around symbols, with ui etc), it would detect that a symbol is pasted or duplicated and change the references to IDs inside the symbol but I'm not sure if the `for` attribute will be synced and then changed everywhere... What do you think?

> **Edit: I tried and it seem to work well for the "Issue 2"**
> * [the code for this "workaround"](https://github.com/silexlabs/grapesjs-symbols/commit/805425c2220ca20f2845b7858c1a386d145fa782)
> * [online demo of the plugin with the workaround](https://codepen.io/lexoyo/pen/xxJGEwo)

Following these issues I understand the IDs will not be addressed in the mid or long term right?
* #6659
* #4837

Thank you for your help !

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.