@atlaskit/editor-core 183.1.6 → 184.0.4

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 (237) hide show
  1. package/.eslintrc.js +7 -3
  2. package/CHANGELOG.md +29 -0
  3. package/dist/cjs/labs/next/full-page.js +2 -6
  4. package/dist/cjs/labs/next/presets/create-stub-internal-apis.js +4 -2
  5. package/dist/cjs/labs/next/presets/default.js +2 -2
  6. package/dist/cjs/labs/next/presets/universal.js +2 -1
  7. package/dist/cjs/plugins/breakout/index.js +54 -35
  8. package/dist/cjs/plugins/card/toolbar.js +4 -3
  9. package/dist/cjs/plugins/collab-edit/plugin-state.js +2 -3
  10. package/dist/cjs/plugins/copy-button/commands.js +8 -1
  11. package/dist/cjs/plugins/extension/index.js +1 -1
  12. package/dist/cjs/plugins/extension/nodeviews/extension.js +5 -3
  13. package/dist/cjs/plugins/extension/pm-plugins/main.js +6 -6
  14. package/dist/cjs/plugins/extension/ui/Extension/Extension/index.js +34 -4
  15. package/dist/cjs/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  16. package/dist/cjs/plugins/extension/ui/Extension/index.js +4 -2
  17. package/dist/cjs/plugins/help-dialog/index.js +12 -8
  18. package/dist/cjs/plugins/index.js +0 -14
  19. package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -1
  20. package/dist/cjs/plugins/media/index.js +15 -5
  21. package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
  22. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +53 -34
  23. package/dist/cjs/plugins/media/styles.js +1 -1
  24. package/dist/cjs/plugins/media/toolbar/index.js +4 -3
  25. package/dist/cjs/plugins/paste/pm-plugins/main.js +7 -1
  26. package/dist/cjs/test-utils.js +6 -1
  27. package/dist/cjs/ui/Appearance/Comment/Comment.js +2 -2
  28. package/dist/cjs/ui/Appearance/FullPage/FullPage.js +2 -2
  29. package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +1 -2
  30. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +2 -2
  31. package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
  32. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
  33. package/dist/cjs/ui/ContentStyles/index.js +9 -10
  34. package/dist/cjs/ui/ContextPanel/index.js +67 -56
  35. package/dist/cjs/ui/MediaAndEmbedsToolbar/index.js +10 -11
  36. package/dist/cjs/ui/Resizer/index.js +8 -8
  37. package/dist/cjs/ui/WidthEmitter/index.js +10 -4
  38. package/dist/cjs/ui/styles.js +6 -0
  39. package/dist/cjs/utils/clipboard.js +18 -11
  40. package/dist/cjs/utils/performance/instrumented-plugin.js +14 -2
  41. package/dist/cjs/version-wrapper.js +1 -1
  42. package/dist/cjs/version.json +1 -1
  43. package/dist/es2019/labs/next/full-page.js +2 -5
  44. package/dist/es2019/labs/next/presets/create-stub-internal-apis.js +4 -2
  45. package/dist/es2019/labs/next/presets/default.js +1 -1
  46. package/dist/es2019/labs/next/presets/universal.js +2 -1
  47. package/dist/es2019/plugins/breakout/index.js +48 -31
  48. package/dist/es2019/plugins/card/toolbar.js +4 -3
  49. package/dist/es2019/plugins/collab-edit/plugin-state.js +2 -4
  50. package/dist/es2019/plugins/copy-button/commands.js +9 -2
  51. package/dist/es2019/plugins/extension/index.js +1 -1
  52. package/dist/es2019/plugins/extension/nodeviews/extension.js +5 -3
  53. package/dist/es2019/plugins/extension/pm-plugins/main.js +4 -4
  54. package/dist/es2019/plugins/extension/ui/Extension/Extension/index.js +38 -2
  55. package/dist/es2019/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  56. package/dist/es2019/plugins/extension/ui/Extension/index.js +4 -2
  57. package/dist/es2019/plugins/help-dialog/index.js +14 -9
  58. package/dist/es2019/plugins/index.js +0 -2
  59. package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -1
  60. package/dist/es2019/plugins/media/index.js +15 -5
  61. package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +21 -10
  62. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +53 -33
  63. package/dist/es2019/plugins/media/styles.js +1 -7
  64. package/dist/es2019/plugins/media/toolbar/index.js +4 -4
  65. package/dist/es2019/plugins/paste/pm-plugins/main.js +7 -1
  66. package/dist/es2019/test-utils.js +6 -1
  67. package/dist/es2019/ui/Appearance/Comment/Comment.js +1 -1
  68. package/dist/es2019/ui/Appearance/FullPage/FullPage.js +1 -1
  69. package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
  70. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  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/ContentStyles/index.js +1 -2
  74. package/dist/es2019/ui/ContextPanel/index.js +66 -43
  75. package/dist/es2019/ui/MediaAndEmbedsToolbar/index.js +8 -9
  76. package/dist/es2019/ui/Resizer/index.js +1 -1
  77. package/dist/es2019/ui/WidthEmitter/index.js +10 -4
  78. package/dist/es2019/ui/styles.js +6 -0
  79. package/dist/es2019/utils/clipboard.js +12 -7
  80. package/dist/es2019/utils/performance/instrumented-plugin.js +15 -2
  81. package/dist/es2019/version-wrapper.js +1 -1
  82. package/dist/es2019/version.json +1 -1
  83. package/dist/esm/labs/next/full-page.js +2 -5
  84. package/dist/esm/labs/next/presets/create-stub-internal-apis.js +4 -2
  85. package/dist/esm/labs/next/presets/default.js +1 -1
  86. package/dist/esm/labs/next/presets/universal.js +2 -1
  87. package/dist/esm/plugins/breakout/index.js +54 -35
  88. package/dist/esm/plugins/card/toolbar.js +4 -3
  89. package/dist/esm/plugins/collab-edit/plugin-state.js +2 -3
  90. package/dist/esm/plugins/copy-button/commands.js +9 -2
  91. package/dist/esm/plugins/extension/index.js +1 -1
  92. package/dist/esm/plugins/extension/nodeviews/extension.js +5 -3
  93. package/dist/esm/plugins/extension/pm-plugins/main.js +6 -6
  94. package/dist/esm/plugins/extension/ui/Extension/Extension/index.js +33 -2
  95. package/dist/esm/plugins/extension/ui/Extension/ExtensionComponent.js +4 -2
  96. package/dist/esm/plugins/extension/ui/Extension/index.js +4 -2
  97. package/dist/esm/plugins/help-dialog/index.js +12 -8
  98. package/dist/esm/plugins/index.js +0 -2
  99. package/dist/esm/plugins/layout/pm-plugins/main.js +0 -1
  100. package/dist/esm/plugins/media/index.js +15 -5
  101. package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +22 -14
  102. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +54 -35
  103. package/dist/esm/plugins/media/styles.js +2 -2
  104. package/dist/esm/plugins/media/toolbar/index.js +4 -3
  105. package/dist/esm/plugins/paste/pm-plugins/main.js +7 -1
  106. package/dist/esm/test-utils.js +6 -1
  107. package/dist/esm/ui/Appearance/Comment/Comment.js +1 -1
  108. package/dist/esm/ui/Appearance/FullPage/FullPage.js +1 -1
  109. package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +1 -1
  110. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  111. package/dist/esm/ui/ColorPickerButton/index.js +2 -2
  112. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
  113. package/dist/esm/ui/ContentStyles/index.js +1 -2
  114. package/dist/esm/ui/ContextPanel/index.js +64 -53
  115. package/dist/esm/ui/MediaAndEmbedsToolbar/index.js +10 -11
  116. package/dist/esm/ui/Resizer/index.js +1 -1
  117. package/dist/esm/ui/WidthEmitter/index.js +10 -4
  118. package/dist/esm/ui/styles.js +6 -0
  119. package/dist/esm/utils/clipboard.js +16 -10
  120. package/dist/esm/utils/performance/instrumented-plugin.js +14 -2
  121. package/dist/esm/version-wrapper.js +1 -1
  122. package/dist/esm/version.json +1 -1
  123. package/dist/types/actions/index.d.ts +1 -1
  124. package/dist/types/create-editor/get-plugins.d.ts +2 -0
  125. package/dist/types/index.d.ts +0 -1
  126. package/dist/types/plugins/breakout/index.d.ts +4 -0
  127. package/dist/types/plugins/breakout/ui/LayoutButton.d.ts +1 -1
  128. package/dist/types/plugins/card/index.d.ts +2 -2
  129. package/dist/types/plugins/collab-edit/actions.d.ts +3 -2
  130. package/dist/types/plugins/collab-edit/events/handlers.d.ts +3 -3
  131. package/dist/types/plugins/collab-edit/events/initialize.d.ts +1 -1
  132. package/dist/types/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  133. package/dist/types/plugins/collab-edit/index.d.ts +0 -1
  134. package/dist/types/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  135. package/dist/types/plugins/collab-edit/participants.d.ts +1 -1
  136. package/dist/types/plugins/collab-edit/plugin.d.ts +0 -2
  137. package/dist/types/plugins/collab-edit/types.d.ts +1 -3
  138. package/dist/types/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  139. package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
  140. package/dist/types/plugins/extension/index.d.ts +2 -1
  141. package/dist/types/plugins/extension/nodeviews/extension.d.ts +4 -1
  142. package/dist/types/plugins/extension/pm-plugins/main.d.ts +3 -1
  143. package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
  144. package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
  145. package/dist/types/plugins/extension/ui/Extension/index.d.ts +3 -0
  146. package/dist/types/plugins/help-dialog/index.d.ts +3 -1
  147. package/dist/types/plugins/index.d.ts +0 -3
  148. package/dist/types/plugins/media/index.d.ts +12 -2
  149. package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
  150. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  151. package/dist/types/plugins/media/nodeviews/types.d.ts +2 -1
  152. package/dist/types/plugins/media/toolbar/index.d.ts +3 -1
  153. package/dist/types/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
  154. package/dist/types/test-utils.d.ts +3 -1
  155. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  156. package/dist/types/ui/ColorPickerButton/index.d.ts +3 -3
  157. package/dist/types/ui/ContextPanel/index.d.ts +3 -4
  158. package/dist/types/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
  159. package/dist/types/ui/PluginSlot/index.d.ts +1 -1
  160. package/dist/types/ui/Resizer/types.d.ts +2 -2
  161. package/dist/types/utils/clipboard.d.ts +1 -0
  162. package/dist/types-ts4.5/actions/index.d.ts +1 -1
  163. package/dist/types-ts4.5/create-editor/get-plugins.d.ts +2 -0
  164. package/dist/types-ts4.5/index.d.ts +0 -1
  165. package/dist/types-ts4.5/plugins/breakout/index.d.ts +6 -0
  166. package/dist/types-ts4.5/plugins/breakout/ui/LayoutButton.d.ts +1 -1
  167. package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
  168. package/dist/types-ts4.5/plugins/collab-edit/actions.d.ts +3 -2
  169. package/dist/types-ts4.5/plugins/collab-edit/events/handlers.d.ts +3 -3
  170. package/dist/types-ts4.5/plugins/collab-edit/events/initialize.d.ts +1 -1
  171. package/dist/types-ts4.5/plugins/collab-edit/events/send-transaction.d.ts +1 -1
  172. package/dist/types-ts4.5/plugins/collab-edit/index.d.ts +0 -1
  173. package/dist/types-ts4.5/plugins/collab-edit/native-collab-provider-plugin.d.ts +2 -2
  174. package/dist/types-ts4.5/plugins/collab-edit/participants.d.ts +1 -1
  175. package/dist/types-ts4.5/plugins/collab-edit/plugin.d.ts +0 -2
  176. package/dist/types-ts4.5/plugins/collab-edit/types.d.ts +1 -3
  177. package/dist/types-ts4.5/plugins/collab-edit/ui/to-avatar.d.ts +1 -1
  178. package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
  179. package/dist/types-ts4.5/plugins/extension/index.d.ts +3 -1
  180. package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +4 -1
  181. package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +3 -1
  182. package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +6 -0
  183. package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +3 -0
  184. package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +3 -0
  185. package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +5 -1
  186. package/dist/types-ts4.5/plugins/index.d.ts +0 -3
  187. package/dist/types-ts4.5/plugins/media/index.d.ts +9 -2
  188. package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +4 -2
  189. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  190. package/dist/types-ts4.5/plugins/media/nodeviews/types.d.ts +2 -1
  191. package/dist/types-ts4.5/plugins/media/toolbar/index.d.ts +3 -1
  192. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/types.d.ts +2 -2
  193. package/dist/types-ts4.5/test-utils.d.ts +3 -1
  194. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  195. package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +3 -3
  196. package/dist/types-ts4.5/ui/ContextPanel/index.d.ts +3 -4
  197. package/dist/types-ts4.5/ui/MediaAndEmbedsToolbar/index.d.ts +3 -1
  198. package/dist/types-ts4.5/ui/PluginSlot/index.d.ts +1 -1
  199. package/dist/types-ts4.5/ui/Resizer/types.d.ts +2 -2
  200. package/dist/types-ts4.5/utils/clipboard.d.ts +1 -0
  201. package/package.json +25 -23
  202. package/report.api.md +15 -63
  203. package/dist/cjs/plugins/collab-edit/provider/index.js +0 -5
  204. package/dist/cjs/plugins/collab-edit/provider/types.js +0 -5
  205. package/dist/cjs/plugins/grid/index.js +0 -207
  206. package/dist/cjs/plugins/grid/styles.js +0 -16
  207. package/dist/cjs/plugins/grid/types.js +0 -5
  208. package/dist/cjs/plugins/width/index.js +0 -88
  209. package/dist/cjs/ui/ContextPanel/context.js +0 -89
  210. package/dist/es2019/plugins/collab-edit/provider/index.js +0 -1
  211. package/dist/es2019/plugins/collab-edit/provider/types.js +0 -1
  212. package/dist/es2019/plugins/grid/index.js +0 -168
  213. package/dist/es2019/plugins/grid/styles.js +0 -36
  214. package/dist/es2019/plugins/grid/types.js +0 -1
  215. package/dist/es2019/plugins/width/index.js +0 -72
  216. package/dist/es2019/ui/ContextPanel/context.js +0 -65
  217. package/dist/esm/plugins/collab-edit/provider/index.js +0 -1
  218. package/dist/esm/plugins/collab-edit/provider/types.js +0 -1
  219. package/dist/esm/plugins/grid/index.js +0 -191
  220. package/dist/esm/plugins/grid/styles.js +0 -7
  221. package/dist/esm/plugins/grid/types.js +0 -1
  222. package/dist/esm/plugins/width/index.js +0 -78
  223. package/dist/esm/ui/ContextPanel/context.js +0 -79
  224. package/dist/types/plugins/collab-edit/provider/index.d.ts +0 -1
  225. package/dist/types/plugins/collab-edit/provider/types.d.ts +0 -1
  226. package/dist/types/plugins/grid/index.d.ts +0 -25
  227. package/dist/types/plugins/grid/styles.d.ts +0 -2
  228. package/dist/types/plugins/grid/types.d.ts +0 -7
  229. package/dist/types/plugins/width/index.d.ts +0 -18
  230. package/dist/types/ui/ContextPanel/context.d.ts +0 -24
  231. package/dist/types-ts4.5/plugins/collab-edit/provider/index.d.ts +0 -1
  232. package/dist/types-ts4.5/plugins/collab-edit/provider/types.d.ts +0 -1
  233. package/dist/types-ts4.5/plugins/grid/index.d.ts +0 -27
  234. package/dist/types-ts4.5/plugins/grid/styles.d.ts +0 -2
  235. package/dist/types-ts4.5/plugins/grid/types.d.ts +0 -7
  236. package/dist/types-ts4.5/plugins/width/index.d.ts +0 -18
  237. package/dist/types-ts4.5/ui/ContextPanel/context.d.ts +0 -24
