Issue #3294Opened February 27, 2021by server1020 reactions

FEAT: Adding options to properties list array in style manager

Question

Hi,

How can I add buildProps to properties list such that when an option is selected, the properties of that option will be displayed

An example of what I am trying to achieve on the flex property.

{
      name: 'Layout',
      open: true,
      buildProps: ['display'],
      properties: [
        {
          type: 'radio',
          property: 'display',
          list: [
            {
              title: 'Block',
              name: '<span class="material-icons">calendar_view_day</span>',
              value: 'block',
            },
            {
              title: 'Flex',
              name: '<span class="material-icons">calendar_view_week</span>',
              value: 'flex',
              buildProps: ['direction', 'align-content', 'align-items', 'align-self', 'justify-content', 'justify-items', 'justify-self'],
            },
            {
              title: 'Grid',
              name: '<span class="material-icons">grid_on</span>',
              value: 'grid',
            },
            {
              title: 'Inline-block',
              name: '<span class="material-icons">padding</span>',
              value: 'inline-block',
            },
            {
              title: 'Inline',
              name: '<span class="material-icons">horizontal_distribute</span>',
              value: 'inline',
            },
            {
              title: 'None',
              name: '<span class="material-icons">visibility_off</span>',
              value: 'none',
            },
          ]
        }
      ]
    }

style-manager

Answers (3)

Ju99ernautMarch 3, 20210 reactions

I believe you can move the build props out of the properties list and still achieve what you're trying, the built in flex box related properties only show when a component has display: flex. It's also important to note that buildProps are just built in presets of inputs so they cannot be embedded into other inputs i.e the properties list

{
      name: 'Layout',
      open: true,
      buildProps: ['display', 'direction', 'align-content', 'align-items', 'align-self', 'justify-content', 'justify-items', 'justify-self'],
      properties: [
        {
          type: 'radio',
          property: 'display',
          list: [
            {
              title: 'Block',
              name: '<span class="material-icons">calendar_view_day</span>',
              value: 'block',
            },
            {
              title: 'Flex',
              name: '<span class="material-icons">calendar_view_week</span>',
              value: 'flex',
            },
            {
              title: 'Grid',
              name: '<span class="material-icons">grid_on</span>',
              value: 'grid',
            },
            {
              title: 'Inline-block',
              name: '<span class="material-icons">padding</span>',
              value: 'inline-block',
            },
            {
              title: 'Inline',
              name: '<span class="material-icons">horizontal_distribute</span>',
              value: 'inline',
            },
            {
              title: 'None',
              name: '<span class="material-icons">visibility_off</span>',
              value: 'none',
            },
          ]
        }
      ]
    }
server102March 14, 20210 reactions

Thank you. I tried it but the grid properties are not working. Might have to implement it manually but am not sure on how best to approach the problem.

Ju99ernautMarch 15, 20210 reactions

There's no buildProps for grid properties so you'll have to build those from scratch, unfortunately docs don't have much info on custom properties probably you'll have to piece things together from the API reference https://grapesjs.com/docs/api/style_manager.html#stylemanager

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.