UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

70 lines (63 loc) 2.92 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; 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 var CELL_MENU = { type: 'menu', key: 'cell-contextual-menu' }; // --- Sections --- export var CELL_ACTION_SECTION = { type: 'menu-section', key: 'cell-action-section' }; export var CELL_ADD_SECTION = { type: 'menu-section', key: 'cell-add-section' }; export var CELL_DANGER_SECTION = { type: 'menu-section', key: 'cell-danger-section' }; export var CELL_MENU_RANK = _defineProperty(_defineProperty(_defineProperty({}, CELL_ACTION_SECTION.key, 100), CELL_ADD_SECTION.key, 200), CELL_DANGER_SECTION.key, 300); export var MERGE_CELLS_ITEM = { type: 'menu-item', key: 'merge-cells' }; export var SPLIT_CELL_ITEM = { type: 'menu-item', key: 'split-cell' }; export var VERTICAL_ALIGN_MENU = { type: 'nested-menu', key: 'vertical-align' }; export var VERTICAL_ALIGN_MENU_SECTION = { type: 'menu-section', key: 'vertical-align-section' }; export var VERTICAL_ALIGN_TOP_ITEM = { type: 'menu-item', key: 'vertical-align-top' }; export var VERTICAL_ALIGN_MIDDLE_ITEM = { type: 'menu-item', key: 'vertical-align-middle' }; export var 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 var CELL_ACTION_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, BACKGROUND_COLOR_ITEM.key, 100), VERTICAL_ALIGN_MENU.key, 200), MERGE_CELLS_ITEM.key, 300), SPLIT_CELL_ITEM.key, 400); export var VERTICAL_ALIGN_MENU_RANK = _defineProperty({}, VERTICAL_ALIGN_MENU_SECTION.key, 100); export var VERTICAL_ALIGN_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, VERTICAL_ALIGN_TOP_ITEM.key, 100), VERTICAL_ALIGN_MIDDLE_ITEM.key, 200), VERTICAL_ALIGN_BOTTOM_ITEM.key, 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 var CELL_ADD_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, MERGE_CELLS_ITEM.key, 100), SPLIT_CELL_ITEM.key, 200), ADD_COLUMN_RIGHT_ITEM.key, 300), ADD_ROW_BELOW_ITEM.key, 400), DISTRIBUTE_COLUMNS_ITEM.key, 500); export var CELL_DANGER_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, CLEAR_CELLS_ITEM.key, 100), DELETE_COLUMN_ITEM.key, 200), DELETE_ROW_ITEM.key, 300);