@@ -7,11 +7,9 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
7
7
  import { MediaSingle, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
8
8
  import { browser } from '@atlaskit/editor-common/utils';
9
9
  import { isNodeSelectedOrInRange } from '../../../utils/nodes';
10
- import WithPluginState from '../../../ui/WithPluginState';
11
- import { pluginKey as widthPluginKey } from '../../width';
12
10
  import { setNodeSelection, setTextSelection } from '../../../utils';
13
11
  import ResizableMediaSingle from '../ui/ResizableMediaSingle';
14
- import { stateKey as mediaPluginKey, MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
12
+ import { MEDIA_CONTENT_WRAP_CLASS_NAME } from '../pm-plugins/main';
15
13
  import { MediaNodeUpdater } from './mediaNodeUpdater';
16
14
  import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
17
15
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -24,6 +22,7 @@ import ReactNodeView from '../../../nodeviews/ReactNodeView';
24
22
  import CaptionPlaceholder from '../ui/CaptionPlaceholder';
25
23
  import { NodeSelection } from 'prosemirror-state';
26
24
  import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
25
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
27
26
  export default class MediaSingleNode extends Component {
28
27
  constructor(...args) {
29
28
  super(...args);
@@ -158,12 +157,12 @@ export default class MediaSingleNode extends Component {
158
157
  (_this$captionPlaceHol = this.captionPlaceHolderRef.current) === null || _this$captionPlaceHol === void 0 ? void 0 : _this$captionPlaceHol.click();
159
158
  });
160
159
  _defineProperty(this, "displayGrid", (visible, gridType, highlight) => {
161
- var _pluginInjectionApi$d, _pluginInjectionApi$d2;
160
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3;
162
161
  const {
163
162
  pluginInjectionApi,
164
163
  view
165
164
  } = this.props;
166
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.displayGrid(view)({
165
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d === void 0 ? void 0 : (_pluginInjectionApi$d2 = _pluginInjectionApi$d.grid) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.actions) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : _pluginInjectionApi$d3.displayGrid(view)({
167
166
  visible,
168
167
  gridType,
169
168
  highlight: highlight
@@ -321,6 +320,42 @@ _defineProperty(MediaSingleNode, "defaultProps", {
321
320
  mediaOptions: {}
322
321
  });
323
322
  _defineProperty(MediaSingleNode, "displayName", 'MediaSingleNode');
323
+ const MediaSingleNodeWrapper = ({
324
+ pluginInjectionApi,
325
+ mediaProvider,
326
+ contextIdentifierProvider,
327
+ node,
328
+ getPos,
329
+ mediaOptions,
330
+ view,
331
+ fullWidthMode,
332
+ selected,
333
+ eventDispatcher,
334
+ dispatchAnalyticsEvent,
335
+ forwardRef
336
+ }) => {
337
+ const {
338
+ widthState,
339
+ mediaState
340
+ } = useSharedPluginState(pluginInjectionApi, ['width', 'media']);
341
+ return jsx(MediaSingleNode, {
342
+ width: widthState.width,
343
+ lineLength: widthState.lineLength,
344
+ node: node,
345
+ getPos: getPos,
346
+ mediaProvider: mediaProvider,
347
+ contextIdentifierProvider: contextIdentifierProvider,
348
+ mediaOptions: mediaOptions,
349
+ view: view,
350
+ fullWidthMode: fullWidthMode,
351
+ selected: selected,
352
+ eventDispatcher: eventDispatcher,
353
+ mediaPluginState: mediaState !== null && mediaState !== void 0 ? mediaState : undefined,
354
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
355
+ forwardRef: forwardRef,
356
+ pluginInjectionApi: pluginInjectionApi
357
+ });
358
+ };
324
359
  class MediaSingleNodeView extends ReactNodeView {
325
360
  constructor(...args) {
326
361
  super(...args);
@@ -404,34 +439,19 @@ class MediaSingleNodeView extends ReactNodeView {
404
439
  mediaProvider,
405
440
  contextIdentifierProvider
406
441
  }) => {
407
- return jsx(WithPluginState, {
408
- editorView: this.view,
409
- plugins: {
410
- width: widthPluginKey,
411
- mediaPluginState: mediaPluginKey
412
- },
413
- render: ({
414
- width,
415
- mediaPluginState
416
- }) => {
417
- return jsx(MediaSingleNode, {
418
- width: width.width,
419
- lineLength: width.lineLength,
420
- node: this.node,
421
- getPos: getPos,
422
- mediaProvider: mediaProvider,
423
- contextIdentifierProvider: contextIdentifierProvider,
424
- mediaOptions: mediaOptions,
425
- view: this.view,
426
- fullWidthMode: fullWidthMode,
427
- selected: this.isNodeSelected,
428
- eventDispatcher: eventDispatcher,
429
- mediaPluginState: mediaPluginState,
430
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
431
- forwardRef: forwardRef,
432
- pluginInjectionApi: pluginInjectionApi
433
- });
434
- }
442
+ return jsx(MediaSingleNodeWrapper, {
443
+ pluginInjectionApi: pluginInjectionApi,
444
+ mediaProvider: mediaProvider,
445
+ contextIdentifierProvider: contextIdentifierProvider,
446
+ node: this.node,
447
+ getPos: getPos,
448
+ mediaOptions: mediaOptions,
449
+ view: this.view,
450
+ fullWidthMode: fullWidthMode,
451
+ selected: this.isNodeSelected,
452
+ eventDispatcher: eventDispatcher,
453
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
454
+ forwardRef: forwardRef
435
455
  });
436
456
  }
437
457
  });
@@ -2,7 +2,7 @@ import { css } from '@emotion/react';
2
2
  import { mediaSingleSharedStyle, richMediaClassName } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorDeleteBorder, akEditorDeleteBackground, akEditorSelectedBorderBoldSize, akEditorMediaResizeHandlerPaddingWide, akEditorMediaResizeHandlerPadding, akEditorSelectedNodeClassName, akEditorDeleteIconColor } from '@atlaskit/editor-shared-styles';
4
4
  import { N60, B200 } from '@atlaskit/theme/colors';
5
- import { fileCardImageViewSelector, fileCardImageViewSelectedSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
5
+ import { fileCardImageViewSelector, inlinePlayerClassName, newFileExperienceClassName } from '@atlaskit/media-card';
6
6
  export const mediaStyles = css`
7
7
  .ProseMirror {
8
8
  ${mediaSingleSharedStyle} & [layout='full-width'] .${richMediaClassName},
@@ -120,12 +120,6 @@ export const mediaStyles = css`
120
120
  ${`var(--ds-border-danger, ${akEditorDeleteBorder})`};
121
121
  transition: background-color 0s, box-shadow 0s;
122
122
  }
123
- .mediaGroupView-content-wrap.danger {
124
- /* Media inline */
125
- .${fileCardImageViewSelectedSelector}::after {
126
- border: 1px solid ${`var(--ds-border-danger, ${akEditorDeleteIconColor})`};
127
- }
128
- }
129
123
  /* Danger when nested node or common */
130
124
  .danger {
131
125
  /* Media single */
@@ -187,7 +187,7 @@ const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState) => {
187
187
  }];
188
188
  return items;
189
189
  };
190
- const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, getEditorFeatureFlags) => {
190
+ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, widthPluginDependencyApi, getEditorFeatureFlags) => {
191
191
  const {
192
192
  mediaSingle
193
193
  } = state.schema.nodes;
@@ -230,7 +230,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
230
230
  });
231
231
  }
232
232
  if (allowAdvancedToolBarOptions) {
233
- toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, allowResizing, allowResizingInTables)];
233
+ toolbarButtons = [...toolbarButtons, ...buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, widthPluginDependencyApi, allowResizing, allowResizingInTables)];
234
234
  if (toolbarButtons.length) {
235
235
  toolbarButtons.push({
236
236
  type: 'separator'
@@ -312,7 +312,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
312
312
  }, removeButton];
313
313
  return items;
314
314
  };
315
- export const floatingToolbar = (state, intl, options = {}) => {
315
+ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) => {
316
316
  const {
317
317
  media,
318
318
  mediaInline,
@@ -379,7 +379,7 @@ export const floatingToolbar = (state, intl, options = {}) => {
379
379
  const element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(`.${MediaSingleNodeSelector}`);
380
380
  return element || mediaPluginState.element;
381
381
  };
382
- items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, getEditorFeatureFlags);
382
+ items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, getEditorFeatureFlags);
383
383
  }
