Module

table/tableselection/croptable

@ckeditor/ckeditor5-table/src/tableselection/croptable

module

Filtering

Functions

  • cropTableToDimensions( sourceTable, cropDimensions = { cropDimensions.startRow, cropDimensions.startColumn, cropDimensions.endRow, cropDimensions.endColumn }, writer, tableUtils ) → Element

    static

    Returns a cropped table according to given dimensions. To return a cropped table that starts at first row and first column and end in third row and column:

    const croppedTable = cropTableToDimensions( table, {
        startRow: 1,
        endRow: 1,
        startColumn: 3,
        endColumn: 3
    }, tableUtils, writer );

    Calling the code above for the table below:

          0   1   2   3   4                      0   1   2
        ┌───┬───┬───┬───┬───┐
     0  │ a │ b │ c │ d │ e │
        ├───┴───┤   ├───┴───┤                  ┌───┬───┬───┐
     1  │ f     │   │ g     │                  │   │   │ g │  0
        ├───┬───┴───┼───┬───┤   will return:   ├───┴───┼───┤
     2  │ h │ i     │ j │ k │                  │ i     │ j │  1
        ├───┤       ├───┤   │                  │       ├───┤
     3  │ l │       │ m │   │                  │       │ m │  2
        ├───┼───┬───┤   ├───┤                  └───────┴───┘
     4  │ n │ o │ p │   │ q │
        └───┴───┴───┴───┴───┘

    Parameters

    sourceTable : Element
    cropDimensions : Object
    Properties
    cropDimensions.startRow : Number
    cropDimensions.startColumn : Number
    cropDimensions.endRow : Number
    cropDimensions.endColumn : Number
    writer : Writer
    tableUtils : TableUtils

    Returns

    Element
  • trimTableCellIfNeeded( tableCell, cellRow, cellColumn, limitRow, limitColumn, writer )

    static

    Adjusts table cell dimensions to not exceed limit row and column.

    If table cell width (or height) covers a column (or row) that is after a limit column (or row) this method will trim "colspan" (or "rowspan") attribute so the table cell will fit in a defined limits.

    Parameters

    tableCell : Element
    cellRow : Number
    cellColumn : Number
    limitRow : Number
    limitColumn : Number
    writer : Writer