@atlaskit/editor-plugin-media 3.0.0 → 3.0.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,23 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#150219](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150219)
14
+ [`8f6e3a7613db0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8f6e3a7613db0) -
15
+ Fixes invalid css comments in template literal styles
16
+ - [#150731](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/150731)
17
+ [`e21eb5fc3b241`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e21eb5fc3b241) -
18
+ ED-27860 Fix media deleted events and update inputMethod to floatingToolbar for expands
19
+ - Updated dependencies
20
+
3
21
  ## 3.0.0
4
22
 
5
23
  ### Patch Changes
@@ -366,7 +366,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
366
366
  fullWidthEnabled: options && options.fullWidthEnabled,
367
367
  allowMediaInlineImages: options && options.allowMediaInlineImages,
368
368
  isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view',
369
- allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
369
+ allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
370
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
370
371
  }, api);
371
372
  }
372
373
  }
@@ -11,7 +11,7 @@ var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/u
11
11
  var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
12
12
 
13
13
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
14
- var pixelSizingWrapper = exports.pixelSizingWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1em 1fr 0;\n\tgrid-template-rows: auto;\n\tgrid-template-areas: 'widthinput label heightinput submit';\n\twidth: ", "px;\n\ttext-align: center;\n\theight: ", ";\n\n\t// Atlaskit fieldset does not allow style override\n\t& > * {\n\t\tmargin-top: 0 !important;\n\t}\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
14
+ var pixelSizingWrapper = exports.pixelSizingWrapper = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1em 1fr 0;\n\tgrid-template-rows: auto;\n\tgrid-template-areas: 'widthinput label heightinput submit';\n\twidth: ", "px;\n\ttext-align: center;\n\theight: ", ";\n\n\t/* Atlaskit fieldset does not allow style override */\n\t& > * {\n\t\tmargin-top: 0 !important;\n\t}\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
15
15
 
16
16
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
17
17
  var pixelEntryForm = exports.pixelEntryForm = (0, _react.css)({
@@ -15,7 +15,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
16
  var _commentWithDotIcon = require("./assets/commentWithDotIcon");
17
17
  var _utils = require("./utils");
18
- var commentButton = exports.commentButton = function commentButton(intl, state, api) {
18
+ var commentButton = exports.commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
19
19
  var _getSelectedMediaSing, _api$annotation, _api$connectivity;
20
20
  var selectMediaNode = (_getSelectedMediaSing = (0, _utils.getSelectedMediaSingle)(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
21
21
  var hasActiveComments = false;
@@ -54,6 +54,11 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
54
54
  description: title
55
55
  }),
56
56
  supportsViewMode: true,
57
- disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline'
57
+ disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
58
+ onMount: function onMount() {
59
+ if ((0, _platformFeatureFlags.fg)('confluence_frontend_preload_inline_comment_editor')) {
60
+ onCommentButtonMount && onCommentButtonMount();
61
+ }
62
+ }
58
63
  };
59
64
  };
@@ -63,10 +63,26 @@ var mediaTypeMessages = {
63
63
  archive: _mediaUi.messages.file_archive_is_selected,
64
64
  unknown: _mediaUi.messages.file_unknown_is_selected
65
65
  };
66
- var removeWithAnalytics = function removeWithAnalytics(editorAnalyticsApi) {
66
+ var getMediaActionSubject = function getMediaActionSubject(nodeType) {
67
+ switch (nodeType.name) {
68
+ case 'mediaSingle':
69
+ return _analytics.ACTION_SUBJECT.MEDIA_SINGLE;
70
+ case 'mediaInline':
71
+ return _analytics.ACTION_SUBJECT.MEDIA_INLINE;
72
+ case 'mediaGroup':
73
+ return _analytics.ACTION_SUBJECT.MEDIA_GROUP;
74
+ default:
75
+ return _analytics.ACTION_SUBJECT.MEDIA;
76
+ }
77
+ };
78
+ var removeWithAnalytics = function removeWithAnalytics(editorAnalyticsApi, nodeType) {
79
+ if (!nodeType) {
80
+ return remove;
81
+ }
82
+ var mediaType = getMediaActionSubject(nodeType);
67
83
  return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
68
84
  action: _analytics.ACTION.DELETED,
69
- actionSubject: _analytics.ACTION_SUBJECT.MEDIA_SINGLE,
85
+ actionSubject: mediaType,
70
86
  attributes: {
71
87
  inputMethod: _analytics.INPUT_METHOD.FLOATING_TB
72
88
  },
@@ -263,7 +279,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
263
279
  allowMediaInlineImages = options.allowMediaInlineImages,
264
280
  allowImagePreview = options.allowImagePreview,
265
281
  isViewOnly = options.isViewOnly,
266
- allowPixelResizing = options.allowPixelResizing;
282
+ allowPixelResizing = options.allowPixelResizing,
283
+ onCommentButtonMount = options.onCommentButtonMount;
267
284
  var toolbarButtons = [];
268
285
  var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
269
286
  hoverDecoration = _ref2.hoverDecoration;
@@ -533,7 +550,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
533
550
  }
534
551
  if (!isEditorControlsEnabled) {
535
552
  if (allowCommentsOnMedia) {
536
- toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi), {
553
+ toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount), {
537
554
  type: 'separator',
538
555
  supportsViewMode: true
539
556
  });
@@ -720,7 +737,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
720
737
  });
721
738
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
722
739
  (0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
723
- toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi));
740
+ toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount));
724
741
  }
725
742
  return toolbarButtons;
726
743
  }
@@ -862,7 +879,7 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
862
879
  })
863
880
  }, hoverDecorationProps(nodeType, _editorSharedStyles.akEditorSelectedNodeClassName)), _objectSpread({
864
881
  title: intl === null || intl === void 0 ? void 0 : intl.formatMessage(_messages.default.delete),
865
- onClick: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions) : remove,
882
+ onClick: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions, selectedNodeType) : remove,
866
883
  icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
867
884
  label: ""
868
885
  })
@@ -361,7 +361,8 @@ export const mediaPlugin = ({
361
361
  fullWidthEnabled: options && options.fullWidthEnabled,
362
362
  allowMediaInlineImages: options && options.allowMediaInlineImages,
363
363
  isViewOnly: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view',
364
- allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
364
+ allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
365
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
365
366
  }, api);
366
367
  }
367
368
  }
@@ -12,7 +12,7 @@ export const pixelSizingWrapper = css`
12
12
  text-align: center;
13
13
  height: ${"var(--ds-space-300, 24px)"};
14
14
 
15
- // Atlaskit fieldset does not allow style override
15
+ /* Atlaskit fieldset does not allow style override */
16
16
  & > * {
17
17
  margin-top: 0 !important;
18
18
  }
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { CommentWithDotIcon } from './assets/commentWithDotIcon';
10
10
  import { getSelectedMediaSingle } from './utils';
11
- export const commentButton = (intl, state, api) => {
11
+ export const commentButton = (intl, state, api, onCommentButtonMount) => {
12
12
  var _getSelectedMediaSing, _api$annotation, _api$annotation$share, _api$connectivity, _api$connectivity$sha, _api$connectivity$sha2;
13
13
  const selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
14
14
  let hasActiveComments = false;
@@ -46,6 +46,11 @@ export const commentButton = (intl, state, api) => {
46
46
  description: title
47
47
  }),
48
48
  supportsViewMode: true,
49
- disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline'
49
+ disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline',
50
+ onMount: () => {
51
+ if (fg('confluence_frontend_preload_inline_comment_editor')) {
52
+ onCommentButtonMount && onCommentButtonMount();
53
+ }
54
+ }
50
55
  };
51
56
  };
