Issue #5346Opened August 30, 2023by pittleCheung0 reactions

BUG: Deleting a component without deleting its corresponding style

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

latest version of Chrome

Reproducible demo link

https://grapesjs.com/demo.html

Describe the bug

How to reproduce the bug? <img width="1665" alt="image" src="https://github.com/GrapesJS/grapesjs/assets/114127651/657cbaf6-7e87-4702-ac7f-36c710464728">

What is the expected behavior? it's style maybe reduce,

What is the current behavior? First of all, my editor only uses one page. Every time I switch pages, it will replace the current configuration with a page from the backend. Therefore, when I implement the public header and tail, I can use editor.CodeManager.getCode(component , 'html', {cssc: editor.CssComposer}); to replace the component, but I cannot use editor.CodeManager.getCode(component, 'css', {cssc: editor.CssComposer}) to replace the style, which will cause if If I operate (delete and add components) the components inside the head and tail multiple times, a lot of redundant styles will appear.

If is necessary to execute some code in order to reproduce the bug, paste it here below:

https://github.com/GrapesJS/grapesjs/issues/5263

I copying all matched styles ,so I can paste anywhere , even cross-browser paste, I find this to be extremely useful. When I delete a component, it does not remove the corresponding styles. This is a major issue, And when I copy and paste multiple times on the same website, it leads to a lot of redundant styles and easily causes style conflicts. so I can't simply expect those styles to be deleted. If possible, I would appreciate some suggestions.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (2)

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.