@atlaskit/editor-core 184.0.4 → 185.0.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 (189) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
  3. package/dist/cjs/editor-next/index.js +41 -34
  4. package/dist/cjs/editor.js +30 -269
  5. package/dist/cjs/i18n/en_ZZ.js +32 -6
  6. package/dist/cjs/index.js +0 -7
  7. package/dist/cjs/labs/next/presets/default.js +2 -1
  8. package/dist/cjs/plugins/base/index.js +0 -12
  9. package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
  10. package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
  11. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
  12. package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
  13. package/dist/cjs/plugins/card/toolbar.js +11 -9
  14. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
  15. package/dist/cjs/plugins/code-block/index.js +7 -5
  16. package/dist/cjs/plugins/code-block/toolbar.js +5 -5
  17. package/dist/cjs/plugins/copy-button/commands.js +2 -3
  18. package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
  19. package/dist/cjs/plugins/expand/index.js +1 -1
  20. package/dist/cjs/plugins/expand/toolbar.js +40 -39
  21. package/dist/cjs/plugins/extension/index.js +1 -1
  22. package/dist/cjs/plugins/extension/toolbar.js +5 -5
  23. package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
  24. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  25. package/dist/cjs/plugins/layout/index.js +8 -4
  26. package/dist/cjs/plugins/layout/toolbar.js +5 -6
  27. package/dist/cjs/plugins/media/toolbar/index.js +31 -24
  28. package/dist/cjs/plugins/panel/index.js +2 -1
  29. package/dist/cjs/plugins/panel/toolbar.js +7 -7
  30. package/dist/cjs/plugins/placeholder-text/index.js +7 -5
  31. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  32. package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
  33. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  34. package/dist/cjs/version-wrapper.js +1 -1
  35. package/dist/cjs/version.json +1 -1
  36. package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
  37. package/dist/es2019/editor-next/index.js +39 -30
  38. package/dist/es2019/editor.js +29 -232
  39. package/dist/es2019/i18n/en_ZZ.js +32 -6
  40. package/dist/es2019/index.js +1 -2
  41. package/dist/es2019/labs/next/presets/default.js +2 -1
  42. package/dist/es2019/plugins/base/index.js +0 -7
  43. package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
  44. package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
  45. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
  46. package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
  47. package/dist/es2019/plugins/card/toolbar.js +8 -6
  48. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  49. package/dist/es2019/plugins/code-block/index.js +7 -5
  50. package/dist/es2019/plugins/code-block/toolbar.js +5 -6
  51. package/dist/es2019/plugins/copy-button/commands.js +2 -3
  52. package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
  53. package/dist/es2019/plugins/expand/index.js +1 -1
  54. package/dist/es2019/plugins/expand/toolbar.js +5 -6
  55. package/dist/es2019/plugins/extension/index.js +1 -1
  56. package/dist/es2019/plugins/extension/toolbar.js +5 -6
  57. package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
  58. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  59. package/dist/es2019/plugins/layout/index.js +8 -5
  60. package/dist/es2019/plugins/layout/toolbar.js +5 -6
  61. package/dist/es2019/plugins/media/toolbar/index.js +35 -24
  62. package/dist/es2019/plugins/panel/index.js +2 -2
  63. package/dist/es2019/plugins/panel/toolbar.js +7 -8
  64. package/dist/es2019/plugins/placeholder-text/index.js +7 -5
  65. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
  66. package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
  67. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  68. package/dist/es2019/version-wrapper.js +1 -1
  69. package/dist/es2019/version.json +1 -1
  70. package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
  71. package/dist/esm/editor-next/index.js +42 -33
  72. package/dist/esm/editor.js +29 -270
  73. package/dist/esm/i18n/en_ZZ.js +32 -6
  74. package/dist/esm/index.js +1 -2
  75. package/dist/esm/labs/next/presets/default.js +2 -1
  76. package/dist/esm/plugins/base/index.js +0 -9
  77. package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
  78. package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
  79. package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
  80. package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
  81. package/dist/esm/plugins/card/toolbar.js +7 -6
  82. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  83. package/dist/esm/plugins/code-block/index.js +7 -5
  84. package/dist/esm/plugins/code-block/toolbar.js +5 -5
  85. package/dist/esm/plugins/copy-button/commands.js +2 -3
  86. package/dist/esm/plugins/copy-button/toolbar.js +7 -8
  87. package/dist/esm/plugins/expand/index.js +1 -1
  88. package/dist/esm/plugins/expand/toolbar.js +40 -39
  89. package/dist/esm/plugins/extension/index.js +1 -1
  90. package/dist/esm/plugins/extension/toolbar.js +5 -5
  91. package/dist/esm/plugins/floating-toolbar/index.js +3 -2
  92. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  93. package/dist/esm/plugins/layout/index.js +8 -4
  94. package/dist/esm/plugins/layout/toolbar.js +5 -6
  95. package/dist/esm/plugins/media/toolbar/index.js +31 -24
  96. package/dist/esm/plugins/panel/index.js +2 -1
  97. package/dist/esm/plugins/panel/toolbar.js +7 -7
  98. package/dist/esm/plugins/placeholder-text/index.js +7 -5
  99. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  100. package/dist/esm/ui/CollapsedEditor/index.js +1 -2
  101. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  102. package/dist/esm/version-wrapper.js +1 -1
  103. package/dist/esm/version.json +1 -1
  104. package/dist/types/editor-next/index.d.ts +0 -6
  105. package/dist/types/editor.d.ts +1 -137
  106. package/dist/types/i18n/en_ZZ.d.ts +28 -2
  107. package/dist/types/index.d.ts +0 -1
  108. package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
  109. package/dist/types/labs/next/presets/default.d.ts +212 -0
  110. package/dist/types/labs/next/presets/mobile.d.ts +106 -0
  111. package/dist/types/plugins/base/index.d.ts +0 -4
  112. package/dist/types/plugins/card/index.d.ts +2 -2
  113. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
  114. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
  115. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  116. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
  117. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
  118. package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
  119. package/dist/types/plugins/card/toolbar.d.ts +1 -2
  120. package/dist/types/plugins/card/types.d.ts +1 -1
  121. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  122. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  123. package/dist/types/plugins/card/ui/types.d.ts +1 -1
  124. package/dist/types/plugins/code-block/index.d.ts +7 -1
  125. package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
  126. package/dist/types/plugins/copy-button/commands.d.ts +2 -1
  127. package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
  128. package/dist/types/plugins/expand/index.d.ts +2 -1
  129. package/dist/types/plugins/expand/toolbar.d.ts +2 -1
  130. package/dist/types/plugins/extension/index.d.ts +7 -2
  131. package/dist/types/plugins/extension/toolbar.d.ts +2 -1
  132. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
  133. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  134. package/dist/types/plugins/layout/index.d.ts +7 -1
  135. package/dist/types/plugins/layout/toolbar.d.ts +2 -1
  136. package/dist/types/plugins/media/index.d.ts +3 -1
  137. package/dist/types/plugins/panel/index.d.ts +2 -0
  138. package/dist/types/plugins/panel/toolbar.d.ts +3 -2
  139. package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
  140. package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
  141. package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
  142. package/dist/types-ts4.5/editor.d.ts +1 -137
  143. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
  144. package/dist/types-ts4.5/index.d.ts +0 -1
  145. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
  146. package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
  147. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
  148. package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
  149. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  150. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
  151. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
  152. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  153. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
  154. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
  155. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
  156. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
  157. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
  158. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  159. package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  160. package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
  161. package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
  162. package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
  163. package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
  164. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
  165. package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
  166. package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
  167. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  168. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
  169. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  170. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  171. package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
  172. package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
  173. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  174. package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
  175. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
  176. package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
  177. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
  178. package/package.json +15 -10
  179. package/report.api.md +5 -93
  180. package/dist/cjs/editor-next/editor-migration-component.js +0 -54
  181. package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
  182. package/dist/es2019/editor-next/editor-migration-component.js +0 -30
  183. package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
  184. package/dist/esm/editor-next/editor-migration-component.js +0 -47
  185. package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
  186. package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
  187. package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
  188. package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
  189. package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
