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