@atlaskit/editor-plugin-media 13.4.11 → 13.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 13.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`01c0f76dfce1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/01c0f76dfce1e) -
8
+ Cleanup experiment `platform_editor_media_vc_fixes_patch1`.
9
+
10
+ ### Patch Changes
11
+
12
+ - [`d1b772ec7a247`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d1b772ec7a247) -
13
+ Disable video caption management controls while editor media renders in view mode.
14
+ - Updated dependencies
15
+
3
16
  ## 13.4.11
4
17
 
5
18
  ### Patch Changes
@@ -22,7 +22,6 @@ var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-n
22
22
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
23
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
24
24
  var _mediaClient = require("@atlaskit/media-client");
25
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
25
  var _aiGeneratingDecoration = require("../../pm-plugins/ai-generating-decoration");
27
26
  var _helpers = require("../../pm-plugins/commands/helpers");
28
27
  var _mediaCommon = require("../../pm-plugins/utils/media-common");
@@ -106,22 +105,13 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
106
105
  if (!mediaSingleNodeParent) {
107
106
  return flexibleDimensions;
108
107
  }
109
- if ((0, _expValEquals.expValEquals)('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
110
- if (_this.hasPxWidthType(mediaSingleNodeParent)) {
111
- return {
112
- width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
113
- height: '100%'
114
- };
115
- }
116
- return flexibleDimensions;
108
+ if (_this.hasPxWidthType(mediaSingleNodeParent)) {
109
+ return {
110
+ width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
111
+ height: '100%'
112
+ };
117
113
  }
118
-
119
- // Compute normal dimensions
120
- var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent);
121
- return {
122
- width: "".concat(maxWidth, "px"),
123
- height: '100%'
124
- };
114
+ return flexibleDimensions;
125
115
  });
126
116
  (0, _defineProperty2.default)(_this, "getMediaProviderToUse", function (mediaOptions, mediaProvider) {
127
117
  if (mediaProvider) {
@@ -107,9 +107,9 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
107
107
  (0, _utils.setNodeSelection)(_this.props.view, propPos - 1);
108
108
  }
109
109
  });
110
- (0, _defineProperty2.default)(_this, "getMediaSettings", (0, _memoizeOne.default)(function (viewAndUploadMediaClientConfig) {
110
+ (0, _defineProperty2.default)(_this, "getMediaSettings", (0, _memoizeOne.default)(function (viewAndUploadMediaClientConfig, isViewOnly) {
111
111
  return {
112
- canUpdateVideoCaptions: (0, _platformFeatureFlags.fg)('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
112
+ canUpdateVideoCaptions: (0, _platformFeatureFlags.fg)('platform_media_video_captions') ? (0, _platformFeatureFlags.fg)('platform_editor_video_caption_commit') ? !!viewAndUploadMediaClientConfig && !isViewOnly : !!viewAndUploadMediaClientConfig : false
113
113
  };
114
114
  }));
115
115
  (0, _defineProperty2.default)(_this, "onPreviewRender", function (fileId) {
@@ -185,7 +185,7 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
185
185
  value: function shouldComponentUpdate(nextProps, nextState) {
186
186
  var hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
187
187
  var hasNewViewAndUploadMediaClientConfig = !this.state.viewAndUploadMediaClientConfig && nextState.viewAndUploadMediaClientConfig;
188
- if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
188
+ if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.isViewOnly !== nextProps.isViewOnly || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
189
189
  return true;
190
190
  }
191
191
  return false;
@@ -386,7 +386,7 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
386
386
  alt: alt,
387
387
  videoControlsWrapperRef: this.videoControlsWrapperRef,
388
388
  ssr: ssr,
389
- mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig),
389
+ mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig, this.props.isViewOnly),
390
390
  isAIGenerating: !!this.props.isAIGenerating,
391
391
  onPreviewRender: this.onPreviewRender,
392
392
  onError: (0, _expValEquals.expValEquals)('platform_editor_media_error_analytics', 'isEnabled', true) ? this.onError : undefined
@@ -22,7 +22,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
22
22
  var _utils = require("@atlaskit/editor-prosemirror/utils");
23
23
  var _mediaClient = require("@atlaskit/media-client");
24
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
25
  var _captions = require("../pm-plugins/commands/captions");
27
26
  var _mediaCommon = require("../pm-plugins/utils/media-common");
28
27
  var _CaptionPlaceholder = require("../ui/CaptionPlaceholder");
@@ -516,7 +515,7 @@ var MediaSingleNodeNext = exports.MediaSingleNodeNext = function MediaSingleNode
516
515
  onClick: clickPlaceholder,
517
516
  placeholderMessage: mediaOptions.allowImagePreview ? _media.captionMessages.placeholderWithDoubleClickPrompt : _media.captionMessages.placeholder
518
517
  })));
519
- if (widthType !== 'pixel' && (0, _expValEquals.expValEquals)('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
518
+ if (widthType !== 'pixel') {
520
519
  return (0, _react2.jsx)(_react.Fragment, null, canResize ? mediaOptions.allowPixelResizing ? (0, _react2.jsx)(_ResizableMediaSingleNext.default, {
521
520
  view: view,
522
521
  getPos: getPos,
@@ -8,7 +8,6 @@ import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-
8
8
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
9
  import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { getAttrsFromUrl } from '@atlaskit/media-client';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { hasAIGeneratingDecoration } from '../../pm-plugins/ai-generating-decoration';
13
12
  import { updateCurrentMediaNodeAttrs } from '../../pm-plugins/commands/helpers';
14
13
  import { isMediaBlobUrlFromAttrs } from '../../pm-plugins/utils/media-common';
@@ -86,22 +85,13 @@ class MediaNodeView extends SelectionBasedNodeView {
86
85
  if (!mediaSingleNodeParent) {
87
86
  return flexibleDimensions;
88
87
  }
89
- if (expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
90
- if (this.hasPxWidthType(mediaSingleNodeParent)) {
91
- return {
92
- width: `${mediaSingleNodeParent.attrs.width}px`,
93
- height: '100%'
94
- };
95
- }
96
- return flexibleDimensions;
88
+ if (this.hasPxWidthType(mediaSingleNodeParent)) {
89
+ return {
90
+ width: `${mediaSingleNodeParent.attrs.width}px`,
91
+ height: '100%'
92
+ };
97
93
  }
98
-
99
- // Compute normal dimensions
100
- const maxWidth = this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent);
101
- return {
102
- width: `${maxWidth}px`,
103
- height: '100%'
104
- };
94
+ return flexibleDimensions;
105
95
  });
106
96
  _defineProperty(this, "getMediaProviderToUse", (mediaOptions, mediaProvider) => {
107
97
  if (mediaProvider) {
@@ -81,9 +81,11 @@ export class MediaNode extends Component {
81
81
  setNodeSelection(this.props.view, propPos - 1);
82
82
  }
83
83
  });
84
- _defineProperty(this, "getMediaSettings", memoizeOne(viewAndUploadMediaClientConfig => ({
85
- canUpdateVideoCaptions: fg('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
86
- })));
84
+ _defineProperty(this, "getMediaSettings", memoizeOne((viewAndUploadMediaClientConfig, isViewOnly) => {
85
+ return {
86
+ canUpdateVideoCaptions: fg('platform_media_video_captions') ? fg('platform_editor_video_caption_commit') ? !!viewAndUploadMediaClientConfig && !isViewOnly : !!viewAndUploadMediaClientConfig : false
87
+ };
88
+ }));
87
89
  _defineProperty(this, "onPreviewRender", fileId => {
88
90
  if (expValEquals('aifc_page_create_with_rovo_include_infographics', 'isEnabled', true)) {
89
91
  var _this$props$pluginInj2, _this$props$pluginInj3;
@@ -154,7 +156,7 @@ export class MediaNode extends Component {
154
156
  shouldComponentUpdate(nextProps, nextState) {
155
157
  const hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
156
158
  const hasNewViewAndUploadMediaClientConfig = !this.state.viewAndUploadMediaClientConfig && nextState.viewAndUploadMediaClientConfig;
157
- if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
159
+ if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.isViewOnly !== nextProps.isViewOnly || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
158
160
  return true;
159
161
  }
160
162
  return false;
@@ -328,7 +330,7 @@ export class MediaNode extends Component {
328
330
  alt: alt,
329
331
  videoControlsWrapperRef: this.videoControlsWrapperRef,
330
332
  ssr: ssr,
331
- mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig),
333
+ mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig, this.props.isViewOnly),
332
334
  isAIGenerating: !!this.props.isAIGenerating,
333
335
  onPreviewRender: this.onPreviewRender,
334
336
  onError: expValEquals('platform_editor_media_error_analytics', 'isEnabled', true) ? this.onError : undefined
@@ -17,7 +17,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
17
17
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
18
18
  import { getAttrsFromUrl } from '@atlaskit/media-client';
19
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
20
  import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
22
21
  import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
23
22
  import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
@@ -475,7 +474,7 @@ export const MediaSingleNodeNext = mediaSingleNodeNextProps => {
475
474
  onClick: clickPlaceholder,
476
475
  placeholderMessage: mediaOptions.allowImagePreview ? captionMessages.placeholderWithDoubleClickPrompt : captionMessages.placeholder
477
476
  })));
478
- if (widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
477
+ if (widthType !== 'pixel') {
479
478
  return jsx(Fragment, null, canResize ? mediaOptions.allowPixelResizing ? jsx(ResizableMediaSingleNext, {
480
479
  view: view,
481
480
  getPos: getPos,
@@ -21,7 +21,6 @@ import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-
21
21
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
22
22
  import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
23
23
  import { getAttrsFromUrl } from '@atlaskit/media-client';
24
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
25
24
  import { hasAIGeneratingDecoration } from '../../pm-plugins/ai-generating-decoration';
26
25
  import { updateCurrentMediaNodeAttrs } from '../../pm-plugins/commands/helpers';
27
26
  import { isMediaBlobUrlFromAttrs } from '../../pm-plugins/utils/media-common';
@@ -100,22 +99,13 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
100
99
  if (!mediaSingleNodeParent) {
101
100
  return flexibleDimensions;
102
101
  }
103
- if (expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
104
- if (_this.hasPxWidthType(mediaSingleNodeParent)) {
105
- return {
106
- width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
107
- height: '100%'
108
- };
109
- }
110
- return flexibleDimensions;
102
+ if (_this.hasPxWidthType(mediaSingleNodeParent)) {
103
+ return {
104
+ width: "".concat(mediaSingleNodeParent.attrs.width, "px"),
105
+ height: '100%'
106
+ };
111
107
  }
112
-
113
- // Compute normal dimensions
114
- var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent);
115
- return {
116
- width: "".concat(maxWidth, "px"),
117
- height: '100%'
118
- };
108
+ return flexibleDimensions;
119
109
  });
120
110
  _defineProperty(_this, "getMediaProviderToUse", function (mediaOptions, mediaProvider) {
121
111
  if (mediaProvider) {
@@ -99,9 +99,9 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
99
99
  setNodeSelection(_this.props.view, propPos - 1);
100
100
  }
101
101
  });
102
- _defineProperty(_this, "getMediaSettings", memoizeOne(function (viewAndUploadMediaClientConfig) {
102
+ _defineProperty(_this, "getMediaSettings", memoizeOne(function (viewAndUploadMediaClientConfig, isViewOnly) {
103
103
  return {
104
- canUpdateVideoCaptions: fg('platform_media_video_captions') ? !!viewAndUploadMediaClientConfig : false
104
+ canUpdateVideoCaptions: fg('platform_media_video_captions') ? fg('platform_editor_video_caption_commit') ? !!viewAndUploadMediaClientConfig && !isViewOnly : !!viewAndUploadMediaClientConfig : false
105
105
  };
106
106
  }));
107
107
  _defineProperty(_this, "onPreviewRender", function (fileId) {
@@ -177,7 +177,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
177
177
  value: function shouldComponentUpdate(nextProps, nextState) {
178
178
  var hasNewViewMediaClientConfig = !this.state.viewMediaClientConfig && nextState.viewMediaClientConfig;
179
179
  var hasNewViewAndUploadMediaClientConfig = !this.state.viewAndUploadMediaClientConfig && nextState.viewAndUploadMediaClientConfig;
180
- if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
180
+ if (this.props.selected !== nextProps.selected || this.props.node.attrs.id !== nextProps.node.attrs.id || this.props.node.attrs.collection !== nextProps.node.attrs.collection || this.props.isAIGenerating !== nextProps.isAIGenerating || this.props.maxDimensions.height !== nextProps.maxDimensions.height || this.props.maxDimensions.width !== nextProps.maxDimensions.width || this.props.contextIdentifierProvider !== nextProps.contextIdentifierProvider || this.props.isLoading !== nextProps.isLoading || this.props.isViewOnly !== nextProps.isViewOnly || this.props.mediaProvider !== nextProps.mediaProvider || this.props.syncProvider !== nextProps.syncProvider || hasNewViewMediaClientConfig || hasNewViewAndUploadMediaClientConfig) {
181
181
  return true;
182
182
  }
183
183
  return false;
@@ -378,7 +378,7 @@ export var MediaNode = /*#__PURE__*/function (_Component) {
378
378
  alt: alt,
379
379
  videoControlsWrapperRef: this.videoControlsWrapperRef,
380
380
  ssr: ssr,
381
- mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig),
381
+ mediaSettings: this.getMediaSettings(viewAndUploadMediaClientConfig, this.props.isViewOnly),
382
382
  isAIGenerating: !!this.props.isAIGenerating,
383
383
  onPreviewRender: this.onPreviewRender,
384
384
  onError: expValEquals('platform_editor_media_error_analytics', 'isEnabled', true) ? this.onError : undefined
@@ -23,7 +23,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
23
23
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
24
24
  import { getAttrsFromUrl } from '@atlaskit/media-client';
25
25
  import { fg } from '@atlaskit/platform-feature-flags';
26
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
26
  import { insertAndSelectCaptionFromMediaSinglePos } from '../pm-plugins/commands/captions';
28
27
  import { isMediaBlobUrlFromAttrs } from '../pm-plugins/utils/media-common';
29
28
  import { CaptionPlaceholder, CaptionPlaceholderButton } from '../ui/CaptionPlaceholder';
@@ -510,7 +509,7 @@ export var MediaSingleNodeNext = function MediaSingleNodeNext(mediaSingleNodeNex
510
509
  onClick: clickPlaceholder,
511
510
  placeholderMessage: mediaOptions.allowImagePreview ? captionMessages.placeholderWithDoubleClickPrompt : captionMessages.placeholder
512
511
  })));
513
- if (widthType !== 'pixel' && expValEquals('platform_editor_media_vc_fixes_patch1', 'isEnabled', true)) {
512
+ if (widthType !== 'pixel') {
514
513
  return jsx(Fragment, null, canResize ? mediaOptions.allowPixelResizing ? jsx(ResizableMediaSingleNext, {
515
514
  view: view,
516
515
  getPos: getPos,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "13.4.11",
3
+ "version": "13.5.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -65,7 +65,7 @@
65
65
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
66
  "@atlaskit/primitives": "^19.0.0",
67
67
  "@atlaskit/textfield": "^8.3.0",
68
- "@atlaskit/tmp-editor-statsig": "^100.0.0",
68
+ "@atlaskit/tmp-editor-statsig": "^101.0.0",
69
69
  "@atlaskit/tokens": "^13.4.0",
70
70
  "@atlaskit/tooltip": "^22.6.0",
71
71
  "@babel/runtime": "^7.0.0",
@@ -150,6 +150,9 @@
150
150
  "platform_media_video_captions": {
151
151
  "type": "boolean"
152
152
  },
153
+ "platform_editor_video_caption_commit": {
154
+ "type": "boolean"
155
+ },
153
156
  "confluence_fe_create_inline_comment_exp_coverage_2": {
154
157
  "type": "boolean"
155
158
  },