UNPKG

2.45 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 */
5import type { Element, ElementCreatorFunction } from 'ckeditor5/src/engine';
6import type TableUtils from '../tableutils';
7import type { AdditionalSlot } from '../tableediting';
8/**
9 * Model table element to view table element conversion helper.
10 */
11export declare function downcastTable(tableUtils: TableUtils, options: DowncastTableOptions): ElementCreatorFunction;
12/**
13 * Model table row element to view `<tr>` element conversion helper.
14 *
15 * @returns Element creator.
16 */
17export declare function downcastRow(): ElementCreatorFunction;
18/**
19 * Model table cell element to view `<td>` or `<th>` element conversion helper.
20 *
21 * This conversion helper will create proper `<th>` elements for table cells that are in the heading section (heading row or column)
22 * and `<td>` otherwise.
23 *
24 * @param options.asWidget If set to `true`, the downcast conversion will produce a widget.
25 * @returns Element creator.
26 */
27export declare function downcastCell(options?: {
28 asWidget?: boolean;
29}): ElementCreatorFunction;
30/**
31 * Overrides paragraph inside table cell conversion.
32 *
33 * This converter:
34 * * should be used to override default paragraph conversion.
35 * * It will only convert `<paragraph>` placed directly inside `<tableCell>`.
36 * * For a single paragraph without attributes it returns `<span>` to simulate data table.
37 * * For all other cases it returns `<p>` element.
38 *
39 * @param options.asWidget If set to `true`, the downcast conversion will produce a widget.
40 * @returns Element creator.
41 */
42export declare function convertParagraphInTableCell(options?: {
43 asWidget?: boolean;
44}): ElementCreatorFunction;
45/**
46 * Checks if given model `<paragraph>` is an only child of a parent (`<tableCell>`) and if it has any attribute set.
47 *
48 * The paragraph should be converted in the editing view to:
49 *
50 * * If returned `true` - to a `<span class="ck-table-bogus-paragraph">`
51 * * If returned `false` - to a `<p>`
52 */
53export declare function isSingleParagraphWithoutAttributes(modelElement: Element): boolean;
54export interface DowncastTableOptions {
55 /**
56 * If set to `true`, the downcast conversion will produce a widget.
57 */
58 asWidget?: boolean;
59 /**
60 * Array of additional slot handlers.
61 */
62 additionalSlots: Array<AdditionalSlot>;
63}