@atlaskit/editor-core 195.6.0 → 195.6.2

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 (106) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +21 -0
  3. package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +1 -1
  4. package/codemods/migrates/remove-config-panel-width-prop.ts +1 -1
  5. package/codemods/migrates/rename-editor-to-editor-migration-component.ts +1 -1
  6. package/codemods/migrates/rename-smartlinks-prop.ts +1 -1
  7. package/codemods/utils.ts +11 -4
  8. package/dist/cjs/CollapsedEditor/index.js +1 -0
  9. package/dist/cjs/actions/index.js +6 -1
  10. package/dist/cjs/composable-editor/editor-internal.js +6 -2
  11. package/dist/cjs/create-editor/ReactEditorView.js +3 -10
  12. package/dist/cjs/create-editor/create-editor.js +0 -1
  13. package/dist/cjs/create-editor/create-plugins-list.js +3 -1
  14. package/dist/cjs/create-editor/create-universal-preset.js +3 -1
  15. package/dist/cjs/presets/context.js +3 -0
  16. package/dist/cjs/test-utils.js +3 -1
  17. package/dist/cjs/ui/ContextPanel/index.js +2 -0
  18. package/dist/cjs/ui/Toolbar/ToolbarInner.js +3 -4
  19. package/dist/cjs/ui/ToolbarFeedback/index.js +1 -0
  20. package/dist/cjs/ui/WithHelpTrigger/index.js +2 -0
  21. package/dist/cjs/use-preset.js +2 -0
  22. package/dist/cjs/utils/action.js +1 -0
  23. package/dist/cjs/utils/deprecation-warnings.js +2 -2
  24. package/dist/cjs/utils/performance/instrumented-plugin.js +2 -0
  25. package/dist/cjs/version-wrapper.js +1 -1
  26. package/dist/es2019/CollapsedEditor/index.js +3 -0
  27. package/dist/es2019/actions/index.js +6 -1
  28. package/dist/es2019/composable-editor/editor-internal.js +6 -2
  29. package/dist/es2019/create-editor/ReactEditorView.js +3 -6
  30. package/dist/es2019/create-editor/create-editor.js +0 -1
  31. package/dist/es2019/create-editor/create-plugins-list.js +3 -1
  32. package/dist/es2019/create-editor/create-universal-preset.js +3 -1
  33. package/dist/es2019/presets/context.js +4 -0
  34. package/dist/es2019/test-utils.js +3 -1
  35. package/dist/es2019/ui/Appearance/Mobile.js +1 -0
  36. package/dist/es2019/ui/ContextPanel/index.js +2 -0
  37. package/dist/es2019/ui/Toolbar/ToolbarInner.js +3 -4
  38. package/dist/es2019/ui/ToolbarFeedback/index.js +1 -0
  39. package/dist/es2019/ui/WithHelpTrigger/index.js +2 -0
  40. package/dist/es2019/use-preset.js +3 -0
  41. package/dist/es2019/utils/action.js +1 -0
  42. package/dist/es2019/utils/deprecation-warnings.js +2 -2
  43. package/dist/es2019/utils/performance/instrumented-plugin.js +2 -0
  44. package/dist/es2019/version-wrapper.js +1 -1
  45. package/dist/esm/CollapsedEditor/index.js +2 -0
  46. package/dist/esm/actions/index.js +6 -1
  47. package/dist/esm/composable-editor/editor-internal.js +6 -2
  48. package/dist/esm/create-editor/ReactEditorView.js +3 -10
  49. package/dist/esm/create-editor/create-editor.js +0 -1
  50. package/dist/esm/create-editor/create-plugins-list.js +3 -1
  51. package/dist/esm/create-editor/create-universal-preset.js +3 -1
  52. package/dist/esm/presets/context.js +4 -0
  53. package/dist/esm/test-utils.js +3 -1
  54. package/dist/esm/ui/ContextPanel/index.js +2 -0
  55. package/dist/esm/ui/Toolbar/ToolbarInner.js +3 -4
  56. package/dist/esm/ui/ToolbarFeedback/index.js +1 -0
  57. package/dist/esm/ui/WithHelpTrigger/index.js +2 -0
  58. package/dist/esm/use-preset.js +3 -0
  59. package/dist/esm/utils/action.js +1 -0
  60. package/dist/esm/utils/deprecation-warnings.js +2 -2
  61. package/dist/esm/utils/performance/instrumented-plugin.js +2 -0
  62. package/dist/esm/version-wrapper.js +1 -1
  63. package/dist/types/CollapsedEditor/index.d.ts +7 -7
  64. package/dist/types/EditorWithActions/index.d.ts +1 -6
  65. package/dist/types/create-editor/ReactEditorView.d.ts +3 -5
  66. package/dist/types/create-editor/get-plugins.d.ts +4 -4
  67. package/dist/types/types/editor-props.d.ts +1 -1
  68. package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +6 -1
  69. package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -1
  70. package/dist/types/ui/Addon/Dropdown/index.d.ts +1 -1
  71. package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
  72. package/dist/types/ui/Addon/types.d.ts +3 -3
  73. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -1
  74. package/dist/types/ui/Appearance/FullPage/BeforeWrapper.d.ts +1 -1
  75. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  76. package/dist/types/ui/CollapsedEditor/index.d.ts +2 -2
  77. package/dist/types/ui/ContentStyles/index.d.ts +2 -1
  78. package/dist/types/ui/PluginSlot/index.d.ts +1 -1
  79. package/dist/types/ui/WithEditorActions/index.d.ts +2 -2
  80. package/dist/types/ui/WithFlash/index.d.ts +1 -1
  81. package/dist/types/ui/WithHelpTrigger/index.d.ts +1 -1
  82. package/dist/types/use-preset.d.ts +2 -1
  83. package/dist/types/utils/deprecation-warnings.d.ts +3 -3
  84. package/dist/types-ts4.5/CollapsedEditor/index.d.ts +7 -7
  85. package/dist/types-ts4.5/EditorWithActions/index.d.ts +1 -6
  86. package/dist/types-ts4.5/create-editor/ReactEditorView.d.ts +3 -5
  87. package/dist/types-ts4.5/create-editor/get-plugins.d.ts +4 -4
  88. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  89. package/dist/types-ts4.5/ui/Addon/ClickAreaBlock/index.d.ts +6 -1
  90. package/dist/types-ts4.5/ui/Addon/ClickAreaMobile/index.d.ts +1 -1
  91. package/dist/types-ts4.5/ui/Addon/Dropdown/index.d.ts +1 -1
  92. package/dist/types-ts4.5/ui/Addon/click-area-helper.d.ts +1 -1
  93. package/dist/types-ts4.5/ui/Addon/types.d.ts +3 -3
  94. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +1 -1
  95. package/dist/types-ts4.5/ui/Appearance/FullPage/BeforeWrapper.d.ts +1 -1
  96. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  97. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +2 -2
  98. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -1
  99. package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
  100. package/dist/types-ts4.5/ui/WithEditorActions/index.d.ts +2 -2
  101. package/dist/types-ts4.5/ui/WithFlash/index.d.ts +1 -1
  102. package/dist/types-ts4.5/ui/WithHelpTrigger/index.d.ts +1 -1
  103. package/dist/types-ts4.5/use-preset.d.ts +2 -1
  104. package/dist/types-ts4.5/utils/deprecation-warnings.d.ts +3 -3
  105. package/docs/4-annotations.tsx +1 -0
  106. package/package.json +9 -13
