@atlaskit/editor-plugin-media 1.43.0 → 1.43.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.43.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#179714](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179714)
8
+ [`7216b07b8cbe7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7216b07b8cbe7) -
9
+ [ux] ED-26058 Support dyanmic visibility of media badges based on media size
10
+ - Updated dependencies
11
+
12
+ ## 1.43.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#177963](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/177963)
17
+ [`9c85947f30827`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9c85947f30827) -
18
+ Clean up feature gate on media single
19
+
3
20
  ## 1.43.0
4
21
 
5
22
  ### Minor Changes
@@ -491,12 +491,13 @@ var MediaSingleNode = exports.default = /*#__PURE__*/function (_Component) {
491
491
  mediaWidth: width,
492
492
  extendedResizeOffset: (0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience') && !isInsideTable
493
493
  }, function (_ref5) {
494
- var badgeSize = _ref5.badgeSize;
495
- return (0, _react2.jsx)(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_hide_external_media_badge') ? (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
494
+ var badgeSize = _ref5.badgeSize,
495
+ visible = _ref5.visible;
496
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_hide_external_media_badge') ? visible && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
496
497
  badgeSize: badgeSize,
497
498
  type: attrs.type,
498
499
  url: attrs.type === 'external' ? attrs.url : undefined
499
- }) : shouldShowExternalMediaBadge && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
500
+ }) : shouldShowExternalMediaBadge && visible && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
500
501
  badgeSize: badgeSize
501
502
  }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
502
503
  view: view,
@@ -651,20 +652,13 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
651
652
  return (0, _createClass2.default)(MediaSingleNodeView, [{
652
653
  key: "createDomRef",
653
654
  value: function createDomRef() {
655
+ var _this$reactComponentP;
654
656
  var domRef = document.createElement('div');
655
- if ((0, _platformFeatureFlags.fg)('platform_editor_prevent_delete_image_in_view_mode')) {
656
- var _this$reactComponentP;
657
- // controll the domRef contentEditable attribute based on the editor view mode
658
- this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
659
- var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
660
- this.updateDomRefContentEditable(domRef, initialViewMode);
661
- } else {
662
- if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
663
- // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
664
- // see also: https://github.com/ProseMirror/prosemirror/issues/884
665
- domRef.contentEditable = 'true';
666
- }
667
- }
657
+
658
+ // control the domRef contentEditable attribute based on the editor view mode
659
+ this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
660
+ var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
661
+ this.updateDomRefContentEditable(domRef, initialViewMode);
668
662
  if ((0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience')) {
669
663
  domRef.classList.add('media-extended-resize-experience');
670
664
  }
@@ -497,12 +497,13 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
497
497
  mediaWidth: width,
498
498
  extendedResizeOffset: (0, _platformFeatureFlags.fg)('platform_editor_media_extended_resize_experience') && !isInsideTable
499
499
  }, function (_ref7) {
500
- var badgeSize = _ref7.badgeSize;
501
- return (0, _react2.jsx)(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_hide_external_media_badge') ? (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
500
+ var badgeSize = _ref7.badgeSize,
501
+ visible = _ref7.visible;
502
+ return (0, _react2.jsx)(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_hide_external_media_badge') ? visible && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
502
503
  badgeSize: badgeSize,
503
504
  type: childMediaNodeAttrs.type,
504
505
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
505
- }) : shouldShowExternalMediaBadge && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
506
+ }) : shouldShowExternalMediaBadge && visible && (0, _react2.jsx)(_mediaSingle.ExternalImageBadge, {
506
507
  badgeSize: badgeSize
507
508
  }), mediaOptions.allowCommentsOnMedia && (0, _react2.jsx)(_CommentBadge.CommentBadgeNextWrapper, {
508
509
  view: view,
@@ -410,12 +410,13 @@ export default class MediaSingleNode extends Component {
410
410
  mediaWidth: width,
411
411
  extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
412
412
  }, ({
413
- badgeSize
414
- }) => jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? jsx(ExternalImageBadge, {
413
+ badgeSize,
414
+ visible
415
+ }) => jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
415
416
  badgeSize: badgeSize,
416
417
  type: attrs.type,
417
418
  url: attrs.type === 'external' ? attrs.url : undefined
418
- }) : shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
419
+ }) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
419
420
  badgeSize: badgeSize
420
421
  }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
421
422
  view: view,
@@ -561,20 +562,13 @@ class MediaSingleNodeView extends ReactNodeView {
561
562
  });
562
563
  }
563
564
  createDomRef() {
565
+ var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3;
564
566
  const domRef = document.createElement('div');
565
- if (fg('platform_editor_prevent_delete_image_in_view_mode')) {
566
- var _this$reactComponentP, _this$reactComponentP2, _this$reactComponentP3;
567
- // controll the domRef contentEditable attribute based on the editor view mode
568
- this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
569
- const initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode;
570
- this.updateDomRefContentEditable(domRef, initialViewMode);
571
- } else {
572
- if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
573
- // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
574
- // see also: https://github.com/ProseMirror/prosemirror/issues/884
575
- domRef.contentEditable = 'true';
576
- }
577
- }
567
+
568
+ // control the domRef contentEditable attribute based on the editor view mode
569
+ this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
570
+ const initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 ? void 0 : (_this$reactComponentP2 = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : (_this$reactComponentP3 = _this$reactComponentP2.sharedState.currentState()) === null || _this$reactComponentP3 === void 0 ? void 0 : _this$reactComponentP3.mode;
571
+ this.updateDomRefContentEditable(domRef, initialViewMode);
578
572
  if (fg('platform_editor_media_extended_resize_experience')) {
579
573
  domRef.classList.add('media-extended-resize-experience');
580
574
  }
@@ -458,12 +458,13 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
458
458
  mediaWidth: width,
459
459
  extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
460
460
  }, ({
461
- badgeSize
462
- }) => jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? jsx(ExternalImageBadge, {
461
+ badgeSize,
462
+ visible
463
+ }) => jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
463
464
  badgeSize: badgeSize,
464
465
  type: childMediaNodeAttrs.type,
465
466
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
466
- }) : shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
467
+ }) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
467
468
  badgeSize: badgeSize
468
469
  }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
469
470
  view: view,
@@ -485,12 +485,13 @@ var MediaSingleNode = /*#__PURE__*/function (_Component) {
485
485
  mediaWidth: width,
486
486
  extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
487
487
  }, function (_ref5) {
488
- var badgeSize = _ref5.badgeSize;
489
- return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? jsx(ExternalImageBadge, {
488
+ var badgeSize = _ref5.badgeSize,
489
+ visible = _ref5.visible;
490
+ return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
490
491
  badgeSize: badgeSize,
491
492
  type: attrs.type,
492
493
  url: attrs.type === 'external' ? attrs.url : undefined
493
- }) : shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
494
+ }) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
494
495
  badgeSize: badgeSize
495
496
  }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
496
497
  view: view,
@@ -646,20 +647,13 @@ var MediaSingleNodeView = /*#__PURE__*/function (_ReactNodeView) {
646
647
  return _createClass(MediaSingleNodeView, [{
647
648
  key: "createDomRef",
648
649
  value: function createDomRef() {
650
+ var _this$reactComponentP;
649
651
  var domRef = document.createElement('div');
650
- if (fg('platform_editor_prevent_delete_image_in_view_mode')) {
651
- var _this$reactComponentP;
652
- // controll the domRef contentEditable attribute based on the editor view mode
653
- this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
654
- var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
655
- this.updateDomRefContentEditable(domRef, initialViewMode);
656
- } else {
657
- if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
658
- // workaround Chrome bug in https://product-fabric.atlassian.net/browse/ED-5379
659
- // see also: https://github.com/ProseMirror/prosemirror/issues/884
660
- domRef.contentEditable = 'true';
661
- }
662
- }
652
+
653
+ // control the domRef contentEditable attribute based on the editor view mode
654
+ this.unsubscribeToViewModeChange = this.subscribeToViewModeChange(domRef);
655
+ var initialViewMode = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode;
656
+ this.updateDomRefContentEditable(domRef, initialViewMode);
663
657
  if (fg('platform_editor_media_extended_resize_experience')) {
664
658
  domRef.classList.add('media-extended-resize-experience');
665
659
  }
@@ -490,12 +490,13 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
490
490
  mediaWidth: width,
491
491
  extendedResizeOffset: fg('platform_editor_media_extended_resize_experience') && !isInsideTable
492
492
  }, function (_ref7) {
493
- var badgeSize = _ref7.badgeSize;
494
- return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? jsx(ExternalImageBadge, {
493
+ var badgeSize = _ref7.badgeSize,
494
+ visible = _ref7.visible;
495
+ return jsx(React.Fragment, null, fg('platform_editor_hide_external_media_badge') ? visible && jsx(ExternalImageBadge, {
495
496
  badgeSize: badgeSize,
496
497
  type: childMediaNodeAttrs.type,
497
498
  url: childMediaNodeAttrs.type === 'external' ? childMediaNodeAttrs.url : undefined
498
- }) : shouldShowExternalMediaBadge && jsx(ExternalImageBadge, {
499
+ }) : shouldShowExternalMediaBadge && visible && jsx(ExternalImageBadge, {
499
500
  badgeSize: badgeSize
500
501
  }), mediaOptions.allowCommentsOnMedia && jsx(CommentBadgeNextWrapper, {
501
502
  view: view,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.43.0",
3
+ "version": "1.43.2",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/editor-palette": "1.6.3",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
42
42
  "@atlaskit/editor-plugin-annotation": "1.26.4",
43
- "@atlaskit/editor-plugin-connectivity": "^1.0.0",
43
+ "@atlaskit/editor-plugin-connectivity": "^1.1.0",
44
44
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
45
45
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
46
46
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
@@ -55,20 +55,20 @@
55
55
  "@atlaskit/editor-tables": "^2.8.0",
56
56
  "@atlaskit/form": "^10.6.0",
57
57
  "@atlaskit/icon": "^23.1.0",
58
- "@atlaskit/media-card": "^78.15.0",
59
- "@atlaskit/media-client": "^28.5.0",
58
+ "@atlaskit/media-card": "^78.16.0",
59
+ "@atlaskit/media-client": "^28.6.0",
60
60
  "@atlaskit/media-client-react": "^2.4.0",
61
61
  "@atlaskit/media-common": "^11.7.0",
62
62
  "@atlaskit/media-filmstrip": "^48.1.0",
63
63
  "@atlaskit/media-picker": "^67.0.0",
64
- "@atlaskit/media-ui": "^27.0.0",
65
- "@atlaskit/media-viewer": "^49.4.0",
64
+ "@atlaskit/media-ui": "^27.1.0",
65
+ "@atlaskit/media-viewer": "^49.5.0",
66
66
  "@atlaskit/platform-feature-flags": "^0.3.0",
67
67
  "@atlaskit/primitives": "^13.3.0",
68
68
  "@atlaskit/textfield": "^6.7.0",
69
69
  "@atlaskit/theme": "^14.0.0",
70
- "@atlaskit/tmp-editor-statsig": "^2.26.0",
71
- "@atlaskit/tokens": "^2.4.0",
70
+ "@atlaskit/tmp-editor-statsig": "^2.27.0",
71
+ "@atlaskit/tokens": "^2.5.0",
72
72
  "@atlaskit/tooltip": "^19.0.0",
73
73
  "@babel/runtime": "^7.0.0",
74
74
  "@emotion/react": "^11.7.1",
@@ -148,9 +148,6 @@
148
148
  "platform-visual-refresh-icons": {
149
149
  "type": "boolean"
150
150
  },
151
- "platform_editor_prevent_delete_image_in_view_mode": {
152
- "type": "boolean"
153
- },
154
151
  "platform_editor_inline_resize_media_to_edge": {
155
152
  "type": "boolean"
156
153
  },