CKEditor 4 Documentation

CKEDITOR.tools.style.parse

Files

The namespace with helper functions to parse some common CSS properties.

Available since: 4.6.1

Defined By

Methods

CKEDITOR.tools.style.parse
view source
( value ) : String[]private
Searches the value for any CSS color occurrences and returns it. ...

Searches the value for any CSS color occurrences and returns it.

Parameters

  • value : String

Returns

  • String[]

    An array of matched results.

CKEDITOR.tools.style.parse
view source
( value ) : Object
Parses the value used as a background property shorthand and returns information as an object. ...

Parses the value used as a background property shorthand and returns information as an object.

Note: Currently only the color property is extracted. Any other parts will go into the unprocessed property.

var background = CKEDITOR.tools.style.parse.background( '#0C0 url(foo.png)' );
console.log( background );
// Logs: { color: '#0C0', unprocessed: 'url(foo.png)' }

Parameters

  • value : String

    The value of the background property.

Returns

  • Object

    An object with information extracted from the background.

    • color : String

      The first color value found. The color format remains the same as in input.

    • unprocessed : String

      The remaining part of the value that has not been processed.

CKEDITOR.tools.style.parse
view source
( value ) : Object
Parses the margin CSS property shorthand format. ...

Parses the margin CSS property shorthand format.

console.log( CKEDITOR.tools.parse.margin( '3px 0 2' ) );
// Logs: { top: "3px", right: "0", bottom: "2", left: "0" }

Parameters

  • value : String

    The margin property value.

Returns

  • Object
    • top : Number

      Top margin.

    • right : Number

      Right margin.

    • bottom : Number

      Bottom margin.

    • left : Number

      Left margin.