@atlaskit/editor-plugin-media 10.0.10 → 10.1.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 (71) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/mediaPlugin.js +6 -3
  3. package/dist/cjs/nodeviews/mediaGroup.js +6 -2
  4. package/dist/cjs/nodeviews/mediaGroupNext.js +1 -0
  5. package/dist/cjs/nodeviews/mediaInline.js +10 -4
  6. package/dist/cjs/nodeviews/mediaNodeView/index.js +3 -1
  7. package/dist/cjs/nodeviews/mediaNodeView/media.js +3 -1
  8. package/dist/cjs/nodeviews/mediaSingle.js +6 -2
  9. package/dist/cjs/pm-plugins/pixel-resizing/ui/index.js +12 -4
  10. package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +79 -73
  11. package/dist/cjs/ui/CommentBadge/index.js +6 -2
  12. package/dist/cjs/ui/ImageBorder/index.js +121 -38
  13. package/dist/cjs/ui/MediaLinkingToolbar.js +18 -6
  14. package/dist/cjs/ui/MediaPicker/DropzoneWrapper.js +6 -2
  15. package/dist/cjs/ui/MediaPicker/PickerFacadeProvider.js +1 -0
  16. package/dist/cjs/ui/MediaViewer/MediaViewerContainer.js +3 -1
  17. package/dist/cjs/ui/MediaViewer/PortalWrapper.js +4 -2
  18. package/dist/cjs/ui/ResizableMediaSingle/index.js +1 -0
  19. package/dist/cjs/ui/toolbar/index.js +6 -2
  20. package/dist/cjs/ui/toolbar/layout-group.js +3 -1
  21. package/dist/cjs/ui/toolbar/linking.js +15 -5
  22. package/dist/cjs/ui/toolbar/mediaInline.js +6 -2
  23. package/dist/es2019/mediaPlugin.js +6 -3
  24. package/dist/es2019/nodeviews/mediaGroup.js +6 -2
  25. package/dist/es2019/nodeviews/mediaGroupNext.js +1 -0
  26. package/dist/es2019/nodeviews/mediaInline.js +11 -4
  27. package/dist/es2019/nodeviews/mediaNodeView/index.js +3 -1
  28. package/dist/es2019/nodeviews/mediaNodeView/media.js +3 -1
  29. package/dist/es2019/nodeviews/mediaSingle.js +6 -2
  30. package/dist/es2019/pm-plugins/pixel-resizing/ui/index.js +12 -4
  31. package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +77 -71
  32. package/dist/es2019/ui/CommentBadge/index.js +6 -2
  33. package/dist/es2019/ui/ImageBorder/index.js +123 -36
  34. package/dist/es2019/ui/MediaLinkingToolbar.js +18 -6
  35. package/dist/es2019/ui/MediaPicker/DropzoneWrapper.js +6 -2
  36. package/dist/es2019/ui/MediaPicker/PickerFacadeProvider.js +1 -0
  37. package/dist/es2019/ui/MediaViewer/MediaViewerContainer.js +3 -1
  38. package/dist/es2019/ui/MediaViewer/PortalWrapper.js +4 -2
  39. package/dist/es2019/ui/ResizableMediaSingle/index.js +1 -0
  40. package/dist/es2019/ui/toolbar/index.js +6 -2
  41. package/dist/es2019/ui/toolbar/layout-group.js +3 -1
  42. package/dist/es2019/ui/toolbar/linking.js +15 -5
  43. package/dist/es2019/ui/toolbar/mediaInline.js +6 -2
  44. package/dist/esm/mediaPlugin.js +6 -3
  45. package/dist/esm/nodeviews/mediaGroup.js +6 -2
  46. package/dist/esm/nodeviews/mediaGroupNext.js +1 -0
  47. package/dist/esm/nodeviews/mediaInline.js +10 -4
  48. package/dist/esm/nodeviews/mediaNodeView/index.js +3 -1
  49. package/dist/esm/nodeviews/mediaNodeView/media.js +3 -1
  50. package/dist/esm/nodeviews/mediaSingle.js +6 -2
  51. package/dist/esm/pm-plugins/pixel-resizing/ui/index.js +12 -4
  52. package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +79 -73
  53. package/dist/esm/ui/CommentBadge/index.js +6 -2
  54. package/dist/esm/ui/ImageBorder/index.js +121 -38
  55. package/dist/esm/ui/MediaLinkingToolbar.js +18 -6
  56. package/dist/esm/ui/MediaPicker/DropzoneWrapper.js +6 -2
  57. package/dist/esm/ui/MediaPicker/PickerFacadeProvider.js +1 -0
  58. package/dist/esm/ui/MediaViewer/MediaViewerContainer.js +3 -1
  59. package/dist/esm/ui/MediaViewer/PortalWrapper.js +4 -2
  60. package/dist/esm/ui/ResizableMediaSingle/index.js +1 -0
  61. package/dist/esm/ui/toolbar/index.js +6 -2
  62. package/dist/esm/ui/toolbar/layout-group.js +3 -1
  63. package/dist/esm/ui/toolbar/linking.js +15 -5
  64. package/dist/esm/ui/toolbar/mediaInline.js +6 -2
  65. package/dist/types/types/index.d.ts +3 -0
  66. package/dist/types/ui/MediaViewer/MediaViewerContainer.d.ts +3 -1
  67. package/dist/types/ui/MediaViewer/PortalWrapper.d.ts +3 -1
  68. package/dist/types-ts4.5/types/index.d.ts +3 -0
  69. package/dist/types-ts4.5/ui/MediaViewer/MediaViewerContainer.d.ts +3 -1
  70. package/dist/types-ts4.5/ui/MediaViewer/PortalWrapper.d.ts +3 -1
  71. package/package.json +4 -4
