GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

BUG: "/" in classes changing to "-" #3623

Closed simxn1 closed 3 years ago

simxn1 commented 3 years ago

Version: ^0.17.19

Are you able to reproduce the bug from the demo?

What is the expected behavior? I would expect the class to stay exactly the same as I name it.

Describe the bug detailed

When you add a class that contains a slash "/" character in it , in the DOM, it changes the slash character to a dash "-".

Describe the bug detailed

Snímka obrazovky 2021-07-15 o 12 01 57 Snímka obrazovky 2021-07-15 o 12 02 02

Are you able to attach a screenshot?

notauserx commented 3 years ago

I also faced the same problem. After looing into the source, I found this is due to

https://github.com/artf/grapesjs/blob/8b423fdf093865a6bf55dc8285030ce99c111d6d/src/selector_manager/model/Selector.js#L123

Based on https://github.com/artf/grapesjs/blob/8b423fdf093865a6bf55dc8285030ce99c111d6d/src/selector_manager/config/config.js#L15

I added the following option to fix my issue

var editor = grapesjs.init({ selectorManager: { escapeName: name => name }, // other options ) However, I do not know the motivation behind the escapeName method in selector.js https://github.com/artf/grapesjs/blob/8b423fdf093865a6bf55dc8285030ce99c111d6d/src/selector_manager/model/Selector.js#L118