384
384
  return {
385
385
  ...baseToolbar,
@@ -29,6 +29,7 @@ import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
29
29
  import { extractSliceFromStep } from '../../../utils/step';
30
30
  import { pluginKey as stateKey, createPluginState } from './plugin-factory';
31
31
  export { pluginKey as stateKey } from './plugin-factory';
32
+ import { hasParentNodeOfType } from 'prosemirror-utils';
32
33
  export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, cardOptions, sanitizePrivateContent, providerFactory) {
33
34
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
34
35
  function getMarkdownSlice(text, openStart, openEnd) {
@@ -158,6 +159,11 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
158
159
  } = state.schema.nodes;
159
160
  const isPastingTextInsidePlaceholderText = ((_state$doc$resolve$no = state.doc.resolve(state.selection.$anchor.pos).nodeAfter) === null || _state$doc$resolve$no === void 0 ? void 0 : _state$doc$resolve$no.type) === placeholder;
160
161
 
162
+ // Don't add closeHistory if we're pasting over layout columns, as we will appendTransaction
163
+ // to cleanup the layout's structure and we want to keep the paste and re-structuring as
164
+ // one event.
165
+ const isPastingOverLayoutColumns = hasParentNodeOfType(state.schema.nodes.layoutColumn)(state.selection);
166
+
161
167
  // don't add closeHistory call if we're pasting a table, as some tables may involve additional
162
168
  // appendedTransactions to repair them (if they're partial or incomplete) and we don't want
163
169
  // to split those repairing transactions in prosemirror-history when they're being added to the
@@ -173,7 +179,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
173
179
  });
