Module

font/utils

@ckeditor/ckeditor5-font/src/utils

module

Filtering

Constants

Functions

  • addColorTableToDropdown( config = { config.dropdownView, config.colors, config.removeButtonLabel, config.documentColorsLabel, config.documentColorsCount } ) → ColorTableView

    static

    A helper that adds ColorTableView to the color dropdown with proper initial values.

    Parameters

    config : Object

    The configuration object.

    Properties
    config.dropdownView : DropdownView

    The dropdown view to which a ColorTableView will be added.

    config.colors : Array.<ColorDefinition>

    An array with definitions representing colors to be displayed in the color table.

    config.removeButtonLabel : String

    The label for the button responsible for removing the color.

    config.documentColorsLabel : String

    The label for the section with document colors.

    config.documentColorsCount : String

    The number of document colors inside the dropdown.

    Returns

    ColorTableView

    The new color table view.

  • buildDefinition( modelAttributeKey, options ) → ConverterDefinition

    static

    Builds a proper converter definition out of input data.

    Parameters

    modelAttributeKey : String

    Key

    options : Array.<FontFamilyOption> | Array.<FontSizeOption>

    Returns

    ConverterDefinition
  • getLocalizedColorOptions( editor, options ) → Array.<ColorDefinition>

    static

    Returns color configuration options as defined in editor.config.(fontColor|fontBackgroundColor).colors but processed to account for editor localization, i.e. to display FontColorConfig or FontBackgroundColorConfig in the correct language.

    Note: The reason behind this method is that there is no way to use t when the user configuration is defined because the editor does not exist yet.

    Parameters

    editor : Editor

    An editor instance.

    options : Array.<ColorDefinition>

    Returns

    Array.<ColorDefinition>

    .

  • normalizeColorOptions( options ) → Array.<ColorDefinition>

    static

    Creates a unified color definition object from color configuration options. The object contains the information necessary to both render the UI and initialize the conversion.

    Parameters

    options : ColorDefinition

    Returns

    Array.<ColorDefinition>
  • renderDowncastElement( styleAttr )

    static

    A font color and font background color helper responsible for downcasting a color attribute to a <span> element.

    Note: The styleAttr parameter should be either 'color' or 'background-color'.

    Parameters

    styleAttr : String
  • renderUpcastAttribute( styleAttr ) → String

    static

    A font color and font background color helper responsible for upcasting data to the model.

    Note: The styleAttr parameter should be either 'color' or 'background-color'.

    Parameters

    styleAttr : String

    Returns

    String