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.37k stars 4.05k forks source link

StyleManager.addProperty , type: 'select' , Cannot read properties of undefined (reading 'replace') #4413

Closed YaseenHajajweh closed 2 years ago

YaseenHajajweh commented 2 years ago

GrapesJS version

What browser are you using?

Chrome Version 103.0.5060.53 (Official Build) (x86_64)

Reproducible demo link

private project

Describe the bug

i am trying to add property to my custom sector , and the property type (Select) , once the builder ready i got this error Cannot read properties of undefined (reading 'replace')

 editor.StyleManager.addSector("salma", {
                name: "Background Style",
                open: true,
                properties: [
                    {
                        type: 'select',
                        property: 'background-size',
                        id: 'background-size',
                        label: 'Select Size',
                        default: 'cover',
                        options: [
                            { id: 'cover', label: 'cover' },
                            { id: 'contain', label: 'contain' },
                            { id: 'fit', label: 'fit' },
                        ],
                    },

                ],
            },{ at: 0 });

Code of Conduct

YaseenHajajweh commented 2 years ago

@artf , sorry i found the solution

options: [
          { id: 'cover', label: 'cover', value: 'cover' },
          { id: 'contain', label: 'contain', value: 'contain' },
          { id: 'fit', label: 'fit', value: 'fit' },
  ],