UNPKG

@atlaskit/editor-plugin-block-controls

Version:

Block controls plugin for @atlaskit/editor-core

25 lines 1.11 kB
import React from 'react'; import { BLOCK_CONTROL_UI_CONTEXT } from '@atlaskit/editor-common/block-controls/block-control-ui-context'; import { BLOCK_CONTROLS_DRAG_HANDLE, BLOCK_CONTROLS_LEFT_GROUP } from '@atlaskit/editor-common/block-controls/surface-keys'; import { BlockControlsSurfaceDragHandle } from './block-controls-surface-drag-handle'; export const getBlockControlsSurfaceDragHandleComponents = ({ api }) => [{ component: ({ surfaceContext }) => /*#__PURE__*/React.createElement(BlockControlsSurfaceDragHandle, { api: api, surfaceContext: surfaceContext }), isHidden: ({ surfaceContext } = {}) => { const context = surfaceContext === null || surfaceContext === void 0 ? void 0 : surfaceContext.get(BLOCK_CONTROL_UI_CONTEXT); return !(context !== null && context !== void 0 && context.activeNode) || context.targetNode.pos !== context.activeNode.pos || context.activeControlKey !== undefined && context.activeControlKey !== BLOCK_CONTROLS_DRAG_HANDLE.key; }, ...BLOCK_CONTROLS_DRAG_HANDLE, parents: [{ ...BLOCK_CONTROLS_LEFT_GROUP, rank: 200 }] }];