@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
54 lines (51 loc) • 2.08 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ExtensionNodeWrapper = void 0;
var _react = _interopRequireDefault(require("react"));
var _react2 = require("@emotion/react");
var _classnames = _interopRequireDefault(require("classnames"));
var _whitespace = require("../whitespace");
/**
* @jsxRuntime classic
* @jsx jsx
*/
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
var styles = (0, _react2.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
*/
var ExtensionNodeWrapper = exports.ExtensionNodeWrapper = function ExtensionNodeWrapper(_ref) {
var children = _ref.children,
nodeType = _ref.nodeType,
macroInteractionDesignFeatureFlags = _ref.macroInteractionDesignFeatureFlags;
var _ref2 = macroInteractionDesignFeatureFlags || {},
showMacroInteractionDesignUpdates = _ref2.showMacroInteractionDesignUpdates;
var wrapperClassNames = (0, _classnames.default)({
'inline-extension': nodeType === 'inlineExtension' && showMacroInteractionDesignUpdates,
relative: showMacroInteractionDesignUpdates
});
return (
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
(0, _react2.jsx)("span", {
className: wrapperClassNames,
css: styles
}, children, nodeType === 'inlineExtension' && _whitespace.ZERO_WIDTH_SPACE)
);
};