attributesToClassNames

src/attributes-to-class-names.js

Returns a list of CSS class names according to the attributes object passed.

attributesToClassNames(attributes: Object, prefix: string, suffix: string): Array
Parameters
attributes (Object) Attributes to be used for generating CSS class names.
prefix (string = '') Prefix for the CSS class name.
suffix (string = '') Suffix for the CSS class name.
Returns
Array: List of generated CSS class names.

backgroundImageStyle

src/background-image-style.js

Generate inline background-image CSS style based on given URL.

backgroundImageStyle(url: string): Object
Parameters
url (string) Background image URL or web address.
Returns
Object: CSS style for the given background-image address.

Extracts selected block style slug from the given block specific CSS class names.

blockStyleSlug(classNames: string): string
Parameters
classNames (string) CSS class names assigned to the block
Returns
string: Style name associated with the block.

Converts a bool to a 'yes' or 'no'.

booleanToString(input: (boolean | string)): string
Parameters
input ((boolean | string)) Bool to convert. If a string is passed it will first be converted to a bool.
Returns
string: Converted value.

Generate dim CSS class name based on given ratio or opacity.

dimRatioClassName(val: number): string
Parameters
val (number) Dim ratio.
Returns
string: Validated CSS class name generated based on the ration given.

Generates corresponding CSS based on the given focal point picker value.

focalPointStyle(input: Object): string
Parameters
input (Object) Focal point object values.
Returns
string: Calculated X and Y position based on the focalpoint object given.

getFormattedContent

src/get-formatted-content.js

Gets a formatted version of the post content provided.

getFormattedContent(content: string): string
Parameters
content (string) Post content.
Returns
string: Formatted post content.

Check if value is classified as an array object and is not empty.

ifArray(input: Array): boolean
Parameters
input (Array) The value to check.
Returns
boolean: Whether the argument provided is a non-empty array.

Determine whether the content is positioned center.

isPositionCenter(position: string): boolean
Parameters
position (string) The value to check.
Returns
boolean: Return true if content is center positioned.

Generate content-position CSS class name based on given position value.

positionToClassName(position: string): string
Parameters
position (string) CSS position value.
Returns
string: Corresponding CSS class name based on the given content-position.

Converts a string (e.g. 'yes' or 'no') to a bool.

stringToBoolean(input: (boolean | string)): boolean
Parameters
input ((boolean | string)) String to convert. If a bool is passed it will be returned as-is.
Returns
boolean: Converted value.