@atlaskit/editor-core 187.4.11 → 187.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/editor-next/index.js +93 -115
  3. package/dist/cjs/editor.js +8 -2
  4. package/dist/cjs/ui/CollapsedEditor/index.js +7 -1
  5. package/dist/cjs/version-wrapper.js +1 -1
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/es2019/editor-next/index.js +91 -77
  8. package/dist/es2019/editor.js +8 -2
  9. package/dist/es2019/ui/CollapsedEditor/index.js +7 -1
  10. package/dist/es2019/version-wrapper.js +1 -1
  11. package/dist/es2019/version.json +1 -1
  12. package/dist/esm/editor-next/index.js +92 -115
  13. package/dist/esm/editor.js +8 -2
  14. package/dist/esm/ui/CollapsedEditor/index.js +7 -1
  15. package/dist/esm/version-wrapper.js +1 -1
  16. package/dist/esm/version.json +1 -1
  17. package/dist/types/editor-next/editor-internal.d.ts +9 -9
  18. package/dist/types/editor-next/index.d.ts +8 -32
  19. package/dist/types/editor.d.ts +1 -1
  20. package/dist/types/types/editor-props.d.ts +32 -32
  21. package/dist/types/ui/CollapsedEditor/index.d.ts +3 -3
  22. package/dist/types-ts4.5/editor-next/editor-internal.d.ts +9 -9
  23. package/dist/types-ts4.5/editor-next/index.d.ts +8 -32
  24. package/dist/types-ts4.5/editor.d.ts +1 -1
  25. package/dist/types-ts4.5/types/editor-props.d.ts +32 -32
  26. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +3 -3
  27. package/package.json +1 -1
  28. package/report.api.md +12 -41
  29. package/tmp/api-report-tmp.d.ts +12 -38
  30. package/dist/cjs/editor-next/utils/editorPropTypes.js +0 -36
  31. package/dist/cjs/editor-next/utils/onEditorCreated.js +0 -28
  32. package/dist/es2019/editor-next/utils/editorPropTypes.js +0 -29
  33. package/dist/es2019/editor-next/utils/onEditorCreated.js +0 -21
  34. package/dist/esm/editor-next/utils/editorPropTypes.js +0 -28
  35. package/dist/esm/editor-next/utils/onEditorCreated.js +0 -21
  36. package/dist/types/editor-next/utils/editorPropTypes.d.ts +0 -19
  37. package/dist/types/editor-next/utils/onEditorCreated.d.ts +0 -12
  38. package/dist/types-ts4.5/editor-next/utils/editorPropTypes.d.ts +0 -19
  39. package/dist/types-ts4.5/editor-next/utils/onEditorCreated.d.ts +0 -12
@@ -1,139 +1,116 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
4
  /** @jsx jsx */
13
- import React from 'react';
5
+ import { useRef } from 'react';
14
6
  import { jsx } from '@emotion/react';
15
- import PropTypes from 'prop-types';
16
7
  import uuid from 'uuid/v4';
17
8
  import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