@@ -25,7 +25,7 @@ const insertPanelTypeWithAnalytics = (panelAttributes, state, insert) => {
25
25
  return tr;
26
26
  };
27
27
  const insertPanelType = (panelAttributes, state) => state.schema.nodes.panel.createChecked(panelAttributes, state.schema.nodes.paragraph.createChecked());
28
- const panelPlugin = (options = {}) => ({
28
+ const panelPlugin = (options = {}, api) => ({
29
29
  name: 'panel',
30
30
  nodes() {
31
31
  const panelNode = panel(!!options.allowCustomPanel);
@@ -130,7 +130,7 @@ const panelPlugin = (options = {}) => ({
130
130
  }
131
131
  return quickInsertOptions;
132
132
  },
133
- floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory)
133
+ floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration)
134
134
  }
135
135
  });
136
136
  export default panelPlugin;
@@ -7,7 +7,6 @@ import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
7
7
  import RemoveEmojiIcon from '@atlaskit/icon/glyph/editor/remove-emoji';
8
8
  import commonMessages from '../../messages';
9
9
  import { removePanel, changePanelType } from './actions';
10
- import { hoverDecoration } from '../base/pm-plugins/decoration';
11
10
  import { panelBackgroundPalette } from '../../ui/ColorPalette/Palettes/panelBackgroundPalette';
