BUG: selector:remove event does not exist
Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome 101
Reproducible demo link
https://jsfiddle.net/sdrf72wx/1/
Describe the bug
How to reproduce the bug?
- execute the code below on the initialization of the editor
- add and remove a selector of a component
- Look at the console output
What is the expected behavior? If a component selector is removed, it should print the selector to the console.
What is the current behavior? There is no console message, if the selector is removed, so the "selector:remove" event is not firing. Also, the "selector" event only catches "selector:add" and "selector:update" but NOT "selector:remove" but in the event section of the Selector Manager they are available.
If it is necessary to execute some code in order to reproduce the bug, paste it here below:
editor.on("selector:remove", (data) => {
console.log(data)
})
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (1)
Hi @Justin8303 selector:remove refers to the global container of selectors so it's only triggered when the selector is actually removed from the global collection and not from the component. When you remove the selector from the component, it still exists as it might also be used somewhere else.
If you need to track component classes changes, I'd suggest using the component:update:classes event
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4191
BUG: We are trying to store the data from grapesJS editor in Angular 10 application, getting CORS error, image attached below
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 99.0.4844.5 Reproducible demo link...
Issue #3873
BUG: Duplicated video block when re-attaching GrapesJs editor to document
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v94 Reproducible demo link https://...
Issue #4323
BUG: Performance issue while dragging component to canvas when you have 2k component on canvas
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Google Chrome Version 101.0.4951.41 (Officia...
Issue #5020
BUG: Changing Title Attribute on Views Panel Buttons Doesn't Persist
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? ChromeReproducible demo link https://jsfiddl...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.