@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
25 lines (24 loc) • 1.25 kB
TypeScript
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
import TableNodeView from './TableNodeViewBase';
export default class TableCell extends TableNodeView<HTMLElement> implements NodeView {
private delayHandle;
/** Cached edge state to avoid redundant DOM writes. */
private prevReachesTop;
private prevReachesBottom;
private prevReachesLeft;
private prevReachesRight;
constructor(node: PMNode, view: EditorView, getPos: () => number | undefined, eventDispatcher: EventDispatcher, editorAnalyticsAPI: EditorAnalyticsAPI | undefined);
destroy: () => void;
update(node: PMNode): boolean;
/**
* Detects whether this cell visually reaches the bottom or right edge of the table
* (accounting for rowspan/colspan) and sets data attributes so CSS can apply
* rounded corners and transparent borders to merged cells that span to the table edges.
*/
private updateTableEdgeAttrs;
private setDataAttr;
private updateNodeView;
}