12
11
  import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
13
12
  import { findPanel } from './utils';
@@ -42,7 +41,7 @@ export const panelIconMap = {
42
41
  id: 'atlassian-tip'
43
42
  }
44
43
  };
45
- export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon, state) => {
44
+ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, activePanelType, activePanelColor, activePanelIcon, state) => {
46
45
  // TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
47
46
  const items = [{
48
47
  id: 'editor.panel.info',
@@ -235,16 +234,16 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
235
234
  focusEditoronEnter: true,
236
235
  icon: RemoveIcon,
237
236
  onClick: removePanel(),
238
- onMouseEnter: hoverDecoration(panelNodeType, true),
239
- onMouseLeave: hoverDecoration(panelNodeType, false),
240
- onFocus: hoverDecoration(panelNodeType, true),
241
- onBlur: hoverDecoration(panelNodeType, false),
237
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
238
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
239
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
240
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
242
241
  title: formatMessage(commonMessages.remove),
243
242
  tabIndex: null
244
243
  });
245
244
  return items;
246
245
  };
247
- export const getToolbarConfig = (state, intl, options = {}, providerFactory) => {
246
+ export const getToolbarConfig = (state, intl, options = {}, providerFactory, hoverDecoration) => {
248
247
  const {
249
248
  formatMessage
250
249
  } = intl;
@@ -261,7 +260,7 @@ export const getToolbarConfig = (state, intl, options = {}, providerFactory) =>
261
260
  };
262
261
 
263
262
  // force toolbar to be turned on
264
- const items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
263
+ const items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, hoverDecoration, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
265
264
  const getDomRef = editorView => {
266
265
  const domAtPos = editorView.domAtPos.bind(editorView);
267
266
  const element = findDomRefAtPos(panelObject.pos, domAtPos);
@@ -10,7 +10,7 @@ import PlaceholderFloatingToolbar from './ui/PlaceholderFloatingToolbar';
10
10
  import { hidePlaceholderFloatingToolbar, insertPlaceholderTextAtSelection } from './actions';
11
11
  import { PlaceholderTextNodeView } from './placeholder-text-nodeview';
12
12
  import { pluginKey } from './plugin-key';
13
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE, INPUT_METHOD } from '../analytics';
13
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
14
14
  import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
15
15
  import { isSelectionAtPlaceholder } from './selection-utils';
16
16
  import { createInternalTypeAheadTools } from '../type-ahead/api';
@@ -175,7 +175,7 @@ const basePlaceholderTextPlugin = options => ({
175
175
  });
176
176
  }
177
177
  });
178
- const decorateWithPluginOptions = (plugin, options) => {
178
+ const decorateWithPluginOptions = (plugin, options, api) => {
179
179
  if (!options.allowInserting) {
180
180
  return plugin;
181
181
  }
@@ -192,11 +192,12 @@ const decorateWithPluginOptions = (plugin, options) => {
192
192
  label: ""
193
193
  }),
194
194
  action(insert, state) {
195
+ var _api$dependencies$ana;
195
196
  const tr = state.tr;
196
197
  tr.setMeta(pluginKey, {
197
198
  showInsertPanelAt: tr.selection.anchor
198
199
  });
199
- return addAnalytics(state, tr, {
200
+ api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions.attachAnalyticsEvent({
200
201
  action: ACTION.INSERTED,
201
202
  actionSubject: ACTION_SUBJECT.DOCUMENT,
202
203
  actionSubjectId: ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
@@ -204,11 +205,12 @@ const decorateWithPluginOptions = (plugin, options) => {
204
205
  inputMethod: INPUT_METHOD.QUICK_INSERT
205
206
  },
206
207
  eventType: EVENT_TYPE.TRACK
207
- });
208
+ })(tr);
209
+ return tr;
208
210
  }
209
211
  }]