@@ -49,10 +49,26 @@ const mediaTypeMessages = {
49
49
  archive: messages.file_archive_is_selected,
50
50
  unknown: messages.file_unknown_is_selected
51
51
  };
52
- const removeWithAnalytics = editorAnalyticsApi => {
52
+ const getMediaActionSubject = nodeType => {
53
+ switch (nodeType.name) {
54
+ case 'mediaSingle':
55
+ return ACTION_SUBJECT.MEDIA_SINGLE;
56
+ case 'mediaInline':
57
+ return ACTION_SUBJECT.MEDIA_INLINE;
58
+ case 'mediaGroup':
59
+ return ACTION_SUBJECT.MEDIA_GROUP;
60
+ default:
61
+ return ACTION_SUBJECT.MEDIA;
62
+ }
63
+ };
64
+ const removeWithAnalytics = (editorAnalyticsApi, nodeType) => {
65
+ if (!nodeType) {
66
+ return remove;
67
+ }
68
+ const mediaType = getMediaActionSubject(nodeType);
53
69
  return withAnalytics(editorAnalyticsApi, {
54
70
  action: ACTION.DELETED,
55
- actionSubject: ACTION_SUBJECT.MEDIA_SINGLE,
71
+ actionSubject: mediaType,
56
72
  attributes: {
57
73
  inputMethod: INPUT_METHOD.FLOATING_TB
58
74
  },
@@ -250,7 +266,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
250
266
  allowMediaInlineImages,
251
267
  allowImagePreview,
252
268
  isViewOnly,
253
- allowPixelResizing
269
+ allowPixelResizing,
270
+ onCommentButtonMount
254
271
  } = options;
255
272
  let toolbarButtons = [];
256
273
  const {
@@ -522,7 +539,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
522
539
  }
523
540
  if (!isEditorControlsEnabled) {
524
541
  if (allowCommentsOnMedia) {
525
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
542
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
526
543
  type: 'separator',
527
544
  supportsViewMode: true
528
545
  });
@@ -715,7 +732,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
715
732
  });
716
733
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
717
734
  updateToFullHeightSeparator(toolbarButtons);
718
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi));
735
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
719
736
  }
