@atlaskit/editor-core 184.0.0 → 185.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/.eslintrc.js +7 -3
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
  4. package/dist/cjs/editor-next/index.js +41 -34
  5. package/dist/cjs/editor.js +30 -269
  6. package/dist/cjs/i18n/en_ZZ.js +32 -6
  7. package/dist/cjs/index.js +0 -7
  8. package/dist/cjs/labs/next/presets/default.js +2 -1
  9. package/dist/cjs/plugins/base/index.js +0 -12
  10. package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
  11. package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
  12. package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
  13. package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
  14. package/dist/cjs/plugins/card/toolbar.js +11 -9
  15. package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
  16. package/dist/cjs/plugins/code-block/index.js +7 -5
  17. package/dist/cjs/plugins/code-block/toolbar.js +5 -5
  18. package/dist/cjs/plugins/copy-button/commands.js +2 -3
  19. package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
  20. package/dist/cjs/plugins/expand/index.js +1 -1
  21. package/dist/cjs/plugins/expand/toolbar.js +40 -39
  22. package/dist/cjs/plugins/extension/index.js +1 -1
  23. package/dist/cjs/plugins/extension/toolbar.js +5 -5
  24. package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
  25. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  26. package/dist/cjs/plugins/layout/index.js +8 -4
  27. package/dist/cjs/plugins/layout/toolbar.js +5 -6
  28. package/dist/cjs/plugins/media/toolbar/index.js +31 -24
  29. package/dist/cjs/plugins/panel/index.js +2 -1
  30. package/dist/cjs/plugins/panel/toolbar.js +7 -7
  31. package/dist/cjs/plugins/placeholder-text/index.js +7 -5
  32. package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  33. package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
  34. package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
  35. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
  36. package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  37. package/dist/cjs/ui/styles.js +6 -0
  38. package/dist/cjs/version-wrapper.js +1 -1
  39. package/dist/cjs/version.json +1 -1
  40. package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
  41. package/dist/es2019/editor-next/index.js +39 -30
  42. package/dist/es2019/editor.js +29 -232
  43. package/dist/es2019/i18n/en_ZZ.js +32 -6
  44. package/dist/es2019/index.js +1 -2
  45. package/dist/es2019/labs/next/presets/default.js +2 -1
  46. package/dist/es2019/plugins/base/index.js +0 -7
  47. package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
  48. package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
  49. package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
  50. package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
  51. package/dist/es2019/plugins/card/toolbar.js +8 -6
  52. package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  53. package/dist/es2019/plugins/code-block/index.js +7 -5
  54. package/dist/es2019/plugins/code-block/toolbar.js +5 -6
  55. package/dist/es2019/plugins/copy-button/commands.js +2 -3
  56. package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
  57. package/dist/es2019/plugins/expand/index.js +1 -1
  58. package/dist/es2019/plugins/expand/toolbar.js +5 -6
  59. package/dist/es2019/plugins/extension/index.js +1 -1
  60. package/dist/es2019/plugins/extension/toolbar.js +5 -6
  61. package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
  62. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  63. package/dist/es2019/plugins/layout/index.js +8 -5
  64. package/dist/es2019/plugins/layout/toolbar.js +5 -6
  65. package/dist/es2019/plugins/media/toolbar/index.js +35 -24
  66. package/dist/es2019/plugins/panel/index.js +2 -2
  67. package/dist/es2019/plugins/panel/toolbar.js +7 -8
  68. package/dist/es2019/plugins/placeholder-text/index.js +7 -5
  69. package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
  70. package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
  71. package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
  72. package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
  73. package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  74. package/dist/es2019/ui/styles.js +6 -0
  75. package/dist/es2019/version-wrapper.js +1 -1
  76. package/dist/es2019/version.json +1 -1
  77. package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
  78. package/dist/esm/editor-next/index.js +42 -33
  79. package/dist/esm/editor.js +29 -270
  80. package/dist/esm/i18n/en_ZZ.js +32 -6
  81. package/dist/esm/index.js +1 -2
  82. package/dist/esm/labs/next/presets/default.js +2 -1
  83. package/dist/esm/plugins/base/index.js +0 -9
  84. package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
  85. package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
  86. package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
  87. package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
  88. package/dist/esm/plugins/card/toolbar.js +7 -6
  89. package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
  90. package/dist/esm/plugins/code-block/index.js +7 -5
  91. package/dist/esm/plugins/code-block/toolbar.js +5 -5
  92. package/dist/esm/plugins/copy-button/commands.js +2 -3
  93. package/dist/esm/plugins/copy-button/toolbar.js +7 -8
  94. package/dist/esm/plugins/expand/index.js +1 -1
  95. package/dist/esm/plugins/expand/toolbar.js +40 -39
  96. package/dist/esm/plugins/extension/index.js +1 -1
  97. package/dist/esm/plugins/extension/toolbar.js +5 -5
  98. package/dist/esm/plugins/floating-toolbar/index.js +3 -2
  99. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
  100. package/dist/esm/plugins/layout/index.js +8 -4
  101. package/dist/esm/plugins/layout/toolbar.js +5 -6
  102. package/dist/esm/plugins/media/toolbar/index.js +31 -24
  103. package/dist/esm/plugins/panel/index.js +2 -1
  104. package/dist/esm/plugins/panel/toolbar.js +7 -7
  105. package/dist/esm/plugins/placeholder-text/index.js +7 -5
  106. package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
  107. package/dist/esm/ui/CollapsedEditor/index.js +1 -2
  108. package/dist/esm/ui/ColorPickerButton/index.js +2 -2
  109. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
  110. package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
  111. package/dist/esm/ui/styles.js +6 -0
  112. package/dist/esm/version-wrapper.js +1 -1
  113. package/dist/esm/version.json +1 -1
  114. package/dist/types/editor-next/index.d.ts +0 -6
  115. package/dist/types/editor.d.ts +1 -137
  116. package/dist/types/i18n/en_ZZ.d.ts +28 -2
  117. package/dist/types/index.d.ts +0 -1
  118. package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
  119. package/dist/types/labs/next/presets/default.d.ts +212 -0
  120. package/dist/types/labs/next/presets/mobile.d.ts +106 -0
  121. package/dist/types/plugins/base/index.d.ts +0 -4
  122. package/dist/types/plugins/card/index.d.ts +2 -2
  123. package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
  124. package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
  125. package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  126. package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
  127. package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
  128. package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
  129. package/dist/types/plugins/card/toolbar.d.ts +1 -2
  130. package/dist/types/plugins/card/types.d.ts +1 -1
  131. package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  132. package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  133. package/dist/types/plugins/card/ui/types.d.ts +1 -1
  134. package/dist/types/plugins/code-block/index.d.ts +7 -1
  135. package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
  136. package/dist/types/plugins/copy-button/commands.d.ts +2 -1
  137. package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
  138. package/dist/types/plugins/expand/index.d.ts +2 -1
  139. package/dist/types/plugins/expand/toolbar.d.ts +2 -1
  140. package/dist/types/plugins/extension/index.d.ts +7 -2
  141. package/dist/types/plugins/extension/toolbar.d.ts +2 -1
  142. package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
  143. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  144. package/dist/types/plugins/layout/index.d.ts +7 -1
  145. package/dist/types/plugins/layout/toolbar.d.ts +2 -1
  146. package/dist/types/plugins/media/index.d.ts +3 -1
  147. package/dist/types/plugins/panel/index.d.ts +2 -0
  148. package/dist/types/plugins/panel/toolbar.d.ts +3 -2
  149. package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
  150. package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
  151. package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
  152. package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
  153. package/dist/types-ts4.5/editor.d.ts +1 -137
  154. package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
  155. package/dist/types-ts4.5/index.d.ts +0 -1
  156. package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
  157. package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
  158. package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
  159. package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
  160. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  161. package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
  162. package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
  163. package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
  164. package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
  165. package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
  166. package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
  167. package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
  168. package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
  169. package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
  170. package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
  171. package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
  172. package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
  173. package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
  174. package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
  175. package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
  176. package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
  177. package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
  178. package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
  179. package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
  180. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
  181. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
  182. package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
  183. package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
  184. package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
  185. package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
  186. package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
  187. package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
  188. package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
  189. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
  190. package/package.json +23 -18
  191. package/report.api.md +5 -93
  192. package/dist/cjs/editor-next/editor-migration-component.js +0 -54
  193. package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
  194. package/dist/es2019/editor-next/editor-migration-component.js +0 -30
  195. package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
  196. package/dist/esm/editor-next/editor-migration-component.js +0 -47
  197. package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
  198. package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
  199. package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
  200. package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
  201. package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