@@ -89,12 +89,20 @@ var ImageBorder = function ImageBorder(_ref) {
89
89
  ref.style.left = "-".concat(rect.width, "px");
90
90
  }
91
91
  };
92
- var handleTriggerByKeyboard = function handleTriggerByKeyboard(event, callback) {
93
- if (event.key === 'Enter' || event.key === ' ') {
94
- event.preventDefault();
95
- callback();
96
- setIsOpenedByKeyboard(true);
92
+ var handleTriggerByKeyboard = function handleTriggerByKeyboard(event, allowedKeys, callback) {
93
+ if (!allowedKeys.includes(event.key)) {
94
+ return;
97
95
  }
96
+ event.preventDefault();
97
+ callback();
98
+ setIsOpenedByKeyboard(true);
99
+ };
100
+ var handleTriggerToolbarByKeyboard = function handleTriggerToolbarByKeyboard(event, callback) {
101
+ handleTriggerByKeyboard(event, ['Enter', ' '], callback);
102
+ };
103
+ var handleTriggerSubmenuByKeyboard = function handleTriggerSubmenuByKeyboard(event, callback) {
104
+ var keys = expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? ['Enter', 'ArrowRight'] : ['Enter', ' '];
105
+ handleTriggerByKeyboard(event, keys, callback);
98
106
  };
99
107
  useEffect(function () {
100
108
  var focusFirstOption = function focusFirstOption(submenuRef, isOpen) {
@@ -141,8 +149,18 @@ var ImageBorder = function ImageBorder(_ref) {
141
149
  dropdownOptionButton,
142
150
  "aria-expanded": isColorSubmenuOpen,
143
151
  onKeyDown: function onKeyDown(e) {
144
- return handleTriggerByKeyboard(e, function () {
145
- return setIsColorSubmenuOpen(!isColorSubmenuOpen);
152
+ return handleTriggerSubmenuByKeyboard(e, function () {
153
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
154
+ setIsColorSubmenuOpen(function (prev) {
155
+ var next = !prev;
156
+ if (next) {
157
+ setIsSizeSubmenuOpen(false);
158
+ }
159
+ return next;
160
+ });
161
+ } else {
162
+ setIsColorSubmenuOpen(!isColorSubmenuOpen);
163
+ }
146
164
  });
147
165
  }
148
166
  }, jsx(Text, null, formatMessage(messages.borderColor)), jsx("div", {
@@ -157,20 +175,26 @@ var ImageBorder = function ImageBorder(_ref) {
157
175
  css: contextualSubMenu(0),
158
176
  ref: handleSubMenuRef
159
177
  }, jsx(ArrowKeyNavigationProvider, {
160
- type: ArrowKeyNavigationType.MENU,
178
+ type: ArrowKeyNavigationType.MENU
179
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
180
+ ,
161
181
  handleClose: function handleClose(e) {
162
182
  e.preventDefault();
163
183
  e.stopPropagation();
164
184
  handleColorSubmenuEsc();
165
185
  },
166
186
  disableCloseOnArrowClick: true
167
- }, jsx(ColorPalette, {
187
+ }, jsx(ColorPalette
188
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
189
+ , {
168
190
  onClick: function onClick(color) {
169
191
  setBorder({
170
192
  color: color
171
193
  });
172
194
  setIsOpen(!isOpen);
173
- },
195
+ }
196
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
197
+ ,
174
198
  onKeyDown: function onKeyDown(color, _, event) {
175
199
  if (event.key === 'Enter' || event.key === ' ') {
176
200
  var _openDropdownButtonRe;
@@ -183,7 +207,9 @@ var ImageBorder = function ImageBorder(_ref) {
183
207
  (_openDropdownButtonRe = openDropdownButtonRef.current) === null || _openDropdownButtonRe === void 0 || _openDropdownButtonRe.focus();
184
208
  }
185
209
  },
186
- selectedColor: color !== null && color !== void 0 ? color : null,
210
+ selectedColor: color !== null && color !== void 0 ? color : null
211
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
212
+ ,
187
213
  paletteOptions: {
188
214
  palette: borderColorPalette,
189
215
  paletteColorTooltipMessages: borderPaletteTooltipMessages,
@@ -208,8 +234,18 @@ var ImageBorder = function ImageBorder(_ref) {
208
234
  "aria-expanded": isSizeSubmenuOpen,
209
235
  ref: dropDownSizeOptionButton,
210
236
  onKeyDown: function onKeyDown(e) {
211
- return handleTriggerByKeyboard(e, function () {
212
- return setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
237
+ return handleTriggerSubmenuByKeyboard(e, function () {
238
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
239
+ setIsSizeSubmenuOpen(function (prev) {
240
+ var next = !prev;
241
+ if (next) {
242
+ setIsColorSubmenuOpen(false);
243
+ }
244
+ return next;
245
+ });
246
+ } else {
247
+ setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
248
+ }
213
249
  });
214
250
  }
215
251
  }, jsx(Text, null, formatMessage(messages.borderSize)), jsx("div", {
@@ -219,7 +255,9 @@ var ImageBorder = function ImageBorder(_ref) {
219
255
  className: DropdownMenuSharedCssClassName.SUBMENU,
220
256
  ref: sizeSubmenuRef
221
257
  }, isSizeSubmenuOpen && jsx(ArrowKeyNavigationProvider, {
222
- type: ArrowKeyNavigationType.MENU,
258
+ type: ArrowKeyNavigationType.MENU
259
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
260
+ ,
223
261
  handleClose: function handleClose(e) {
224
262
  e.preventDefault();
225
263
  handleSizeSubmenuEsc();
@@ -332,13 +370,17 @@ var ImageBorder = function ImageBorder(_ref) {
332
370
  spacing: "spacious",
333
371
  label: "",
334
372
  size: "small"
335
- }),
373
+ })
374
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
375
+ ,
336
376
  onClick: function onClick() {
337
377
  setIsOpen(!isOpen);
338
378
  setIsOpenedByKeyboard(false);
339
- },
379
+ }
380
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
381
+ ,
340
382
  onKeyDown: function onKeyDown(e) {
341
- return handleTriggerByKeyboard(e, function () {
383
+ return handleTriggerToolbarByKeyboard(e, function () {
342
384
  return setIsOpen(!isOpen);
343
385
  });
344
386
  }
@@ -349,12 +391,17 @@ var ImageBorder = function ImageBorder(_ref) {
349
391
  forcePlacement: true,
350
392
  stick: true
351
393
  }, jsx("div", {
352
- /* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */
394
+ onMouseLeave: expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true) ? undefined : function () {
395
+ setIsColorSubmenuOpen(false);
396
+ setIsSizeSubmenuOpen(false);
397
+ }
398
+ /* eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766 */,
353
399
  css: dropdownWrapper
354
400
  }, jsx(DropdownMenu
355
401
  //This needs be removed when the a11y is completely handled
356
402
  //Disabling key navigation now as it works only partially
357
403
  //Same with packages/editor/editor-plugin-table/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx
404
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
358
405
  , {
359
406
  arrowKeyNavigationProviderOptions: {
360
407
  type: ArrowKeyNavigationType.MENU,
@@ -366,47 +413,83 @@ var ImageBorder = function ImageBorder(_ref) {
366
413
  } : function () {
367
414
  var _openDropdownButtonRe3;
368
415
  (_openDropdownButtonRe3 = openDropdownButtonRef.current) === null || _openDropdownButtonRe3 === void 0 || _openDropdownButtonRe3.focus();
369
- },
416
+ }
417
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
418
+ ,
370
419
  items: [{
371
420
  items: items
372
421
  }],
373
- isOpen: isOpen,
422
+ isOpen: isOpen
423
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
424
+ ,
374
425
  shouldFocusFirstItem: function shouldFocusFirstItem() {
375
426
  return isOpenByKeyboard;
376
- },
427
+ }
428
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
429
+ ,
377
430
  onOpenChange: function onOpenChange() {
378
431
  setIsOpen(false);
379
432
  setIsColorSubmenuOpen(false);
380
433
  setIsSizeSubmenuOpen(false);
381
434
  setIsOpenedByKeyboard(false);
382
- },
435
+ }
436
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
437
+ ,
383
438
  onItemActivated: function onItemActivated(_ref3) {
384
439
  var item = _ref3.item;
385
440
  if (item.value.name === 'color') {
386
- setIsColorSubmenuOpen(!isColorSubmenuOpen);
441
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
442
+ setIsColorSubmenuOpen(function (prev) {
443
+ var next = !prev;
444
+ if (next) {
445
+ setIsSizeSubmenuOpen(false);
446
+ }
447
+ return next;
448
+ });
449
+ } else {
450
+ setIsColorSubmenuOpen(!isColorSubmenuOpen);
451
+ }
387
452
  }
388
453
  if (item.value.name === 'size') {
389
- setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
454
+ if (expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
455
+ setIsSizeSubmenuOpen(function (prev) {
456
+ var next = !prev;
457
+ if (next) {
458
+ setIsColorSubmenuOpen(false);
459
+ }
460
+ return next;
461
+ });
462
+ } else {
463
+ setIsSizeSubmenuOpen(!isSizeSubmenuOpen);
464
+ }
390
465
  }
391
- },
466
+ }
467
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
468
+ ,
392
469
  onMouseEnter: function onMouseEnter(_ref4) {
393
470
  var item = _ref4.item;
394
- if (item.value.name === 'color') {
395
- setIsColorSubmenuOpen(true);
396
- setIsOpenedByKeyboard(false);
397
- }
398
- if (item.value.name === 'size') {
399
- setIsSizeSubmenuOpen(true);
400
- setIsOpenedByKeyboard(false);
471
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
472
+ if (item.value.name === 'color') {
473
+ setIsColorSubmenuOpen(true);
474
+ setIsOpenedByKeyboard(false);
475
+ }
476
+ if (item.value.name === 'size') {
477
+ setIsSizeSubmenuOpen(true);
478
+ setIsOpenedByKeyboard(false);
479
+ }
401
480
  }
402
- },
481
+ }
482
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
483
+ ,
403
484
  onMouseLeave: function onMouseLeave(_ref5) {
404
485
  var item = _ref5.item;
405
- if (item.value.name === 'color') {
406
- setIsColorSubmenuOpen(false);
407
- }
408
- if (item.value.name === 'size') {
409
- setIsSizeSubmenuOpen(false);
486
+ if (!expValEquals('platform_editor_toolbar_submenu_open_click', 'isEnabled', true)) {
487
+ if (item.value.name === 'color') {
488
+ setIsColorSubmenuOpen(false);
489
+ }
490
+ if (item.value.name === 'size') {
491
+ setIsSizeSubmenuOpen(false);
492
+ }
410
493
  }
411
494
  },
412
495
  fitWidth: fitWidth + fitTolerance,
@@ -122,13 +122,17 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
122
122
  icon: jsx(ChevronLeftLargeIcon, {
123
123
  label: formatLinkAddressText,
124
124
  size: "small"
125
- }),
125
+ })
126
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
127
+ ,
126
128
  onClick: function onClick() {
127
129
  return _this.handleOnBack({
128
130
  url: value,
129
131
  inputMethod: currentInputMethod
130
132
  });
131
- },
133
+ }
134
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
135
+ ,
132
136
  onKeyDown: function onKeyDown(event) {
133
137
  if (event.key === 'Enter' || event.key === ' ') {
134
138
  event.preventDefault();
@@ -145,7 +149,9 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
145
149
  placeholder: getPlaceholder(!!activityProvider),
146
150
  autoFocus: true,
147
151
  onCancel: _this.handleCancel,
148
- defaultValue: value,
152
+ defaultValue: value
153
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
154
+ ,
149
155
  onSubmit: function onSubmit(inputValue) {
150
156
  var validationErrors = _this.getValidationErrors(inputValue, currentInputMethod);
151
157
  _this.setState({
@@ -154,7 +160,9 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
154
160
  if (!validationErrors.length) {
155
161
  _onSubmit();
156
162
  }
157
- },
163
+ }
164
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
165
+ ,
158
166
  onChange: function onChange(value) {
159
167
  _this.setState({
160
168
  validationErrors: []
@@ -171,10 +179,14 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
171
179
  title: formatUnlinkText,
172
180
  icon: jsx(EditorUnlinkIcon, {
173
181
  label: formatUnlinkText
174
- }),
182
+ })
183
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
184
+ ,
175
185
  onClick: function onClick() {
176
186
  return _this.handleUnlink();
177
- },
187
+ }
188
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
189
+ ,
178
190
  onKeyDown: function onKeyDown(event) {
179
191
  if (event.key === 'Enter' || event.key === ' ') {
180
192
  event.preventDefault();
@@ -41,10 +41,14 @@ var DropzoneWrapperInternal = function DropzoneWrapperInternal(_ref) {
41
41
  config: dropzoneConfig,
42
42
  onError: pickerFacadeInstance.handleUploadError,
43
43
  onPreviewUpdate: pickerFacadeInstance.handleUploadPreviewUpdate,
44
- onEnd: pickerFacadeInstance.handleReady,
44
+ onEnd: pickerFacadeInstance.handleReady
45
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
46
+ ,
45
47
  onDragEnter: function onDragEnter() {
46
48
  return handleDrag === null || handleDrag === void 0 ? void 0 : handleDrag('enter');
47
- },
49
+ }
50
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
51
+ ,
48
52
  onDragLeave: function onDragLeave() {
49
53
  return handleDrag === null || handleDrag === void 0 ? void 0 : handleDrag('leave');
50
54
  },
@@ -108,6 +108,7 @@ export default function PickerFacadeProvider(_ref) {
108
108
  }(), [analyticsName, insertFile, mediaOptions, options === null || options === void 0 ? void 0 : options.errorReporter]);
109
109
  useEffect(function () {
110
110
  if (mediaProvider) {
111
+ // eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- Ignored via go/ees017 (to be fixed)
111
112
  handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
112
113
  }
113
114
  }, [mediaProvider, handleMediaProvider]);
@@ -26,6 +26,7 @@ export var MediaViewerContainer = function MediaViewerContainer(_ref) {
26
26
  isSelected = _ref$isSelected === void 0 ? true : _ref$isSelected,
27
27
  _ref$isInline = _ref.isInline,
28
28
  isInline = _ref$isInline === void 0 ? false : _ref$isInline,
29
+ mediaViewerExtensions = _ref.mediaViewerExtensions,
29
30
  children = _ref.children;
30
31
  var _useState = useState(false),
31
32
  _useState2 = _slicedToArray(_useState, 2),
@@ -56,6 +57,7 @@ export var MediaViewerContainer = function MediaViewerContainer(_ref) {
56
57
  }, children), shouldShowViewer && jsx(RenderMediaViewer, {
57
58
  selectedNodeAttrs: selectedNodeAttrs,
58
59
  mediaClientConfig: mediaClientConfig,
59
- onClose: closeMediaViewer
60
+ onClose: closeMediaViewer,
61
+ extensions: mediaViewerExtensions
60
62
  })) : children);
61
63
  };
@@ -24,7 +24,8 @@ export var RenderMediaViewer = function RenderMediaViewer(_ref) {
24
24
  onClose = _ref.onClose,
25
25
  selectedNodeAttrs = _ref.selectedNodeAttrs,
26
26
  _ref$items = _ref.items,
27
- items = _ref$items === void 0 ? [] : _ref$items;
27
+ items = _ref$items === void 0 ? [] : _ref$items,
28
+ extensions = _ref.extensions;
28
29
  var identifier = getIdentifier(selectedNodeAttrs);
29
30
  var collectionName = isExternalMedia(selectedNodeAttrs) ? '' : selectedNodeAttrs.collection;
30
31
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(MediaViewer, {
@@ -35,6 +36,7 @@ export var RenderMediaViewer = function RenderMediaViewer(_ref) {
35
36
  ,
36
37
  mediaClientConfig: mediaClientConfig,
37
38
  selectedItem: identifier,
38
- onClose: onClose
39
+ onClose: onClose,
40
+ extensions: extensions
39
41
  }), document.body);
40
42
  };
@@ -430,6 +430,7 @@ var ResizableMediaSingle = /*#__PURE__*/function (_React$Component) {
430
430
  // when cursor is located below a media with caption,
431
431
  // press “Up“ key will result cursor focus on an invalid position, (on the resize handler)
432
432
  // This workaround adds an empty div inside the resize handler to prevent the issue.
433
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
433
434
  ,
434
435
  handleComponentFunc: function handleComponentFunc() {
435
436
  return jsx("div", {
@@ -296,11 +296,15 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
296
296
  var dispatch = editorView.dispatch,
297
297
  state = editorView.state;
298
298
  var borderMark = currentMediaOrInlineNodeBorderMark(state);
299
- return /*#__PURE__*/React.createElement(ImageBorderItem, {
299
+ return /*#__PURE__*/React.createElement(ImageBorderItem
300
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
301
+ , {
300
302
  toggleBorder: function toggleBorder() {
301
303
  var _pluginInjectionApi$a;
302
304
  toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
303
- },
305
+ }
306
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
307
+ ,
304
308
  setBorder: function setBorder(attrs) {
305
309
  var _pluginInjectionApi$a2;
306
310
  setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
@@ -42,7 +42,9 @@ export var LayoutGroup = function LayoutGroup(_ref) {
42
42
  }) : undefined,
43
43
  title: item.title,
44
44
  selected: item.selected,
45
- disabled: item.disabled,
45
+ disabled: item.disabled
46
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
47
+ ,
46
48
  onClick: function onClick() {
47
49
  dispatchCommand(item.onClick);
48
50
  hide();
@@ -67,12 +67,16 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
67
67
  displayUrl: link,
68
68
  providerFactory: providerFactory,
69
69
  intl: intl,
70
- editing: editing,
70
+ editing: editing
71
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
72
+ ,
71
73
  onUnlink: function onUnlink(setFocus) {
72
74
  var _pluginInjectionApi$a;
73
75
  unlink(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(view.state, view.dispatch, view);
74
76
  setFocusOnFloatingToolbar(setFocus);
75
- },
77
+ }
78
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
79
+ ,
76
80
  onBack: function onBack(href, meta, setFocus) {
77
81
  if (href.trim() && meta.inputMethod) {
78
82
  var _pluginInjectionApi$a2;
@@ -80,7 +84,9 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
80
84
  }
81
85
  hideLinkingToolbar(view.state, view.dispatch, view);
82
86
  setFocusOnFloatingToolbar(setFocus);
83
- },
87
+ }
88
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
89
+ ,
84
90
  onCancel: function onCancel() {
85
91
  var _pluginInjectionApi$f2;
86
92
  hideLinkingToolbar(view.state, view.dispatch, view, true);
@@ -92,13 +98,17 @@ export var getLinkingToolbar = function getLinkingToolbar(toolbarBaseConfig, med
92
98
  var selector = areToolbarFlagsEnabled(Boolean(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.toolbar)) ? FORCE_FOCUS_SELECTOR_EDITOR_CONTROLS : FORCE_FOCUS_SELECTOR;
93
99
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$f2 = pluginInjectionApi.floatingToolbar) === null || _pluginInjectionApi$f2 === void 0 || (_pluginInjectionApi$f2 = _pluginInjectionApi$f2.actions) === null || _pluginInjectionApi$f2 === void 0 || _pluginInjectionApi$f2.forceFocusSelector(selector)(tr);
94
100
  dispatch(tr);
95
- },
101
+ }
102
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
103
+ ,
96
104
  onSubmit: function onSubmit(href, meta) {
97
105
  var _pluginInjectionApi$a3;
98
106
  setUrlToMedia(href, meta.inputMethod, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(view.state, view.dispatch, view);
99
107
  hideLinkingToolbar(view.state, view.dispatch, view);
100
108
  setFocusOnFloatingToolbar(true);
101
- },
109
+ }
110
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
111
+ ,
102
112
  onBlur: function onBlur() {
103
113
  hideLinkingToolbar(view.state, view.dispatch, view);
104
114
  },
@@ -195,11 +195,15 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
195
195
  var dispatch = editorView.dispatch,
196
196
  state = editorView.state;
197
197
  var borderMark = currentMediaOrInlineNodeBorderMark(state);
198
- return /*#__PURE__*/React.createElement(ImageBorderItem, {
198
+ return /*#__PURE__*/React.createElement(ImageBorderItem
199
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
200
+ , {
199
201
  toggleBorder: function toggleBorder() {
200
202
  var _pluginInjectionApi$a2;
201
203
  toggleBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(state, dispatch);
202
- },
204
+ }
205
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
206
+ ,
203
207
  setBorder: function setBorder(attrs) {
204
208
  var _pluginInjectionApi$a3;
205
209
  setBorderMark(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(attrs)(state, dispatch);
@@ -9,6 +9,7 @@ import type { FileIdentifier } from '@atlaskit/media-client';
9
9
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
10
10
  import type { MediaClientConfig } from '@atlaskit/media-core';
11
11
  import type { MediaFile, UploadParams } from '@atlaskit/media-picker/types';
12
+ import type { MediaViewerExtensions } from '@atlaskit/media-viewer';
12
13
  interface PlaceholderTextOptions {
13
14
  allowInserting?: boolean;
14
15
  }
@@ -91,6 +92,8 @@ export interface MediaPluginOptions {
91
92
  */
92
93
  isExternalMediaUploadDisabled?: boolean;
93
94
  mediaShallowCopyScope?: MediaCopyScope;
95
+ /** Extensions for the media viewer header (e.g. comment navigation button). */
96
+ mediaViewerExtensions?: MediaViewerExtensions;
94
97
  onCommentButtonMount?: () => void;
95
98
  /**
96
99
  * When enabled, prevents automatic focus/selection of media nodes after upload completion.
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { MediaClientConfig } from '@atlaskit/media-core/auth';
9
+ import type { MediaViewerExtensions } from '@atlaskit/media-viewer';
9
10
  type MediaViewerContainerProps = {
10
11
  children?: React.ReactNode;
11
12
  isEditorViewMode?: boolean;
@@ -13,7 +14,8 @@ type MediaViewerContainerProps = {
13
14
  isSelected?: boolean;
14
15
  mediaClientConfig: MediaClientConfig;
15
16
  mediaNode: PMNode;
17
+ mediaViewerExtensions?: MediaViewerExtensions;
16
18
  selectedMediaContainerNode: () => PMNode | undefined;
17
19
  };
18
- export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
20
+ export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, mediaViewerExtensions, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
19
21
  export {};
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { MediaADFAttrs } from '@atlaskit/adf-schema';
3
3
  import type { Identifier, MediaClientConfig } from '@atlaskit/media-client';
4
+ import { type MediaViewerExtensions } from '@atlaskit/media-viewer';
4
5
  interface RenderMediaViewerProps {
6
+ extensions?: MediaViewerExtensions;
5
7
  items?: Identifier[];
6
8
  mediaClientConfig: MediaClientConfig;
7
9
  onClose: () => void;
8
10
  selectedNodeAttrs: MediaADFAttrs;
9
11
  }
10
- export declare const RenderMediaViewer: ({ mediaClientConfig, onClose, selectedNodeAttrs, items, }: RenderMediaViewerProps) => React.ReactPortal;
12
+ export declare const RenderMediaViewer: ({ mediaClientConfig, onClose, selectedNodeAttrs, items, extensions, }: RenderMediaViewerProps) => React.ReactPortal;
11
13
  export {};
@@ -9,6 +9,7 @@ import type { FileIdentifier } from '@atlaskit/media-client';
9
9
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
10
10
  import type { MediaClientConfig } from '@atlaskit/media-core';
11
11
  import type { MediaFile, UploadParams } from '@atlaskit/media-picker/types';
12
+ import type { MediaViewerExtensions } from '@atlaskit/media-viewer';
12
13
  interface PlaceholderTextOptions {
13
14
  allowInserting?: boolean;
14
15
  }
@@ -91,6 +92,8 @@ export interface MediaPluginOptions {
91
92
  */
92
93
  isExternalMediaUploadDisabled?: boolean;
93
94
  mediaShallowCopyScope?: MediaCopyScope;
95
+ /** Extensions for the media viewer header (e.g. comment navigation button). */
96
+ mediaViewerExtensions?: MediaViewerExtensions;
94
97
  onCommentButtonMount?: () => void;
95
98
  /**
96
99
  * When enabled, prevents automatic focus/selection of media nodes after upload completion.
@@ -6,6 +6,7 @@ import React from 'react';
6
6
  import { jsx } from '@emotion/react';
7
7
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { MediaClientConfig } from '@atlaskit/media-core/auth';
9
+ import type { MediaViewerExtensions } from '@atlaskit/media-viewer';
9
10
  type MediaViewerContainerProps = {
10
11
  children?: React.ReactNode;
11
12
  isEditorViewMode?: boolean;
@@ -13,7 +14,8 @@ type MediaViewerContainerProps = {
13
14
  isSelected?: boolean;
14
15
  mediaClientConfig: MediaClientConfig;
15
16
  mediaNode: PMNode;
17
+ mediaViewerExtensions?: MediaViewerExtensions;
16
18
  selectedMediaContainerNode: () => PMNode | undefined;
17
19
  };
18
- export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
20
+ export declare const MediaViewerContainer: ({ mediaNode, selectedMediaContainerNode, mediaClientConfig, isEditorViewMode, isSelected, isInline, mediaViewerExtensions, children, }: MediaViewerContainerProps) => jsx.JSX.Element;
19
21
  export {};
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import type { MediaADFAttrs } from '@atlaskit/adf-schema';
3
3
  import type { Identifier, MediaClientConfig } from '@atlaskit/media-client';
4
+ import { type MediaViewerExtensions } from '@atlaskit/media-viewer';
4
5
  interface RenderMediaViewerProps {
6
+ extensions?: MediaViewerExtensions;
5
7
  items?: Identifier[];
6
8
  mediaClientConfig: MediaClientConfig;
7
9
  onClose: () => void;
8
10
  selectedNodeAttrs: MediaADFAttrs;
9
11
  }
10
- export declare const RenderMediaViewer: ({ mediaClientConfig, onClose, selectedNodeAttrs, items, }: RenderMediaViewerProps) => React.ReactPortal;
12
+ export declare const RenderMediaViewer: ({ mediaClientConfig, onClose, selectedNodeAttrs, items, extensions, }: RenderMediaViewerProps) => React.ReactPortal;
11
13
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "10.0.10",
3
+ "version": "10.1.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -54,19 +54,19 @@
54
54
  "@atlaskit/form": "^15.4.0",
55
55
  "@atlaskit/icon": "^33.0.0",
56
56
  "@atlaskit/icon-lab": "^6.0.0",
57
- "@atlaskit/media-card": "^79.15.0",
57
+ "@atlaskit/media-card": "^79.16.0",
58
58
  "@atlaskit/media-client": "^36.0.0",
59
59
  "@atlaskit/media-client-react": "^5.0.0",
60
60
  "@atlaskit/media-common": "^13.0.0",
61
61
  "@atlaskit/media-filmstrip": "^51.2.0",
62
62
  "@atlaskit/media-picker": "^70.1.0",
63
63
  "@atlaskit/media-ui": "^28.7.0",
64
- "@atlaskit/media-viewer": "^52.8.0",
64
+ "@atlaskit/media-viewer": "^52.9.0",
65
65
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
66
  "@atlaskit/primitives": "^18.0.0",
67
67
  "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^22.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^42.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^44.0.0",
70
70
  "@atlaskit/tokens": "^11.1.0",
71
71
  "@atlaskit/tooltip": "^21.0.0",
72
72
  "@babel/runtime": "^7.0.0",