@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
14 lines • 666 B
JavaScript
import { getPluginState } from '../../../../pm-plugins/plugin-factory';
var getNormalizedValign = function getNormalizedValign(valign) {
return valign !== null && valign !== void 0 ? valign : 'top';
};
export var getSelectedCellValign = function getSelectedCellValign(editorView) {
if (!editorView) {
return 'top';
}
var state = editorView.state;
var _getPluginState = getPluginState(state),
targetCellPosition = _getPluginState.targetCellPosition;
var cell = typeof targetCellPosition === 'number' ? state.doc.nodeAt(targetCellPosition) : undefined;
return getNormalizedValign(cell === null || cell === void 0 ? void 0 : cell.attrs.valign);
};