package/.eslintrc.js CHANGED
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  rules: {
3
+ '@typescript-eslint/no-explicit-any': 'error',
3
4
  '@atlaskit/design-system/ensure-design-token-usage/preview': [
4
5
  'error',
5
6
  { domains: ['spacing'], shouldEnforceFallbacks: false },
@@ -33,6 +34,7 @@ module.exports = {
33
34
  ],
34
35
  rules: {
35
36
  'import/no-restricted-paths': ['off'],
37
+ '@typescript-eslint/no-explicit-any': ['off'],
36
38
  },
37
39
  },
38
40
  ],
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 195.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131378](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131378)
8
+ [`04848ee5982e0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/04848ee5982e0) -
9
+ Remove `reactContext` from `PMPluginFactoryParams` type. This was an unused property and so
10
+ shouldn't have any upgrade friction.
11
+ - [#131548](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131548)
12
+ [`1b9034d028442`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1b9034d028442) -
13
+ [ux] Fix extension label button text size and update VR tests
14
+ - Updated dependencies
15
+
16
+ ## 195.6.1
17
+
18
+ ### Patch Changes
19
+
20
+ - [#131374](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131374)
21
+ [`9ef24a0e887b2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ef24a0e887b2) -
22
+ Fix type definitions for `any` type in editor-core.
23
+
3
24
  ## 195.6.0
4
25
 