@@ -10,7 +10,6 @@ import DownloadIcon from '@atlaskit/icon/glyph/download';
10
10
  import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
11
11
  import commonMessages from '../../../messages';
12
12
  import { stateKey } from '../pm-plugins/plugin-key';
13
- import { hoverDecoration } from '../../base/pm-plugins/decoration';
14
13
  import { getLinkingToolbar, shouldShowMediaLinkToolbar } from './linking';
15
14
  import buildLayoutButtons from '../../../ui/MediaAndEmbedsToolbar';
16
15
  import { getMediaLinkingState } from '../pm-plugins/linking';
@@ -18,7 +17,7 @@ import { getPluginState as getMediaAltTextPluginState } from '../pm-plugins/alt-
18
17
  import { altTextButton, getAltTextToolbar } from './alt-text';
19
18
  import { showLinkingToolbar } from '../commands/linking';
20
19
  import { LinkToolbarAppearance } from './linking-toolbar-appearance';
21
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, EVENT_TYPE } from '../../analytics';
20
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
22
21
  import { messages } from '@atlaskit/media-ui';
23
22
  import { messages as cardMessages } from '../../card/messages';
24
23
  import { FilePreviewItem } from './filePreviewItem';
@@ -41,7 +40,7 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
41
40
  }
42
41
  return true;
