# table/utils/common

module

<a id="functions">

## Functions

<a id="function-createEmptyTableCell">

### `createEmptyTableCell( writer, insertPosition, attributes ) → ModelElement` _(internal)_

A common method to create an empty table cell. It creates a proper model structure as a table cell must have at least one block inside.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L54)

#### Parameters

* `writer: ModelWriter`

  The model writer.

* `insertPosition: ModelPosition`

  The position at which the table cell should be inserted.

* `attributes: Record<string, unknown>`

  The element attributes.

  Defaults to `{}`

#### Returns

* `ModelElement`

  Created table cell.

<a id="function-enableProperty">

### `enableProperty( schema, conversion, options = { options.attributeName?, options.attributeType?, options.defaultValue, options.modelAttribute, options.reduceBoxSides?, options.styleName } ) → void` _(internal)_

Enables conversion for an attribute for simple view-model mappings.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L86)

#### Parameters

* `schema: ModelSchema`

* `conversion: Conversion`

* `options: object`

  Properties

  * `options.attributeName?: string`

  * `options.attributeType?: 'length' | 'color'`

  * `options.defaultValue: string`

    The default value for the specified `modelAttribute`.

  * `options.modelAttribute: string`

  * `options.reduceBoxSides?: boolean`

  * `options.styleName: string`

#### Returns

* `void`

<a id="function-getEmptyTableCellBlocks">

### `getEmptyTableCellBlocks( table ) → IterableIterator<ModelElement>` _(internal)_

Yields every empty block (typically a `paragraph`) found inside the given table's cells.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L190)

#### Parameters

* `table: ModelElement`

#### Returns

* `IterableIterator<ModelElement>`

<a id="function-getSelectionAffectedTable">

### `getSelectionAffectedTable( selection ) → ModelElement` _(internal)_

Depending on the position of the selection we either return the table under cursor or look for the table higher in the hierarchy.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L115)

#### Parameters

* `selection: ModelDocumentSelection`

#### Returns

* `ModelElement`

<a id="function-groupCellsByTable">

### `groupCellsByTable( tableCells ) → Map<ModelElement, Array<ModelElement>>` _(internal)_

Groups table cells by their parent table.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L131)

#### Parameters

* `tableCells: Array<ModelElement>`

#### Returns

* `Map<ModelElement, Array<ModelElement>>`

<a id="function-isEntireCellsLineHeader">

### `isEntireCellsLineHeader( __namedParameters = { __namedParameters.column?, __namedParameters.row?, __namedParameters.table } ) → boolean` _(internal)_

Checks if all cells in a given row or column are header cells.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L152)

#### Parameters

* `__namedParameters: object`

  Properties

  * `__namedParameters.column?: number`
  * `__namedParameters.row?: number`
  * `__namedParameters.table: ModelElement`

#### Returns

* `boolean`

<a id="function-isHeadingColumnCell">

### `isHeadingColumnCell( tableUtils, tableCell ) → boolean` _(internal)_

Checks if a table cell belongs to the heading column section.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L72)

#### Parameters

* `tableUtils: TableUtils`
* `tableCell: ModelElement`

#### Returns

* `boolean`

<a id="function-isTableCellTypeEnabled">

### `isTableCellTypeEnabled( editor ) → boolean` _(internal)_

Checks whether the `tableCellType` attribute is enabled in the editor schema and the experimental flag is set.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L181)

#### Parameters

* `editor: Editor`

#### Returns

* `boolean`

<a id="function-updateNumericAttribute">

### `updateNumericAttribute( key, value, item, writer, defaultValue ) → void` _(internal)_

A common method to update the numeric value. If a value is the default one, it will be unset.

[See source](https://github.com/ckeditor/ckeditor5/blob/master/packages/ckeditor5-table/src/utils/common.ts#L35)

#### Parameters

* `key: string`

  An attribute key.

* `value: unknown`

  The new attribute value.

* `item: ModelItem`

  A model item on which the attribute will be set.

* `writer: ModelWriter`

* `defaultValue: unknown`

  The default attribute value. If a value is lower or equal, it will be unset.

  Defaults to `1`

#### Returns

* `void`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