18
- import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
19
- import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
20
- import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
9
+ import { ACTION, fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
10
+ import { EditorExperience, ExperienceStore } from '@atlaskit/editor-common/ufo';
11
+ import { getAnalyticsAppearance, startMeasure, stopMeasure } from '@atlaskit/editor-common/utils';
12
+ import { basePlugin } from '../plugins';
21
13
  import EditorActions from '../actions';
22
14
  import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from-props';
23
- import { basePlugin } from '../plugins';
24
15
  import { name, version } from '../version-wrapper';
16
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
17
+ import { useConstructor } from '@atlaskit/editor-common/hooks';
18
+ import { useEditorContext } from '../ui/EditorContext';
19
+ import measurements from '../utils/performance/measure-enum';
25
20
  import EditorInternal from './editor-internal';
26
21
  import deprecationWarnings from './utils/deprecationWarnings';
27
- import { propTypes } from './utils/editorPropTypes';
28
- import _onEditorCreated from './utils/onEditorCreated';
22
+ import sendDurationAnalytics from './utils/sendDurationAnalytics';
29
23
  import trackEditorActions from './utils/trackEditorActions';
30
- var EditorNext = /*#__PURE__*/function (_React$Component) {
31
- _inherits(EditorNext, _React$Component);
32
- var _super = _createSuper(EditorNext);
33
- function EditorNext(props, context) {
34
- var _this;
35
- _classCallCheck(this, EditorNext);
36
- _this = _super.call(this, props);
37
- _defineProperty(_assertThisInitialized(_this), "handleSave", function (view) {
38
- var _this$props$onSave, _this$props;
39
- return (_this$props$onSave = (_this$props = _this.props).onSave) === null || _this$props$onSave === void 0 ? void 0 : _this$props$onSave.call(_this$props, view);
40
- });
41
- _defineProperty(_assertThisInitialized(_this), "handleAnalyticsEvent", function (data) {
42
- return fireAnalyticsEvent(_this.createAnalyticsEvent)(data);
43
- });
44
- _defineProperty(_assertThisInitialized(_this), "getFeatureFlags", function () {
45
- return createFeatureFlagsFromProps(_this.props);
46
- });
47
- _defineProperty(_assertThisInitialized(_this), "getExperienceStore", function () {
48
- return _this.experienceStore;
49
- });
24
+ export function Editor(passedProps) {
25
+ var _editorContext$editor;
26
+ var defaultProps = {
27
+ appearance: 'comment',
28
+ disabled: false,
29
+ quickInsert: true
30
+ };
31
+ var props = _objectSpread(_objectSpread({}, defaultProps), passedProps);
32
+ var editorContext = useEditorContext();
33
+ var editorActions = useRef((_editorContext$editor = editorContext === null || editorContext === void 0 ? void 0 : editorContext.editorActions) !== null && _editorContext$editor !== void 0 ? _editorContext$editor : new EditorActions());
34
+ var startTime = useRef(performance.now());
35
+ var _useAnalyticsEvents = useAnalyticsEvents(),
36
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
37
+ var experienceStore = useRef();
38
+ var handleAnalyticsEvent = function handleAnalyticsEvent(data) {
39
+ return fireAnalyticsEvent(createAnalyticsEvent)(data);
40
+ };
41
+ useConstructor(function () {
50
42
  deprecationWarnings(props);
51
- _this.editorActions = (context || {}).editorActions || new EditorActions();
52
- _this.editorSessionId = uuid();
53
- _this.startTime = performance.now();
54
- _this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
55
- _this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
56
- _this.getExperienceStore = _this.getExperienceStore.bind(_assertThisInitialized(_this));
57
- trackEditorActions(_this.editorActions, props.performanceTracking, function (value) {
58
- return _this.handleAnalyticsEvent(value);
43
+ trackEditorActions(editorActions.current, props.performanceTracking, function (value) {
44
+ return handleAnalyticsEvent(value);
59
45
  });
60
- return _this;
61
- }
62
- _createClass(EditorNext, [{
63
- key: "onEditorCreated",
64
- value: function onEditorCreated(instance) {
65
- var _this2 = this;
66
- _onEditorCreated(instance, this.props, function (experienceStore) {
67
- return _this2.experienceStore = experienceStore;
68
- }, this.getExperienceStore, function () {
69
- return _this2.createAnalyticsEvent;
70
- }, this.editorActions, this.startTime, function (view, dispatcher, transformerForActions) {
71
- return _this2.registerEditorForActions(view, dispatcher, transformerForActions);
72
- });
73
- }
74
- }, {
75
- key: "onEditorDestroyed",
76
- value: function onEditorDestroyed(_instance) {
77
- var _this$props$onDestroy, _this$props2;
78
- this.unregisterEditorFromActions();
79
- (_this$props$onDestroy = (_this$props2 = this.props).onDestroy) === null || _this$props$onDestroy === void 0 ? void 0 : _this$props$onDestroy.call(_this$props2);
46
+ });
47
+ var getExperienceStore = function getExperienceStore() {
48
+ return experienceStore.current;
49
+ };
50
+ var onEditorCreated = function onEditorCreated(instance) {
51
+ var _props$featureFlags;
52
+ editorActions.current._privateRegisterEditor(instance.view, instance.eventDispatcher, instance.transformer, function () {
53
+ return createFeatureFlagsFromProps(props);
54
+ });
55
+ if ((_props$featureFlags = props.featureFlags) !== null && _props$featureFlags !== void 0 && _props$featureFlags.ufo) {
56
+ var _experienceStore$curr;
57
+ experienceStore.current = ExperienceStore.getInstance(instance.view);
58
+ (_experienceStore$curr = experienceStore.current) === null || _experienceStore$curr === void 0 ? void 0 : _experienceStore$curr.start(EditorExperience.loadEditor, startTime.current);
80
59
  }
81
- }, {
82
- key: "registerEditorForActions",
83
- value: function registerEditorForActions(editorView, eventDispatcher, contentTransformer) {
84
- this.editorActions._privateRegisterEditor(editorView, eventDispatcher, contentTransformer, this.getFeatureFlags);
60
+ if (props.onEditorReady) {
61
+ var _props$performanceTra, _props$performanceTra2, _props$featureFlags2;
62
+ var measureEditorReady = (props === null || props === void 0 ? void 0 : (_props$performanceTra = props.performanceTracking) === null || _props$performanceTra === void 0 ? void 0 : (_props$performanceTra2 = _props$performanceTra.onEditorReadyCallbackTracking) === null || _props$performanceTra2 === void 0 ? void 0 : _props$performanceTra2.enabled) || ((_props$featureFlags2 = props.featureFlags) === null || _props$featureFlags2 === void 0 ? void 0 : _props$featureFlags2.ufo);
63
+ measureEditorReady && startMeasure(measurements.ON_EDITOR_READY_CALLBACK);
64
+ props.onEditorReady(editorActions.current);
65
+ measureEditorReady && stopMeasure(measurements.ON_EDITOR_READY_CALLBACK, sendDurationAnalytics(ACTION.ON_EDITOR_READY_CALLBACK, props, getExperienceStore, createAnalyticsEvent));
85
66
  }
86
- }, {
87
- key: "unregisterEditorFromActions",
88
- value: function unregisterEditorFromActions() {
89
- this.editorActions._privateUnregisterEditor();
67
+ };
68
+ var onEditorDestroyed = function onEditorDestroyed(_instance) {
69
+ var _props$onDestroy;
70
+ editorActions.current._privateUnregisterEditor();
71
+ (_props$onDestroy = props.onDestroy) === null || _props$onDestroy === void 0 ? void 0 : _props$onDestroy.call(props);
72
+ };
73
+ return jsx(EditorInternal, {
74
+ props: props,
75
+ handleAnalyticsEvent: handleAnalyticsEvent,
76
+ createAnalyticsEvent: createAnalyticsEvent,
77
+ preset: props.preset,
78
+ handleSave: function handleSave(view) {
79
+ var _props$onSave;
80
+ return (_props$onSave = props.onSave) === null || _props$onSave === void 0 ? void 0 : _props$onSave.call(props, view);
81
+ },
82
+ editorActions: editorActions.current,
83
+ getExperienceStore: getExperienceStore,
84
+ onEditorCreated: onEditorCreated,
85
+ onEditorDestroyed: onEditorDestroyed
86
+ });
87
+ }
88
+ export default function EditorNext(props) {
89
+ var editorSessionId = useRef(uuid());
90
+ return jsx(FabricEditorAnalyticsContext, {
91
+ data: {
92
+ packageName: name,
93
+ packageVersion: version,
94
+ componentName: 'editorCore',
95
+ appearance: getAnalyticsAppearance(props.appearance),
96
+ editorSessionId: editorSessionId.current
90
97
  }
91
- }, {
92
- key: "render",
93
- value: function render() {
94
- var _this3 = this;
95
- return jsx(FabricEditorAnalyticsContext, {
96
- data: {
97
- packageName: name,
98
- packageVersion: version,
99
- componentName: 'editorCore',
100
- appearance: getAnalyticsAppearance(this.props.appearance),
101
- editorSessionId: this.editorSessionId
102
- }
103
- }, jsx(WithCreateAnalyticsEvent, {
104
- render: function render(createAnalyticsEvent) {
105
- return (_this3.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
106
- props: _this3.props,
107
- handleAnalyticsEvent: _this3.handleAnalyticsEvent,
108
- createAnalyticsEvent: _this3.createAnalyticsEvent,
109
- preset: _this3.props.preset,
110
- handleSave: _this3.handleSave,
111
- editorActions: _this3.editorActions,
112
- getExperienceStore: _this3.getExperienceStore,
113
- onEditorCreated: _this3.onEditorCreated,
114
- onEditorDestroyed: _this3.onEditorDestroyed
115
- });
116
- }
117
- }));
98
+ }, jsx(Editor, props));
99
+ }
100
+ EditorNext.propTypes = {
101
+ minHeight: function minHeight(_ref) {
102
+ var appearance = _ref.appearance,
103
+ _minHeight = _ref.minHeight;
104
+ if (_minHeight && appearance && !['comment', 'chromeless'].includes(appearance)) {
105
+ return new Error('minHeight only supports editor appearance chromeless and comment for Editor');
118
106
  }
119
- }]);
120
- return EditorNext;
121
- }(React.Component);
122
- _defineProperty(EditorNext, "defaultProps", {
123
- appearance: 'comment',
124
- disabled: false,
125
- quickInsert: true
126
- });
127
- _defineProperty(EditorNext, "contextTypes", {
128
- editorActions: PropTypes.object
129
- });
130
- _defineProperty(EditorNext, "propTypes", _objectSpread(_objectSpread({}, propTypes('minHeight only supports editor appearance chromeless and comment for EditorNext')), {}, {
131
- preset: function preset(_ref) {
132
- var _preset = _ref.preset;
107
+ return null;
108
+ },
109
+ preset: function preset(_ref2) {
110
+ var _preset = _ref2.preset;
133
111
  if (!_preset.has(basePlugin)) {
134
112
  return new Error('Presets must contain the base plugin');
135
113
  }
136
114
  return null;
137
115
  }
138
- }));
139
- export { EditorNext as default };
116
+ };
@@ -10,7 +10,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
10
10
  /** @jsx jsx */
11
11
  import React from 'react';
12
12
  import { jsx } from '@emotion/react';
13
- import { defaultProps } from './editor-next/utils/editorPropTypes';
14
13
  import EditorNext from './editor-next';
15
14
  import useUniversalPreset from './labs/next/presets/useUniversalPreset';
16
15
  var EditorNextWrapper = function EditorNextWrapper(_ref) {
@@ -39,5 +38,12 @@ var Editor = /*#__PURE__*/function (_React$Component) {
39
38
  }]);
40
39
  return Editor;
41
40
  }(React.Component);
42
- _defineProperty(Editor, "defaultProps", defaultProps);
41
+ _defineProperty(Editor, "defaultProps", {
42
+ appearance: 'comment',
43
+ disabled: false,
44
+ extensionHandlers: {},
45
+ allowHelpDialog: true,
46
+ allowNewInsertionBehaviour: true,
47
+ quickInsert: true
48
+ });
43
49
  export { Editor as default };
@@ -34,7 +34,7 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
34
34
  _createClass(CollapsedEditor, [{
35
35
  key: "componentDidUpdate",
36
36
  value: function componentDidUpdate() {
37
- if (this.props.isExpanded && this.editorComponent && (!this.previouslyExpanded || this.previouslyExpanded === undefined)) {
37
+ if (this.props.isExpanded && (this.editorComponent || this.functionalEditor) && (!this.previouslyExpanded || this.previouslyExpanded === undefined)) {
38
38
  var _this$props$onExpand, _this$props;
39
39
  (_this$props$onExpand = (_this$props = this.props).onExpand) === null || _this$props$onExpand === void 0 ? void 0 : _this$props$onExpand.call(_this$props);
40
40
  }
@@ -48,12 +48,18 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
48
48
  if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext) {
49
49
  throw new Error('Expected child to be of type `Editor`');
50
50
  }
51
+ this.functionalEditor = child.type === EditorNext;
51
52
  if (!this.props.isExpanded) {
52
53
  return /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(ChromeCollapsed, {
53
54
  onFocus: this.props.onFocus,
54
55
  text: this.props.placeholder
55
56
  }));
56
57
  }
58
+
59
+ // Let's avoid ref logic for functional Editor
60
+ if (this.functionalEditor) {
61
+ return child;
62
+ }
57
63
  return /*#__PURE__*/React.cloneElement(child, {
58
64
  ref: function ref(editorComponent) {
59
65
  return _this2.handleEditorRef(editorComponent, child.ref);
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.4.11";
2
+ export var version = "187.5.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.4.11",
3
+ "version": "187.5.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,14 +1,14 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { EditorView } from 'prosemirror-view';
3
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
- import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
- import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
6
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
+ import type { EditorView } from 'prosemirror-view';
3
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
+ import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
6
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
7
  import type { AllEditorPresetPluginTypes, Transformer } from '@atlaskit/editor-common/types';
8
- import { ExperienceStore } from '@atlaskit/editor-common/ufo';
9
- import EditorActions from '../actions';
10
- import { EventDispatcher } from '../event-dispatcher';
11
- import { EditorNextProps, EditorProps } from '../types/editor-props';
8
+ import type { ExperienceStore } from '@atlaskit/editor-common/ufo';
9
+ import type EditorActions from '../actions';
10
+ import type { EventDispatcher } from '../event-dispatcher';
11
+ import type { EditorNextProps, EditorProps } from '../types/editor-props';
12
12
  interface Props<PropsType> {
13
13
  props: PropsType;
14
14
  handleAnalyticsEvent: FireAnalyticsCallback;
@@ -1,35 +1,11 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
1
  import { jsx } from '@emotion/react';
4
- import PropTypes from 'prop-types';
5
- import { EditorNextProps } from '../types/editor-props';
6
- import { Context } from './utils/editorPropTypes';
7
- export default class EditorNext extends React.Component<EditorNextProps> {
8
- static defaultProps: {
9
- appearance: string;
10
- disabled: boolean;
11
- quickInsert: boolean;
2
+ import type { EditorNextProps } from '../types/editor-props';
3
+ export declare function Editor(passedProps: EditorNextProps): jsx.JSX.Element;
4
+ declare function EditorNext(props: EditorNextProps): jsx.JSX.Element;
5
+ declare namespace EditorNext {
6
+ var propTypes: {
7
+ minHeight: ({ appearance, minHeight, }: Pick<EditorNextProps, "appearance" | "minHeight">) => Error | null;
8
+ preset: ({ preset }: Pick<EditorNextProps, "preset">) => Error | null;
12
9
  };
13
- static contextTypes: {
14
- editorActions: PropTypes.Requireable<object>;
15
- };
16
- static propTypes: {
17
- preset: ({ preset }: Pick<EditorNextProps, 'preset'>) => Error | null;
18
- minHeight: ({ appearance, minHeight, }: Pick<import("../types/editor-props").EditorProps, "appearance" | "minHeight">) => Error | null;
19
- };
20
- private editorActions;
21
- private createAnalyticsEvent?;
22
- private editorSessionId;
23
- private experienceStore?;
24
- private startTime?;
25
- constructor(props: EditorNextProps, context: Context);
26
- private onEditorCreated;
27
- private onEditorDestroyed;
28
- private handleSave;
29
- private handleAnalyticsEvent;
30
- private registerEditorForActions;
31
- private getFeatureFlags;
32
- private unregisterEditorFromActions;
33
- private getExperienceStore;
34
- render(): jsx.JSX.Element;
35
10
  }
11
+ export default EditorNext;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { EditorProps } from './types/editor-props';
4
+ import type { EditorProps } from './types/editor-props';
5
5
  export type { AllowedBlockTypes, Command, CommandDispatch, DomAtPos, EditorAppearance, EditorAppearanceComponentProps, EditorConfig, EditorInstance, EditorPlugin, EditorProps, ExtensionConfig, ExtensionProvidersProp, FeedbackInfo, MarkConfig, MessageDescriptor, NodeConfig, NodeViewConfig, PluginsOptions, PMPlugin, PMPluginCreateConfig, PMPluginFactory, PMPluginFactoryParams, ReactComponents, ToolbarUIComponentFactory, ToolbarUiComponentFactoryParams, UIComponentFactory, UiComponentFactoryParams, } from './types';
6
6
  export default class Editor extends React.Component<EditorProps> {
7
7
  static defaultProps: EditorProps;
@@ -1,39 +1,39 @@
1
- import { ReactElement, RefObject } from 'react';
2
- import { Node, Schema } from 'prosemirror-model';
3
- import { EditorView } from 'prosemirror-view';
4
- import { ActivityProvider } from '@atlaskit/activity-provider';
5
- import { CardOptions } from '@atlaskit/editor-common/card';
1
+ import type { ReactElement, RefObject } from 'react';
2
+ import type { Node, Schema } from 'prosemirror-model';
3
+ import type { EditorView } from 'prosemirror-view';
4
+ import type { ActivityProvider } from '@atlaskit/activity-provider';
5
+ import type { CardOptions } from '@atlaskit/editor-common/card';
6
6
  import type { ExtensionHandlers, ExtensionProvider } from '@atlaskit/editor-common/extensions';
7
- import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
7
+ import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
8
8
  import type { ContextIdentifierProvider, Providers, SearchProvider } from '@atlaskit/editor-common/provider-factory';
9
9
  import type { AllEditorPresetPluginTypes, Transformer } from '@atlaskit/editor-common/types';
10
10
  import type { LinkingOptions } from '@atlaskit/editor-common/types';
11
11
  import type { ErrorReportingHandler } from '@atlaskit/editor-common/utils';
12
- import { PluginConfig as TablesPluginConfig } from '@atlaskit/editor-plugin-table/types';
13
- import { MentionProvider } from '@atlaskit/mention/resource';
14
- import { TaskDecisionProvider } from '@atlaskit/task-decision';
15
- import EditorActions from '../actions';
16
- import { AnnotationProviders } from '../plugins/annotation/types';
17
- import { BlockTypePluginOptions } from '../plugins/block-type/types';
18
- import { CodeBlockOptions } from '../plugins/code-block/types';
19
- import { CollabEditOptions } from '../plugins/collab-edit/types';
20
- import { DatePluginConfig } from '../plugins/date/types';
21
- import { FindReplaceOptions } from '../plugins/find-replace/types';
22
- import { LayoutPluginOptions } from '../plugins/layout/types';
23
- import { MediaOptions, MediaState } from '../plugins/media/types';
24
- import { MentionPluginConfig } from '../plugins/mentions/types';
25
- import { PanelPluginConfig } from '../plugins/panel/types';
26
- import { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
27
- import { QuickInsertOptions } from '../plugins/quick-insert/types';
28
- import { TextColorPluginConfig } from '../plugins/text-color/pm-plugins/main';
29
- import { TextFormattingOptions } from '../plugins/text-formatting/types';
30
- import { MenuItem } from '../ui/DropdownMenu/types';
31
- import { EditorAppearance } from './editor-appearance';
32
- import { EditorOnChangeHandler } from './editor-onchange';
33
- import { EditorPlugin } from './editor-plugin';
34
- import { EmptyStateHandler } from './empty-state-handler';
35
- import { ExtensionConfig } from './extension-config';
36
- import { PerformanceTracking } from './performance-tracking';
12
+ import type { PluginConfig as TablesPluginConfig } from '@atlaskit/editor-plugin-table/types';
13
+ import type { MentionProvider } from '@atlaskit/mention/resource';
14
+ import type { TaskDecisionProvider } from '@atlaskit/task-decision';
15
+ import type EditorActions from '../actions';
16
+ import type { AnnotationProviders } from '../plugins/annotation/types';
17
+ import type { BlockTypePluginOptions } from '../plugins/block-type/types';
18
+ import type { CodeBlockOptions } from '../plugins/code-block/types';
19
+ import type { CollabEditOptions } from '../plugins/collab-edit/types';
20
+ import type { DatePluginConfig } from '../plugins/date/types';
21
+ import type { FindReplaceOptions } from '../plugins/find-replace/types';
22
+ import type { LayoutPluginOptions } from '../plugins/layout/types';
23
+ import type { MediaOptions, MediaState } from '../plugins/media/types';
24
+ import type { MentionPluginConfig } from '../plugins/mentions/types';
25
+ import type { PanelPluginConfig } from '../plugins/panel/types';
26
+ import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
27
+ import type { QuickInsertOptions } from '../plugins/quick-insert/types';
28
+ import type { TextColorPluginConfig } from '../plugins/text-color/pm-plugins/main';
29
+ import type { TextFormattingOptions } from '../plugins/text-formatting/types';
30
+ import type { MenuItem } from '../ui/DropdownMenu/types';
31
+ import type { EditorAppearance } from './editor-appearance';
32
+ import type { EditorOnChangeHandler } from './editor-onchange';
33
+ import type { EditorPlugin } from './editor-plugin';
34
+ import type { EmptyStateHandler } from './empty-state-handler';
35
+ import type { ExtensionConfig } from './extension-config';
36
+ import type { PerformanceTracking } from './performance-tracking';
37
37
  export type ReactComponents = ReactElement<any> | ReactElement<any>[];
38
38
  type ExtensionProviders = (ExtensionProvider | Promise<ExtensionProvider>)[];
39
39
  type ExtensionProvidersWithEditorAction = (editorActions?: EditorActions) => ExtensionProviders;
@@ -153,7 +153,6 @@ export interface EditorSharedPropsWithPlugins {
153
153
  insertMenuItems?: MenuItem[];
154
154
  primaryToolbarComponents?: PrimaryToolbarComponents;
155
155
  allowUndoRedoButtons?: boolean;
156
- allowTextColor?: boolean | TextColorPluginConfig;
157
156
  allowTables?: boolean | TablesPluginConfig;
158
157
  /** @deprecated Use smartLinks instead. */
159
158
  UNSAFE_cards?: CardOptions;
@@ -256,5 +255,6 @@ export interface EditorPluginFeatureProps {
256
255
  uploadErrorHandler?: (state: MediaState) => void;
257
256
  waitForMediaUpload?: boolean;
258
257
  extensionHandlers?: ExtensionHandlers;
258
+ allowTextColor?: boolean | TextColorPluginConfig;
259
259
  }
260
260
  export {};
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import Editor from '../../editor';
3
- import EditorNext from '../../editor-next';
4
3
  export interface Props {
5
4
  placeholder?: string;
6
5
  children?: any;
@@ -11,9 +10,10 @@ export interface Props {
11
10
  export interface State {
12
11
  }
13
12
  export default class CollapsedEditor extends React.Component<Props, State> {
14
- editorComponent?: Editor | EditorNext;
13
+ editorComponent?: Editor;
15
14
  previouslyExpanded?: boolean;
15
+ functionalEditor?: boolean;
16
16
  componentDidUpdate(): void;
17
17
  handleEditorRef: (editorRef?: Editor, editorRefCallback?: any) => void;
18
- render(): JSX.Element;
18
+ render(): any;
19
19
  }
@@ -1,14 +1,14 @@
1
1
  import { jsx } from '@emotion/react';
2
- import { EditorView } from 'prosemirror-view';
3
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
- import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
- import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
6
- import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
2
+ import type { EditorView } from 'prosemirror-view';
3
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
5
+ import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
6
+ import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
7
7
  import type { AllEditorPresetPluginTypes, Transformer } from '@atlaskit/editor-common/types';
8
- import { ExperienceStore } from '@atlaskit/editor-common/ufo';
9
- import EditorActions from '../actions';
10
- import { EventDispatcher } from '../event-dispatcher';
11
- import { EditorNextProps, EditorProps } from '../types/editor-props';
8
+ import type { ExperienceStore } from '@atlaskit/editor-common/ufo';
9
+ import type EditorActions from '../actions';
10
+ import type { EventDispatcher } from '../event-dispatcher';
11
+ import type { EditorNextProps, EditorProps } from '../types/editor-props';
12
12
  interface Props<PropsType> {
13
13
  props: PropsType;
14
14
  handleAnalyticsEvent: FireAnalyticsCallback;
@@ -1,35 +1,11 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
1
  import { jsx } from '@emotion/react';
4
- import PropTypes from 'prop-types';
5
- import { EditorNextProps } from '../types/editor-props';
6
- import { Context } from './utils/editorPropTypes';
7
- export default class EditorNext extends React.Component<EditorNextProps> {
8
- static defaultProps: {
9
- appearance: string;
10
- disabled: boolean;
11
- quickInsert: boolean;
2
+ import type { EditorNextProps } from '../types/editor-props';
3
+ export declare function Editor(passedProps: EditorNextProps): jsx.JSX.Element;
4
+ declare function EditorNext(props: EditorNextProps): jsx.JSX.Element;
5
+ declare namespace EditorNext {
6
+ var propTypes: {
7
+ minHeight: ({ appearance, minHeight, }: Pick<EditorNextProps, "appearance" | "minHeight">) => Error | null;
8
+ preset: ({ preset }: Pick<EditorNextProps, "preset">) => Error | null;
12
9
  };
13
- static contextTypes: {
14
- editorActions: PropTypes.Requireable<object>;
15
- };
16
- static propTypes: {
17
- preset: ({ preset }: Pick<EditorNextProps, 'preset'>) => Error | null;
18
- minHeight: ({ appearance, minHeight, }: Pick<import("../types/editor-props").EditorProps, "appearance" | "minHeight">) => Error | null;
19
- };
20
- private editorActions;
21
- private createAnalyticsEvent?;
22
- private editorSessionId;
23
- private experienceStore?;
24
- private startTime?;
25
- constructor(props: EditorNextProps, context: Context);
26
- private onEditorCreated;
27
- private onEditorDestroyed;
28
- private handleSave;
29
- private handleAnalyticsEvent;
30
- private registerEditorForActions;
31
- private getFeatureFlags;
32
- private unregisterEditorFromActions;
33
- private getExperienceStore;
34
- render(): jsx.JSX.Element;
35
10
  }
11
+ export default EditorNext;
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
- import { EditorProps } from './types/editor-props';
4
+ import type { EditorProps } from './types/editor-props';
5
5
  export type { AllowedBlockTypes, Command, CommandDispatch, DomAtPos, EditorAppearance, EditorAppearanceComponentProps, EditorConfig, EditorInstance, EditorPlugin, EditorProps, ExtensionConfig, ExtensionProvidersProp, FeedbackInfo, MarkConfig, MessageDescriptor, NodeConfig, NodeViewConfig, PluginsOptions, PMPlugin, PMPluginCreateConfig, PMPluginFactory, PMPluginFactoryParams, ReactComponents, ToolbarUIComponentFactory, ToolbarUiComponentFactoryParams, UIComponentFactory, UiComponentFactoryParams, } from './types';
6
6
  export default class Editor extends React.Component<EditorProps> {
7
7
  static defaultProps: EditorProps;