@atlaskit/editor-plugin-media 1.12.4 → 1.13.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,11 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#84964](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84964) [`be8d48da5d54`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be8d48da5d54) - [ux] MediaGroup should show MediaViewer when Editor in 'view' mode
8
+
3
9
  ## 1.12.4
4
10
 
5
11
  ### Patch Changes
@@ -136,7 +136,8 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
136
136
  getPos = _this$props.getPos,
137
137
  allowLazyLoading = _this$props.allowLazyLoading,
138
138
  disabled = _this$props.disabled,
139
- mediaOptions = _this$props.mediaOptions;
139
+ mediaOptions = _this$props.mediaOptions,
140
+ editorViewMode = _this$props.editorViewMode;
140
141
  var items = _this.mediaNodes.map(function (item, idx) {
141
142
  // We declared this to get a fresh position every time
142
143
  var getNodePos = function getNodePos() {
@@ -179,7 +180,8 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
179
180
  return /*#__PURE__*/_react.default.createElement(_mediaFilmstrip.Filmstrip, {
180
181
  items: items,
181
182
  mediaClientConfig: viewMediaClientConfig,
182
- featureFlags: mediaOptions.featureFlags
183
+ featureFlags: mediaOptions.featureFlags,
184
+ shouldOpenMediaViewer: editorViewMode
183
185
  });
184
186
  });
185
187
  _this.mediaNodes = [];
@@ -305,10 +307,12 @@ var _default = exports.default = IntlMediaGroup;
305
307
  function MediaGroupNodeViewInternal(_ref3) {
306
308
  var renderFn = _ref3.renderFn,
307
309
  pluginInjectionApi = _ref3.pluginInjectionApi;
308
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorDisabled']),
309
- editorDisabledPlugin = _useSharedPluginState.editorDisabledState;
310
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorDisabled', 'editorViewMode']),
311
+ editorDisabledPlugin = _useSharedPluginState.editorDisabledState,
312
+ editorViewModePlugin = _useSharedPluginState.editorViewModeState;
310
313
  return renderFn({
311
- editorDisabledPlugin: editorDisabledPlugin
314
+ editorDisabledPlugin: editorDisabledPlugin,
315
+ editorViewModePlugin: editorViewModePlugin
312
316
  });
313
317
  }
314
318
  var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
@@ -333,7 +337,8 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
333
337
  var mediaProvider = _ref4.mediaProvider,
334
338
  contextIdentifierProvider = _ref4.contextIdentifierProvider;
335
339
  var renderFn = function renderFn(_ref5) {
336
- var editorDisabledPlugin = _ref5.editorDisabledPlugin;
340
+ var editorDisabledPlugin = _ref5.editorDisabledPlugin,
341
+ editorViewModePlugin = _ref5.editorViewModePlugin;
337
342
  if (!mediaProvider) {
338
343
  return null;
339
344
  }
@@ -349,7 +354,8 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
349
354
  isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
350
355
  anchorPos: _this3.view.state.selection.$anchor.pos,
351
356
  headPos: _this3.view.state.selection.$head.pos,
352
- mediaOptions: mediaOptions
357
+ mediaOptions: mediaOptions,
358
+ editorViewMode: (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view'
353
359
  });
354
360
  };
