Issue #2657πŸ’¬ AnsweredOpened March 16, 2020by Podvodila0 reactions

Custom style property is not working when toRequire attribute is set

Quick answerby Podvodila

I managed to hotfix it by extending isTargetStylable method inside PropertyView.js - https://github.com/artf/grapesjs/blob/85b7b82103e12fb01a3700b1002a57a7b60ccaf1/src/style_manager/view/PropertyView.js#L504-510 I replaced thisif (toRequire) { stylable = !target || (stylableReq && (stylableReq.indexOf(id) >= 0 || styl...

Read full answer below ↓

Question

Are you using the latest release (older versions are NOT supported)? YesWhat is the expected behavior? Custom style property applying to componentWhat happens instead? Custom style property is not workingSteps to reproduceselect Box componenttry to change Box Width style property (under Custom tab) When I add custom style property(flex) with toRequire: 1 parameter then custom style is not working. When I mark toRequire as 0 then style property work as expected. JSFiddle with toRequire: 1 - https://jsfiddle.net/rjw7Lq93/1/ JSFiddle with toRequire: 0 - https://jsfiddle.net/rjw7Lq93/2/

Answers (3)

Podvodilaβ€’ March 18, 2020

I managed to hotfix it by extending isTargetStylable method inside PropertyView.js - https://github.com/artf/grapesjs/blob/85b7b82103e12fb01a3700b1002a57a7b60ccaf1/src/style_manager/view/PropertyView.js#L504-510 I replaced thisif (toRequire) { stylable = !target || (stylableReq && (stylableReq.inde...

Podvodilaβ€’ March 18, 2020

Offtop I don't want to create another topic, just want to say that in the same method(isTargetStylable) that would be better to replace searching for property with id(as I understand for the built-in styles, it is the same as the property) inside unstylable(as well as stylable) check if (.isArray(u...

artfβ€’ April 3, 2020

would be better to replace searching for property with id(as I understand for the built-in styles, it is the same as the property) inside unstylable(as well as stylable) check Yeah, totally correct! Honestly, I use toRequire option and never seen this kind of issue so I'm not sure why this happenin...

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.