174
180
  return tableExists;
175
181
  });
176
- if (!isPastingTextInsidePlaceholderText && !isPastingTable) {
182
+ if (!isPastingTextInsidePlaceholderText && !isPastingTable && !isPastingOverLayoutColumns) {
177
183
  tr.setMeta(betterTypePluginKey, true);
178
184
  }
179
185
  addLinkMetadata(view.state.selection, tr, {
@@ -38,6 +38,9 @@ function lightProcessPluginsList(editorPlugins) {
38
38
  if (editorPlugin.nodes) {
39
39
  acc.nodes.push(...editorPlugin.nodes());
40
40
  }
41
+ if (editorPlugin.contentComponent) {
42
+ acc.contentComponents.push(editorPlugin.contentComponent);
43
+ }
41
44
  if (editorPlugin.onEditorViewStateUpdated) {
42
45
  acc.onEditorViewStateUpdatedCallbacks.push(editorPlugin.onEditorViewStateUpdated);
43
46
  }
@@ -46,6 +49,7 @@ function lightProcessPluginsList(editorPlugins) {
46
49
  nodes: [],
47
50
  marks: [],
48
51
  plugins: [],
52
+ contentComponents: [],
49
53
  onEditorViewStateUpdatedCallbacks: []
50
54
  });
51
55
  }
@@ -66,7 +70,8 @@ export const createPMSchemaAndPlugins = (inputPreset = new EditorPresetBuilder()
66
70
  return {
67
71
  plugins,
68
72
  schema,
69
- onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks
73
+ onEditorViewStateUpdatedCallbacks: editorConfig.onEditorViewStateUpdatedCallbacks,
74
+ editorConfig
70
75
  };
71
76
  };
72
77
  export { PortalProviderAPI } from './ui/PortalProvider';
@@ -17,7 +17,7 @@ import WithFlash from '../../WithFlash';
17
17
  import { WidthConsumer } from '@atlaskit/editor-common/ui';
18
18
  import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
19
19
  import WidthEmitter from '../../WidthEmitter';
20
- import { GRID_GUTTER } from '../../../plugins/grid';
20
+ import { GRID_GUTTER } from '@atlaskit/editor-common/styles';
21
21
  import classnames from 'classnames';
22
22
  import { injectIntl } from 'react-intl-next';
23
23
  import messages from '../../../messages';
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
5
5
  import rafSchedule from 'raf-schd';
6
6
  import { akEditorToolbarKeylineHeight } from '@atlaskit/editor-shared-styles';
7
7
  import { fullPageEditorWrapper } from './StyledComponents';
8
- import { ContextPanelWidthProvider } from '../../ContextPanel/context';
8
+ import { ContextPanelWidthProvider } from '@atlaskit/editor-common/ui';
9
9
  import { FullPageContentArea } from './FullPageContentArea';
10
10
  import { FullPageToolbar } from './FullPageToolbar';
11
11
  export class FullPageEditor extends React.Component {
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx, useTheme } from '@emotion/react';
3
3
  import { WidthConsumer } from '@atlaskit/editor-common/ui';
4
- import { ContextPanelConsumer } from '../../ContextPanel/context';
4
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
5
5
  import React from 'react';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { ClickAreaBlock } from '../../Addon';
@@ -7,7 +7,7 @@ import FindReplaceToolbarButtonWithState from '../../../plugins/find-replace/Fin
7
7
  import { BeforePrimaryToolbarWrapper } from '../../../plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper';
8
8
  import Toolbar from '../../Toolbar';
9
9
  import { mainToolbarStyle, mainToolbarIconBeforeStyle, mainToolbarFirstChildStyle, mainToolbarSecondChildStyle, nonCustomToolbarWrapperStyle, customToolbarWrapperStyle, MAXIMUM_TWO_LINE_TOOLBAR_BREAKPOINT } from './MainToolbar';
10
- import { ContextPanelConsumer } from '../../ContextPanel/context';
10
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
11
11
  import messages from './messages';
12
12
  import { ToolbarArrowKeyNavigationProvider } from '../../ToolbarArrowKeyNavigationProvider';
13
13
  export const EditorToolbar = /*#__PURE__*/React.memo(props => {
@@ -165,8 +165,8 @@ const ColorPickerButton = props => {
165
165
  border: 1px solid ${DEFAULT_BORDER_COLOR};
166
166
  border-radius: ${borderRadius()}px;
167
167
  background-color: ${currentColor || 'transparent'};
168
- width: ${((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || 14}px;
169
- height: ${((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || 14}px;
168
+ width: ${((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px'};
169
+ height: ${((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px'};
170
170
  padding: 0;
171
171
  }
172
172
  `;
@@ -5,8 +5,6 @@ import { Field } from '@atlaskit/form';
5
5
  import { hexToEditorTableChartsPaletteColor } from '@atlaskit/editor-palette';
6
6
  import { DEFAULT_BORDER_COLOR } from '../../../ui/ColorPalette/Palettes/common';
7
7
  import { validate } from '../utils';
8
- // eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
9
- import { gridSize } from '@atlaskit/theme/constants';
10
8
  import { requiredIndicator } from './common/RequiredIndicator';
11
9
  import { headingSizes } from '@atlaskit/theme/typography';
12
10
  import FieldMessages from '../FieldMessages';
@@ -373,13 +371,10 @@ const ColorPicker = props => {
373
371
  showSomewhatSemanticTooltips: useSomewhatSemanticTextColorNames,
374
372
  cols: EXPANDED_COLOR_PICKER_COLUMNS,
375
373
  alignX: "right",
376
- placement: "ConfigPanel"
377
- // TODO: Migrate away from gridSize
378
- // Recommendation: Update types of size object to accept string width/height and then replace gridSize with tokens
379
- ,
374
+ placement: "ConfigPanel",
380
375
  size: {
381
- width: 3 * gridSize(),
382
- height: 3 * gridSize()
376
+ width: "var(--ds-space-300, 24px)",
377
+ height: "var(--ds-space-300, 24px)"
383
378
  }
384
379
  }) : jsx(ColorPickerButton, {
385
380
  title: title,
@@ -390,8 +385,8 @@ const ColorPicker = props => {
390
385
  alignX: "right",
391
386
  placement: "ConfigPanel",
392
387
  size: {
393
- width: 3 * gridSize(),
394
- height: 3 * gridSize()
388
+ width: "var(--ds-space-300, 24px)",
389
+ height: "var(--ds-space-300, 24px)"
395
390
  }
396
391
  });
397
392
  };
@@ -1,7 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import React, { useMemo } from 'react';
3
3
  import { jsx, css, useTheme } from '@emotion/react';
4
- import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles } from '@atlaskit/editor-common/styles';
4
+ import { whitespaceSharedStyles, paragraphSharedStyles, listsSharedStyles, indentationSharedStyles, blockMarksSharedStyles, shadowSharedStyle, dateSharedStyle, tasksAndDecisionsStyles, annotationSharedStyles, smartCardSharedStyles, textColorStyles, resizerStyles, gridStyles } from '@atlaskit/editor-common/styles';
5
5
  import { editorFontSize } from '@atlaskit/editor-shared-styles';
6
6
  import { unsupportedStyles } from '../../plugins/unsupported-content/styles';
7
7
  import { telepointerStyle } from '../../plugins/collab-edit/styles';
@@ -20,7 +20,6 @@ import { mentionsStyles } from '../../plugins/mentions/styles';
20
20
  import { emojiStyles } from '../../plugins/emoji/styles';
21
21
  import { textFormattingStyles } from '../../plugins/text-formatting/styles';
22
22
  import { placeholderTextStyles } from '../../plugins/placeholder-text/styles';
23
- import { gridStyles } from '../../plugins/grid/styles';
24
23
  import { linkStyles } from '../../plugins/hyperlink/styles';
25
24
  import { extensionStyles } from '../../plugins/extension/ui/styles';
26
25
  import { expandStyles } from '../../plugins/expand/ui/styles';
@@ -6,10 +6,9 @@ import { css, jsx } from '@emotion/react';
6
6
  import Transition from 'react-transition-group/Transition';
7
7
  import { N30 } from '@atlaskit/theme/colors';
8
8
  import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
9
- import { ContextPanelConsumer } from './context';
9
+ import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
10
10
  import WithPluginState from '../WithPluginState';
11
11
  import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
12
- import { pluginKey as widthPluginKey } from '../../plugins/width';
13
12
  import WithEditorActions from '../WithEditorActions';
14
13
  import { getChildBreakoutModes } from '../../utils/document';
15
14
  const ANIM_SPEED_MS = 500;
@@ -58,6 +57,15 @@ export class SwappableContentArea extends React.PureComponent {
58
57
  mounted: false,
59
58
  currentPluginContent: undefined
60
59
  });
60
+ _defineProperty(this, "focusEditor", () => {
61
+ const {
62
+ editorView
63
+ } = this.props;
64
+ if (editorView && !editorView.hasFocus()) {
65
+ var _editorView$focus;
66
+ (_editorView$focus = editorView.focus) === null || _editorView$focus === void 0 ? void 0 : _editorView$focus.call(editorView);
67
+ }
68
+ });
61
69
  _defineProperty(this, "showPluginContent", () => {
62
70
  const {
63
71
  pluginContent
@@ -87,7 +95,8 @@ export class SwappableContentArea extends React.PureComponent {
87
95
  timeout: this.state.mounted ? ANIM_SPEED_MS : 0,
88
96
  in: isVisible,
89
97
  mountOnEnter: true,
90
- unmountOnExit: true
98
+ unmountOnExit: true,
99
+ onExiting: this.focusEditor
91
100
  }, children);
92
101
  });
93
102
  }
@@ -123,8 +132,9 @@ export class SwappableContentArea extends React.PureComponent {
123
132
  broadcastPosition,
124
133
  positionedOverEditor
125
134
  }) => {
135
+ const contextPanelWidth = visible ? width : 0;
126
136
  const newPosition = editorWidth ? shouldPanelBePositionedOverEditor(editorWidth, width) : false;
127
- broadcastWidth(visible ? width : 0);
137
+ broadcastWidth(contextPanelWidth);
128
138
  (newPosition && visible) !== positionedOverEditor && broadcastPosition(newPosition && visible);
129
139
  return jsx("div", {
130
140
  css: [panel, !visible && panelHidden,
@@ -143,44 +153,57 @@ export class SwappableContentArea extends React.PureComponent {
143
153
  });
144
154
  }
145
155
  }
146
- export default class ContextPanel extends React.Component {
147
- render() {
148
- return jsx(WithEditorActions, {
149
- render: actions => {
150
- const eventDispatcher = actions._privateGetEventDispatcher();
151
- const editorView = actions._privateGetEditorView();
152
- if (!eventDispatcher) {
153
- return jsx(SwappableContentArea, _extends({
154
- editorView: editorView
155
- }, this.props));
156
- }
157
- return jsx(WithPluginState, {
158
- eventDispatcher: eventDispatcher,
159
- plugins: {
160
- contextPanel: contextPanelPluginKey,
161
- widthState: widthPluginKey
162
- },
163
- render: ({
164
- contextPanel,
165
- widthState = {
166
- width: 0,
167
- containerWidth: 0,
168
- lineLength: akEditorDefaultLayoutWidth
169
- }
170
- }) => {
171
- const firstContent = contextPanel && contextPanel.contents.find(Boolean);
172
- const editorWidth = {
173
- ...widthState,
174
- contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
175
- };
176
- return jsx(SwappableContentArea, _extends({}, this.props, {
177
- editorView: editorView,
178
- pluginContent: firstContent,
179
- editorWidth: editorWidth
180
- }));
181
- }
182
- });
183
- }
184
- });
156
+
157
+ // TODO: ED-17837 We have this workaround because we do
158
+ // not have access to the pluginInjectionApi at this location.
159
+ // It might be that we need to inject the pluginInjectionApi
160
+ // via context so that we can use it in this file (similar to
161
+ // WithEditorActions). To be investigated further.
162
+ // @ts-ignore
163
+ const widthPluginKey = {
164
+ key: 'widthPlugin$',
165
+ getState: state => {
166
+ return state['widthPlugin$'];
167
+ }
168
+ };
169
+ function ContextPanelWithActions({
170
+ actions,
171
+ ...props
172
+ }) {
173
+ const eventDispatcher = actions._privateGetEventDispatcher();
174
+ const editorView = actions._privateGetEditorView();
175
+ if (!eventDispatcher) {
176
+ return jsx(SwappableContentArea, _extends({
177
+ editorView: editorView
178
+ }, props));
185
179
  }
180
+ return jsx(WithPluginState, {
181
+ eventDispatcher: eventDispatcher,
182
+ plugins: {
183
+ contextPanel: contextPanelPluginKey,
184
+ widthState: widthPluginKey
185
+ },
186
+ render: ({
187
+ contextPanel,
188
+ widthState
189
+ }) => {
190
+ const firstContent = contextPanel && contextPanel.contents.find(Boolean);
191
+ const editorWidth = {
192
+ ...widthState,
193
+ contentBreakoutModes: editorView ? getChildBreakoutModes(editorView.state.doc, editorView.state.schema) : []
194
+ };
195
+ return jsx(SwappableContentArea, _extends({}, props, {
196
+ editorView: editorView,
197
+ pluginContent: firstContent,
198
+ editorWidth: editorWidth
199
+ }));
200
+ }
201
+ });
202
+ }
203
+ export default function ContextPanel(props) {
204
+ return jsx(WithEditorActions, {
205
+ render: actions => jsx(ContextPanelWithActions, _extends({
206
+ actions: actions
207
+ }, props))
208
+ });
186
209
  }
@@ -9,7 +9,6 @@ import EditorAlignImageLeft from '@atlaskit/icon/glyph/editor/align-image-left';
9
9
  import EditorAlignImageRight from '@atlaskit/icon/glyph/editor/align-image-right';
10
10
  import EditorAlignImageCenter from '@atlaskit/icon/glyph/editor/align-image-center';
11
11
  import { alignAttributes } from '../../utils/rich-media-utils';
12
- import { pluginKey as widthPluginKey } from '../../plugins/width';
13
12
  import { DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
14
13
  import { addAnalytics } from '../../plugins/analytics/utils';
15
14
  import { ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, ACTION } from '../../plugins/analytics';
@@ -62,7 +61,7 @@ const getNodeWidth = (node, schema) => {
62
61
  }
63
62
  return node.firstChild && node.firstChild.attrs.width || node.attrs.width;
64
63
  };
65
- const makeAlign = (layout, nodeType) => {
64
+ const makeAlign = (layout, nodeType, widthPluginDependencyApi) => {
66
65
  return (state, dispatch) => {
67
66
  const {
68
67
  node
@@ -76,7 +75,7 @@ const makeAlign = (layout, nodeType) => {
76
75
  if (!dispatch) {
77
76
  return false;
78
77
  }
79
- const widthPluginState = widthPluginKey.getState(state);
78
+ const widthPluginState = widthPluginDependencyApi === null || widthPluginDependencyApi === void 0 ? void 0 : widthPluginDependencyApi.sharedState.currentState();
80
79
  if (!node || node.type !== nodeType || !widthPluginState) {
81
80
  return false;
82
81
  }
@@ -116,7 +115,7 @@ const makeAlign = (layout, nodeType) => {
116
115
  return true;
117
116
  };
118
117
  };
119
- const mapIconsToToolbarItem = (icons, layout, intl, nodeType) => icons.map(toolbarItem => {
118
+ const mapIconsToToolbarItem = (icons, layout, intl, nodeType, widthPluginDependencyApi) => icons.map(toolbarItem => {
120
119
  const {
121
120
  id,
122
121
  value
@@ -127,7 +126,7 @@ const mapIconsToToolbarItem = (icons, layout, intl, nodeType) => icons.map(toolb
127
126
  icon: toolbarItem.icon,
128
127
  title: intl.formatMessage(layoutToMessages[value]),
129
128
  selected: layout === value,
130
- onClick: makeAlign(value, nodeType)
129
+ onClick: makeAlign(value, nodeType, widthPluginDependencyApi)
131
130
  };
132
131
  });
133
132
  const shouldHideLayoutToolbar = (selection, {
@@ -135,7 +134,7 @@ const shouldHideLayoutToolbar = (selection, {
135
134
  }, allowResizingInTables) => {
136
135
  return hasParentNodeOfType([nodes.bodiedExtension, nodes.listItem, nodes.expand, nodes.nestedExpand, ...(allowResizingInTables ? [] : [nodes.table])].filter(Boolean))(selection);
137
136
  };
138
- const buildLayoutButtons = (state, intl, nodeType, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true) => {
137
+ const buildLayoutButtons = (state, intl, nodeType, widthPluginDependencyApi, allowResizing, allowResizingInTables, allowWrapping = true, allowAlignment = true) => {
139
138
  const {
140
139
  selection
141
140
  } = state;
@@ -145,9 +144,9 @@ const buildLayoutButtons = (state, intl, nodeType, allowResizing, allowResizingI
145
144
  const {
146
145
  layout
147
146
  } = selection.node.attrs;
148
- const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType) : [];
149
- const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType) : [];
150
- const breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType) : [];
147
+ const alignmentToolbarItems = allowAlignment ? mapIconsToToolbarItem(alignmentIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
148
+ const wrappingToolbarItems = allowWrapping ? mapIconsToToolbarItem(wrappingIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
149
+ const breakOutToolbarItems = !allowResizing ? mapIconsToToolbarItem(breakoutIcons, layout, intl, nodeType, widthPluginDependencyApi) : [];
151
150
  const items = [...alignmentToolbarItems, ...getSeparatorBetweenAlignmentAndWrapping(allowAlignment, allowWrapping), ...wrappingToolbarItems, ...getSeparatorBeforeBreakoutItems(allowAlignment, allowWrapping, allowResizing), ...breakOutToolbarItems];
152
151
  return items;
153
152
  };
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { Resizable } from 're-resizable';
5
- import { gridTypeForLayout } from '../../plugins/grid';
5
+ import { gridTypeForLayout } from '@atlaskit/editor-common/utils';
6
6
  import { snapTo, handleSides } from './utils';
7
7
  import { richMediaClassName } from '@atlaskit/editor-common/styles';
8
8
  import { akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
@@ -1,7 +1,13 @@
1
- import React, { useEffect, useContext, useState } from 'react';
2
- import { pluginKey as widthPluginKey } from '../../plugins/width';
3
- import { WidthContext } from '@atlaskit/editor-common/ui';
4
- import { ContextPanel } from '../ContextPanel/context';
1
+ import React, { useContext, useEffect, useState } from 'react';
2
+ import { ContextPanel, WidthContext } from '@atlaskit/editor-common/ui';
3
+ // TODO: ED-17870 This workaround will be removed here.
4
+ // @ts-ignore
5
+ const widthPluginKey = {
6
+ key: 'widthPlugin$',
7
+ getState: state => {
8
+ return state['widthPlugin$'];
9
+ }
10
+ };
5
11
  // Why do we need this? Why not just use the width from the context directly rather than this?
6
12
  // Well my friend - some of the VR tests break, seemingly due to the fact that existing behaviour
7
13
  // assumes the initial value is 0, the width from context may not start from 0 however.
@@ -10,6 +10,9 @@ export const buttonGroupStyle = css`
10
10
  display: flex;
11
11
  }
12
12
  `;
13
+
14
+ // This style is copied to packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/styles.tsx
15
+ // If you make change here, change in above file as well.
13
16
  export const separatorStyles = css`
14
17
  background: ${`var(--ds-border, ${N30})`};
15
18
  width: 1px;
@@ -18,6 +21,9 @@ export const separatorStyles = css`
18
21
  margin: 0 8px;
19
22
  user-select: none;
20
23
  `;
24
+
25
+ // This style is copied to packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/styles.tsx
26
+ // If you make change here, change in above file as well.
21
27
  export const wrapperStyle = css`
22
28
  display: flex;
23
29
  align-items: center;
@@ -43,19 +43,24 @@ export const copyHTMLToClipboard = async (elementToCopy, plainTextToCopy) => {
43
43
  type: 'text/html'
44
44
  })
45
45
  });
46
-
47
46
  // @ts-ignore
48
47
  await navigator.clipboard.write([data]);
49
48
  } catch (error) {
50
49
  throw new Error('Clipboard api is not supported');
51
50
  }
52
51
  } else {
53
- // At the time of development, Firefox doesn't support ClipboardItem API
52
+ // ED-17083 extension copy seems have issue with ClipboardItem API
54
53
  // Hence of use of this polyfill
55
- const Clipboard = clipboard;
56
- const dt = new Clipboard.DT();
57
- dt.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
58
- dt.setData('text/html', elementToCopy.innerHTML);
59
- Clipboard.write(dt);
54
+ copyHTMLToClipboardPolyfill(elementToCopy, plainTextToCopy);
60
55
  }
56
+ };
57
+
58
+ // At the time of development, Firefox doesn't support ClipboardItem API
59
+ // Hence of use of this polyfill
60
+ export const copyHTMLToClipboardPolyfill = (elementToCopy, plainTextToCopy) => {
61
+ const Clipboard = clipboard;
62
+ const dt = new Clipboard.DT();
63
+ dt.setData('text/plain', plainTextToCopy || elementToCopy.innerText);
64
+ dt.setData('text/html', elementToCopy.innerHTML);
65
+ Clipboard.write(dt);
61
66
  };