@atlaskit/editor-plugin-media-insert 2.7.0 → 2.7.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,24 @@
1
1
  # @atlaskit/editor-plugin-media-insert
2
2
 
3
+ ## 2.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#141594](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141594)
8
+ [`3f6b2eb7bd493`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f6b2eb7bd493) -
9
+ [ux] [ED-24867] This change moves nesting codeblocks and media in blockquotes via insertion
10
+ methods behind an experiment gate.
11
+ - Updated dependencies
12
+
13
+ ## 2.7.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#140707](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140707)
18
+ [`972fb840acf35`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/972fb840acf35) -
19
+ Switch from fg to experiment for media-from-url
20
+ - Updated dependencies
21
+
3
22
  ## 2.7.0
4
23
 
5
24
  ### Minor Changes
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.showMediaInsertPopup = exports.closeMediaInsertPicker = exports.ACTION_OPEN_POPUP = exports.ACTION_CLOSE_POPUP = void 0;
7
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
7
8
  var _pluginKey = require("./pm-plugins/plugin-key");
8
9
  var ACTION_OPEN_POPUP = exports.ACTION_OPEN_POPUP = 'OPEN_POPUP';
9
10
  var ACTION_CLOSE_POPUP = exports.ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
@@ -15,6 +16,10 @@ var setPopupMeta = function setPopupMeta(_ref) {
15
16
  });
16
17
  };
17
18
  var showMediaInsertPopup = exports.showMediaInsertPopup = function showMediaInsertPopup(tr) {
19
+ // Log exposure here but don't actually switch anything on it
20
+ (0, _experiments.editorExperiment)('add-media-from-url', true, {
21
+ exposure: true
22
+ });
18
23
  return setPopupMeta({
19
24
  type: ACTION_OPEN_POPUP,
20
25
  tr: tr
@@ -9,12 +9,15 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _messages = require("@atlaskit/editor-common/messages");
11
11
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _actions = require("./actions");
13
14
  var _main = require("./pm-plugins/main");
14
15
  var _pluginKey = require("./pm-plugins/plugin-key");
15
16
  var _MediaInsertPicker = require("./ui/MediaInsertPicker");
16
17
  var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_ref) {
18
+ var _api$featureFlags;
17
19
  var api = _ref.api;
20
+ var isNestingInQuoteSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestMediaAndCodeblockInQuote) || (0, _platformFeatureFlags.fg)('editor_nest_media_and_codeblock_in_quotes_jira');
18
21
  return {
19
22
  name: 'mediaInsert',
20
23
  pmPlugins: function pmPlugins() {
@@ -71,7 +74,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
71
74
  alt: fileName,
72
75
  __fileMimeType: mediaState.fileMimeType
73
76
  });
74
- return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
77
+ return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
75
78
  };
76
79
  var insertExternalMediaSingle = function insertExternalMediaSingle(_ref6) {
77
80
  var _api$media$actions$in2;
@@ -84,7 +87,7 @@ var mediaInsertPlugin = exports.mediaInsertPlugin = function mediaInsertPlugin(_
84
87
  alt: alt,
85
88
  __external: true
86
89
  });
87
- return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
90
+ return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
88
91
  };
