Module

table/tablecolumnresize/utils

@ckeditor/ckeditor5-table/src/tablecolumnresize/utils

module

Filtering

Functions

  • clamp( number, min, max ) → Number

    Clamps the number within the inclusive lower (min) and upper (max) bounds. Returned number is rounded using the toPrecision() function.

    Parameters

    number : Number
    min : Number
    max : Number

    Returns

    Number
  • fillArray( length, value ) → Array.<*>

    Creates an array with defined length and fills all elements with defined value.

    Parameters

    length : Number
    value : *

    Returns

    Array.<*>
  • getAffectedTables( changes, model ) → Set.<Element>

    Collects all affected by the differ table model elements. The returned set may be empty.

    Parameters

    changes : Array.<DiffItem>
    model : Model

    Returns

    Set.<Element>
  • getColumnIndex( cell ) → Object

    Returns the column indexes on the left and right edges of a cell.

    Parameters

    cell : Element

    Returns

    Object
  • getColumnMinWidthAsPercentage( table, editor ) → Number

    Calculates the percentage of the minimum column width given in pixels for a given table.

    Parameters

    table : Element
    editor : Editor

    Returns

    Number
  • getColumnWidthsInPixels( table, editor ) → Array.<Number>

    Calculates the column widths in pixels basing on the columnWidths table attribute:

    • If the value for a given column is provided in pixels then it is just converted to a number and returned.
    • Otherwise, it is assumed that unit is percentage and the column width is calculated proportionally to the whole table width.

    Parameters

    table : Element
    editor : Editor

    Returns

    Array.<Number>
  • getElementWidthInPixels( domElement ) → Number

    Returns the computed width (in pixels) of the DOM element.

    Parameters

    domElement : HTMLElement

    Returns

    Number
  • getNumberOfColumn( table, editor ) → Number

    Returns the total number of columns in a table.

    Parameters

    table : Element
    editor : Editor

    Returns

    Number
  • getTableWidthInPixels( table, editor ) → Number

    Calculates the table width in pixels.

    Parameters

    table : Element
    editor : Editor

    Returns

    Number
  • isTableRendered( table, editor ) → Number

    Checks if the table is already fully rendered, with the <colgroup> element that defines the widths for each column.

    Parameters

    table : Element
    editor : Editor

    Returns

    Number
  • normalizeColumnWidthsAttribute( columnWidthsAttribute ) → Array.<Number>

    Makes sure that the sum of the widths from all columns is 100%. If the sum of all the widths is not equal 100%, all the widths are changed proportionally so that they all sum back to 100%.

    Currently, only widths provided as percentage values are supported.

    Parameters

    columnWidthsAttribute : String

    Returns

    Array.<Number>
  • sumArray( array ) → Number

    Sums all array values that can be parsed to a float.

    Parameters

    array : Array.<Number>

    Returns

    Number
  • toPrecision( value ) → Number

    Rounds the provided value to a fixed-point number with defined number of digits after the decimal point.

    Parameters

    value : Number | String

    Returns

    Number