43
42
  };
44
- var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState) {
43
+ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
45
44
  var mediaGroup = state.schema.nodes.mediaGroup;
46
45
  var items = [{
47
46
  id: 'editor.media.view.switcher',
@@ -104,17 +103,17 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
104
103
  appearance: 'danger',
105
104
  focusEditoronEnter: true,
106
105
  icon: RemoveIcon,
107
- onMouseEnter: hoverDecoration(mediaGroup, true),
108
- onMouseLeave: hoverDecoration(mediaGroup, false),
109
- onFocus: hoverDecoration(mediaGroup, true),
110
- onBlur: hoverDecoration(mediaGroup, false),
106
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
107
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
108
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
109
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
111
110
  title: intl.formatMessage(commonMessages.remove),
112
111
  onClick: handleRemoveMediaGroup,
113
112
  testId: 'media-toolbar-remove-button'
114
113
  }];
115
114
  return items;
116
115
  };
117
- var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState) {
116
+ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
118
117
  var mediaInline = state.schema.nodes.mediaInline;
119
118
  var items = [{
120
119
  id: 'editor.media.view.switcher',
@@ -177,17 +176,18 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
177
176
  appearance: 'danger',
178
177
  focusEditoronEnter: true,
179
178
  icon: RemoveIcon,
180
- onMouseEnter: hoverDecoration(mediaInline, true),
181
- onMouseLeave: hoverDecoration(mediaInline, false),
182
- onFocus: hoverDecoration(mediaInline, true),
183
- onBlur: hoverDecoration(mediaInline, false),
179
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
180
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
181
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
182
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
184
183
  title: intl.formatMessage(commonMessages.remove),
185
184
  onClick: removeInlineCard,
186
185
  testId: 'media-toolbar-remove-button'
187
186
  }];
188
187
  return items;
189
188
  };
190
- var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, widthPluginDependencyApi, getEditorFeatureFlags) {
189
+ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
190
+ var _pluginInjectionApi$d2;
191
191
  var mediaSingle = state.schema.nodes.mediaSingle;
192
192
  var allowResizing = options.allowResizing,
193
193
  allowLinking = options.allowLinking,
@@ -224,7 +224,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
224
224
  });
225
225
  }
226
226
  if (allowAdvancedToolBarOptions) {
227
- toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPluginDependencyApi, allowResizing, allowResizingInTables)));
227
+ toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, allowResizing, allowResizingInTables)));
228
228
  if (toolbarButtons.length) {
229
229
  toolbarButtons.push({
230
230
  type: 'separator'
@@ -245,14 +245,16 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
245
245
  };
246
246
  var openLink = function openLink() {
247
247
  if (editorView) {
248
- var _state2 = editorView.state,
248
+ var _pluginInjectionApi$d;
249
+ var tr = editorView.state.tr,
249
250
  dispatch = editorView.dispatch;
250
- dispatch(addAnalytics(_state2, _state2.tr, {
251
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.attachAnalyticsEvent({
251
252
  eventType: EVENT_TYPE.TRACK,
252
253
  action: ACTION.VISITED,
253
254
  actionSubject: ACTION_SUBJECT.MEDIA,
254
255
  actionSubjectId: ACTION_SUBJECT_ID.LINK
255
- }));
256
+ })(tr);
257
+ dispatch(tr);
256
258
  return true;
257
259
  }
258
260
  };
@@ -276,16 +278,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
276
278
  type: 'separator'
277
279
  });
