@atlaskit/editor-plugin-media 8.5.0 → 8.5.1

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,11 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 8.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 8.5.0
4
10
 
5
11
  ### Minor Changes
@@ -19,9 +19,7 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
19
19
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
20
20
  var _selectionBasedNodeView = require("@atlaskit/editor-common/selection-based-node-view");
21
21
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
22
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
23
22
  var _mediaClient = require("@atlaskit/media-client");
24
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
25
23
  var _helpers = require("../../pm-plugins/commands/helpers");
26
24
  var _mediaCommon = require("../../pm-plugins/utils/media-common");
27
25
  var _media = _interopRequireDefault(require("./media"));
@@ -77,22 +75,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
77
75
  }, true)(_this.view.state, _this.view.dispatch);
78
76
  }
79
77
  });
80
- (0, _defineProperty2.default)(_this, "getMaxCardDimensions", function (editorWidth) {
81
- if ((0, _expValEquals.expValEquals)('platform_editor_media_vc_fixes', 'isEnabled', true)) {
82
- var mediaSingleNodeParent = _this.getMediaSingleNode(_this.getPos);
83
- if (mediaSingleNodeParent) {
84
- var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent, editorWidth === null || editorWidth === void 0 ? void 0 : editorWidth.width);
85
- return {
86
- width: "".concat(maxWidth, "px"),
87
- height: '100%'
88
- };
89
- }
90
- }
91
- return {
92
- width: '100%',
93
- height: '100%'
94
- };
95
- });
96
78
  (0, _defineProperty2.default)(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
97
79
  return function (_ref2) {
98
80
  var _this$reactComponentP;
@@ -116,15 +98,18 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
116
98
  }
117
99
  width = width || _mediaSingle.DEFAULT_IMAGE_WIDTH;
118
100
  height = height || _mediaSingle.DEFAULT_IMAGE_HEIGHT;
119
- var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
120
101
 
121
102
  // mediaSingle defines the max dimensions, so we don't need to constrain twice.
122
- var maxDimensions = _this.getMaxCardDimensions(editorWidth);
103
+ var maxDimensions = {
104
+ width: "100%",
105
+ height: "100%"
106
+ };
123
107
  var originalDimensions = {
124
108
  width: width,
125
109
  height: height
126
110
  };
127
111
  var isSelectedAndInteracted = _this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
112
+ var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
128
113
  return /*#__PURE__*/_react.default.createElement(_media.default, {
129
114
  api: pluginInjectionApi,
130
115
  view: _this.view,
@@ -155,44 +140,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
155
140
  }
156
141
  (0, _inherits2.default)(MediaNodeView, _SelectionBasedNodeVi);
157
142
  return (0, _createClass2.default)(MediaNodeView, [{
158
- key: "getMediaSingleNode",
159
- value: function getMediaSingleNode(getPos) {
160
- var pos = getPos();
161
- if (typeof pos !== 'number') {
162
- return null;
163
- }
164
- var $pos = this.view.state.doc.resolve(pos);
165
-
166
- // The parent of the media node should be mediaSingle
167
- if ($pos.parent && $pos.parent.type.name === 'mediaSingle') {
168
- return $pos.parent;
169
- }
170
- return null;
171
- }
172
- }, {
173
- key: "getMaxWidthFromMediaSingleNode",
174
- value: function getMaxWidthFromMediaSingleNode(mediaSingleNode, containerWidth) {
175
- var _mediaSingleNode$attr = mediaSingleNode.attrs,
176
- widthAttr = _mediaSingleNode$attr.width,
177
- widthTypeAttr = _mediaSingleNode$attr.widthType,
178
- layoutAttr = _mediaSingleNode$attr.layout;
179
- if (widthAttr && widthTypeAttr === 'pixel') {
180
- return widthAttr;
181
- }
182
- // on SSR mode, containerWidth from widthPluginState can be 0
183
- if (!containerWidth) {
184
- switch (layoutAttr) {
185
- case 'full-width':
186
- return _editorSharedStyles.akEditorFullWidthLayoutWidth;
187
- case 'wide':
188
- return _editorSharedStyles.akEditorCalculatedWideLayoutWidth;
189
- default:
190
- return _editorSharedStyles.akEditorDefaultLayoutWidth;
191
- }
192
- }
193
- return containerWidth;
194
- }
195
- }, {
196
143
  key: "createDomRef",
197
144
  value: function createDomRef() {
198
145
  var domRef = document.createElement('div');
@@ -5,9 +5,7 @@ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-comm
5
5
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
6
6
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
7
7
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
8
- import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
9
8
  import { getAttrsFromUrl } from '@atlaskit/media-client';
10
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
9
  import { updateCurrentMediaNodeAttrs } from '../../pm-plugins/commands/helpers';
12
10
  import { isMediaBlobUrlFromAttrs } from '../../pm-plugins/utils/media-common';
13
11
  // Ignored via go/ees005
@@ -57,22 +55,6 @@ class MediaNodeView extends SelectionBasedNodeView {
57
55
  }, true)(this.view.state, this.view.dispatch);
58
56
  }
59
57
  });
60
- _defineProperty(this, "getMaxCardDimensions", editorWidth => {
61
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
62
- const mediaSingleNodeParent = this.getMediaSingleNode(this.getPos);
63
- if (mediaSingleNodeParent) {
64
- const maxWidth = this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent, editorWidth === null || editorWidth === void 0 ? void 0 : editorWidth.width);
65
- return {
66
- width: `${maxWidth}px`,
67
- height: '100%'
68
- };
69
- }
70
- }
71
- return {
72
- width: '100%',
73
- height: '100%'
74
- };
75
- });
76
58
  _defineProperty(this, "renderMediaNodeWithState", contextIdentifierProvider => {
77
59
  return ({
78
60
  width: editorWidth,
@@ -103,17 +85,20 @@ class MediaNodeView extends SelectionBasedNodeView {
103
85
  }
104
86
  width = width || DEFAULT_IMAGE_WIDTH;
105
87
  height = height || DEFAULT_IMAGE_HEIGHT;
106
- const {
107
- pluginInjectionApi
108
- } = this.reactComponentProps;
109
88
 
110
89
  // mediaSingle defines the max dimensions, so we don't need to constrain twice.
111
- const maxDimensions = this.getMaxCardDimensions(editorWidth);
90
+ const maxDimensions = {
91
+ width: `100%`,
92
+ height: `100%`
93
+ };
112
94
  const originalDimensions = {
113
95
  width,
114
96
  height
115
97
  };
116
98
  const isSelectedAndInteracted = this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
99
+ const {
100
+ pluginInjectionApi
101
+ } = this.reactComponentProps;
117
102
  return /*#__PURE__*/React.createElement(MediaNode, {
118
103
  api: pluginInjectionApi,
119
104
  view: this.view,
@@ -144,41 +129,6 @@ class MediaNodeView extends SelectionBasedNodeView {
144
129
  });
145
130
  });
146
131
  }
147
- getMediaSingleNode(getPos) {
148
- const pos = getPos();
149
- if (typeof pos !== 'number') {
150
- return null;
151
- }
152
- const $pos = this.view.state.doc.resolve(pos);
153
-
154
- // The parent of the media node should be mediaSingle
155
- if ($pos.parent && $pos.parent.type.name === 'mediaSingle') {
156
- return $pos.parent;
157
- }
158
- return null;
159
- }
160
- getMaxWidthFromMediaSingleNode(mediaSingleNode, containerWidth) {
161
- const {
162
- width: widthAttr,
163
- widthType: widthTypeAttr,
164
- layout: layoutAttr
165
- } = mediaSingleNode.attrs;
166
- if (widthAttr && widthTypeAttr === 'pixel') {
167
- return widthAttr;
168
- }
169
- // on SSR mode, containerWidth from widthPluginState can be 0
170
- if (!containerWidth) {
171
- switch (layoutAttr) {
172
- case 'full-width':
173
- return akEditorFullWidthLayoutWidth;
174
- case 'wide':
175
- return akEditorCalculatedWideLayoutWidth;
176
- default:
177
- return akEditorDefaultLayoutWidth;
178
- }
179
- }
180
- return containerWidth;
181
- }
182
132
  createDomRef() {
183
133
  const domRef = document.createElement('div');
184
134
  if (this.reactComponentProps.mediaOptions && this.reactComponentProps.mediaOptions.allowMediaSingleEditable) {
@@ -18,9 +18,7 @@ import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-comm
18
18
  import { WithProviders } from '@atlaskit/editor-common/provider-factory';
19
19
  import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
20
20
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
21
- import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorCalculatedWideLayoutWidth } from '@atlaskit/editor-shared-styles';
22
21
  import { getAttrsFromUrl } from '@atlaskit/media-client';
23
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
24
22
  import { updateCurrentMediaNodeAttrs } from '../../pm-plugins/commands/helpers';
25
23
  import { isMediaBlobUrlFromAttrs } from '../../pm-plugins/utils/media-common';
26
24
  // Ignored via go/ees005
@@ -71,22 +69,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
71
69
  }, true)(_this.view.state, _this.view.dispatch);
72
70
  }
