UNPKG

@textbus/editor

Version:

Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.

49 lines (48 loc) 1.86 kB
import { ChangeController, ComponentInstance, Slot, Slots } from '@textbus/core'; export interface TableSlotState { rowspan: number; colspan: number; } export type TableCellSlot = Slot<TableSlotState>; export interface TableCellPosition { beforeCell: TableCellSlot | null; afterCell: TableCellSlot | null; row: TableCellSlot[]; cell: TableCellSlot; rowIndex: number; columnIndex: number; offsetColumn: number; offsetRow: number; } export interface TableRange { startPosition: TableCellPosition; endPosition: TableCellPosition; selectedCells: TableCellSlot[]; } export interface TableRowPosition { cells: TableCellSlot[]; beforeRow: TableCellSlot[]; afterRow: TableCellSlot[]; cellsPosition: TableCellPosition[]; } export interface TableCellRect { minRow: number; maxRow: number; minColumn: number; maxColumn: number; } export declare function createCell(colspan?: number, rowspan?: number): Slot<{ rowspan: number; colspan: number; }>; export declare function autoComplete(table: TableCellSlot[][]): TableCellSlot[][]; export declare function slotsToTable(slots: TableCellSlot[], columnSize: number): TableCellSlot[][]; export declare function serialize(bodies: TableCellSlot[][]): TableRowPosition[]; export interface TableConfig { useTextbusStyle: boolean; columnCount: number; rowCount: number; } export declare function findFocusCell(componentInstance: ComponentInstance, slot: TableCellSlot): TableCellSlot | null; export declare function selectCells(startCell: TableCellSlot, endCell: TableCellSlot, componentInstance: ComponentInstance, columnCount: number): TableRange; export declare function useTableMultipleRange(slots: Slots, stateController: ChangeController<TableConfig>, config: TableConfig, callback: (tableRange: TableRange) => void): void;