Issue #3086Opened October 21, 2020by dharmatv1 reactions

BUG: How to restrict the style manger properties based upon the component

Question

Version:

0.15.9

What is the expected behavior? Whenever any component drag and drop into the builder part, that related style's properties I need to customize it. For instance Drag and drop the link component into the builder part, then I click on that, it shows the following style properties(Please check the link) https://snipboard.io/cCFUOD.jpg But I need to customize that whatever I want, like Dimension I want to show apart from all.

What is the current behavior? Showing all style manager properties

Are you able to attach screenshots, screencasts, or a live demo? Yes

I read the documentation but I didn't get any solution for this. Could u guys anyone please help me with this

Answers (3)

MartinPutzOctober 21, 20201 reactions

@dharmatv Hi there! This is not a bug, you can achieve it by defining the styleable properties for a component.

editor.DomComponents.addType('customComp', {
	model: {
		defaults: {
			tagName: 'customComp',
                        stylable:['color']
		}
	},
	view: {
		tagName: 'div',
		...
	}
});

Demo: Drag and drop the last block and you will see only (text)color can be changed. https://jsfiddle.net/MartinPutz/o376qsy1/

dharmatvOctober 21, 20200 reactions

Hi @MartinPutz Thanks for your reply I understand. My requirement is needed only grapesjs components should not be custom components I didn't mention sorry for that

artfOctober 23, 20200 reactions

You can use data attributes <div data-gjs-stylable="['color']"></div>

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.