5
26
  ### Minor Changes
@@ -8,7 +8,7 @@ import { findImportFromPackage } from '../utils';
8
8
  * Ref: ED-15849
9
9
  */
10
10
  const createRemoveAllowMoreTextColorsPropTransform = (pkg: string, component: string) => {
11
- return (j: core.JSCodeshift, source: Collection<any>) => {
11
+ return (j: core.JSCodeshift, source: Collection<unknown>) => {
12
12
  // Find regular or renamed imports
13
13
  // of <Editor/> component from '@atlaskit/editor-core' package
14
14
  const importedNames: string[] = findImportFromPackage(
@@ -4,7 +4,7 @@ import type { Collection } from 'jscodeshift/src/Collection';
4
4
  import { findImportFromPackage } from '../utils';
5
5
 
6
6
  const createRemoveComponentPropTransform = (pkg: string, component: string, propName: string) => {
7
- return (j: core.JSCodeshift, source: Collection<any>) => {
7
+ return (j: core.JSCodeshift, source: Collection<unknown>) => {
8
8
  // Find regular or renamed imports
9
9
  const importedNames: string[] = findImportFromPackage(j, source, pkg, component);
10
10
 
@@ -7,7 +7,7 @@ import type { Collection } from 'jscodeshift/src/Collection';
7
7
  * Ref: ED-16826
8
8
  */
9
9
  export const createUpdateEditorToMigrationComponent = (pkg: string, component: string) => {
10
- return (j: core.JSCodeshift, source: Collection<any>) => {
10
+ return (j: core.JSCodeshift, source: Collection<unknown>) => {
11
11
  source
12
12
  .find(j.ImportDeclaration, { source: { value: pkg } })
13
13
  .filter(
@@ -14,7 +14,7 @@ export const createJSXRenameVariableToNestedKeyTransform = (
14
14
  toObjectName: string,
15
15
  toObjectKey: string,
16
16
  ) => {
17
- return (j: core.JSCodeshift, source: Collection<any>) => {
17
+ return (j: core.JSCodeshift, source: Collection<unknown>) => {
18
18
  source
19
19
  .find(j.JSXAttribute, { name: { type: 'JSXIdentifier', name: from } })
20
20
  .forEach((fromAttribute) => {
package/codemods/utils.ts CHANGED
@@ -8,7 +8,11 @@ import type {
8
8
  } from 'jscodeshift';
9
9
  import type { Collection } from 'jscodeshift/src/Collection';
10
10
 
11
- function hasImportDeclaration(j: core.JSCodeshift, source: Collection<any>, importPath: string) {
11
+ function hasImportDeclaration(
12
+ j: core.JSCodeshift,
13
+ source: Collection<unknown>,
14
+ importPath: string,
15
+ ) {
12
16
  const imports = source
13
17
  .find(j.ImportDeclaration)
14
18
  .filter((path: ASTPath<ImportDeclaration>) => path.node.source.value === importPath);
@@ -17,7 +21,10 @@ function hasImportDeclaration(j: core.JSCodeshift, source: Collection<any>, impo
17
21
  }
18
22
 
19
23
  export const createTransformer =
20
- (packageName: string, migrations: { (j: core.JSCodeshift, source: Collection<any>): void }[]) =>
24
+ (
25
+ packageName: string,
26
+ migrations: { (j: core.JSCodeshift, source: Collection<unknown>): void }[],
27
+ ) =>
21
28
  (fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => {
22
29
  const source = j(fileInfo.source);
23
30
 
@@ -42,7 +49,7 @@ export const createTransformer =
42
49
  */
43
50
  export const findImportFromPackage = (
44
51
  j: core.JSCodeshift,
45
- source: Collection<any>,
52
+ source: Collection<unknown>,
46
53
  pkg: string,
47
54
  importName: string,
48
55
  ): string[] => {
@@ -89,7 +96,7 @@ export const findImportFromPackage = (
89
96
  * @param toName String
90
97
  */
91
98
  export const createRenameVariableTransform = (from: string, toName: string) => {
92
- return (j: core.JSCodeshift, source: Collection<any>) => {
99
+ return (j: core.JSCodeshift, source: Collection<unknown>) => {
93
100
  source.find(j.Identifier, { name: from }).forEach((x) => {
94
101
  x.replace(j.identifier(toName));
95
102
  });
@@ -21,6 +21,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
25
  var CollapsedEditor = exports.default = /*#__PURE__*/function (_React$Component) {
25
26
  (0, _inherits2.default)(CollapsedEditor, _React$Component);
26
27
  var _super = _createSuper(CollapsedEditor);
@@ -25,9 +25,12 @@ var _nodesByLocalIds = require("../utils/nodes-by-localIds");
25
25
  var fakePluginKey = {
26
26
  key: 'nativeCollabProviderPlugin$',
27
27
  getState: function getState(state) {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
29
  return state['nativeCollabProviderPlugin$'];
29
30
  }
30
31
  };
32
+
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
34
  var EditorActions = exports.default = /*#__PURE__*/function () {
32
35
  function EditorActions() {
33
36
  var _this = this;
@@ -327,7 +330,9 @@ var EditorActions = exports.default = /*#__PURE__*/function () {
327
330
  }
328
331
  }, {
329
332
  key: "replaceDocument",
330
- value: function replaceDocument(rawValue) {
333
+ value: function replaceDocument(
334
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
335
+ rawValue) {
331
336
  var shouldScrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
332
337
  var shouldAddToHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
333
338
  (0, _deprecationWarnings.default)('EditorActions.replaceDocument', {
@@ -44,7 +44,9 @@ var EditorInternal = exports.EditorInternal = /*#__PURE__*/(0, _react.memo)(func
44
44
  onEditorDestroyed = _ref.onEditorDestroyed,
45
45
  preset = _ref.preset;
46
46
  var Component = (0, _createEditor.getUiComponent)(props.appearance);
47
- var setEditorApi = (0, _react.useCallback)(function (api) {
47
+ var setEditorApi = (0, _react.useCallback)(
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ function (api) {
48
50
  // This is an workaround to unblock Editor Lego Decoupling project, if you have questions ping us #cc-editor-lego
49
51
  // We may clean up this code when EditorActions deprecation process starts
50
52
  // @ts-expect-error 2339: Property '__EDITOR_INTERNALS_DO_NOT_USE__API' does not exist on type 'EditorActions<any>'.
@@ -157,7 +159,9 @@ function ReactEditorViewContextWrapper(props) {
157
159
  * so we should also set the value for the `EditorContext` that is used in
158
160
  * `EditorInternal`.
159
161
  */
160
- var setEditorAPI = (0, _react.useCallback)(function (api) {
162
+ var setEditorAPI = (0, _react.useCallback)(
163
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
+ function (api) {
161
165
  setInternalEditorAPI === null || setInternalEditorAPI === void 0 || setInternalEditorAPI(api);
162
166
  setExternalEditorAPI === null || setExternalEditorAPI === void 0 || setExternalEditorAPI(api);
163
167
  }, [setInternalEditorAPI, setExternalEditorAPI]);
@@ -86,11 +86,11 @@ function handleEditorFocus(view) {
86
86
  var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Component) {
87
87
  (0, _inherits2.default)(ReactEditorView, _React$Component);
88
88
  var _super = _createSuper(ReactEditorView);
89
- function ReactEditorView(props, context) {
89
+ function ReactEditorView(props) {
90
90
  var _props$setEditorApi, _props$editorProps;
91
91
  var _this;
92
92
  (0, _classCallCheck2.default)(this, ReactEditorView);
93
- _this = _super.call(this, props, context);
93
+ _this = _super.call(this, props);
94
94
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "editorRef", /*#__PURE__*/_react.default.createRef());
95
95
  // ProseMirror is instantiated prior to the initial React render cycle,
96
96
  // so we allow transactions by default, to avoid discarding the initial one.
@@ -135,7 +135,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
135
135
  _this.featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(_this.props.editorProps);
136
136
  _this.editorState = _this.createEditorState({
137
137
  props: _this.props,
138
- context: _this.context,
139
138
  doc: doc,
140
139
  resetting: true,
141
140
  selectionAtStart: !shouldScrollToBottom
@@ -201,9 +200,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
201
200
  eventDispatcher: _this.eventDispatcher,
202
201
  providerFactory: options.props.providerFactory,
203
202
  portalProviderAPI: _this.props.portalProviderAPI,
204
- reactContext: function reactContext() {
205
- return options.context;
206
- },
207
203
  dispatchAnalyticsEvent: _this.dispatchAnalyticsEvent,
208
204
  performanceTracking: _this.props.editorProps.performanceTracking,
209
205
  transactionTracker: _this.transactionTracker,
@@ -582,7 +578,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
582
578
  _this.eventDispatcher.on('resetEditorState', _this.resetEditorState);
583
579
  _this.editorState = _this.createEditorState({
584
580
  props: props,
585
- context: context,
586
581
  doc: props.editorProps.defaultValue,
587
582
  // ED-4759: Don't set selection at end for full-page editor - should be at start.
588
583
  selectionAtStart: (0, _isFullPage.isFullPage)(props.editorProps.appearance)
@@ -616,6 +611,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
616
611
  }, {
617
612
  key: "getPluginNames",
618
613
  value: function getPluginNames() {
614
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
619
615
  return this.editorState.plugins.map(function (p) {
620
616
  return p.key;
621
617
  });
@@ -696,9 +692,6 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
696
692
  eventDispatcher: this.eventDispatcher,
697
693
  providerFactory: props.providerFactory,
698
694
  portalProviderAPI: props.portalProviderAPI,
699
- reactContext: function reactContext() {
700
- return _this2.context;
701
- },
702
695
  dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
703
696
  performanceTracking: props.editorProps.performanceTracking,
704
697
  transactionTracker: this.transactionTracker,
@@ -131,7 +131,6 @@ function createPMPlugins(config) {
131
131
  providerFactory: config.providerFactory,
132
132
  errorReporter: config.errorReporter,
133
133
  portalProviderAPI: config.portalProviderAPI,
134
- reactContext: config.reactContext,
135
134
  dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
136
135
  featureFlags: config.featureFlags || {},
137
136
  getIntl: config.getIntl
@@ -109,7 +109,9 @@ function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEvent
109
109
  * Note: The order that presets are added determines
110
110
  * their placement in the editor toolbar.
111
111
  */
112
- function createPluginsList(preset, props, pluginInjectionAPI) {
112
+ function createPluginsList(
113
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
+ preset, props, pluginInjectionAPI) {
113
115
  var excludes = new Set();
114
116
  if (!isCodeBlockAllowed({
115
117
  allowBlockType: props.allowBlockType
@@ -25,7 +25,9 @@ function createUniversalPreset(_ref) {
25
25
  return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
26
26
  }
27
27
  function withDangerouslyAppendPlugins(preset) {
28
- function createEditorNextPluginsFromDangerouslyAppended(plugins) {
28
+ function createEditorNextPluginsFromDangerouslyAppended(plugins
29
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
+ ) {
29
31
  return plugins ? plugins.map(function (plugin) {
30
32
  return function () {
31
33
  return plugin;
@@ -12,9 +12,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+
15
17
  var EditorAPIContext = exports.EditorAPIContext = /*#__PURE__*/_react.default.createContext({});
16
18
  var PresetContextProvider = exports.PresetContextProvider = function PresetContextProvider(_ref) {
17
19
  var children = _ref.children;
20
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
21
  var _useState = (0, _react.useState)(),
19
22
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
20
23
  editorApi = _useState2[0],
@@ -49,7 +49,9 @@ function lightProcessPluginsList(editorPlugins) {
49
49
  });
50
50
  }
51
51
  return acc;
52
- }, {});
52
+ },
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
+ {});
53
55
 
54
56
  /**
55
57
  * Process plugins
@@ -221,6 +221,7 @@ var SwappableContentArea = exports.SwappableContentArea = /*#__PURE__*/function
221
221
  var widthPluginKey = {
222
222
  key: 'widthPlugin$',
223
223
  getState: function getState(state) {
224
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
224
225
  return state['widthPlugin$'];
225
226
  }
226
227
  };
@@ -229,6 +230,7 @@ var widthPluginKey = {
229
230
  var contextPanelPluginKey = {
230
231
  key: 'contextPanelPluginKey$',
231
232
  getState: function getState(state) {
233
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
234
  return state['contextPanelPluginKey$'];
233
235
  }
234
236
  };
@@ -60,9 +60,6 @@ var ToolbarInner = exports.ToolbarInner = /*#__PURE__*/function (_React$Componen
60
60
  return (0, _react2.jsx)("div", {
61
61
  css: toolbarComponentsWrapper
62
62
  }, items.map(function (component, key) {
63
- var props = {
64
- key: key
65
- };
66
63
  var element = component({
67
64
  editorView: editorView,
68
65
  editorActions: editorActions,
@@ -80,7 +77,9 @@ var ToolbarInner = exports.ToolbarInner = /*#__PURE__*/function (_React$Componen
80
77
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
81
78
  wrapperElement: null
82
79
  });
83
- return element && /*#__PURE__*/_react.default.cloneElement(element, props);
80
+ return element && /*#__PURE__*/_react.default.cloneElement(element, {
81
+ key: key
82
+ });
84
83
  }));
85
84
  }
86
85
  }]);
@@ -206,6 +206,7 @@ var ToolbarFeedbackInternal = /*#__PURE__*/function (_PureComponent) {
206
206
  }]);
207
207
  return ToolbarFeedbackInternal;
208
208
  }(_react.PureComponent);
209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
209
210
  (0, _defineProperty2.default)(ToolbarFeedbackInternal, "contextTypes", {
210
211
  editorActions: _propTypes.default.object.isRequired
211
212
  });
@@ -33,6 +33,8 @@ var WithHelpTrigger = exports.default = /*#__PURE__*/function (_React$Component)
33
33
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openHelp", function () {
34
34
  var _ref = _this.context,
35
35
  editorActions = _ref.editorActions;
36
+
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
38
  var dispatch = (0, _eventDispatcher.createDispatch)(editorActions.eventDispatcher);
37
39
  dispatch(_utils.analyticsEventKey, {
38
40
  payload: {
@@ -8,6 +8,8 @@ exports.usePreset = usePreset;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _react = require("react");
10
10
  var _preset = require("@atlaskit/editor-common/preset");
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+
11
13
  /**
12
14
  * Creates a preset.
13
15
  *
@@ -14,6 +14,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  var mediaPluginKey = {
15
15
  key: 'mediaPlugin$',
16
16
  getState: function getState(state) {
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
18
  return state['mediaPlugin$'];
18
19
  }
19
20
  };
@@ -7,7 +7,7 @@ exports.default = void 0;
7
7
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
8
8
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
- var deprecationWarnings = function deprecationWarnings(className, props, deprecations) {
10
+ function deprecationWarnings(className, props, deprecations) {
11
11
  if (process.env.NODE_ENV === 'production') {
12
12
  return;
13
13
  }
@@ -37,5 +37,5 @@ var deprecationWarnings = function deprecationWarnings(className, props, depreca
37
37
  } finally {
38
38
  _iterator.f();
39
39
  }
40
- };
40
+ }
41
41
  var _default = exports.default = deprecationWarnings;
@@ -36,6 +36,7 @@ var InstrumentedPlugin = exports.InstrumentedPlugin = /*#__PURE__*/function (_Sa
36
36
  if (spec.state) {
37
37
  var originalApply = spec.state.apply.bind(spec.state);
38
38
  spec.state.apply = function (aTr, value, oldState, newState) {
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
40
  var self = (0, _assertThisInitialized2.default)(_this);
40
41
  var tr = new Proxy(aTr, (0, _saferTransactions.freezeUnsafeTransactionProperties)({
41
42
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
@@ -60,6 +61,7 @@ var InstrumentedPlugin = exports.InstrumentedPlugin = /*#__PURE__*/function (_Sa
60
61
  if (uiTracking.enabled && spec.view) {
61
62
  var originalView = spec.view.bind(spec);
62
63
  spec.view = function (editorView) {
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
65
  var self = (0, _assertThisInitialized2.default)(_this);
64
66
  var measure = "\uD83E\uDD89".concat(self.key, "::view::update");
65
67
  var view = originalView(editorView);
@@ -5,4 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "195.6.0";
8
+ var version = exports.version = "195.6.2";
@@ -1,6 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import ChromeCollapsed from '../ui/ChromeCollapsed';
4
+
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+
4
7
  export default class CollapsedEditor extends React.Component {
5
8
  constructor(...args) {
6
9
  super(...args);
@@ -15,9 +15,12 @@ import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
15
15
  const fakePluginKey = {
16
16
  key: 'nativeCollabProviderPlugin$',
17
17
  getState: state => {
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  return state['nativeCollabProviderPlugin$'];
19
20
  }
20
21
  };
22
+
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
24
  export default class EditorActions {
22
25
  constructor() {
23
26
  _defineProperty(this, "listeners", []);
@@ -223,7 +226,9 @@ export default class EditorActions {
223
226
  }
224
227
  return isEmptyDocument(this.editorView.state.doc);
225
228
  }
226
- replaceDocument(rawValue, shouldScrollToBottom = true, /** @deprecated [ED-14158] shouldAddToHistory is not being used in this function */
229
+ replaceDocument(
230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
+ rawValue, shouldScrollToBottom = true, /** @deprecated [ED-14158] shouldAddToHistory is not being used in this function */
227
232
  shouldAddToHistory = true) {
228
233
  deprecationWarnings('EditorActions.replaceDocument', {
229
234
  shouldAddToHistory
@@ -37,7 +37,9 @@ export const EditorInternal = /*#__PURE__*/memo(({
37
37
  }) => {
38
38
  var _props$performanceTra, _props$performanceTra2, _props$performanceTra3, _props$performanceTra4;
39
39
  const Component = getUiComponent(props.appearance);
40
- const setEditorApi = useCallback(api => {
40
+ const setEditorApi = useCallback(
41
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ api => {
41
43
  // This is an workaround to unblock Editor Lego Decoupling project, if you have questions ping us #cc-editor-lego
42
44
  // We may clean up this code when EditorActions deprecation process starts
43
45
  // @ts-expect-error 2339: Property '__EDITOR_INTERNALS_DO_NOT_USE__API' does not exist on type 'EditorActions<any>'.
@@ -151,7 +153,9 @@ function ReactEditorViewContextWrapper(props) {
151
153
  * so we should also set the value for the `EditorContext` that is used in
152
154
  * `EditorInternal`.
153
155
  */
154
- const setEditorAPI = useCallback(api => {
156
+ const setEditorAPI = useCallback(
157
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
+ api => {
155
159
  setInternalEditorAPI === null || setInternalEditorAPI === void 0 ? void 0 : setInternalEditorAPI(api);
156
160
  setExternalEditorAPI === null || setExternalEditorAPI === void 0 ? void 0 : setExternalEditorAPI(api);
157
161
  }, [setInternalEditorAPI, setExternalEditorAPI]);
@@ -73,6 +73,7 @@ export class ReactEditorView extends React.Component {
73
73
  };
74
74
  }
75
75
  getPluginNames() {
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
77
  return this.editorState.plugins.map(p => p.key);
77
78
  }
78
79
  countNodes() {
@@ -85,9 +86,9 @@ export class ReactEditorView extends React.Component {
85
86
  // progressively opt out synthetic tenants.
86
87
  return ((_this$props$editorPro3 = this.props.editorProps) === null || _this$props$editorPro3 === void 0 ? void 0 : (_this$props$editorPro4 = _this$props$editorPro3.performanceTracking) === null || _this$props$editorPro4 === void 0 ? void 0 : (_this$props$editorPro5 = _this$props$editorPro4.transactionTracking) === null || _this$props$editorPro5 === void 0 ? void 0 : _this$props$editorPro5.enabled) === false;
87
88
  }
88
- constructor(props, context) {
89
+ constructor(props) {
89
90
  var _props$setEditorApi, _props$editorProps, _props$editorProps$pe, _props$editorProps$pe2;
90
- super(props, context);
91
+ super(props);
91
92
  _defineProperty(this, "editorRef", /*#__PURE__*/React.createRef());
92
93
  // ProseMirror is instantiated prior to the initial React render cycle,
93
94
  // so we allow transactions by default, to avoid discarding the initial one.
@@ -131,7 +132,6 @@ export class ReactEditorView extends React.Component {
131
132
  this.featureFlags = createFeatureFlagsFromProps(this.props.editorProps);
132
133
  this.editorState = this.createEditorState({
133
134
  props: this.props,
134
- context: this.context,
135
135
  doc: doc,
136
136
  resetting: true,
137
137
  selectionAtStart: !shouldScrollToBottom
@@ -199,7 +199,6 @@ export class ReactEditorView extends React.Component {
199
199
  eventDispatcher: this.eventDispatcher,
200
200
  providerFactory: options.props.providerFactory,
201
201
  portalProviderAPI: this.props.portalProviderAPI,
202
- reactContext: () => options.context,
203
202
  dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
204
203
  performanceTracking: this.props.editorProps.performanceTracking,
205
204
  transactionTracker: this.transactionTracker,
@@ -568,7 +567,6 @@ export class ReactEditorView extends React.Component {
568
567
  this.eventDispatcher.on('resetEditorState', this.resetEditorState);
569
568
  this.editorState = this.createEditorState({
570
569
  props,
571
- context,
572
570
  doc: props.editorProps.defaultValue,
573
571
  // ED-4759: Don't set selection at end for full-page editor - should be at start.
574
572
  selectionAtStart: isFullPage(props.editorProps.appearance)
@@ -649,7 +647,6 @@ export class ReactEditorView extends React.Component {
649
647
  eventDispatcher: this.eventDispatcher,
650
648
  providerFactory: props.providerFactory,
651
649
  portalProviderAPI: props.portalProviderAPI,
652
- reactContext: () => this.context,
653
650
  dispatchAnalyticsEvent: this.dispatchAnalyticsEvent,
654
651
  performanceTracking: props.editorProps.performanceTracking,
655
652
  transactionTracker: this.transactionTracker,
@@ -109,7 +109,6 @@ export function createPMPlugins(config) {
109
109
  providerFactory: config.providerFactory,
110
110
  errorReporter: config.errorReporter,
111
111
  portalProviderAPI: config.portalProviderAPI,
112
- reactContext: config.reactContext,
113
112
  dispatchAnalyticsEvent: config.dispatchAnalyticsEvent,
114
113
  featureFlags: config.featureFlags || {},
115
114
  getIntl: config.getIntl
@@ -98,7 +98,9 @@ export function getDefaultPresetOptionsFromEditorProps(props, createAnalyticsEve
98
98
  * Note: The order that presets are added determines
99
99
  * their placement in the editor toolbar.
100
100
  */
101
- export default function createPluginsList(preset, props, pluginInjectionAPI) {
101
+ export default function createPluginsList(
102
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
103
+ preset, props, pluginInjectionAPI) {
102
104
  const excludes = new Set();
103
105
  if (!isCodeBlockAllowed({
104
106
  allowBlockType: props.allowBlockType
@@ -20,7 +20,9 @@ export function createUniversalPreset({
20
20
  return withDangerouslyAppendPlugins(preset)((_props$dangerouslyApp = props.dangerouslyAppendPlugins) === null || _props$dangerouslyApp === void 0 ? void 0 : _props$dangerouslyApp.__plugins);
21
21
  }
22
22
  function withDangerouslyAppendPlugins(preset) {
23
- function createEditorNextPluginsFromDangerouslyAppended(plugins) {
23
+ function createEditorNextPluginsFromDangerouslyAppended(plugins
24
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ ) {
24
26
  return plugins ? plugins.map(plugin => () => plugin) : [];
25
27
  }
26
28
  return editorPluginsToAppend => {
@@ -1,8 +1,12 @@
1
1
  import React, { useContext, useMemo, useState } from 'react';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+
2
5
  export const EditorAPIContext = /*#__PURE__*/React.createContext({});
3
6
  export const PresetContextProvider = ({
4
7
  children
5
8
  }) => {
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
10
  const [editorApi, setEditorApi] = useState();
7
11
  const contextValue = useMemo(() => ({
8
12
  editorApi,
@@ -17,7 +17,9 @@ function lightProcessPluginsList(editorPlugins) {
17
17
  });
18
18
  }
19
19
  return acc;
20
- }, {});
20
+ },
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ {});
21
23
 
22
24
  /**
23
25
  * Process plugins
@@ -19,6 +19,7 @@ export default function Mobile({
19
19
  innerRef,
20
20
  pluginHooks,
21
21
  featureFlags
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
23
  }) {
23
24
  var _innerRef$current;
24
25
  return /*#__PURE__*/React.createElement(MobileAppearance, {
@@ -194,6 +194,7 @@ export class SwappableContentArea extends React.PureComponent {
194
194
  const widthPluginKey = {
195
195
  key: 'widthPlugin$',
196
196
  getState: state => {
197
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
198
  return state['widthPlugin$'];
198
199
  }
199
200
  };
@@ -202,6 +203,7 @@ const widthPluginKey = {
202
203
  const contextPanelPluginKey = {
203
204
  key: 'contextPanelPluginKey$',
204
205
  getState: state => {
206
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
207
  return state['contextPanelPluginKey$'];
206
208
  }
207
209
  };
@@ -41,9 +41,6 @@ export class ToolbarInner extends React.Component {
41
41
  return jsx("div", {
42
42
  css: toolbarComponentsWrapper
43
43
  }, items.map((component, key) => {
44
- const props = {
45
- key
46
- };
47
44
  const element = component({
48
45
  editorView,
49
46
  editorActions: editorActions,
@@ -61,7 +58,9 @@ export class ToolbarInner extends React.Component {
61
58
  dispatchAnalyticsEvent,
62
59
  wrapperElement: null
63
60
  });
64
- return element && /*#__PURE__*/React.cloneElement(element, props);
61
+ return element && /*#__PURE__*/React.cloneElement(element, {
62
+ key
63
+ });
65
64
  }));
66
65
  }
67
66
  }