@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
73 lines (71 loc) • 3.46 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";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _extends from "@babel/runtime/helpers/extends";
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; })(); }
// Disable no-re-export rule for entry point files
/* eslint-disable @atlaskit/editor/no-re-export */
/**
* @jsxRuntime classic
* @jsx jsx
*/
import React 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 { ComposableEditor } from './composable-editor';
import useUniversalPreset from './presets/useUniversalPreset';
import editorDeprecationWarnings from './utils/editorDeprecationWarnings';
var ComposableEditorWrapper = function ComposableEditorWrapper(_ref) {
var props = _ref.props,
initialPluginConfiguration = _ref.initialPluginConfiguration;
var preset = useUniversalPreset({
props: props,
initialPluginConfiguration: initialPluginConfiguration
});
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
return jsx(ComposableEditor, _extends({
preset: preset
}, props));
};
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required -- Ignored via go/ED-25883
/**
* @deprecated - Please use the `ComposableEditor` component instead.
* We strongly encourage the use of custom presets, however your easiest migration path is to use the `useUniversalPreset` hook.
* The `ComposableEditor` component is a more flexible and customizable alternative to the `Editor` component.
* It allows you to create an editor with a custom set of plugins and configurations.
* For more information, see the documentation for the `ComposableEditor` component here: https://atlaskit.atlassian.com/packages/editor/editor-core
*/
// Ignored via go/ees005
// eslint-disable-next-line @repo/internal/react/no-class-components
var Editor = /*#__PURE__*/function (_React$Component) {
function Editor(props) {
var _this;
_classCallCheck(this, Editor);
_this = _callSuper(this, Editor, [props]);
editorDeprecationWarnings(props);
return _this;
}
_inherits(Editor, _React$Component);
return _createClass(Editor, [{
key: "render",
value: function render() {
return jsx(ComposableEditorWrapper, {
props: this.props,
initialPluginConfiguration: this.props.initialPluginConfiguration
});
}
}]);
}(React.Component);
_defineProperty(Editor, "defaultProps", {
appearance: 'comment',
disabled: false,
extensionHandlers: {},
allowHelpDialog: true,
quickInsert: true
});
export { Editor as default };