import type { CreateElementData, EditorPlugin, IEditor, PluginEvent } from 'roosterjs-editor-types'; /** * TableResize plugin, provides the ability to resize a table by drag-and-drop */ export default class TableResize implements EditorPlugin { private onShowHelperElement?; private anchorContainerSelector?; private editor; private onMouseMoveDisposer; private tableRectMap; private tableEditor; /** * Construct a new instance of TableResize plugin * @param onShowHelperElement An optional callback to allow customize helper element of table resizing. * To customize the helper element, add this callback and change the attributes of elementData then it * will be picked up by TableResize code * @param anchorContainerSelector An optional selector string to specify the container to host the plugin. * The container must not be affected by transform: scale(), otherwise the position calculation will be wrong. * If not specified, the plugin will be inserted in document.body */ constructor(onShowHelperElement?: ((elementData: CreateElementData, helperType: 'CellResizer' | 'TableInserter' | 'TableResizer' | 'TableSelector', tableOrTd: HTMLTableElement | HTMLTableCellElement) => void) | undefined, anchorContainerSelector?: string | undefined); /** * Get a friendly name of this plugin */ getName(): string; /** * Initialize this plugin. This should only be called from Editor * @param editor Editor instance */ initialize(editor: IEditor): void; private onMouseOut; /** * Dispose this plugin */ dispose(): void; /** * Handle events triggered from editor * @param event PluginEvent object */ onPluginEvent(e: PluginEvent): void; private onMouseMove; /** * @internal Public only for unit test * @param table Table to use when setting the Editors * @param event (Optional) Mouse event */ setTableEditor(table: HTMLTableElement | null, event?: MouseEvent): void; private invalidateTableRects; private disposeTableEditor; private ensureTableRects; }