278
280
  }
281
+ var _ref = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
282
+ hoverDecoration = _ref.hoverDecoration;
279
283
  var removeButton = {
280
284
  id: 'editor.media.delete',
281
285
  type: 'button',
282
286
  appearance: 'danger',
283
287
  focusEditoronEnter: true,
284
288
  icon: RemoveIcon,
285
- onMouseEnter: hoverDecoration(mediaSingle, true),
286
- onMouseLeave: hoverDecoration(mediaSingle, false),
287
- onFocus: hoverDecoration(mediaSingle, true),
288
- onBlur: hoverDecoration(mediaSingle, false),
289
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
290
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
291
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
292
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
289
293
  title: intl.formatMessage(commonMessages.remove),
290
294
  onClick: remove,
291
295
  testId: 'media-toolbar-remove-button'
@@ -303,6 +307,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
303
307
  return items;
304
308
  };
305
309
  export var floatingToolbar = function floatingToolbar(state, intl) {
310
+ var _pluginInjectionApi$d3;
306
311
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
307
312
  var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
308
313
  var _state$schema$nodes = state.schema.nodes,
@@ -318,6 +323,8 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
318
323
  getEditorFeatureFlags = options.getEditorFeatureFlags;
319
324
  var mediaPluginState = stateKey.getState(state);
320
325
  var mediaLinkingState = getMediaLinkingState(state);
326
+ var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
327
+ hoverDecoration = _ref2.hoverDecoration;
321
328
  if (!mediaPluginState) {
322
329
  return;
323
330
  }
@@ -356,21 +363,21 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
356
363
  var selector = mediaFilmstripItemDOMSelector(mediaOffset);
357
364
  return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
358
365
  };
359
- items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
366
+ items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
360
367
  } else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
361
368
  baseToolbar.getDomRef = function () {
362
369
  var _mediaPluginState$ele2;
363
370
  var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(MediaInlineNodeSelector));
364
371
  return element || mediaPluginState.element;
365
372
  };
366
- items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
373
+ items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
367
374
  } else {
368
375
  baseToolbar.getDomRef = function () {
369
376
  var _mediaPluginState$ele3;
370
377
  var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(MediaSingleNodeSelector));
371
378
  return element || mediaPluginState.element;
372
379
  };
373
- items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, getEditorFeatureFlags);
380
+ items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
374
381
  }
