UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

41 lines 2.03 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["children", "type"]; import React from 'react'; import { ReactEditorViewContext } from '../../ui-react'; import { ColorPaletteArrowKeyNavigationProvider } from './ColorPaletteArrowKeyNavigationProvider'; import { MenuArrowKeyNavigationProvider } from './MenuArrowKeyNavigationProvider'; import { ArrowKeyNavigationType } from './types'; export var ArrowKeyNavigationProvider = function ArrowKeyNavigationProvider(props) { var children = props.children, type = props.type, restProps = _objectWithoutProperties(props, _excluded); if (type === ArrowKeyNavigationType.COLOR) { return /*#__PURE__*/React.createElement(ReactEditorViewContext.Consumer, null, function (_ref) { var popupsMountPoint = _ref.popupsMountPoint, editorView = _ref.editorView, editorRef = _ref.editorRef; return editorRef && /*#__PURE__*/React.createElement(ColorPaletteArrowKeyNavigationProvider, _extends({ selectedRowIndex: props.selectedRowIndex, selectedColumnIndex: props.selectedColumnIndex, isOpenedByKeyboard: props.isOpenedByKeyboard, isPopupPositioned: props.isPopupPositioned, editorRef: editorRef, popupsMountPoint: popupsMountPoint // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading }, restProps), children); }); } return /*#__PURE__*/React.createElement(ReactEditorViewContext.Consumer, null, function (_ref2) { var popupsMountPoint = _ref2.popupsMountPoint, editorView = _ref2.editorView, editorRef = _ref2.editorRef; return editorRef && /*#__PURE__*/React.createElement(MenuArrowKeyNavigationProvider, _extends({ editorRef: editorRef, popupsMountPoint: popupsMountPoint // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading }, restProps), children); }); };