89
92
  var insertFile = function insertFile(_ref7) {
90
93
  var _api$media$sharedStat, _api$media$sharedStat2;
@@ -1,3 +1,4 @@
1
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
1
2
  import { pluginKey } from './pm-plugins/plugin-key';
2
3
  export const ACTION_OPEN_POPUP = 'OPEN_POPUP';
3
4
  export const ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
@@ -8,6 +9,10 @@ const setPopupMeta = ({
8
9
  type
9
10
  });
10
11
  export const showMediaInsertPopup = tr => {
12
+ // Log exposure here but don't actually switch anything on it
13
+ editorExperiment('add-media-from-url', true, {
14
+ exposure: true
15
+ });
11
16
  return setPopupMeta({
12
17
  type: ACTION_OPEN_POPUP,
13
18
  tr
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
4
  import { IconImages } from '@atlaskit/editor-common/quick-insert';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { closeMediaInsertPicker, showMediaInsertPopup } from './actions';
6
7
  import { createPlugin } from './pm-plugins/main';
7
8
  import { pluginKey } from './pm-plugins/plugin-key';
@@ -9,6 +10,8 @@ import { MediaInsertPicker } from './ui/MediaInsertPicker';
9
10
  export const mediaInsertPlugin = ({
10
11
  api
11
12
  }) => {
13
+ var _api$featureFlags, _api$featureFlags$sha;
14
+ const isNestingInQuoteSupported = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
12
15
  return {
13
16
  name: 'mediaInsert',
14
17
  pmPlugins() {
@@ -68,7 +71,7 @@ export const mediaInsertPlugin = ({
68
71
  alt: fileName,
69
72
  __fileMimeType: mediaState.fileMimeType
70
73
  });
71
- return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
74
+ return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
72
75
  };
73
76
  const insertExternalMediaSingle = ({
74
77
  url,
@@ -82,7 +85,7 @@ export const mediaInsertPlugin = ({
82
85
  alt,
83
86
  __external: true
84
87
  });
85
- return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
88
+ return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
86
89
  };
87
90
  const insertFile = ({
88
91
  mediaState,
@@ -1,3 +1,4 @@
1
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
1
2
  import { pluginKey } from './pm-plugins/plugin-key';
2
3
  export var ACTION_OPEN_POPUP = 'OPEN_POPUP';
3
4
  export var ACTION_CLOSE_POPUP = 'CLOSE_POPUP';
@@ -9,6 +10,10 @@ var setPopupMeta = function setPopupMeta(_ref) {
9
10
  });
10
11
  };
11
12
  export var showMediaInsertPopup = function showMediaInsertPopup(tr) {
13
+ // Log exposure here but don't actually switch anything on it
14
+ editorExperiment('add-media-from-url', true, {
15
+ exposure: true
16
+ });
12
17
  return setPopupMeta({
13
18
  type: ACTION_OPEN_POPUP,
14
19
  tr: tr
@@ -2,12 +2,15 @@ import React from 'react';
2
2
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
4
4
  import { IconImages } from '@atlaskit/editor-common/quick-insert';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { closeMediaInsertPicker as _closeMediaInsertPicker, showMediaInsertPopup } from './actions';
6
7
  import { createPlugin } from './pm-plugins/main';
7
8
  import { pluginKey } from './pm-plugins/plugin-key';
8
9
  import { MediaInsertPicker } from './ui/MediaInsertPicker';
9
10
  export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
11
+ var _api$featureFlags;
10
12
  var api = _ref.api;
13
+ var isNestingInQuoteSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
11
14
  return {
12
15
  name: 'mediaInsert',
13
16
  pmPlugins: function pmPlugins() {
@@ -64,7 +67,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
64
67
  alt: fileName,
65
68
  __fileMimeType: mediaState.fileMimeType
66
69
  });
67
- return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
70
+ return (_api$media$actions$in = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in !== void 0 ? _api$media$actions$in : false;
68
71
  };
69
72
  var insertExternalMediaSingle = function insertExternalMediaSingle(_ref6) {
70
73
  var _api$media$actions$in2;
@@ -77,7 +80,7 @@ export var mediaInsertPlugin = function mediaInsertPlugin(_ref) {
77
80
  alt: alt,
78
81
  __external: true
79
82
  });
80
- return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
83
+ return (_api$media$actions$in2 = api === null || api === void 0 ? void 0 : api.media.actions.insertMediaAsMediaSingle(editorView, node, inputMethod, isNestingInQuoteSupported)) !== null && _api$media$actions$in2 !== void 0 ? _api$media$actions$in2 : false;
81
84
  };
82
85
  var insertFile = function insertFile(_ref7) {
83
86
  var _api$media$sharedStat, _api$media$sharedStat2;
@@ -3,6 +3,7 @@ import type { Providers } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
6
7
  import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
7
8
  import { type MediaState, type MediaStateEventSubscriber } from '@atlaskit/editor-plugin-media/types';
8
9
  export type MediaInsertPluginState = {
@@ -13,7 +14,11 @@ export type InsertMediaSingle = (props: {
13
14
  inputMethod: InputMethodInsertMedia;
14
15
  }) => boolean;
15
16
  export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
16
- dependencies: [OptionalPlugin<AnalyticsPlugin>, MediaPlugin];
17
+ dependencies: [
18
+ OptionalPlugin<AnalyticsPlugin>,
19
+ MediaPlugin,
20
+ OptionalPlugin<FeatureFlagsPlugin>
21
+ ];
17
22
  sharedState: MediaInsertPluginState;
18
23
  }>;
19
24
  export type InsertExternalMediaSingle = (props: {
@@ -3,6 +3,7 @@ import type { Providers } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { NextEditorPlugin, OptionalPlugin, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
4
4
  import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
6
7
  import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
7
8
  import { type MediaState, type MediaStateEventSubscriber } from '@atlaskit/editor-plugin-media/types';
8
9
  export type MediaInsertPluginState = {
@@ -15,7 +16,8 @@ export type InsertMediaSingle = (props: {
15
16
  export type MediaInsertPlugin = NextEditorPlugin<'mediaInsert', {
16
17
  dependencies: [
17
18
  OptionalPlugin<AnalyticsPlugin>,
18
- MediaPlugin
19
+ MediaPlugin,
20
+ OptionalPlugin<FeatureFlagsPlugin>
19
21
  ];
20
22
  sharedState: MediaInsertPluginState;
21
23
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media-insert",
3
- "version": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "description": "Media Insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,20 +24,22 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@atlaskit/button": "^20.1.0",
27
- "@atlaskit/editor-common": "^89.1.0",
27
+ "@atlaskit/editor-common": "^89.2.0",
28
28
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
29
29
  "@atlaskit/editor-plugin-media": "^1.31.0",
30
30
  "@atlaskit/editor-prosemirror": "6.0.0",
31
31
  "@atlaskit/editor-shared-styles": "^2.13.0",
32
32
  "@atlaskit/icon": "^22.18.0",
33
- "@atlaskit/media-card": "^78.3.0",
33
+ "@atlaskit/media-card": "^78.4.0",
34
34
  "@atlaskit/media-client": "^28.0.0",
35
35
  "@atlaskit/media-client-react": "^2.2.0",
36
- "@atlaskit/media-picker": "^66.4.0",
36
+ "@atlaskit/media-picker": "^66.6.0",
37
+ "@atlaskit/platform-feature-flags": "^0.3.0",
37
38
  "@atlaskit/primitives": "^12.1.0",
38
39
  "@atlaskit/section-message": "^6.6.0",
39
40
  "@atlaskit/tabs": "^16.4.0",
40
41
  "@atlaskit/textfield": "^6.5.0",
42
+ "@atlaskit/tmp-editor-statsig": "*",
41
43
  "@babel/runtime": "^7.0.0",
42
44
  "react": "^16.8.0",
43
45
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -87,5 +89,10 @@
87
89
  "no-unused-dependencies": {
88
90
  "checkDevDependencies": true
89
91
  }
92
+ },
93
+ "platform-feature-flags": {
94
+ "editor_nest_media_and_codeblock_in_quotes_jira": {
95
+ "type": "boolean"
96
+ }
90
97
  }
91
98
  }