210
212
  };
211
213
  return plugin;
212
214
  };
213
- const placeholderTextPlugin = (options, api) => decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
215
+ const placeholderTextPlugin = (options, api) => decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options, api);
214
216
  export default placeholderTextPlugin;
@@ -182,6 +182,27 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
182
182
  element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
183
183
  };
184
184
  }, [ref, cancel]);
185
+
186
+ // ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
187
+ // This is the expected keyboard behaviour advised by the Accessibility team
188
+ useLayoutEffect(() => {
189
+ const escape = event => {
190
+ if (event.key === 'Escape') {
191
+ cancel({
192
+ addPrefixTrigger: true,
193
+ setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
194
+ forceFocusOnEditor: true
195
+ });
196
+ }
197
+ };
198
+ const {
199
+ current: element
200
+ } = ref;
201
+ element === null || element === void 0 ? void 0 : element.addEventListener('keydown', escape);
202
+ return () => {
203
+ element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
204
+ };
205
+ }, [ref, cancel]);
185
206
  return jsx(Popup, {
186
207
  zIndex: akEditorFloatingDialogZIndex,
187
208
  target: anchorElement,
@@ -3,7 +3,6 @@ import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
3
3
  import React from 'react';
4
4
  import Editor from '../../editor';
5
5
  import EditorNext from '../../editor-next';
6
- import EditorMigrationComponent from '../../editor-next/editor-migration-component';
7
6
  import EditorWithActions from '../../labs/EditorWithActions';
8
7
  import ChromeCollapsed from '../ChromeCollapsed';
9
8
  export default class CollapsedEditor extends React.Component {
@@ -25,7 +24,7 @@ export default class CollapsedEditor extends React.Component {
25
24
  }
26
25
  render() {
27
26
  const child = React.Children.only(this.props.children);
28
- if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext && child.type !== EditorMigrationComponent) {
27
+ if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext) {
29
28
  throw new Error('Expected child to be of type `Editor`');
30
29
  }
31
30
  if (!this.props.isExpanded) {
@@ -152,18 +152,20 @@ function StatelessElementBrowser(props) {
152
152
  /* Only for hitting enter to select item when focused on search bar,
153
153
  * The actual enter key press is handled on individual items level.
154
154
  */
155
+ const selectedItem = items[selectedItemIndex];
155
156
  const onItemsEnterKeyPress = useCallback(e => {
156
157
  if (e.key !== 'Enter') {
157
158
  return;
158
159
  }
159
- props.onInsertItem(items[selectedItemIndex]);
160
- }, [props, items, selectedItemIndex]);
160
+ if (onSelectItem && selectedItem != null) {
161
+ onSelectItem(selectedItem);
162
+ }
163
+ }, [onSelectItem, selectedItem]);
161
164
 
162
165
  /**
163
166
  * On arrow key selection and clicks the selectedItemIndex will change.
164
167
  * Making sure to update parent component.
165
168
  */
166
- const selectedItem = items[selectedItemIndex];
167
169
  useEffect(() => {
168
170
  if (onSelectItem && selectedItem != null) {
169
171
  onSelectItem(selectedItem);
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "184.0.4";
2
+ export const version = "185.0.2";
3
3
  export const 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": "184.0.4",
3
+ "version": "185.0.2",
4
4
  "sideEffects": false
5
5
  }
@@ -25,7 +25,7 @@ function getSpellCheck(featureFlags) {
25
25
  * which is used by both current and archv3 editors.
26
26
  */
27
27
  export function createFeatureFlagsFromProps(props) {
28
- var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44, _props$featureFlags45, _props$featureFlags46, _props$featureFlags47;
28
+ var _props$featureFlags, _ref, _props$featureFlags$u, _props$featureFlags2, _props$featureFlags3, _props$allowLayouts, _props$performanceTra, _props$performanceTra2, _props$featureFlags4, _props$featureFlags5, _props$allowTables, _props$featureFlags6, _props$featureFlags7, _props$allowTables2, _props$featureFlags8, _props$featureFlags9, _props$allowTables3, _props$featureFlags10, _props$featureFlags11, _props$allowTables4, _props$allowTables5, _props$featureFlags12, _props$featureFlags13, _props$allowTables6, _props$allowExtension, _props$featureFlags14, _props$featureFlags15, _props$featureFlags16, _props$featureFlags17, _props$featureFlags18, _props$featureFlags19, _props$featureFlags20, _props$featureFlags21, _props$featureFlags22, _props$featureFlags23, _props$featureFlags24, _props$featureFlags25, _props$featureFlags26, _props$featureFlags27, _props$featureFlags28, _props$featureFlags29, _props$featureFlags30, _props$featureFlags31, _props$collabEdit, _props$collabEdit2, _props$featureFlags32, _props$featureFlags33, _props$featureFlags34, _props$featureFlags35, _props$featureFlags36, _props$featureFlags37, _props$featureFlags38, _props$featureFlags39, _props$featureFlags40, _props$featureFlags41, _props$featureFlags42, _props$featureFlags43, _props$featureFlags44, _props$featureFlags45, _props$featureFlags46;
29
29
  var normalizedFeatureFlags = normalizeFeatureFlags(props.featureFlags);
30
30
  var tableCellOptionsInFloatingToolbar = normalizedFeatureFlags.tableCellOptionsInFloatingToolbar || ((_props$featureFlags = props.featureFlags) === null || _props$featureFlags === void 0 ? void 0 : _props$featureFlags.tableCellOptionsInFloatingToolbar) || undefined;
31
31
 
@@ -72,7 +72,6 @@ export function createFeatureFlagsFromProps(props) {
72
72
  useSomewhatSemanticTextColorNames: Boolean(typeof normalizedFeatureFlags.useSomewhatSemanticTextColorNames === 'boolean' && !!normalizedFeatureFlags.useSomewhatSemanticTextColorNames || (typeof ((_props$featureFlags43 = props.featureFlags) === null || _props$featureFlags43 === void 0 ? void 0 : _props$featureFlags43.useSomewhatSemanticTextColorNames) === 'boolean' ? !!((_props$featureFlags44 = props.featureFlags) !== null && _props$featureFlags44 !== void 0 && _props$featureFlags44.useSomewhatSemanticTextColorNames) : false)),
73
73
  lpLinkPickerFocusTrap: Boolean(normalizedFeatureFlags.lpLinkPickerFocusTrap),
74
74
  preventPopupOverflow: Boolean(typeof ((_props$featureFlags45 = props.featureFlags) === null || _props$featureFlags45 === void 0 ? void 0 : _props$featureFlags45['prevent-popup-overflow']) === 'boolean' ? !!((_props$featureFlags46 = props.featureFlags) !== null && _props$featureFlags46 !== void 0 && _props$featureFlags46['prevent-popup-overflow']) : false),
75
- useEditorNext: normalizedFeatureFlags.useEditorNext === true || ((_props$featureFlags47 = props.featureFlags) === null || _props$featureFlags47 === void 0 ? void 0 : _props$featureFlags47.useEditorNext) === true,
76
75
  // duplicated logic from `create-plugins-list.ts` due to presets not being finalised
77
76
  useBetterTypeaheadNavigation: Boolean(typeof pseudoNormalisedUseBetterTypeaheadNavigation === 'boolean' ? !!pseudoNormalisedUseBetterTypeaheadNavigation : true)
78
77
  });
@@ -12,13 +12,14 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
  /** @jsx jsx */
13
13
 
14
14
  import { WithCreateAnalyticsEvent } from '@atlaskit/editor-common/ui';
15
- import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
15
+ // import { getAnalyticsAppearance } from '@atlaskit/editor-common/utils';
16
16
  import { jsx } from '@emotion/react';
17
17
  import PropTypes from 'prop-types';
18
18
  import React from 'react';
19
- import { name, version } from '../version-wrapper';
20
- import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
21
- import uuid from 'uuid/v4';
19
+ // import { name, version } from '../version-wrapper';
20
+
21
+ // import { FabricEditorAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
22
+ // import uuid from 'uuid/v4';
22
23
  import EditorActions from '../actions';
23
24
  import { fireAnalyticsEvent } from '@atlaskit/editor-common/analytics';
24
25
  import EditorInternal from './editor-internal';
@@ -31,6 +32,8 @@ import { basePlugin } from '../plugins';
31
32
  var EditorNext = /*#__PURE__*/function (_React$Component) {
32
33
  _inherits(EditorNext, _React$Component);
33
34
  var _super = _createSuper(EditorNext);
35
+ // private editorSessionId: string;
36
+
34
37
  function EditorNext(props, context) {
35
38
  var _this;
36
39
  _classCallCheck(this, EditorNext);
@@ -50,7 +53,7 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
50
53
  });
51
54
  deprecationWarnings(props);
52
55
  _this.editorActions = (context || {}).editorActions || new EditorActions();
53
- _this.editorSessionId = uuid();
56
+ // this.editorSessionId = uuid();
54
57
  _this.startTime = performance.now();
55
58
  _this.onEditorCreated = _this.onEditorCreated.bind(_assertThisInitialized(_this));
56
59
  _this.onEditorDestroyed = _this.onEditorDestroyed.bind(_assertThisInitialized(_this));
@@ -93,38 +96,44 @@ var EditorNext = /*#__PURE__*/function (_React$Component) {
93
96
  key: "render",
94
97
  value: function render() {
95
98
  var _this3 = this;
96
- return jsx(FabricEditorAnalyticsContext, {
97
- data: {
98
- packageName: name,
99
- packageVersion: version,
100
- componentName: 'editorCore',
101
- appearance: getAnalyticsAppearance(this.props.appearance),
102
- editorSessionId: this.editorSessionId
103
- }
104
- }, jsx(WithCreateAnalyticsEvent, {
105
- render: function render(createAnalyticsEvent) {
106
- return (_this3.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
107
- props: _this3.props,
108
- handleAnalyticsEvent: _this3.handleAnalyticsEvent,
109
- createAnalyticsEvent: _this3.createAnalyticsEvent,
110
- preset: _this3.props.preset,
111
- handleSave: _this3.handleSave,
112
- editorActions: _this3.editorActions,
113
- getExperienceStore: _this3.getExperienceStore,
114
- onEditorCreated: _this3.onEditorCreated,
115
- onEditorDestroyed: _this3.onEditorDestroyed
116
- });
117
- }
118
- }));
99
+ // TODO: https://product-fabric.atlassian.net/browse/ED-16979
100
+ // Move `FabricEditorAnalyticsContext` back into `EditorNext`
101
+ // This was moved out here to workaround the issue that the analytics
102
+ // context does not wrap the Preset (and therefore does not pass this context
103
+ // information to analytics calls within plugins). After this cleanup task ^ we will
104
+ // not have to generate the `createAnalyticsEvent` outside the Preset
105
+ // and we can move this back into `EditorNext`.
106
+ return (
107
+ // <FabricEditorAnalyticsContext
108
+ // data={{
109
+ // packageName: name,
110
+ // packageVersion: version,
111
+ // componentName: 'editorCore',
112
+ // appearance: getAnalyticsAppearance(this.props.appearance),
113
+ // editorSessionId: this.editorSessionId,
114
+ // }}
115
+ // >
116
+ jsx(WithCreateAnalyticsEvent, {
117
+ render: function render(createAnalyticsEvent) {
118
+ return (_this3.createAnalyticsEvent = createAnalyticsEvent) && jsx(EditorInternal, {
119
+ props: _this3.props,
120
+ handleAnalyticsEvent: _this3.handleAnalyticsEvent,
121
+ createAnalyticsEvent: _this3.createAnalyticsEvent,
122
+ preset: _this3.props.preset,
123
+ handleSave: _this3.handleSave,
124
+ editorActions: _this3.editorActions,
125
+ getExperienceStore: _this3.getExperienceStore,
126
+ onEditorCreated: _this3.onEditorCreated,
127
+ onEditorDestroyed: _this3.onEditorDestroyed
128
+ });
129
+ }
130
+ })
131
+ // </FabricEditorAnalyticsContext>
132
+ );
119
133
  }
120
134
  }]);
121
135
  return EditorNext;
122
136
  }(React.Component);
123
- /**
124
- * WARNING: Code should be shared between Editor + EditorNext
125
- * If you are making changes that affect both, consider making them
126
- * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
127
- */
128
137
  _defineProperty(EditorNext, "defaultProps", defaultProps);
129
138
  _defineProperty(EditorNext, "contextTypes", {
130
139
  editorActions: PropTypes.object