mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.9 KiB
2.9 KiB
PropertyComposite
Extends Property
Properties
propertiesArray<Object> Array of sub properties, eg.[{ type: 'number', property: 'margin-top' }, ...]detachedBoolean? Indicate if the final CSS property is splitted (detached:margin-top: X; margin-right: Y; ...) or combined (not detached:margin: X Y ...;)separator(String | RegExp)? Value used to split property values, default" ".joinString? Value used to join property values, default" ".fromStyleFunction? Custom logic for getting property values from the target style object.fromStyle: (style) => { const margins = parseMarginShorthand(style.margin); return { 'margin-top': margins.top, // ... }; }toStyleFunction? Custom logic for creating the CSS style object to apply on selected targets.toStyle: (values) => { const top = values['margin-top'] || 0; const right = values['margin-right'] || 0; // ... return { margin: `${top} ${right} ...`, }; }
getProperties
Get properties.
getProperty
Get property by id.
Parameters
idString Property id.
Returns (Property | null)
getPropertyAt
Get property at index.
Parameters
indexNumber
Returns (Property | null)
isDetached
Check if the property is detached.
Returns Boolean
getValues
Get current values of properties.
Parameters
-
optsObject Options (optional, default{})opts.byNameBoolean Use property names as a key instead of the id. (optional, defaultfalse)
Examples
// In case the property is `margin` with sub properties like `margin-top`, `margin-right`, etc.
console.log(property.getValues());
// { 'margin-top': '10px', 'margin-right': '20px', ... };
Returns Object
getSeparator
Get property separator.
Returns RegExp
getJoin
Get the join value.
Returns String