@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
47 lines • 1.51 kB
JavaScript
import React from 'react';
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
import { CornerControls } from './CornerControls/ClassicCornerControls';
import { RowControls } from './RowControls/ClassicControls';
export const FloatingControlsWithSelection = ({
editorView,
tableRef,
isInDanger,
isResizing,
isHeaderRowEnabled,
isHeaderColumnEnabled,
hoveredRows,
stickyTop,
hoverRows,
selectRow,
tableActive,
api
}) => {
const {
selection
} = useSharedPluginStateWithSelector(api, ['selection'], states => {
var _states$selectionStat;
return {
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
};
});
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
editorView: editorView,
tableRef: tableRef,
isInDanger: isInDanger,
isResizing: isResizing,
isHeaderRowEnabled: isHeaderRowEnabled,
isHeaderColumnEnabled: isHeaderColumnEnabled,
hoveredRows: hoveredRows,
stickyTop: tableActive ? stickyTop : undefined
}), /*#__PURE__*/React.createElement(RowControls, {
selection: selection,
editorView: editorView,
tableRef: tableRef,
hoverRows: hoverRows,
hoveredRows: hoveredRows,
isInDanger: isInDanger,
isResizing: isResizing,
selectRow: selectRow,
stickyTop: tableActive ? stickyTop : undefined
}));
};