@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
67 lines (66 loc) • 2.97 kB
JavaScript
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";
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; })(); }
import React from 'react';
import { EditorContext } from '@atlaskit/editor-common/UNSAFE_do_not_use_editor_context';
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components, react/prefer-stateless-function
var WithEditorActions = /*#__PURE__*/function (_React$Component) {
function WithEditorActions(props) {
_classCallCheck(this, WithEditorActions);
return _callSuper(this, WithEditorActions, [props]);
}
_inherits(WithEditorActions, _React$Component);
return _createClass(WithEditorActions, [{
key: "render",
value: function render() {
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
return /*#__PURE__*/React.createElement(WithEditorActionsNew, this.props);
}
}]);
}(React.Component);
export { WithEditorActions as default };
function WithEditorActionsNew(props) {
var render = props.render;
var context = React.useContext(EditorContext);
return /*#__PURE__*/React.createElement(WithEditorActionsInner, {
render: render,
editorActions: context === null || context === void 0 ? void 0 : context.editorActions
});
}
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components
var WithEditorActionsInner = /*#__PURE__*/function (_React$Component2) {
function WithEditorActionsInner() {
_classCallCheck(this, WithEditorActionsInner);
return _callSuper(this, WithEditorActionsInner, arguments);
}
_inherits(WithEditorActionsInner, _React$Component2);
return _createClass(WithEditorActionsInner, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this = this;
this.props.editorActions._privateSubscribe(function () {
return _this.forceUpdate();
});
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
var _this2 = this;
this.props.editorActions._privateUnsubscribe(function () {
return _this2.forceUpdate();
});
}
}, {
key: "render",
value: function render() {
return this.props.render(this.props.editorActions);
}
}]);
}(React.Component);