375
382
  return _objectSpread(_objectSpread({}, baseToolbar), {}, {
376
383
  items: items,
@@ -29,6 +29,7 @@ var insertPanelType = function insertPanelType(panelAttributes, state) {
29
29
  };
30
30
  var panelPlugin = function panelPlugin() {
31
31
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
+ var api = arguments.length > 1 ? arguments[1] : undefined;
32
33
  return {
33
34
  name: 'panel',
34
35
  nodes: function nodes() {
@@ -149,7 +150,7 @@ var panelPlugin = function panelPlugin() {
149
150
  return quickInsertOptions;
150
151
  },
151
152
  floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
152
- return getToolbarConfig(state, intl, options, providerFactory);
153
+ return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
153
154
  }
154
155
  }
155
156
  };
@@ -11,7 +11,6 @@ import ErrorIcon from '@atlaskit/icon/glyph/editor/error';
11
11
  import RemoveEmojiIcon from '@atlaskit/icon/glyph/editor/remove-emoji';
12
12
  import commonMessages from '../../messages';
13
13
  import { removePanel, changePanelType } from './actions';
14
- import { hoverDecoration } from '../base/pm-plugins/decoration';
15
14
  import { panelBackgroundPalette } from '../../ui/ColorPalette/Palettes/panelBackgroundPalette';
16
15
  import { getPanelTypeBackgroundNoTokens } from '@atlaskit/editor-common/panel';
17
16
  import { findPanel } from './utils';
@@ -39,7 +38,7 @@ export var panelIconMap = (_panelIconMap = {}, _defineProperty(_panelIconMap, Pa
39
38
  shortName: ':tip:',
40
39
  id: 'atlassian-tip'
41
40
  }), _panelIconMap);
42
- export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon, state) {
41
+ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, activePanelType, activePanelColor, activePanelIcon, state) {
43
42
  // TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
44
43
  var items = [{
45
44
  id: 'editor.panel.info',
@@ -242,10 +241,10 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
242
241
  focusEditoronEnter: true,
243
242
  icon: RemoveIcon,
244
243
  onClick: removePanel(),
245
- onMouseEnter: hoverDecoration(panelNodeType, true),
246
- onMouseLeave: hoverDecoration(panelNodeType, false),
247
- onFocus: hoverDecoration(panelNodeType, true),
248
- onBlur: hoverDecoration(panelNodeType, false),
244
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
245
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
246
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
247
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
249
248
  title: formatMessage(commonMessages.remove),
250
249
  tabIndex: null
251
250
  });
@@ -254,6 +253,7 @@ export var getToolbarItems = function getToolbarItems(formatMessage, panelNodeTy
254
253
  export var getToolbarConfig = function getToolbarConfig(state, intl) {
255
254
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
256
255
  var providerFactory = arguments.length > 3 ? arguments[3] : undefined;
256
+ var hoverDecoration = arguments.length > 4 ? arguments[4] : undefined;
257
257
  var formatMessage = intl.formatMessage;
258
258
  var panelObject = findPanel(state);
259
259
  if (panelObject) {
@@ -267,7 +267,7 @@ export var getToolbarConfig = function getToolbarConfig(state, intl) {
267
267
  };
268
268
 
269
269
  // force toolbar to be turned on
270
- var 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);
270
+ var 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);
271
271
  var getDomRef = function getDomRef(editorView) {
272
272
  var domAtPos = editorView.domAtPos.bind(editorView);
273
273
  var 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';
@@ -186,7 +186,7 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
186
186
  }
187
187
  };
188
188
  };
189
- var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options) {
189
+ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
190
190
  if (!options.allowInserting) {
191
191
  return plugin;
192
192
  }
@@ -205,11 +205,12 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
205
205
  });
206
206
  },
207
207
  action: function action(insert, state) {
208
+ var _api$dependencies$ana;
208
209
  var tr = state.tr;
209
210
  tr.setMeta(pluginKey, {
210
211
  showInsertPanelAt: tr.selection.anchor
211
212
  });
212
- return addAnalytics(state, tr, {
213
+ 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({
213
214
  action: ACTION.INSERTED,
214
215
  actionSubject: ACTION_SUBJECT.DOCUMENT,
215
216
  actionSubjectId: ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
@@ -217,7 +218,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
217
218
  inputMethod: INPUT_METHOD.QUICK_INSERT
218
219
  },
219
220
  eventType: EVENT_TYPE.TRACK
220
- });
221
+ })(tr);
222
+ return tr;
221
223
  }
222
224
  }];
223
225
  }
@@ -225,6 +227,6 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
225
227
  return plugin;
226
228
  };
227
229
  var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
228
- return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
230
+ return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options, api);
229
231
  };
230
232
  export default placeholderTextPlugin;
@@ -171,6 +171,25 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
171
171
  element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
172
172
  };
173
173
  }, [ref, cancel]);
