UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

38 lines (37 loc) 1.29 kB
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 export default class WithEditorActions extends React.Component { constructor(props) { super(props); } render() { // Ignored via go/ees005 // eslint-disable-next-line react/jsx-props-no-spreading return /*#__PURE__*/React.createElement(WithEditorActionsNew, this.props); } } function WithEditorActionsNew(props) { const { render } = props; const 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 class WithEditorActionsInner extends React.Component { componentDidMount() { this.props.editorActions._privateSubscribe(() => this.forceUpdate()); } componentWillUnmount() { this.props.editorActions._privateUnsubscribe(() => this.forceUpdate()); } render() { return this.props.render(this.props.editorActions); } }