UNPKG

@atlaskit/editor-common

Version:

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

46 lines (45 loc) 1.75 kB
/** * @jsxRuntime classic * @jsx jsx */ import React from 'react'; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766 import { css, jsx } from '@emotion/react'; import classnames from 'classnames'; import { ZERO_WIDTH_SPACE } from '../whitespace'; var styles = css({ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 '&.inline-extension': { display: 'inline-block' }, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766 '&.relative': { position: 'relative' } }); /** * If inlineExtension, add zero width space to the end of the nodes and wrap with span; * Also if showMacroInteractionDesignUpdates is true, then add the inline-block style to account for the lozenge. * else wrap with a div (for multi bodied extensions) * * @param param0 * @returns */ export var ExtensionNodeWrapper = function ExtensionNodeWrapper(_ref) { var children = _ref.children, nodeType = _ref.nodeType, macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags; var _ref2 = macroInteractionDesignFeatureFlags || {}, showMacroInteractionDesignUpdates = _ref2.showMacroInteractionDesignUpdates; var wrapperClassNames = classnames({ 'inline-extension': nodeType === 'inlineExtension' && showMacroInteractionDesignUpdates, relative: showMacroInteractionDesignUpdates }); return ( // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 jsx("span", { className: wrapperClassNames, css: styles }, children, nodeType === 'inlineExtension' && ZERO_WIDTH_SPACE) ); };