174
+
175
+ // ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
176
+ // This is the expected keyboard behaviour advised by the Accessibility team
177
+ useLayoutEffect(function () {
178
+ var escape = function escape(event) {
179
+ if (event.key === 'Escape') {
180
+ cancel({
181
+ addPrefixTrigger: true,
182
+ setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
183
+ forceFocusOnEditor: true
184
+ });
185
+ }
186
+ };
187
+ var element = ref.current;
188
+ element === null || element === void 0 ? void 0 : element.addEventListener('keydown', escape);
189
+ return function () {
190
+ element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
191
+ };
192
+ }, [ref, cancel]);
174
193
  return jsx(Popup, {
175
194
  zIndex: akEditorFloatingDialogZIndex,
176
195
  target: anchorElement,
@@ -11,7 +11,6 @@ import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
11
11
  import React from 'react';
12
12
  import Editor from '../../editor';
13
13
  import EditorNext from '../../editor-next';
14
- import EditorMigrationComponent from '../../editor-next/editor-migration-component';
15
14
  import EditorWithActions from '../../labs/EditorWithActions';
16
15
  import ChromeCollapsed from '../ChromeCollapsed';
17
16
  var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
@@ -46,7 +45,7 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
46
45
  value: function render() {
47
46
  var _this2 = this;
48
47
  var child = React.Children.only(this.props.children);
49
- if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext && child.type !== EditorMigrationComponent) {
48
+ if (child.type !== Editor && child.type !== EditorWithActions && child.type !== EditorNext) {
50
49
  throw new Error('Expected child to be of type `Editor`');
51
50
  }
52
51
  if (!this.props.isExpanded) {
@@ -159,8 +159,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
159
159
  };
160
160
  var title = props.title || '';
161
161
  var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
162
- var buttonStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n padding: 0;\n }\n "])), "var(--ds-background-neutral, transparent)", /* If custom props size height, override the button base height property */
163
- !!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || 14, ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || 14);
162
+ var buttonStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n }\n "])), "var(--ds-background-neutral, transparent)", /* If custom props size height, override the button base height property */
163
+ !!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", DEFAULT_BORDER_COLOR, borderRadius(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px');
164
164
  return jsx("div", {
165
165
  css: colorPickerButtonWrapper
166
166
  }, jsx(Tooltip, {
@@ -10,8 +10,6 @@ import { Field } from '@atlaskit/form';
10
10
  import { hexToEditorTableChartsPaletteColor } from '@atlaskit/editor-palette';
11
11
  import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
12
12
  import { validate as _validate } from '../utils';
13
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
14
- import { gridSize } from '@atlaskit/theme/constants';
15
13
  import { requiredIndicator } from './common/RequiredIndicator';
16
14
  import { headingSizes } from '@atlaskit/theme/typography';
17
15
  import FieldMessages from '../FieldMessages';
@@ -368,13 +366,10 @@ var ColorPicker = function ColorPicker(props) {
368
366
  showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames,
369
367
  cols: EXPANDED_COLOR_PICKER_COLUMNS,
370
368
  alignX: "right",
371
- placement: "ConfigPanel"
372
- // TODO: Migrate away from gridSize
373
- // Recommendation: Update types of size object to accept string width/height and then replace gridSize with tokens
374
- ,
369
+ placement: "ConfigPanel",
375
370
  size: {
376
- width: 3 * gridSize(),
377
- height: 3 * gridSize()
371
+ width: "var(--ds-space-300, 24px)",
372
+ height: "var(--ds-space-300, 24px)"
378
373
  }
379
374
  }) : jsx(ColorPickerButton, {
380
375
  title: title,
@@ -385,8 +380,8 @@ var ColorPicker = function ColorPicker(props) {
385
380
  alignX: "right",
386
381
  placement: "ConfigPanel",
387
382
  size: {
388
- width: 3 * gridSize(),
389
- height: 3 * gridSize()
383
+ width: "var(--ds-space-300, 24px)",
384
+ height: "var(--ds-space-300, 24px)"
390
385
  }
391
386
  });
392
387
  };
@@ -74,18 +74,20 @@ function StatelessElementBrowser(props) {
74
74
  /* Only for hitting enter to select item when focused on search bar,
75
75
  * The actual enter key press is handled on individual items level.
76
76
  */
77
+ var selectedItem = items[selectedItemIndex];
77
78
  var onItemsEnterKeyPress = useCallback(function (e) {
78
79
  if (e.key !== 'Enter') {
79
80
  return;
80
81
  }
81
- props.onInsertItem(items[selectedItemIndex]);
82
- }, [props, items, selectedItemIndex]);
82
+ if (onSelectItem && selectedItem != null) {
83
+ onSelectItem(selectedItem);
84
+ }
85
+ }, [onSelectItem, selectedItem]);
83
86
 
84
87
  /**
85
88
  * On arrow key selection and clicks the selectedItemIndex will change.
86
89
  * Making sure to update parent component.
87
90
  */
88
- var selectedItem = items[selectedItemIndex];
89
91
  useEffect(function () {
90
92
  if (onSelectItem && selectedItem != null) {
91
93
  onSelectItem(selectedItem);
@@ -5,7 +5,13 @@ import { N30 } from '@atlaskit/theme/colors';
5
5
  export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
6
6
  export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
7
7
  export var buttonGroupStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n\n & > div {\n display: flex;\n }\n"])));
8
+
9
+ // This style is copied to packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/styles.tsx
10
+ // If you make change here, change in above file as well.
8
11
  export var separatorStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: ", ";\n width: 1px;\n height: 24px;\n display: inline-block;\n margin: 0 8px;\n user-select: none;\n"])), "var(--ds-border, ".concat(N30, ")"));
12
+
13
+ // This style is copied to packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/styles.tsx
14
+ // If you make change here, change in above file as well.
9
15
  export var wrapperStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n > div,\n > span {\n display: flex;\n }\n\n > div > div {\n display: flex;\n }\n\n margin-left: 0;\n min-width: auto;\n"])));
10
16
  export var wrapperSmallStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-left: 4px;\n min-width: 40px;\n"])));
11
17
  export var expandIconWrapperStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "184.0.0";
2
+ export var version = "185.0.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "184.0.0",
3
+ "version": "185.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,11 +4,6 @@ import React from 'react';
4
4
  import { EditorNextProps } from '../types/editor-props';
5
5
  import { Context } from './utils/editorPropTypes';
6
6
  export default class EditorNext extends React.Component<EditorNextProps> {
7
- /**
8
- * WARNING: Code should be shared between Editor + EditorNext
9
- * If you are making changes that affect both, consider making them
10
- * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
11
- */
12
7
  static defaultProps: import("../types/editor-props").EditorProps;
13
8
  static contextTypes: {
14
9
  editorActions: PropTypes.Requireable<object>;
@@ -19,7 +14,6 @@ export default class EditorNext extends React.Component<EditorNextProps> {
19
14
  };
20
15
  private editorActions;
21
16
  private createAnalyticsEvent?;
22
- private editorSessionId;
23
17
  private experienceStore?;
24
18
  private startTime?;
25
19
  constructor(props: EditorNextProps, context: Context);
@@ -1,146 +1,10 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import PropTypes from 'prop-types';
4
- import { EditorView } from 'prosemirror-view';
5
3
  import React from 'react';
6
- import type { ExtensionProvider } from '@atlaskit/editor-common/extensions';
7
- import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
8
- import type { Transformer, AllEditorPresetPluginTypes } from '@atlaskit/editor-common/types';
9
- import EditorActions from './actions';
10
- import { Context } from './editor-next/utils/editorPropTypes';
11
- import { EventDispatcher } from './event-dispatcher';
12
- import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
13
- import { QuickInsertOptions, QuickInsertProvider } from './plugins/quick-insert/types';
14
4
  import { EditorProps } from './types/editor-props';
15
- import { ProviderFactoryState } from './editor-next/hooks/useProviderFactory';
16
5
  export type { AllowedBlockTypes, Command, CommandDispatch, DomAtPos, EditorAppearance, EditorAppearanceComponentProps, EditorConfig, EditorInstance, EditorPlugin, EditorProps, ExtensionConfig, ExtensionProvidersProp, FeedbackInfo, MarkConfig, MessageDescriptor, NodeConfig, NodeViewConfig, PluginsOptions, PMPlugin, PMPluginCreateConfig, PMPluginFactory, PMPluginFactoryParams, ReactComponents, ToolbarUIComponentFactory, ToolbarUiComponentFactoryParams, UIComponentFactory, UiComponentFactoryParams, } from './types';
17
- type PresetState = {
18
- preset: EditorPresetBuilder<string[], AllEditorPresetPluginTypes[]>;
19
- };
20
- export default class Editor extends React.Component<EditorProps, ProviderFactoryState & PresetState> {
21
- /**
22
- * WARNING: Code should be shared between Editor + EditorNext
23
- * If you are making changes that affect both, consider making them
24
- * in editor-next/editor-internal.tsx or editor-next/editor-utils.ts
25
- */
6
+ export default class Editor extends React.Component<EditorProps> {
26
7
  static defaultProps: EditorProps;
27
- static contextTypes: {
28
- editorActions: PropTypes.Requireable<object>;
29
- };
30
- static propTypes: {
31
- minHeight: ({ appearance, minHeight, }: Pick<EditorProps, "appearance" | "minHeight">) => Error | null;
32
- };
33
- private providerFactory;
34
- private editorActions;
35
- private createAnalyticsEvent?;
36
8
  private editorSessionId;
37
- private experienceStore?;
38
- private startTime?;
39
- constructor(props: EditorProps, context: Context);
40
- /**
41
- * Consider any changes here to corresponding file for `EditorNext` in
42
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
43
- * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
44
- */
45
- componentDidMount(): void;
46
- /**
47
- * Consider any changes here to corresponding file for `EditorNext` in
48
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts)
49
- */
50
- componentDidUpdate(prevProps: EditorProps): void;
51
- /**
52
- * Consider any changes here to corresponding file for `EditorNext` in
53
- * `useProviderFactory` (editor-next/hooks/useProviderFactory.ts) and
54
- * `useMeasureEditorMountTime` (editor-next/hooks/useMeasureEditorMountTime.ts)
55
- */
56
- componentWillUnmount(): void;
57
- /**
58
- * @private
59
- * @deprecated - Do not override this at all, this is an anti-pattern.
60
- * Please reach out to the Editor team if you were previously using this
61
- * and need to find a workaround.
62
- */
63
- trackEditorActions(editorActions: EditorActions & {
64
- _contentRetrievalTracking?: {
65
- getValueTracked: boolean;
66
- samplingCounters: {
67
- success: number;
68
- failure: number;
69
- };
70
- };
71
- }, props: EditorProps): EditorActions<any> & {
72
- _contentRetrievalTracking?: {
73
- getValueTracked: boolean;
74
- samplingCounters: {
75
- success: number;
76
- failure: number;
77
- };
78
- } | undefined;
79
- };
80
- /**
81
- * @private
82
- * @deprecated - Do not override this at all, this is an antipattern.
83
- * Please reach out to the Editor team if you were previously using this
84
- * and need to find a workaround.
85
- */
86
- prepareExtensionProvider: (extensionProviders?: import("./types").ExtensionProvidersProp | undefined) => ExtensionProvider<any> | undefined;
87
- /**
88
- * @private
89
- * @deprecated - Do not override this at all, this is an antipattern.
90
- * Please reach out to the Editor team if you were previously using this
91
- * and need to find a workaround.
92
- */
93
- prepareQuickInsertProvider: (extensionProvider?: ExtensionProvider, quickInsert?: QuickInsertOptions) => Promise<QuickInsertProvider> | undefined;
94
- /**
95
- * @private
96
- * @deprecated - Do not override this at all, this is an antipattern.
97
- * Please reach out to the Editor team if you were previously using this
98
- * and need to find a workaround.
99
- */
100
- onEditorCreated(instance: {
101
- view: EditorView;
102
- eventDispatcher: EventDispatcher;
103
- transformer?: Transformer<string>;
104
- }): void;
105
- /**
106
- * @private
107
- * @deprecated - Do not override this at all, this is an antipattern.
108
- * Please reach out to the Editor team if you were previously using this
109
- * and need to find a workaround.
110
- */
111
- onEditorDestroyed(_instance: {
112
- view: EditorView;
113
- transformer?: Transformer<string>;
114
- }): void;
115
- /**
116
- * @private
117
- * @deprecated - Do not override this at all, this is an antipattern.
118
- * Please reach out to the Editor team if you were previously using this
119
- * and need to find a workaround.
120
- */
121
- handleSave: (view: EditorView) => void;
122
- /**
123
- * @private
124
- * @deprecated - Do not override this at all, this is an antipattern.
125
- * Please reach out to the Editor team if you were previously using this
126
- * and need to find a workaround.
127
- */
128
- handleAnalyticsEvent: FireAnalyticsCallback;
129
- /**
130
- * @private
131
- * @deprecated - Do not override this at all, this is an antipattern.
132
- * Please reach out to the Editor team if you were previously using this
133
- * and need to find a workaround.
134
- */
135
- registerEditorForActions(editorView: EditorView, eventDispatcher: EventDispatcher, contentTransformer?: Transformer<string>): void;
136
- private getFeatureFlags;
137
- /**
138
- * @private
139
- * @deprecated - Do not override this at all, this is an antipattern.
140
- * Please reach out to the Editor team if you were previously using this
141
- * and need to find a workaround.
142
- */
143
- unregisterEditorFromActions(): void;
144
- private getExperienceStore;
145
9
  render(): jsx.JSX.Element;
146
10
  }