@atlaskit/editor-core 195.6.0 → 195.6.1

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 (101) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +8 -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 +1 -0
  12. package/dist/cjs/create-editor/create-plugins-list.js +3 -1
  13. package/dist/cjs/create-editor/create-universal-preset.js +3 -1
  14. package/dist/cjs/presets/context.js +3 -0
  15. package/dist/cjs/test-utils.js +3 -1
  16. package/dist/cjs/ui/ContextPanel/index.js +2 -0
  17. package/dist/cjs/ui/Toolbar/ToolbarInner.js +3 -4
  18. package/dist/cjs/ui/ToolbarFeedback/index.js +1 -0
  19. package/dist/cjs/ui/WithHelpTrigger/index.js +2 -0
  20. package/dist/cjs/use-preset.js +2 -0
  21. package/dist/cjs/utils/action.js +1 -0
  22. package/dist/cjs/utils/deprecation-warnings.js +2 -2
  23. package/dist/cjs/utils/performance/instrumented-plugin.js +2 -0
  24. package/dist/cjs/version-wrapper.js +1 -1
  25. package/dist/es2019/CollapsedEditor/index.js +3 -0
  26. package/dist/es2019/actions/index.js +6 -1
  27. package/dist/es2019/composable-editor/editor-internal.js +6 -2
  28. package/dist/es2019/create-editor/ReactEditorView.js +1 -0
  29. package/dist/es2019/create-editor/create-plugins-list.js +3 -1
  30. package/dist/es2019/create-editor/create-universal-preset.js +3 -1
  31. package/dist/es2019/presets/context.js +4 -0
  32. package/dist/es2019/test-utils.js +3 -1
  33. package/dist/es2019/ui/Appearance/Mobile.js +1 -0
  34. package/dist/es2019/ui/ContextPanel/index.js +2 -0
  35. package/dist/es2019/ui/Toolbar/ToolbarInner.js +3 -4
  36. package/dist/es2019/ui/ToolbarFeedback/index.js +1 -0
  37. package/dist/es2019/ui/WithHelpTrigger/index.js +2 -0
  38. package/dist/es2019/use-preset.js +3 -0
  39. package/dist/es2019/utils/action.js +1 -0
  40. package/dist/es2019/utils/deprecation-warnings.js +2 -2
  41. package/dist/es2019/utils/performance/instrumented-plugin.js +2 -0
  42. package/dist/es2019/version-wrapper.js +1 -1
  43. package/dist/esm/CollapsedEditor/index.js +2 -0
  44. package/dist/esm/actions/index.js +6 -1
  45. package/dist/esm/composable-editor/editor-internal.js +6 -2
  46. package/dist/esm/create-editor/ReactEditorView.js +1 -0
  47. package/dist/esm/create-editor/create-plugins-list.js +3 -1
  48. package/dist/esm/create-editor/create-universal-preset.js +3 -1
  49. package/dist/esm/presets/context.js +4 -0
  50. package/dist/esm/test-utils.js +3 -1
  51. package/dist/esm/ui/ContextPanel/index.js +2 -0
  52. package/dist/esm/ui/Toolbar/ToolbarInner.js +3 -4
  53. package/dist/esm/ui/ToolbarFeedback/index.js +1 -0
  54. package/dist/esm/ui/WithHelpTrigger/index.js +2 -0
  55. package/dist/esm/use-preset.js +3 -0
  56. package/dist/esm/utils/action.js +1 -0
  57. package/dist/esm/utils/deprecation-warnings.js +2 -2
  58. package/dist/esm/utils/performance/instrumented-plugin.js +2 -0
  59. package/dist/esm/version-wrapper.js +1 -1
  60. package/dist/types/CollapsedEditor/index.d.ts +7 -7
  61. package/dist/types/EditorWithActions/index.d.ts +1 -6
  62. package/dist/types/create-editor/get-plugins.d.ts +4 -2
  63. package/dist/types/types/editor-props.d.ts +1 -1
  64. package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +6 -1
  65. package/dist/types/ui/Addon/ClickAreaMobile/index.d.ts +1 -1
  66. package/dist/types/ui/Addon/Dropdown/index.d.ts +1 -1
  67. package/dist/types/ui/Addon/click-area-helper.d.ts +1 -1
  68. package/dist/types/ui/Addon/types.d.ts +3 -3
  69. package/dist/types/ui/Appearance/Chromeless.d.ts +1 -1
  70. package/dist/types/ui/Appearance/FullPage/BeforeWrapper.d.ts +1 -1
  71. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  72. package/dist/types/ui/CollapsedEditor/index.d.ts +2 -2
  73. package/dist/types/ui/ContentStyles/index.d.ts +2 -1
  74. package/dist/types/ui/PluginSlot/index.d.ts +1 -1
  75. package/dist/types/ui/WithEditorActions/index.d.ts +2 -2
  76. package/dist/types/ui/WithFlash/index.d.ts +1 -1
  77. package/dist/types/ui/WithHelpTrigger/index.d.ts +1 -1
  78. package/dist/types/use-preset.d.ts +2 -1
  79. package/dist/types/utils/deprecation-warnings.d.ts +3 -3
  80. package/dist/types-ts4.5/CollapsedEditor/index.d.ts +7 -7
  81. package/dist/types-ts4.5/EditorWithActions/index.d.ts +1 -6
  82. package/dist/types-ts4.5/create-editor/get-plugins.d.ts +4 -2
  83. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  84. package/dist/types-ts4.5/ui/Addon/ClickAreaBlock/index.d.ts +6 -1
  85. package/dist/types-ts4.5/ui/Addon/ClickAreaMobile/index.d.ts +1 -1
  86. package/dist/types-ts4.5/ui/Addon/Dropdown/index.d.ts +1 -1
  87. package/dist/types-ts4.5/ui/Addon/click-area-helper.d.ts +1 -1
  88. package/dist/types-ts4.5/ui/Addon/types.d.ts +3 -3
  89. package/dist/types-ts4.5/ui/Appearance/Chromeless.d.ts +1 -1
  90. package/dist/types-ts4.5/ui/Appearance/FullPage/BeforeWrapper.d.ts +1 -1
  91. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  92. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +2 -2
  93. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -1
  94. package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
  95. package/dist/types-ts4.5/ui/WithEditorActions/index.d.ts +2 -2
  96. package/dist/types-ts4.5/ui/WithFlash/index.d.ts +1 -1
  97. package/dist/types-ts4.5/ui/WithHelpTrigger/index.d.ts +1 -1
  98. package/dist/types-ts4.5/use-preset.d.ts +2 -1
  99. package/dist/types-ts4.5/utils/deprecation-warnings.d.ts +3 -3
  100. package/docs/4-annotations.tsx +1 -0
  101. package/package.json +4 -4
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,13 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 195.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131374](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/131374)
8
+ [`9ef24a0e887b2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9ef24a0e887b2) -
9
+ Fix type definitions for `any` type in editor-core.
10
+
3
11
  ## 195.6.0
4
12
 
5
13
  ### 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]);
@@ -616,6 +616,7 @@ var ReactEditorView = exports.ReactEditorView = /*#__PURE__*/function (_React$Co
616
616
  }, {
617
617
  key: "getPluginNames",
618
618
  value: function getPluginNames() {
619
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
619
620
  return this.editorState.plugins.map(function (p) {
620
621
  return p.key;
621
622
  });
@@ -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.1";
@@ -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() {
@@ -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
  }
@@ -178,6 +178,7 @@ class ToolbarFeedbackInternal extends PureComponent {
178
178
  }, "Learn more")))))) : null;
179
179
  }
180
180
  }
181
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
181
182
  _defineProperty(ToolbarFeedbackInternal, "contextTypes", {
182
183
  editorActions: PropTypes.object.isRequired
183
184
  });
@@ -12,6 +12,8 @@ export default class WithHelpTrigger extends React.Component {
12
12
  const {
13
13
  editorActions
14
14
  } = this.context;
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
17
  const dispatch = createDispatch(editorActions.eventDispatcher);
16
18
  dispatch(analyticsEventKey, {
17
19
  payload: {
@@ -1,5 +1,8 @@
1
1
  import { useLayoutEffect, useMemo, useState } from 'react';
2
2
  import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
3
+
4
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
+
3
6
  /**
4
7
  * Creates a preset.
5
8
  *
@@ -4,6 +4,7 @@
4
4
  const mediaPluginKey = {
5
5
  key: 'mediaPlugin$',
6
6
  getState: state => {
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  return state['mediaPlugin$'];
8
9
  }
9
10
  };
@@ -1,4 +1,4 @@
1
- const deprecationWarnings = (className, props, deprecations) => {
1
+ function deprecationWarnings(className, props, deprecations) {
2
2
  if (process.env.NODE_ENV === 'production') {
3
3
  return;
4
4
  }
@@ -16,5 +16,5 @@ const deprecationWarnings = (className, props, deprecations) => {
16
16
  }
17
17
  }
18
18
  }
19
- };
19
+ }
20
20
  export default deprecationWarnings;
@@ -15,6 +15,7 @@ export class InstrumentedPlugin extends SafePlugin {
15
15
  if (spec.state) {
16
16
  const originalApply = spec.state.apply.bind(spec.state);
17
17
  spec.state.apply = (aTr, value, oldState, newState) => {
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  const self = this;
19
20
  const tr = new Proxy(aTr, freezeUnsafeTransactionProperties({
20
21
  dispatchAnalyticsEvent,
@@ -41,6 +42,7 @@ export class InstrumentedPlugin extends SafePlugin {
41
42
  if (uiTracking.enabled && spec.view) {
42
43
  const originalView = spec.view.bind(spec);
43
44
  spec.view = editorView => {
45
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
46
  const self = this;
45
47
  const measure = `🦉${self.key}::view::update`;
46
48
  const view = originalView(editorView);
@@ -1,2 +1,2 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "195.6.0";
2
+ export const version = "195.6.1";
@@ -11,6 +11,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
12
  import React from 'react';
13
13
  import ChromeCollapsed from '../ui/ChromeCollapsed';
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
16
  var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
15
17
  _inherits(CollapsedEditor, _React$Component);
16
18
  var _super = _createSuper(CollapsedEditor);
@@ -19,9 +19,12 @@ import { findNodePosByFragmentLocalIds } from '../utils/nodes-by-localIds';
19
19
  var fakePluginKey = {
20
20
  key: 'nativeCollabProviderPlugin$',
21
21
  getState: function getState(state) {
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
23
  return state['nativeCollabProviderPlugin$'];
23
24
  }
24
25
  };
26
+
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
28
  var EditorActions = /*#__PURE__*/function () {
26
29
  function EditorActions() {
27
30
  var _this = this;
@@ -321,7 +324,9 @@ var EditorActions = /*#__PURE__*/function () {
321
324
  }
322
325
  }, {
323
326
  key: "replaceDocument",
324
- value: function replaceDocument(rawValue) {
327
+ value: function replaceDocument(
328
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
329
+ rawValue) {
325
330
  var shouldScrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
326
331
  var shouldAddToHistory = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
327
332
  deprecationWarnings('EditorActions.replaceDocument', {