@atlaskit/editor-plugin-media 9.5.8 → 9.6.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,18 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 9.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 9.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`88ce28af57fa3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/88ce28af57fa3) -
14
+ Support starting createCommentExperience from editor media toolbar
15
+
3
16
  ## 9.5.8
4
17
 
5
18
  ### Patch Changes
@@ -391,7 +391,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
391
391
  allowMediaInlineImages: options && options.allowMediaInlineImages,
392
392
  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',
393
393
  allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
394
- onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
394
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount,
395
+ createCommentExperience: options === null || options === void 0 ? void 0 : options.createCommentExperience
395
396
  }, api);
396
397
  }
397
398
  }
@@ -15,7 +15,7 @@ var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
16
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
17
  var _utils = require("./utils");
18
- var commentButton = exports.commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
18
+ var commentButton = exports.commentButton = function commentButton(intl, state, api, onCommentButtonMount, createCommentExperience) {
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;
@@ -35,6 +35,17 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
35
35
  var isOpeningMediaCommentFromToolbar = (0, _platformFeatureFlags.fg)('confluence_frontend_media_scroll_fix') ? true : false;
36
36
  if (!showCommentForBlockNode(selectMediaNode, _analytics.VIEW_METHOD.COMMENT_BUTTON, isOpeningMediaCommentFromToolbar)(state, dispatch)) {
37
37
  var _selectMediaNode$attr;
38
+ if ((0, _platformFeatureFlags.fg)('confluence_fe_create_inline_comment_exp_coverage_2')) {
39
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
40
+ attributes: {
41
+ pageClass: 'editor',
42
+ commentType: 'block',
43
+ blockType: 'media',
44
+ entryPoint: 'highlightActionsSimple'
45
+ }
46
+ });
47
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
48
+ }
38
49
  setInlineCommentDraftState(true,
39
50
  // TODO: ED-26962 - might need to update to reflect it's from media floating toolbar
40
51
  _analytics.INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id, isOpeningMediaCommentFromToolbar)(state, dispatch);
@@ -287,7 +287,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
287
287
  allowImagePreview = options.allowImagePreview,
288
288
  isViewOnly = options.isViewOnly,
289
289
  allowPixelResizing = options.allowPixelResizing,
290
- onCommentButtonMount = options.onCommentButtonMount;
290
+ onCommentButtonMount = options.onCommentButtonMount,
291
+ createCommentExperience = options.createCommentExperience;
291
292
  var toolbarButtons = [];
292
293
  var _ref3 = (_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 : {},
293
294
  hoverDecoration = _ref3.hoverDecoration;
@@ -513,7 +514,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
513
514
  }
514
515
  if (!areAnyNewToolbarFlagsEnabled) {
515
516
  if (allowCommentsOnMedia) {
516
- toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount), {
517
+ toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience), {
517
518
  type: 'separator',
518
519
  supportsViewMode: true
519
520
  });
@@ -758,7 +759,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
758
759
  });
759
760
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
760
761
  (0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
761
- toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount));
762
+ toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
762
763
  }
763
764
  return toolbarButtons;
764
765
  }
@@ -387,7 +387,8 @@ export const mediaPlugin = ({
387
387
  allowMediaInlineImages: options && options.allowMediaInlineImages,
388
388
  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',
389
389
  allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
390
- onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
390
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount,
391
+ createCommentExperience: options === null || options === void 0 ? void 0 : options.createCommentExperience
391
392
  }, api);
392
393
  }
393
394
  }
@@ -8,7 +8,7 @@ import CommentIcon from '@atlaskit/icon/core/comment';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
10
  import { getSelectedMediaSingle } from './utils';
11
- export const commentButton = (intl, state, api, onCommentButtonMount) => {
11
+ export const commentButton = (intl, state, api, onCommentButtonMount, createCommentExperience) => {
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;
@@ -27,6 +27,17 @@ export const commentButton = (intl, state, api, onCommentButtonMount) => {
27
27
  const isOpeningMediaCommentFromToolbar = fg('confluence_frontend_media_scroll_fix') ? true : false;
28
28
  if (!showCommentForBlockNode(selectMediaNode, VIEW_METHOD.COMMENT_BUTTON, isOpeningMediaCommentFromToolbar)(state, dispatch)) {
29
29
  var _selectMediaNode$attr;
30
+ if (fg('confluence_fe_create_inline_comment_exp_coverage_2')) {
31
+ createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.start({
32
+ attributes: {
33
+ pageClass: 'editor',
34
+ commentType: 'block',
35
+ blockType: 'media',
36
+ entryPoint: 'highlightActionsSimple'
37
+ }
38
+ });
39
+ createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.initExperience.start();
40
+ }
30
41
  setInlineCommentDraftState(true,
31
42
  // TODO: ED-26962 - might need to update to reflect it's from media floating toolbar
32
43
  INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id, isOpeningMediaCommentFromToolbar)(state, dispatch);
@@ -276,7 +276,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
276
276
  allowImagePreview,
277
277
  isViewOnly,
278
278
  allowPixelResizing,
279
- onCommentButtonMount
279
+ onCommentButtonMount,
280
+ createCommentExperience
280
281
  } = options;
281
282
  let toolbarButtons = [];
282
283
  const {
@@ -506,7 +507,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
506
507
  }
507
508
  if (!areAnyNewToolbarFlagsEnabled) {
508
509
  if (allowCommentsOnMedia) {
509
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
510
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience), {
510
511
  type: 'separator',
511
512
  supportsViewMode: true
512
513
  });
@@ -757,7 +758,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
757
758
  });
758
759
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
759
760
  updateToFullHeightSeparator(toolbarButtons);
760
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
761
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
761
762
  }
762
763
  return toolbarButtons;
763
764
  }
@@ -382,7 +382,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
382
382
  allowMediaInlineImages: options && options.allowMediaInlineImages,
383
383
  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',
384
384
  allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
385
- onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
385
+ onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount,
386
+ createCommentExperience: options === null || options === void 0 ? void 0 : options.createCommentExperience
386
387
  }, api);
387
388
  }
388
389
  }
@@ -8,7 +8,7 @@ import CommentIcon from '@atlaskit/icon/core/comment';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
10
10
  import { getSelectedMediaSingle } from './utils';
11
- export var commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
11
+ export var commentButton = function commentButton(intl, state, api, onCommentButtonMount, createCommentExperience) {
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;
@@ -28,6 +28,17 @@ export var commentButton = function commentButton(intl, state, api, onCommentBut
28
28
  var isOpeningMediaCommentFromToolbar = fg('confluence_frontend_media_scroll_fix') ? true : false;
29
29
  if (!showCommentForBlockNode(selectMediaNode, VIEW_METHOD.COMMENT_BUTTON, isOpeningMediaCommentFromToolbar)(state, dispatch)) {
30
30
  var _selectMediaNode$attr;
31
+ if (fg('confluence_fe_create_inline_comment_exp_coverage_2')) {
32
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
33
+ attributes: {
34
+ pageClass: 'editor',
35
+ commentType: 'block',
36
+ blockType: 'media',
37
+ entryPoint: 'highlightActionsSimple'
38
+ }
39
+ });
40
+ createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
41
+ }
31
42
  setInlineCommentDraftState(true,
32
43
  // TODO: ED-26962 - might need to update to reflect it's from media floating toolbar
33
44
  INPUT_METHOD.FLOATING_TB, 'block', (_selectMediaNode$attr = selectMediaNode.attrs) === null || _selectMediaNode$attr === void 0 ? void 0 : _selectMediaNode$attr.id, isOpeningMediaCommentFromToolbar)(state, dispatch);
@@ -278,7 +278,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
278
278
  allowImagePreview = options.allowImagePreview,
279
279
  isViewOnly = options.isViewOnly,
280
280
  allowPixelResizing = options.allowPixelResizing,
281
- onCommentButtonMount = options.onCommentButtonMount;
281
+ onCommentButtonMount = options.onCommentButtonMount,
282
+ createCommentExperience = options.createCommentExperience;
282
283
  var toolbarButtons = [];
283
284
  var _ref3 = (_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 : {},
284
285
  hoverDecoration = _ref3.hoverDecoration;
@@ -504,7 +505,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
504
505
  }
505
506
  if (!areAnyNewToolbarFlagsEnabled) {
506
507
  if (allowCommentsOnMedia) {
507
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
508
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience), {
508
509
  type: 'separator',
509
510
  supportsViewMode: true
510
511
  });
@@ -749,7 +750,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
749
750
  });
750
751
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
751
752
  updateToFullHeightSeparator(toolbarButtons);
752
- toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
753
+ toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount, createCommentExperience));
753
754
  }
754
755
  return toolbarButtons;
755
756
  }
@@ -48,6 +48,20 @@ export interface MediaPluginOptions {
48
48
  allowResizingInTables?: boolean;
49
49
  allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
50
50
  altTextValidator?: (value: string) => string[];
51
+ createCommentExperience?: {
52
+ initExperience: {
53
+ start: () => void;
54
+ };
55
+ start: (_: {
56
+ attributes: {
57
+ annotationId?: undefined;
58
+ blockType: 'media';
59
+ commentType: 'block';
60
+ entryPoint?: 'highlightActionsSimple';
61
+ pageClass: 'editor';
62
+ };
63
+ }) => void;
64
+ };
51
65
  customDropzoneContainer?: HTMLElement;
52
66
  customMediaPicker?: CustomMediaPicker;
53
67
  disableQuickInsert?: boolean;
@@ -164,6 +178,7 @@ export type MediaFloatingToolbarOptions = {
164
178
  allowResizing?: boolean;
165
179
  allowResizingInTables?: boolean;
166
180
  altTextValidator?: (value: string) => string[];
181
+ createCommentExperience?: MediaPluginOptions['createCommentExperience'];
167
182
  fullWidthEnabled?: boolean;
168
183
  isViewOnly?: boolean;
169
184
  onCommentButtonMount?: () => void;
@@ -2,4 +2,5 @@ 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, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
5
+ import type { MediaPluginOptions } from '../../types';
6
+ export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void, createCommentExperience?: MediaPluginOptions["createCommentExperience"]) => FloatingToolbarButton<Command>;
@@ -48,6 +48,20 @@ export interface MediaPluginOptions {
48
48
  allowResizingInTables?: boolean;
49
49
  allowTemplatePlaceholders?: boolean | PlaceholderTextOptions;
50
50
  altTextValidator?: (value: string) => string[];
51
+ createCommentExperience?: {
52
+ initExperience: {
53
+ start: () => void;
54
+ };
55
+ start: (_: {
56
+ attributes: {
57
+ annotationId?: undefined;
58
+ blockType: 'media';
59
+ commentType: 'block';
60
+ entryPoint?: 'highlightActionsSimple';
61
+ pageClass: 'editor';
62
+ };
63
+ }) => void;
64
+ };
51
65
  customDropzoneContainer?: HTMLElement;
52
66
  customMediaPicker?: CustomMediaPicker;
53
67
  disableQuickInsert?: boolean;
@@ -164,6 +178,7 @@ export type MediaFloatingToolbarOptions = {
164
178
  allowResizing?: boolean;
165
179
  allowResizingInTables?: boolean;
166
180
  altTextValidator?: (value: string) => string[];
181
+ createCommentExperience?: MediaPluginOptions['createCommentExperience'];
167
182
  fullWidthEnabled?: boolean;
168
183
  isViewOnly?: boolean;
169
184
  onCommentButtonMount?: () => void;
@@ -2,4 +2,5 @@ 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, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
5
+ import type { MediaPluginOptions } from '../../types';
6
+ export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void, createCommentExperience?: MediaPluginOptions["createCommentExperience"]) => FloatingToolbarButton<Command>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "9.5.8",
3
+ "version": "9.6.1",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^18.0.0",
67
67
  "@atlaskit/textfield": "^8.2.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^30.0.0",
69
+ "@atlaskit/tmp-editor-statsig": "^31.0.0",
70
70
  "@atlaskit/tokens": "^11.0.0",
71
71
  "@atlaskit/tooltip": "^20.14.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -159,6 +159,9 @@
159
159
  },
160
160
  "platform_editor_media_insert_check": {
161
161
  "type": "boolean"
162
+ },
163
+ "confluence_fe_create_inline_comment_exp_coverage_2": {
164
+ "type": "boolean"
162
165
  }
163
166
  },
164
167
  "stricter": {