@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
160 lines (159 loc) • 6.43 kB
TypeScript
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
import type { PanelDefinition as Panel } from './panel';
import type { ParagraphDefinition as Paragraph, ParagraphWithAlignmentDefinition as ParagraphWithMarks } from './paragraph';
import type { BlockQuoteDefinition as Blockquote } from './blockquote';
import type { OrderedListDefinition as OrderedList, BulletListDefinition as BulletList } from './types/list';
import type { RuleDefinition as Rule } from './rule';
import type { HeadingDefinition as Heading, HeadingWithMarksDefinition as HeadingWithMarks } from './heading';
import type { CodeBlockDefinition as CodeBlock } from './code-block';
import type { MediaGroupDefinition as MediaGroup } from './media-group';
import type { MediaSingleDefinition as MediaSingle } from './media-single';
import type { DecisionListDefinition as DecisionList } from './decision-list';
import type { TaskListDefinition as TaskList } from './task-list';
import type { ExtensionDefinition as Extension } from './extension';
import type { BlockCardDefinition as BlockCard } from './block-card';
import type { EmbedCardDefinition as EmbedCard } from './embed-card';
import type { NestedExpandDefinition as NestedExpand } from './nested-expand';
import type { FragmentDefinition } from '../marks/fragment';
export interface CellAttributes {
background?: string;
colspan?: number;
colwidth?: number[];
localId?: string;
rowspan?: number;
}
export declare const tablePrefixSelector = "pm-table";
export declare const tableCellSelector = "pm-table-cell-content-wrap";
export declare const tableHeaderSelector = "pm-table-header-content-wrap";
export declare const tableCellContentWrapperSelector = "pm-table-cell-nodeview-wrapper";
export declare const tableCellContentDomSelector = "pm-table-cell-nodeview-content-dom";
export declare const getCellAttrs: (dom: HTMLElement, defaultValues?: CellAttributes) => {
background: string | null;
colspan: number;
colwidth: number[] | null;
localId?: string;
rowspan: number;
};
export type CellDomAttrs = {
class?: string;
colorname?: string;
colspan?: string;
'data-cell-background'?: string;
'data-colwidth'?: string;
'data-local-id'?: string;
rowspan?: string;
style?: string;
};
export declare const setGlobalTheme: (theme: string) => void;
/**
* gets cell dom attributes based on node attributes
* @returns CellDomAttrs
*/
export declare const getCellDomAttrs: (node: PmNode) => CellDomAttrs;
export declare const tableBackgroundColorPalette: Map<string, string>;
export declare const tableBackgroundBorderColor: string;
export declare const tableBackgroundColorNames: Map<string, string>;
export type DisplayMode = 'default' | 'fixed';
export type Layout = 'default' | 'full-width' | 'wide' | 'center' | 'align-start' | 'align-end';
export interface TableAttributes {
__autoSize?: boolean;
displayMode?: DisplayMode;
isNumberColumnEnabled?: boolean;
layout?: Layout;
/**
* @minLength 1
*/
localId?: string;
width?: number;
}
/**
* @name table_node
*/
export interface TableDefinition {
attrs?: TableAttributes;
/**
* @minItems 1
*/
content: Array<TableRow>;
marks?: Array<FragmentDefinition>;
type: 'table';
}
/**
* @name table_row_node
*/
export interface TableRow {
content: Array<TableHeader | TableCell>;
type: 'tableRow';
}
/**
* @name table_cell_content
* @minItems 1
* @allowUnsupportedBlock true
*/
export type TableCellContent = Array<Panel | Paragraph | ParagraphWithMarks | Blockquote | OrderedList | BulletList | Rule | Heading | HeadingWithMarks | CodeBlock | MediaGroup | MediaSingle | DecisionList | TaskList | Extension | BlockCard | NestedExpand | EmbedCard>;
/**
* @name table_cell_node
*/
export interface TableCell {
attrs?: CellAttributes;
content: TableCellContent;
type: 'tableCell';
}
/**
* @name table_header_node
*/
export interface TableHeader {
attrs?: CellAttributes;
content: TableCellContent;
type: 'tableHeader';
}
export interface TableWithNestedTableDefinition {
attrs?: TableAttributes;
/**
* @minItems 1
*/
content: Array<TableRow>;
marks?: Array<FragmentDefinition>;
type: 'table';
}
export interface TableRowWithNestedTableDefinition {
content: Array<TableHeader | TableCell>;
type: 'tableRow';
}
export interface TableCellWithNestedTableDefinition {
attrs?: CellAttributes;
content: TableCellContent | TableDefinition;
type: 'tableCell';
}
export interface TableHeaderWithNestedTableDefinition {
attrs?: CellAttributes;
content: TableCellContent | TableDefinition;
type: 'tableHeader';
}
/** Includes table width attribute */
export declare const table: import("prosemirror-model").NodeSpec;
/** @deprecated Do not use, instead use the regular `table` export */
export declare const tableWithCustomWidth: import("prosemirror-model").NodeSpec;
export declare const tableStage0: import("prosemirror-model").NodeSpec;
export declare const tableToJSON: (node: PmNode) => {
attrs: import("prosemirror-model").Attrs;
};
export declare const tableRow: import("prosemirror-model").NodeSpec;
export declare const tableCell: import("prosemirror-model").NodeSpec;
export declare const toJSONTableCell: (node: PmNode) => {
attrs: Record<string, any>;
};
export declare const tableHeader: import("prosemirror-model").NodeSpec;
export declare const toJSONTableHeader: (node: PmNode) => {
attrs: Record<string, any>;
};
export declare const tableWithNestedTable: import("prosemirror-model").NodeSpec;
export declare const tableRowWithNestedTable: import("prosemirror-model").NodeSpec;
export declare const tableCellWithNestedTable: import("prosemirror-model").NodeSpec;
export declare const tableHeaderWithNestedTable: import("prosemirror-model").NodeSpec;
export declare const tableRowWithLocalId: import("prosemirror-model").NodeSpec;
export declare const tableCellWithLocalId: import("prosemirror-model").NodeSpec;
export declare const tableHeaderWithLocalId: import("prosemirror-model").NodeSpec;
export declare const tableRowWithNestedTableWithLocalId: import("prosemirror-model").NodeSpec;
export declare const tableCellWithNestedTableWithLocalId: import("prosemirror-model").NodeSpec;
export declare const tableHeaderWithNestedTableWithLocalId: import("prosemirror-model").NodeSpec;