UNPKG

4.1 kBTypeScriptView Raw
1import { Node as PmNode, NodeSpec } from 'prosemirror-model';
2import { CellAttributes } from '@atlaskit/editor-tables/types';
3import { PanelDefinition as Panel } from './panel';
4import { ParagraphDefinition as Paragraph, ParagraphWithAlignmentDefinition as ParagraphWithMarks } from './paragraph';
5import { BlockQuoteDefinition as Blockquote } from './blockquote';
6import { OrderedListDefinition as OrderedList } from './types/list';
7import { BulletListDefinition as BulletList } from './types/list';
8import { RuleDefinition as Rule } from './rule';
9import { HeadingDefinition as Heading, HeadingWithMarksDefinition as HeadingWithMarks } from './heading';
10import { CodeBlockDefinition as CodeBlock } from './code-block';
11import { MediaGroupDefinition as MediaGroup } from './media-group';
12import { MediaSingleDefinition as MediaSingle } from './media-single';
13import { DecisionListDefinition as DecisionList } from './decision-list';
14import { TaskListDefinition as TaskList } from './task-list';
15import { ExtensionDefinition as Extension } from './extension';
16import { BlockCardDefinition as BlockCard } from './block-card';
17import { EmbedCardDefinition as EmbedCard } from './embed-card';
18import { NestedExpandDefinition as NestedExpand } from './nested-expand';
19import { FragmentDefinition } from '../marks/fragment';
20export type { CellAttributes };
21export declare const tablePrefixSelector = "pm-table";
22export declare const tableCellSelector: string;
23export declare const tableHeaderSelector: string;
24export declare const tableCellContentWrapperSelector: string;
25export declare const tableCellContentDomSelector: string;
26export declare const getCellAttrs: (dom: HTMLElement, defaultValues?: CellAttributes) => {
27 colspan: number;
28 rowspan: number;
29 colwidth: number[] | null;
30 background: string | null;
31};
32export declare type CellDomAttrs = {
33 colspan?: string;
34 rowspan?: string;
35 style?: string;
36 colorname?: string;
37 'data-colwidth'?: string;
38 'data-cell-background'?: string;
39 class?: string;
40};
41/**
42 * gets cell dom attributes based on node attributes
43 * @returns CellDomAttrs
44 */
45export declare const getCellDomAttrs: (node: PmNode) => CellDomAttrs;
46export declare const tableBackgroundColorPalette: Map<string, string>;
47export declare const tableBackgroundBorderColor: string;
48export declare const tableBackgroundColorNames: Map<string, string>;
49export declare type Layout = 'default' | 'full-width' | 'wide';
50export interface TableAttributes {
51 isNumberColumnEnabled?: boolean;
52 layout?: Layout;
53 __autoSize?: boolean;
54 /**
55 * @minLength 1
56 */
57 localId?: string;
58}
59/**
60 * @name table_node
61 */
62export interface TableDefinition {
63 type: 'table';
64 attrs?: TableAttributes;
65 /**
66 * @minItems 1
67 */
68 content: Array<TableRow>;
69 marks?: Array<FragmentDefinition>;
70}
71/**
72 * @name table_row_node
73 */
74export interface TableRow {
75 type: 'tableRow';
76 content: Array<TableHeader | TableCell>;
77}
78/**
79 * @name table_cell_content
80 * @minItems 1
81 * @allowUnsupportedBlock true
82 */
83export declare type TableCellContent = Array<Panel | Paragraph | ParagraphWithMarks | Blockquote | OrderedList | BulletList | Rule | Heading | HeadingWithMarks | CodeBlock | MediaGroup | MediaSingle | DecisionList | TaskList | Extension | BlockCard | NestedExpand | EmbedCard>;
84/**
85 * @name table_cell_node
86 */
87export interface TableCell {
88 type: 'tableCell';
89 attrs?: CellAttributes;
90 content: TableCellContent;
91}
92/**
93 * @name table_header_node
94 */
95export interface TableHeader {
96 type: 'tableHeader';
97 attrs?: CellAttributes;
98 content: TableCellContent;
99}
100export declare const table: NodeSpec;
101export declare const tableToJSON: (node: PmNode) => {
102 attrs: {
103 [key: string]: any;
104 };
105};
106export declare const tableRow: NodeSpec;
107export declare const tableCell: NodeSpec;
108export declare const toJSONTableCell: (node: PmNode) => {
109 attrs: Record<string, any>;
110};
111export declare const tableHeader: NodeSpec;
112export declare const toJSONTableHeader: (node: PmNode) => {
113 attrs: Record<string, any>;
114};