720
737
  return toolbarButtons;
721
738
  }
@@ -860,7 +877,7 @@ export const floatingToolbar = (state, intl, options = {}, pluginInjectionApi) =
860
877
  ...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
861
878
  }, {
862
879
  title: intl === null || intl === void 0 ? void 0 : intl.formatMessage(commonMessages.delete),
863
- onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions) : remove,
880
+ onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions, selectedNodeType) : remove,
864
881
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
865
882
  label: ""
866
883
  }),
@@ -356,7 +356,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
356
356
  fullWidthEnabled: options && options.fullWidthEnabled,
357
357
  allowMediaInlineImages: options && options.allowMediaInlineImages,
358
358
  isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view',
359
- allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
359
+ allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
360
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
360
361
  }, api);
361
362
  }
362
363
  }
@@ -5,7 +5,7 @@ import { css } from '@emotion/react';
5
5
  var PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH = 120;
6
6
 
7
7
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
8
- export var pixelSizingWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1em 1fr 0;\n\tgrid-template-rows: auto;\n\tgrid-template-areas: 'widthinput label heightinput submit';\n\twidth: ", "px;\n\ttext-align: center;\n\theight: ", ";\n\n\t// Atlaskit fieldset does not allow style override\n\t& > * {\n\t\tmargin-top: 0 !important;\n\t}\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
8
+ export var pixelSizingWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 1em 1fr 0;\n\tgrid-template-rows: auto;\n\tgrid-template-areas: 'widthinput label heightinput submit';\n\twidth: ", "px;\n\ttext-align: center;\n\theight: ", ";\n\n\t/* Atlaskit fieldset does not allow style override */\n\t& > * {\n\t\tmargin-top: 0 !important;\n\t}\n"])), PIXEL_SIZING_WRAPPER_MINIMUM_WIDTH, "var(--ds-space-300, 24px)");
9
9
 
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
11
11
  export var pixelEntryForm = css({
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { CommentWithDotIcon } from './assets/commentWithDotIcon';
10
10
  import { getSelectedMediaSingle } from './utils';
11
- export var commentButton = function commentButton(intl, state, api) {
11
+ export var commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
12
12
  var _getSelectedMediaSing, _api$annotation, _api$connectivity;
13
13
  var selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
14
14
  var hasActiveComments = false;
@@ -47,6 +47,11 @@ export var commentButton = function commentButton(intl, state, api) {
47
47
  description: title
48
48
  }),
49
49
  supportsViewMode: true,
50
- disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline'
50
+ disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
51
+ onMount: function onMount() {
52
+ if (fg('confluence_frontend_preload_inline_comment_editor')) {
53
+ onCommentButtonMount && onCommentButtonMount();
54
+ }
55
+ }
51
56
  };
52
57
  };
@@ -53,10 +53,26 @@ var mediaTypeMessages = {
53
53
  archive: messages.file_archive_is_selected,
54
54
  unknown: messages.file_unknown_is_selected
55
55
  };
56
- var removeWithAnalytics = function removeWithAnalytics(editorAnalyticsApi) {
56
+ var getMediaActionSubject = function getMediaActionSubject(nodeType) {
57
+ switch (nodeType.name) {
58
+ case 'mediaSingle':
59
+ return ACTION_SUBJECT.MEDIA_SINGLE;
60
+ case 'mediaInline':
61
+ return ACTION_SUBJECT.MEDIA_INLINE;
62
+ case 'mediaGroup':
63
+ return ACTION_SUBJECT.MEDIA_GROUP;
64
+ default:
65
+ return ACTION_SUBJECT.MEDIA;
66
+ }
67
+ };
68
+ var removeWithAnalytics = function removeWithAnalytics(editorAnalyticsApi, nodeType) {
69
+ if (!nodeType) {
70
+ return remove;
71
+ }
72
+ var mediaType = getMediaActionSubject(nodeType);
57
73
  return withAnalytics(editorAnalyticsApi, {
58
74
  action: ACTION.DELETED,
59
- actionSubject: ACTION_SUBJECT.MEDIA_SINGLE,
75
+ actionSubject: mediaType,
60
76
  attributes: {
61
77
  inputMethod: INPUT_METHOD.FLOATING_TB
62
78
  },
@@ -253,7 +269,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
253
269
  allowMediaInlineImages = options.allowMediaInlineImages,
254
270
  allowImagePreview = options.allowImagePreview,
255
271
  isViewOnly = options.isViewOnly,
256
- allowPixelResizing = options.allowPixelResizing;
272
+ allowPixelResizing = options.allowPixelResizing,
273
+ onCommentButtonMount = options.onCommentButtonMount;
257
274
  var toolbarButtons = [];
258
275
  var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
259
276
  hoverDecoration = _ref2.hoverDecoration;
@@ -523,7 +540,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
523
540
  }
524
541
  if (!isEditorControlsEnabled) {
525
542
  if (allowCommentsOnMedia) {
526
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
543
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
527
544
  type: 'separator',
528
545
  supportsViewMode: true
529
546
  });
@@ -710,7 +727,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
710
727
  });
711
728
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
712
729
  updateToFullHeightSeparator(toolbarButtons);
713
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi));
730
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
714
731
  }
