@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
94 lines (87 loc) • 2.64 kB
JavaScript
import { ADD_COLUMN_RIGHT_ITEM, DELETE_COLUMN_ITEM, DISTRIBUTE_COLUMNS_ITEM } from '../column/keys';
import { ADD_ROW_BELOW_ITEM, DELETE_ROW_ITEM } from '../row/keys';
import { BACKGROUND_COLOR_ITEM, CLEAR_CELLS_ITEM } from '../shared/keys';
// --- Menu surface ---
export const CELL_MENU = {
type: 'menu',
key: 'cell-contextual-menu'
};
// --- Sections ---
export const CELL_ACTION_SECTION = {
type: 'menu-section',
key: 'cell-action-section'
};
export const CELL_ADD_SECTION = {
type: 'menu-section',
key: 'cell-add-section'
};
export const CELL_DANGER_SECTION = {
type: 'menu-section',
key: 'cell-danger-section'
};
export const CELL_MENU_RANK = {
[]: 100,
[]: 200,
[]: 300
};
export const MERGE_CELLS_ITEM = {
type: 'menu-item',
key: 'merge-cells'
};
export const SPLIT_CELL_ITEM = {
type: 'menu-item',
key: 'split-cell'
};
export const VERTICAL_ALIGN_MENU = {
type: 'nested-menu',
key: 'vertical-align'
};
export const VERTICAL_ALIGN_MENU_SECTION = {
type: 'menu-section',
key: 'vertical-align-section'
};
export const VERTICAL_ALIGN_TOP_ITEM = {
type: 'menu-item',
key: 'vertical-align-top'
};
export const VERTICAL_ALIGN_MIDDLE_ITEM = {
type: 'menu-item',
key: 'vertical-align-middle'
};
export const VERTICAL_ALIGN_BOTTOM_ITEM = {
type: 'menu-item',
key: 'vertical-align-bottom'
};
// --- Item ranks within their sections ---
//
// The add/delete items rendered in the cell menu are shared with the row/column
// menus (registered once in `../shared/getSharedItems` with multiple parents), so
// we reuse their existing keys here rather than declaring cell-specific ones.
export const CELL_ACTION_SECTION_RANK = {
[]: 100,
[]: 200,
[]: 300,
[]: 400
};
export const VERTICAL_ALIGN_MENU_RANK = {
[]: 100
};
export const VERTICAL_ALIGN_MENU_SECTION_RANK = {
[]: 100,
[]: 200,
[]: 300
};
// Merge/Split cells are relocated from the action section into the add section when the
// cell menu update gate is on; they sit at the top of the section.
export const CELL_ADD_SECTION_RANK = {
[]: 100,
[]: 200,
[]: 300,
[]: 400,
[]: 500
};
export const CELL_DANGER_SECTION_RANK = {
[]: 100,
[]: 200,
[]: 300
};