355
361
  return /*#__PURE__*/_react.default.createElement(MediaGroupNodeViewInternal, {
@@ -118,7 +118,8 @@ class MediaGroup extends React.Component {
118
118
  getPos,
119
119
  allowLazyLoading,
120
120
  disabled,
121
- mediaOptions
121
+ mediaOptions,
122
+ editorViewMode
122
123
  } = this.props;
123
124
  const items = this.mediaNodes.map((item, idx) => {
124
125
  // We declared this to get a fresh position every time
@@ -162,7 +163,8 @@ class MediaGroup extends React.Component {
162
163
  return /*#__PURE__*/React.createElement(Filmstrip, {
163
164
  items: items,
164
165
  mediaClientConfig: viewMediaClientConfig,
165
- featureFlags: mediaOptions.featureFlags
166
+ featureFlags: mediaOptions.featureFlags,
167
+ shouldOpenMediaViewer: editorViewMode
166
168
  });
167
169
  });
168
170
  this.mediaNodes = [];
@@ -254,10 +256,12 @@ function MediaGroupNodeViewInternal({
254
256
  pluginInjectionApi
255
257
  }) {
256
258
  const {
257
- editorDisabledState: editorDisabledPlugin
258
- } = useSharedPluginState(pluginInjectionApi, ['editorDisabled']);
259
+ editorDisabledState: editorDisabledPlugin,
260
+ editorViewModeState: editorViewModePlugin
261
+ } = useSharedPluginState(pluginInjectionApi, ['editorDisabled', 'editorViewMode']);
259
262
  return renderFn({
260
- editorDisabledPlugin
263
+ editorDisabledPlugin,
264
+ editorViewModePlugin
261
265
  });
262
266
  }
263
267
  class MediaGroupNodeView extends ReactNodeView {
@@ -276,7 +280,8 @@ class MediaGroupNodeView extends ReactNodeView {
276
280
  contextIdentifierProvider
277
281
  }) => {
278
282
  const renderFn = ({
279
- editorDisabledPlugin
283
+ editorDisabledPlugin,
284
+ editorViewModePlugin
280
285
  }) => {
281
286
  if (!mediaProvider) {
282
287
  return null;
@@ -293,7 +298,8 @@ class MediaGroupNodeView extends ReactNodeView {
293
298
  isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
294
299
  anchorPos: this.view.state.selection.$anchor.pos,
295
300
  headPos: this.view.state.selection.$head.pos,
296
- mediaOptions: mediaOptions
301
+ mediaOptions: mediaOptions,
302
+ editorViewMode: (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view'
297
303
  });
298
304
  };
299
305
  return /*#__PURE__*/React.createElement(MediaGroupNodeViewInternal, {
@@ -129,7 +129,8 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
129
129
  getPos = _this$props.getPos,
130
130
  allowLazyLoading = _this$props.allowLazyLoading,
131
131
  disabled = _this$props.disabled,
132
- mediaOptions = _this$props.mediaOptions;
132
+ mediaOptions = _this$props.mediaOptions,
133
+ editorViewMode = _this$props.editorViewMode;
133
134
  var items = _this.mediaNodes.map(function (item, idx) {
134
135
  // We declared this to get a fresh position every time
135
136
  var getNodePos = function getNodePos() {
@@ -172,7 +173,8 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
172
173
  return /*#__PURE__*/React.createElement(Filmstrip, {
173
174
  items: items,
174
175
  mediaClientConfig: viewMediaClientConfig,
175
- featureFlags: mediaOptions.featureFlags
176
+ featureFlags: mediaOptions.featureFlags,
177
+ shouldOpenMediaViewer: editorViewMode
176
178
  });
177
179
  });
178
180
  _this.mediaNodes = [];
@@ -298,10 +300,12 @@ export default IntlMediaGroup;
298
300
  function MediaGroupNodeViewInternal(_ref3) {
299
301
  var renderFn = _ref3.renderFn,
300
302
  pluginInjectionApi = _ref3.pluginInjectionApi;
301
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorDisabled']),
302
- editorDisabledPlugin = _useSharedPluginState.editorDisabledState;
303
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorDisabled', 'editorViewMode']),
304
+ editorDisabledPlugin = _useSharedPluginState.editorDisabledState,
305
+ editorViewModePlugin = _useSharedPluginState.editorViewModeState;
303
306
  return renderFn({
304
- editorDisabledPlugin: editorDisabledPlugin
307
+ editorDisabledPlugin: editorDisabledPlugin,
308
+ editorViewModePlugin: editorViewModePlugin
305
309
  });
306
310
  }
307
311
  var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
@@ -326,7 +330,8 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
326
330
  var mediaProvider = _ref4.mediaProvider,
327
331
  contextIdentifierProvider = _ref4.contextIdentifierProvider;
328
332
  var renderFn = function renderFn(_ref5) {
329
- var editorDisabledPlugin = _ref5.editorDisabledPlugin;
333
+ var editorDisabledPlugin = _ref5.editorDisabledPlugin,
334
+ editorViewModePlugin = _ref5.editorViewModePlugin;
330
335
  if (!mediaProvider) {
331
336
  return null;
332
337
  }
@@ -342,7 +347,8 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
342
347
  isCopyPasteEnabled: mediaOptions.isCopyPasteEnabled,
343
348
  anchorPos: _this3.view.state.selection.$anchor.pos,
344
349
  headPos: _this3.view.state.selection.$head.pos,
345
- mediaOptions: mediaOptions
350
+ mediaOptions: mediaOptions,
351
+ editorViewMode: (editorViewModePlugin === null || editorViewModePlugin === void 0 ? void 0 : editorViewModePlugin.mode) === 'view'
346
352
  });
347
353
  };
348
354
  return /*#__PURE__*/React.createElement(MediaGroupNodeViewInternal, {
@@ -15,6 +15,7 @@ export type MediaGroupProps = {
15
15
  view: EditorView;
16
16
  getPos: () => number | undefined;
17
17
  disabled?: boolean;
18
+ editorViewMode?: boolean;
18
19
  allowLazyLoading?: boolean;
19
20
  mediaProvider: Promise<MediaProvider>;
20
21
  contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
@@ -15,6 +15,7 @@ export type MediaGroupProps = {
15
15
  view: EditorView;
16
16
  getPos: () => number | undefined;
17
17
  disabled?: boolean;
18
+ editorViewMode?: boolean;
18
19
  allowLazyLoading?: boolean;
19
20
  mediaProvider: Promise<MediaProvider>;
20
21
  contextIdentifierProvider?: Promise<ContextIdentifierProvider>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.12.4",
3
+ "version": "1.13.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,13 +36,14 @@
36
36
  "@atlaskit/adf-schema": "^35.7.0",
37
37
  "@atlaskit/analytics-namespaced-context": "^6.9.0",
38
38
  "@atlaskit/analytics-next": "^9.2.0",
39
- "@atlaskit/button": "^17.7.0",
39
+ "@atlaskit/button": "^17.8.0",
40
40
  "@atlaskit/editor-common": "^78.21.0",
41
41
  "@atlaskit/editor-palette": "1.5.3",
42
42
  "@atlaskit/editor-plugin-analytics": "^1.0.0",
43
43
  "@atlaskit/editor-plugin-annotation": "1.5.3",
44
44
  "@atlaskit/editor-plugin-decorations": "^1.0.0",
45
45
  "@atlaskit/editor-plugin-editor-disabled": "^1.0.0",
46
+ "@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
46
47
  "@atlaskit/editor-plugin-floating-toolbar": "^1.2.0",
47
48
  "@atlaskit/editor-plugin-focus": "^1.1.0",
48
49
  "@atlaskit/editor-plugin-grid": "^1.0.0",