715
732
  return toolbarButtons;
716
733
  }
@@ -852,7 +869,7 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
852
869
  })
853
870
  }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)), _objectSpread({
854
871
  title: intl === null || intl === void 0 ? void 0 : intl.formatMessage(commonMessages.delete),
855
- onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions) : remove,
872
+ onClick: fg('platform_editor_controls_patch_analytics_2') ? removeWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a12 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a12 === void 0 ? void 0 : _pluginInjectionApi$a12.actions, selectedNodeType) : remove,
856
873
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
857
874
  label: ""
858
875
  })
@@ -74,6 +74,7 @@ export interface MediaPluginOptions {
74
74
  * ```
75
75
  */
76
76
  isExternalMediaUploadDisabled?: boolean;
77
+ onCommentButtonMount?: () => void;
77
78
  }
78
79
  /**
79
80
  * @private
@@ -145,6 +146,7 @@ export type MediaFloatingToolbarOptions = {
145
146
  allowCommentsOnMedia?: boolean;
146
147
  isViewOnly?: boolean;
147
148
  allowPixelResizing?: boolean;
149
+ onCommentButtonMount?: () => void;
148
150
  };
149
151
  export type MediaDecorationSpec = {
150
152
  type: 'media';
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
- export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarButton<Command>;
5
+ export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
@@ -74,6 +74,7 @@ export interface MediaPluginOptions {
74
74
  * ```
75
75
  */
76
76
  isExternalMediaUploadDisabled?: boolean;
77
+ onCommentButtonMount?: () => void;
77
78
  }
78
79
  /**
79
80
  * @private
@@ -145,6 +146,7 @@ export type MediaFloatingToolbarOptions = {
145
146
  allowCommentsOnMedia?: boolean;
146
147
  isViewOnly?: boolean;
147
148
  allowPixelResizing?: boolean;
149
+ onCommentButtonMount?: () => void;
148
150
  };
149
151
  export type MediaDecorationSpec = {
150
152
  type: 'media';
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
- export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarButton<Command>;
5
+ export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
39
39
  "@atlaskit/analytics-next": "^11.0.0",
40
40
  "@atlaskit/button": "^23.0.0",
41
- "@atlaskit/editor-common": "^104.0.0",
41
+ "@atlaskit/editor-common": "^104.1.0",
42
42
  "@atlaskit/editor-palette": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
44
44
  "@atlaskit/editor-plugin-annotation": "^2.7.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/editor-shared-styles": "^3.4.0",
58
58
  "@atlaskit/editor-tables": "^2.9.0",
59
59
  "@atlaskit/form": "^12.0.0",
60
- "@atlaskit/icon": "^25.6.0",
60
+ "@atlaskit/icon": "^26.0.0",
61
61
  "@atlaskit/media-card": "^79.2.0",
62
62
  "@atlaskit/media-client": "^33.0.0",
63
63
  "@atlaskit/media-client-react": "^4.0.0",
@@ -70,7 +70,7 @@
70
70
  "@atlaskit/primitives": "^14.7.0",
71
71
  "@atlaskit/textfield": "^8.0.0",
72
72
  "@atlaskit/theme": "^18.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^4.16.0",
73
+ "@atlaskit/tmp-editor-statsig": "^4.19.0",
74
74
  "@atlaskit/tokens": "^4.8.0",
75
75
  "@atlaskit/tooltip": "^20.0.0",
76
76
  "@babel/runtime": "^7.0.0",
@@ -195,6 +195,9 @@
195
195
  },
196
196
  "platform_editor_controls_patch_analytics_2": {
197
197
  "type": "boolean"
198
+ },
199
+ "confluence_frontend_preload_inline_comment_editor": {
200
+ "type": "boolean"
198
201
  }
199
202
  },
200
203
  "stricter": {