73
71
  });
74
- _defineProperty(_this, "getMaxCardDimensions", function (editorWidth) {
75
- if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
76
- var mediaSingleNodeParent = _this.getMediaSingleNode(_this.getPos);
77
- if (mediaSingleNodeParent) {
78
- var maxWidth = _this.getMaxWidthFromMediaSingleNode(mediaSingleNodeParent, editorWidth === null || editorWidth === void 0 ? void 0 : editorWidth.width);
79
- return {
80
- width: "".concat(maxWidth, "px"),
81
- height: '100%'
82
- };
83
- }
84
- }
85
- return {
86
- width: '100%',
87
- height: '100%'
88
- };
89
- });
90
72
  _defineProperty(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
91
73
  return function (_ref2) {
92
74
  var _this$reactComponentP;
@@ -110,15 +92,18 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
110
92
  }
111
93
  width = width || DEFAULT_IMAGE_WIDTH;
112
94
  height = height || DEFAULT_IMAGE_HEIGHT;
113
- var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
114
95
 
115
96
  // mediaSingle defines the max dimensions, so we don't need to constrain twice.
116
- var maxDimensions = _this.getMaxCardDimensions(editorWidth);
97
+ var maxDimensions = {
98
+ width: "100%",
99
+ height: "100%"
100
+ };
117
101
  var originalDimensions = {
118
102
  width: width,
119
103
  height: height
120
104
  };
121
105
  var isSelectedAndInteracted = _this.nodeInsideSelection() && interactionState !== 'hasNotHadInteraction';
106
+ var pluginInjectionApi = _this.reactComponentProps.pluginInjectionApi;
122
107
  return /*#__PURE__*/React.createElement(MediaNode, {
123
108
  api: pluginInjectionApi,
124
109
  view: _this.view,
@@ -149,44 +134,6 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
149
134
  }
150
135
  _inherits(MediaNodeView, _SelectionBasedNodeVi);
151
136
  return _createClass(MediaNodeView, [{
152
- key: "getMediaSingleNode",
153
- value: function getMediaSingleNode(getPos) {
154
- var pos = getPos();
155
- if (typeof pos !== 'number') {
156
- return null;
157
- }
158
- var $pos = this.view.state.doc.resolve(pos);
159
-
160
- // The parent of the media node should be mediaSingle
161
- if ($pos.parent && $pos.parent.type.name === 'mediaSingle') {
162
- return $pos.parent;
163
- }
164
- return null;
165
- }
166
- }, {
167
- key: "getMaxWidthFromMediaSingleNode",
168
- value: function getMaxWidthFromMediaSingleNode(mediaSingleNode, containerWidth) {
169
- var _mediaSingleNode$attr = mediaSingleNode.attrs,
170
- widthAttr = _mediaSingleNode$attr.width,
171
- widthTypeAttr = _mediaSingleNode$attr.widthType,
172
- layoutAttr = _mediaSingleNode$attr.layout;
173
- if (widthAttr && widthTypeAttr === 'pixel') {
174
- return widthAttr;
175
- }
176
- // on SSR mode, containerWidth from widthPluginState can be 0
177
- if (!containerWidth) {
178
- switch (layoutAttr) {
179
- case 'full-width':
180
- return akEditorFullWidthLayoutWidth;
181
- case 'wide':
182
- return akEditorCalculatedWideLayoutWidth;
183
- default:
184
- return akEditorDefaultLayoutWidth;
185
- }
186
- }
187
- return containerWidth;
188
- }
189
- }, {
190
137
  key: "createDomRef",
191
138
  value: function createDomRef() {
192
139
  var domRef = document.createElement('div');
@@ -9,7 +9,7 @@ import type { SharedInteractionState } from '@atlaskit/editor-plugin-interaction
9
9
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
10
10
  import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
12
- import type { getPosHandler, getPosHandlerNode, MediaOptions } from '../../types';
12
+ import type { getPosHandler, MediaOptions } from '../../types';
13
13
  import type { MediaNodeViewProps } from '../types';
14
14
  interface MediaNodeWithPluginStateComponentProps {
15
15
  interactionState?: SharedInteractionState['interactionState'];
@@ -18,8 +18,6 @@ interface MediaNodeWithPluginStateComponentProps {
18
18
  }
19
19
  declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
20
20
  private isSelected;
21
- getMediaSingleNode(getPos: getPosHandlerNode): PMNode | null;
22
- getMaxWidthFromMediaSingleNode(mediaSingleNode: PMNode, containerWidth?: number): number;
23
21
  createDomRef(): HTMLElement;
24
22
  viewShouldUpdate(nextNode: PMNode, decorations: Decoration[]): boolean;
25
23
  stopEvent(event: Event): boolean;
@@ -29,10 +27,6 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
29
27
  height: number;
30
28
  width: number;
31
29
  }) => void;
32
- getMaxCardDimensions: (editorWidth?: WidthPluginState) => {
33
- width: string;
34
- height: string;
35
- };
36
30
  renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider, interactionState, }: MediaNodeWithPluginStateComponentProps) => React.JSX.Element;
37
31
  renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => React.JSX.Element;
38
32
  render(): React.JSX.Element;
@@ -8,5 +8,5 @@ type Props = {
8
8
  isOpen?: boolean;
9
9
  onBrowseFn: (browse: () => void) => void;
10
10
  };
11
- export declare const BrowserWrapper: ({ api, isOpen, onBrowseFn, featureFlags }: Props) => React.JSX.Element;
11
+ export declare const BrowserWrapper: ({ api, isOpen, onBrowseFn, featureFlags, }: Props) => React.JSX.Element;
12
12
  export {};
@@ -9,7 +9,7 @@ import type { SharedInteractionState } from '@atlaskit/editor-plugin-interaction
9
9
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
10
10
  import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
11
11
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
12
- import type { getPosHandler, getPosHandlerNode, MediaOptions } from '../../types';
12
+ import type { getPosHandler, MediaOptions } from '../../types';
13
13
  import type { MediaNodeViewProps } from '../types';
14
14
  interface MediaNodeWithPluginStateComponentProps {
15
15
  interactionState?: SharedInteractionState['interactionState'];
@@ -18,8 +18,6 @@ interface MediaNodeWithPluginStateComponentProps {
18
18
  }
19
19
  declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
20
20
  private isSelected;
21
- getMediaSingleNode(getPos: getPosHandlerNode): PMNode | null;
22
- getMaxWidthFromMediaSingleNode(mediaSingleNode: PMNode, containerWidth?: number): number;
23
21
  createDomRef(): HTMLElement;
24
22
  viewShouldUpdate(nextNode: PMNode, decorations: Decoration[]): boolean;
25
23
  stopEvent(event: Event): boolean;
@@ -29,10 +27,6 @@ declare class MediaNodeView extends SelectionBasedNodeView<MediaNodeViewProps> {
29
27
  height: number;
30
28
  width: number;
31
29
  }) => void;
32
- getMaxCardDimensions: (editorWidth?: WidthPluginState) => {
33
- width: string;
34
- height: string;
35
- };
36
30
  renderMediaNodeWithState: (contextIdentifierProvider?: Promise<ContextIdentifierProvider>) => ({ width: editorWidth, mediaProvider, interactionState, }: MediaNodeWithPluginStateComponentProps) => React.JSX.Element;
37
31
  renderMediaNodeWithProviders: ({ contextIdentifierProvider }: Providers) => React.JSX.Element;
38
32
  render(): React.JSX.Element;
@@ -8,5 +8,5 @@ type Props = {
8
8
  isOpen?: boolean;
9
9
  onBrowseFn: (browse: () => void) => void;
10
10
  };
11
- export declare const BrowserWrapper: ({ api, isOpen, onBrowseFn, featureFlags }: Props) => React.JSX.Element;
11
+ export declare const BrowserWrapper: ({ api, isOpen, onBrowseFn, featureFlags, }: Props) => React.JSX.Element;
12
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "8.5.0",
3
+ "version": "8.5.1",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^51.5.1",
33
33
  "@atlaskit/analytics-namespaced-context": "^7.2.0",
34
34
  "@atlaskit/analytics-next": "^11.1.0",
35
- "@atlaskit/button": "^23.6.0",
35
+ "@atlaskit/button": "^23.7.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
38
38
  "@atlaskit/editor-plugin-annotation": "^6.3.0",
@@ -51,11 +51,11 @@
51
51
  "@atlaskit/editor-prosemirror": "7.0.0",
52
52
  "@atlaskit/editor-shared-styles": "^3.10.0",
53
53
  "@atlaskit/editor-tables": "^2.9.0",
54
- "@atlaskit/form": "^14.3.0",
54
+ "@atlaskit/form": "^15.0.0",
55
55
  "@atlaskit/icon": "^29.0.0",
56
56
  "@atlaskit/icon-lab": "^5.12.0",
57
- "@atlaskit/media-card": "^79.9.0",
58
- "@atlaskit/media-client": "^35.6.0",
57
+ "@atlaskit/media-card": "^79.10.0",
58
+ "@atlaskit/media-client": "^35.7.0",
59
59
  "@atlaskit/media-client-react": "^4.1.0",
60
60
  "@atlaskit/media-common": "^12.3.0",
61
61
  "@atlaskit/media-filmstrip": "^51.1.0",
@@ -64,9 +64,9 @@
64
64
  "@atlaskit/media-viewer": "^52.5.0",
65
65
  "@atlaskit/platform-feature-flags": "^1.1.0",
66
66
  "@atlaskit/primitives": "^16.4.0",
67
- "@atlaskit/textfield": "^8.1.0",
67
+ "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^15.2.0",
69
+ "@atlaskit/tmp-editor-statsig": "^15.9.0",
70
70
  "@atlaskit/tokens": "^8.4.0",
71
71
  "@atlaskit/tooltip": "^20.11.0",
72
72
  "@babel/runtime": "^7.0.0",