UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

38 lines (37 loc) 1.11 kB
/** * @jsxRuntime classic * @jsx jsx */ import React from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic import { css, jsx } from '@emotion/react'; import { clickAreaClickHandler } from '../click-area-helper'; const clickWrapper = css({ flexGrow: 1, height: '100%' }); export const ClickAreaBlock = ({ editorView, editorDisabled, children }) => { const handleMouseDown = React.useCallback(event => { if (!editorView) { return; } if (!editorDisabled) { clickAreaClickHandler(editorView, event); } }, [editorView, editorDisabled]); return jsx("div", { "data-editor-click-wrapper": true, "data-testid": "click-wrapper", css: clickWrapper, onMouseDown: handleMouseDown // This div is a presentational container that captures mouse events // for programmatic editor focus management, not user interaction. , role: "presentation" }, children); }; export default ClickAreaBlock;