UNPKG

1.86 kBTypeScriptView Raw
1/**
2 * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4 */
5/**
6 * @module table/utils/common
7 */
8import type { Conversion, Element, Item, Position, Schema, Writer } from 'ckeditor5/src/engine';
9import type TableUtils from '../tableutils';
10/**
11 * A common method to update the numeric value. If a value is the default one, it will be unset.
12 *
13 * @param key An attribute key.
14 * @param value The new attribute value.
15 * @param item A model item on which the attribute will be set.
16 * @param defaultValue The default attribute value. If a value is lower or equal, it will be unset.
17 */
18export declare function updateNumericAttribute(key: string, value: unknown, item: Item, writer: Writer, defaultValue?: unknown): void;
19/**
20 * 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.
21 *
22 * @param writer The model writer.
23 * @param insertPosition The position at which the table cell should be inserted.
24 * @param attributes The element attributes.
25 * @returns Created table cell.
26 */
27export declare function createEmptyTableCell(writer: Writer, insertPosition: Position, attributes?: Record<string, unknown>): Element;
28/**
29 * Checks if a table cell belongs to the heading column section.
30 */
31export declare function isHeadingColumnCell(tableUtils: TableUtils, tableCell: Element): boolean;
32/**
33 * Enables conversion for an attribute for simple view-model mappings.
34 *
35 * @param options.defaultValue The default value for the specified `modelAttribute`.
36 */
37export declare function enableProperty(schema: Schema, conversion: Conversion, options: {
38 modelAttribute: string;
39 styleName: string;
40 defaultValue: string;
41 reduceBoxSides?: boolean;
42}): void;