@atlaskit/editor-plugin-media 1.22.6 → 1.22.7

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,13 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.22.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`666ab2fb8703d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/666ab2fb8703d) -
8
+ Accept the media provider from the plugin rather than only from editor-core
9
+ - Updated dependencies
10
+
3
11
  ## 1.22.6
4
12
 
5
13
  ### Patch Changes
@@ -32,6 +32,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
32
32
  var _view2 = require("@atlaskit/editor-prosemirror/view");
33
33
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
34
34
  var _mediaCommon = require("@atlaskit/media-common");
35
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
35
36
  var _helpers = _interopRequireWildcard(require("../commands/helpers"));
36
37
  var helpers = _helpers;
37
38
  var _pickerFacade = _interopRequireDefault(require("../picker-facade"));
@@ -499,9 +500,13 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
499
500
  this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
500
501
  var nodes = _state.schema.nodes;
501
502
  (0, _assert.default)(nodes.media && (nodes.mediaGroup || nodes.mediaSingle), 'Editor: unable to init media plugin - media or mediaGroup/mediaSingle node absent in schema');
502
- options.providerFactory.subscribe('mediaProvider', function (_name, provider) {
503
- return _this.setMediaProvider(provider);
504
- });
503
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider && (0, _platformFeatureFlags.fg)('platform_editor_media_provider_from_plugin_config')) {
504
+ this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
505
+ } else {
506
+ options.providerFactory.subscribe('mediaProvider', function (_name, provider) {
507
+ return _this.setMediaProvider(provider);
508
+ });
509
+ }
505
510
  if ((0, _mediaInline.mediaInlineImagesEnabled)((0, _mediaCommon.getMediaFeatureFlag)('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
506
511
  this.allowInlineImages = true;
507
512
  }
@@ -17,6 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
17
17
  var _react = _interopRequireDefault(require("react"));
18
18
  var _reactDom = require("react-dom");
19
19
  var _utils = require("@atlaskit/editor-common/utils");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _pickerFacade = _interopRequireDefault(require("../../picker-facade"));
21
22
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
22
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
@@ -126,7 +127,12 @@ var PickerFacadeProvider = exports.default = /*#__PURE__*/function (_React$Compo
126
127
  (0, _createClass2.default)(PickerFacadeProvider, [{
127
128
  key: "componentDidMount",
128
129
  value: function componentDidMount() {
129
- this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
130
+ var mediaProvider = this.props.mediaState.mediaProvider;
131
+ if (mediaProvider && (0, _platformFeatureFlags.fg)('platform_editor_media_provider_from_plugin_config')) {
132
+ this.handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
133
+ } else {
134
+ this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
135
+ }
130
136
  }
131
137
  }, {
132
138
  key: "componentWillUnmount",
@@ -14,6 +14,7 @@ import { findDomRefAtPos, findParentNodeOfType, findSelectedNodeOfType, isNodeSe
14
14
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
15
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
16
16
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
17
+ import { fg } from '@atlaskit/platform-feature-flags';
17
18
  import * as helpers from '../commands/helpers';
18
19
  import { updateMediaNodeAttrs } from '../commands/helpers';
19
20
  import PickerFacade from '../picker-facade';
@@ -444,7 +445,11 @@ export class MediaPluginStateImplementation {
444
445
  nodes
445
446
  } = _state.schema;
446
447
  assert(nodes.media && (nodes.mediaGroup || nodes.mediaSingle), 'Editor: unable to init media plugin - media or mediaGroup/mediaSingle node absent in schema');
447
- options.providerFactory.subscribe('mediaProvider', (_name, provider) => this.setMediaProvider(provider));
448
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider && fg('platform_editor_media_provider_from_plugin_config')) {
449
+ this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
450
+ } else {
451
+ options.providerFactory.subscribe('mediaProvider', (_name, provider) => this.setMediaProvider(provider));
452
+ }
448
453
  if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
449
454
  this.allowInlineImages = true;
450
455
  }
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { flushSync } from 'react-dom';
4
4
  import { ErrorReporter } from '@atlaskit/editor-common/utils';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import PickerFacade from '../../picker-facade';
6
7
  const dummyMediaPickerObject = {
7
8
  on: () => {},
@@ -63,7 +64,14 @@ export default class PickerFacadeProvider extends React.Component {
63
64
  });
64
65
  }
65
66
  componentDidMount() {
66
- this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
67
+ const {
68
+ mediaProvider
69
+ } = this.props.mediaState;
70
+ if (mediaProvider && fg('platform_editor_media_provider_from_plugin_config')) {
71
+ this.handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
72
+ } else {
73
+ this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
74
+ }
67
75
  }
68
76
  componentWillUnmount() {
69
77
  this.props.mediaState.options.providerFactory.unsubscribe('mediaProvider', this.handleMediaProvider);
@@ -23,6 +23,7 @@ import { findDomRefAtPos, findParentNodeOfType, findSelectedNodeOfType, isNodeSe
23
23
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
24
24
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
25
25
  import { getMediaFeatureFlag } from '@atlaskit/media-common';
26
+ import { fg } from '@atlaskit/platform-feature-flags';
26
27
  import * as helpers from '../commands/helpers';
27
28
  import { updateMediaNodeAttrs } from '../commands/helpers';
28
29
  import PickerFacade from '../picker-facade';
@@ -484,9 +485,13 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
484
485
  this.waitForMediaUpload = options.waitForMediaUpload === undefined ? true : options.waitForMediaUpload;
485
486
  var nodes = _state.schema.nodes;
486
487
  assert(nodes.media && (nodes.mediaGroup || nodes.mediaSingle), 'Editor: unable to init media plugin - media or mediaGroup/mediaSingle node absent in schema');
487
- options.providerFactory.subscribe('mediaProvider', function (_name, provider) {
488
- return _this.setMediaProvider(provider);
489
- });
488
+ if (mediaOptions !== null && mediaOptions !== void 0 && mediaOptions.provider && fg('platform_editor_media_provider_from_plugin_config')) {
489
+ this.setMediaProvider(mediaOptions === null || mediaOptions === void 0 ? void 0 : mediaOptions.provider);
490
+ } else {
491
+ options.providerFactory.subscribe('mediaProvider', function (_name, provider) {
492
+ return _this.setMediaProvider(provider);
493
+ });
494
+ }
490
495
  if (mediaInlineImagesEnabled(getMediaFeatureFlag('mediaInline', (_this$mediaOptions2 = this.mediaOptions) === null || _this$mediaOptions2 === void 0 ? void 0 : _this$mediaOptions2.featureFlags), (_this$mediaOptions3 = this.mediaOptions) === null || _this$mediaOptions3 === void 0 ? void 0 : _this$mediaOptions3.allowMediaInlineImages)) {
491
496
  this.allowInlineImages = true;
492
497
  }
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
12
12
  import React from 'react';
13
13
  import { flushSync } from 'react-dom';
14
14
  import { ErrorReporter } from '@atlaskit/editor-common/utils';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
15
16
  import PickerFacade from '../../picker-facade';
16
17
  var dummyMediaPickerObject = {
17
18
  on: function on() {},
@@ -119,7 +120,12 @@ var PickerFacadeProvider = /*#__PURE__*/function (_React$Component) {
119
120
  _createClass(PickerFacadeProvider, [{
120
121
  key: "componentDidMount",
121
122
  value: function componentDidMount() {
122
- this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
123
+ var mediaProvider = this.props.mediaState.mediaProvider;
124
+ if (mediaProvider && fg('platform_editor_media_provider_from_plugin_config')) {
125
+ this.handleMediaProvider('mediaProvider', Promise.resolve(mediaProvider));
126
+ } else {
127
+ this.props.mediaState.options.providerFactory.subscribe('mediaProvider', this.handleMediaProvider);
128
+ }
123
129
  }
124
130
  }, {
125
131
  key: "componentWillUnmount",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.22.6",
3
+ "version": "1.22.7",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,8 +36,8 @@
36
36
  "@atlaskit/adf-schema": "^39.0.3",
37
37
  "@atlaskit/analytics-namespaced-context": "^6.10.0",
38
38
  "@atlaskit/analytics-next": "^9.3.0",
39
- "@atlaskit/button": "^18.1.0",
40
- "@atlaskit/editor-common": "^84.0.0",
39
+ "@atlaskit/button": "^18.2.0",
40
+ "@atlaskit/editor-common": "^84.1.0",
41
41
  "@atlaskit/editor-palette": "1.6.0",
42
42
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
43
43
  "@atlaskit/editor-plugin-annotation": "1.14.1",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/editor-shared-styles": "^2.12.0",
55
55
  "@atlaskit/editor-tables": "^2.7.0",
56
56
  "@atlaskit/form": "^10.4.0",
57
- "@atlaskit/icon": "^22.5.0",
57
+ "@atlaskit/icon": "^22.6.0",
58
58
  "@atlaskit/media-card": "^78.0.0",
59
59
  "@atlaskit/media-client": "^27.3.0",
60
60
  "@atlaskit/media-client-react": "^2.0.0",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/media-ui": "^25.10.0",
65
65
  "@atlaskit/media-viewer": "^48.6.0",
66
66
  "@atlaskit/platform-feature-flags": "^0.3.0",
67
- "@atlaskit/primitives": "^10.0.0",
67
+ "@atlaskit/primitives": "^10.1.0",
68
68
  "@atlaskit/textfield": "^6.4.0",
69
69
  "@atlaskit/theme": "^12.11.0",
70
70
  "@atlaskit/tokens": "^1.53.0",
@@ -143,6 +143,9 @@
143
143
  },
144
144
  "platform.editor.live-view.disable-editing-in-view-mode_fi1rx": {
145
145
  "type": "boolean"
146
+ },
147
+ "platform_editor_media_provider_from_plugin_config": {
148
+ "type": "boolean"
146
149
  }
147
150
  },
148
151
  "stricter": {