BUG: Style Manage does not hide style blocks
Question
Hey @artf, I'm trying to hide style properties based on the selected element. for example, when I drag and drop an image on my GrapesJS, I would like to show only the width property, but the unstylable/stylable attributes are not working.
Version: "grapesjs": "^0.16.18",
Are you able to reproduce the bug from the demo?
[X] Yes [ ] No
What is the expected behavior? To hide the properties that are not on my array
What is the current behavior? It is not hiding anything.
Are you able to attach screenshots, screencasts or a live demo?
[X] Yes (attach) [ ] No
Answers (3)
Hi @cartifon !
I believe the stylable attribute only works on Components & not Blocks as in your example. The following should do the trick:
blocks: [
{
id: "image",
label: "Image",
// Select the component once it's dropped
select: true,
// You can pass components as a JSON instead of a simple HTML string,
// in this case we also use a defined component type `image`
content: { type: "image", stylable: ['width'] },
// This triggers `active` event on dropped components and the `image`
// reacts by opening the AssetManager
activate: true
}
]
Cheers !
I have another question, would the unstylable work in the same way?
Hey @mcottret, thanks for the help. Yes, it does work with that! Maybe the documentation should be more clear on that.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1141
[Question] - How to extend the existing traits and render the changes in canvas?
I am trying to write a plugin to manage all the element properties of Boostrap Blocks. If someone clicks on the button it will show button...
Issue #2547
Unable to drag an element if style has bottom or right values
Hi @artf , If any component CSS has bottom or right values , not able to drag them. Values are generating as NaN. Attached the screenshot f...
Issue #1363
Problem trying to inject new HTML content in the Editor
Hi @artf, I'm now working on doing content in multi-languages inside the editor but I would like to know how can I save in the Dom HTML new...
Issue #3083
[Feature]: Highlight drop zones
Hi @artf , How would you recommend highlighting the components on the canvas that the selected block can be dropped into based on draggable...
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.