UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

68 lines (67 loc) 3.24 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** * @jsxRuntime classic * @jsx jsx */ import React, { PureComponent } 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 { jsx } from '@emotion/react'; import { injectIntl } from 'react-intl'; import { messages } from './messages'; import { inputStyle } from './styles'; // Ignored via go/ees005 // eslint-disable-next-line @repo/internal/react/no-class-components var ChromeCollapsed = /*#__PURE__*/function (_PureComponent) { function ChromeCollapsed() { var _this; _classCallCheck(this, ChromeCollapsed); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _callSuper(this, ChromeCollapsed, [].concat(args)); _defineProperty(_this, "focusHandler", function (evt) { /** * We need this magic for FireFox. * The reason we need it is, when, in FireFox, we have focus inside input, * and then we remove that input and move focus to another place programmatically, * for whatever reason UP/DOWN arrows don't work until you blur and focus editor manually. */ if (_this.input) { _this.input.blur(); } if (_this.props.onFocus) { _this.props.onFocus(evt); } }); _defineProperty(_this, "handleInputRef", function (ref) { _this.input = ref; }); return _this; } _inherits(ChromeCollapsed, _PureComponent); return _createClass(ChromeCollapsed, [{ key: "render", value: function render() { var placeholder = this.props.text || this.props.intl.formatMessage(messages.chromeCollapsedPlaceholder); return jsx("input", { "data-testid": "chrome-collapsed" // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 , css: inputStyle, ref: this.handleInputRef, onFocus: this.focusHandler, placeholder: placeholder, "aria-label": this.props.label }); } }]); }(PureComponent); // eslint-disable-next-line @typescript-eslint/ban-types var _default_1 = injectIntl(ChromeCollapsed); export default _default_1;