How to customize StyleManager input components?
The demo version on GrapesJS site has some custom style input components (i.e. opacity slider, "undo" button by the property name...) How is this achieved? Is there anyway I can use them with my own plugin? Those are part of the configuration. For property clearing use this option The opacity is built using the slider...
Read full answer below ↓Question
The demo version on GrapesJS site has some custom style input components (i.e. opacity slider, "undo" button by the property name...) How is this achieved? Is there anyway I can use them with my own plugin?
Also how do I get my custom sector properties to behave like the buildProps? In my case I have to translate all strings, so I can't use buildProps, but the custom props don't behave like the buildProps does. They are not taking the components attribute initial value on component:selected as the buildProps does, color picker doesn't show onClick and so on.
Answers (1)
The demo version on GrapesJS site has some custom style input components (i.e. opacity slider, "undo" button by the property name...) How is this achieved? Is there anyway I can use them with my own plugin?
Those are part of the configuration.
For property clearing use this option
styleManager: { clearProperties: 1 },
The opacity is built using the slider type, here is the part from the source of the demo
https://github.com/artf/grapesjs/blob/53cfe888a0ee5d49c43cd4e3fa5daf0b55f8277c/demo.html#L1101-L1108
Also how do I get my custom sector properties to behave like the buildProps? In my case I have to translate all strings, so I can't use buildProps, but the custom props don't behave like the buildProps does. They are not taking the components attribute initial value on component:selected as the buildProps does, color picker doesn't show onClick and so on.
You can translate the strings by extending buildProps
Take a look at the demo source
https://github.com/artf/grapesjs/blob/53cfe888a0ee5d49c43cd4e3fa5daf0b55f8277c/demo.html#L1036-L1052
As you see I change the default labels of properties like margin/padding by extending them in properties (using property or id as an identifier).
You can also see the flex-width which is totally custom and placed there just to make use of buildProps for other built-in properties
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3255
Custom Style Manager
Hi @artf I am trying to change the type and input values of display property like this way -: But on style-manager Button are not visible....
Issue #4897
component:styleUpdate / component:styleUpdate:propertyName not fired
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge 109.0.1518.70 Reproducible demo link...
Issue #4601
update() of custom types added to StyleManager is no more triggered when switching between some targets.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chromium 104 Reproducible demo link https:...
Issue #4576
Clicking 'wrap for style' button affects the inner components of other components inside the same text box
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome 104.0.5112.101 Reproducible demo link...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.