@atlaskit/editor-plugin-media 1.20.0 → 1.20.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,21 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.20.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.20.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#100662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100662)
14
+ [`3d61cd8f2afe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d61cd8f2afe) -
15
+ [ED-23355] Update annotation viewed event to with attributes nodeType and method to capture
16
+ usage for comments on media
17
+ - Updated dependencies
18
+
3
19
  ## 1.20.0
4
20
 
5
21
  ### Minor Changes
@@ -11,7 +11,6 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
11
11
  var _model = require("@atlaskit/editor-prosemirror/model");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _utils = require("@atlaskit/editor-prosemirror/utils");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _analytics2 = require("../utils/analytics");
16
15
  var _currentMediaNode = require("../utils/current-media-node");
17
16
  var _mediaCommon = require("../utils/media-common");
@@ -81,12 +80,10 @@ var changeInlineToMediaCard = exports.changeInlineToMediaCard = function changeI
81
80
  previousType: _analytics.ACTION_SUBJECT_ID.MEDIA_INLINE
82
81
  }
83
82
  })(tr);
84
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.ally-media-file-dropdown_1kxo8')) {
85
- var $endOfNode = tr.doc.resolve(insertPos + 1);
86
- var newSelection = new _state.NodeSelection($endOfNode);
87
- tr.setSelection(newSelection);
88
- forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".thumbnail-appearance")(tr);
89
- }
83
+ var $endOfNode = tr.doc.resolve(insertPos + 1);
84
+ var newSelection = new _state.NodeSelection($endOfNode);
85
+ tr.setSelection(newSelection);
86
+ forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".thumbnail-appearance")(tr);
90
87
  dispatch(tr);
91
88
  }
92
89
  return true;
@@ -124,11 +121,9 @@ var changeMediaCardToInline = exports.changeMediaCardToInline = function changeM
124
121
  previousType: _analytics.ACTION_SUBJECT_ID.MEDIA_GROUP
125
122
  }
126
123
  })(tr);
127
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.ally-media-file-dropdown_1kxo8')) {
128
- var newSelection = _state.NodeSelection.create(tr.doc, state.selection.anchor);
129
- tr.setSelection(newSelection);
130
- forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".inline-appearance")(tr);
131
- }
124
+ var newSelection = _state.NodeSelection.create(tr.doc, state.selection.anchor);
125
+ tr.setSelection(newSelection);
126
+ forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".inline-appearance")(tr);
132
127
  dispatch(tr);
133
128
  }
134
129
  return true;
@@ -28,7 +28,7 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
28
28
  var _api$annotation$actio = api.annotation.actions,
29
29
  showCommentForBlockNode = _api$annotation$actio.showCommentForBlockNode,
30
30
  setInlineCommentDraftState = _api$annotation$actio.setInlineCommentDraftState;
31
- if (!showCommentForBlockNode(selectMediaNode)(state, dispatch)) {
31
+ if (!showCommentForBlockNode(selectMediaNode, _analytics.VIEW_METHOD.COMMENT_BUTTON)(state, dispatch)) {
32
32
  var _selectMediaNode$attr;
33
33
  setInlineCommentDraftState(true,
34
34
  // TODO: might need to update to reflect it's from media floating toolbar
@@ -87,6 +87,30 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
87
87
  }
88
88
  var mediaGroup = state.schema.nodes.mediaGroup;
89
89
  var items = [{
90
+ id: 'editor.media.view.switcher.inline',
91
+ type: 'button',
92
+ icon: _card.IconInline,
93
+ selected: false,
94
+ focusEditoronEnter: true,
95
+ disabled: false,
96
+ onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
97
+ title: intl.formatMessage(_messages.cardMessages.inlineTitle),
98
+ testId: 'inline-appearance',
99
+ className: 'inline-appearance' // a11y. uses to force focus on item
100
+ }, {
101
+ id: 'editor.media.view.switcher.thumbnail',
102
+ type: 'button',
103
+ icon: _card.IconCard,
104
+ selected: true,
105
+ disabled: false,
106
+ focusEditoronEnter: true,
107
+ onClick: function onClick() {
108
+ return true;
109
+ },
110
+ title: intl.formatMessage(_messages.cardMessages.blockTitle),
111
+ testId: 'thumbnail-appearance',
112
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
113
+ }, {
90
114
  type: 'separator'
91
115
  }, generateFilePreviewItem(mediaPluginState, intl), {
92
116
  type: 'separator'
@@ -125,54 +149,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
125
149
  onClick: handleRemoveMediaGroup,
126
150
  testId: 'media-toolbar-remove-button'
127
151
  }];
128
- (0, _platformFeatureFlags.getBooleanFF)('platform.editor.ally-media-file-dropdown_1kxo8') ?
129
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
130
- items.unshift({
131
- id: 'editor.media.view.switcher.inline',
132
- type: 'button',
133
- icon: _card.IconInline,
134
- selected: false,
135
- focusEditoronEnter: true,
136
- disabled: false,
137
- onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
138
- title: intl.formatMessage(_messages.cardMessages.inlineTitle),
139
- testId: 'inline-appearance',
140
- className: 'inline-appearance' // a11y. uses to force focus on item
141
- }, {
142
- id: 'editor.media.view.switcher.thumbnail',
143
- type: 'button',
144
- icon: _card.IconCard,
145
- selected: true,
146
- disabled: false,
147
- focusEditoronEnter: true,
148
- onClick: function onClick() {
149
- return true;
150
- },
151
- title: intl.formatMessage(_messages.cardMessages.blockTitle),
152
- testId: 'thumbnail-appearance',
153
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
154
- }) : items.unshift({
155
- id: 'editor.media.view.switcher',
156
- type: 'dropdown',
157
- title: intl.formatMessage(_mediaUi.messages.changeView),
158
- options: [{
159
- id: 'editor.media.view.switcher.inline',
160
- title: intl.formatMessage(_messages.cardMessages.inline),
161
- selected: false,
162
- disabled: false,
163
- onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
164
- testId: 'inline-appearance'
165
- }, {
166
- id: 'editor.media.view.switcher.thumbnail',
167
- title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
168
- selected: true,
169
- disabled: false,
170
- onClick: function onClick() {
171
- return true;
172
- },
173
- testId: 'thumbnail-appearance'
174
- }]
175
- });
176
152
  return items;
177
153
  };
178
154
  var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) {
@@ -14,7 +14,6 @@ var _state2 = require("@atlaskit/editor-prosemirror/state");
14
14
  var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"));
15
15
  var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
16
16
  var _mediaUi = require("@atlaskit/media-ui");
17
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
17
  var _linking = require("../commands/linking");
19
18
  var _linking2 = require("../pm-plugins/linking");
20
19
  var _ImageBorder = _interopRequireDefault(require("../ui/ImageBorder"));
@@ -41,6 +40,30 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
41
40
  return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
42
41
  }
43
42
  var items = [{
43
+ id: 'editor.media.view.switcher.inline',
44
+ type: 'button',
45
+ icon: _card.IconInline,
46
+ selected: true,
47
+ disabled: false,
48
+ focusEditoronEnter: true,
49
+ onClick: function onClick() {
50
+ return true;
51
+ },
52
+ title: intl.formatMessage(_messages.cardMessages.inlineTitle),
53
+ testId: 'inline-appearance',
54
+ className: 'inline-appearance' // a11y. uses to force focus on item
55
+ }, {
56
+ id: 'editor.media.view.switcher.thumbnail',
57
+ type: 'button',
58
+ icon: _card.IconCard,
59
+ selected: false,
60
+ disabled: false,
61
+ focusEditoronEnter: true,
62
+ onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
63
+ title: intl.formatMessage(_messages.cardMessages.blockTitle),
64
+ testId: 'thumbnail-appearance',
65
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
66
+ }, {
44
67
  type: 'separator'
45
68
  }, {
46
69
  type: 'custom',
@@ -89,57 +112,6 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
89
112
  onClick: _commands.removeInlineCard,
90
113
  testId: 'media-toolbar-remove-button'
91
114
  }];
92
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.ally-media-file-dropdown_1kxo8')) {
93
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
94
- items.unshift({
95
- id: 'editor.media.view.switcher.inline',
96
- type: 'button',
97
- icon: _card.IconInline,
98
- selected: true,
99
- disabled: false,
100
- focusEditoronEnter: true,
101
- onClick: function onClick() {
102
- return true;
103
- },
104
- title: intl.formatMessage(_messages.cardMessages.inlineTitle),
105
- testId: 'inline-appearance',
106
- className: 'inline-appearance' // a11y. uses to force focus on item
107
- }, {
108
- id: 'editor.media.view.switcher.thumbnail',
109
- type: 'button',
110
- icon: _card.IconCard,
111
- selected: false,
112
- disabled: false,
113
- focusEditoronEnter: true,
114
- onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
115
- title: intl.formatMessage(_messages.cardMessages.blockTitle),
116
- testId: 'thumbnail-appearance',
117
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
118
- });
119
- } else {
120
- items.unshift({
121
- id: 'editor.media.view.switcher',
122
- type: 'dropdown',
123
- title: intl.formatMessage(_mediaUi.messages.changeView),
124
- options: [{
125
- id: 'editor.media.view.switcher.inline',
126
- title: intl.formatMessage(_messages.cardMessages.inline),
127
- selected: true,
128
- disabled: false,
129
- onClick: function onClick() {
130
- return true;
131
- },
132
- testId: 'inline-appearance'
133
- }, {
134
- id: 'editor.media.view.switcher.thumbnail',
135
- title: intl.formatMessage(_mediaUi.messages.displayThumbnail),
136
- selected: false,
137
- disabled: false,
138
- onClick: (0, _commands.changeInlineToMediaCard)(editorAnalyticsAPI, forceFocusSelector),
139
- testId: 'thumbnail-appearance'
140
- }]
141
- });
142
- }
143
115
  return items;
144
116
  };
145
117
  var getMediaInlineImageToolbar = exports.getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
@@ -9,6 +9,7 @@ exports.CommentBadge = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactIntlNext = require("react-intl-next");
12
+ var _analytics = require("@atlaskit/editor-common/analytics");
12
13
  var _hooks = require("@atlaskit/editor-common/hooks");
13
14
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
14
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -46,7 +47,7 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
46
47
  var onClick = (0, _react.useCallback)(function () {
47
48
  if (api.annotation && mediaNode) {
48
49
  var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
49
- showCommentForBlockNode(mediaNode)(state, dispatch);
50
+ showCommentForBlockNode(mediaNode, _analytics.VIEW_METHOD.BADGE)(state, dispatch);
50
51
  }
51
52
  }, [api.annotation, dispatch, mediaNode, state]);
52
53
  var pos = getPos();
@@ -3,7 +3,6 @@ import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { findParentNodeClosestToPos, isNodeSelection, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
6
  import { findChangeFromLocation, getChangeMediaAnalytics, getMediaInputResizeAnalyticsEvent } from '../utils/analytics';
8
7
  import { currentMediaInlineNodeWithPos } from '../utils/current-media-node';
9
8
  import { isSelectionMediaSingleNode } from '../utils/media-common';
@@ -73,12 +72,10 @@ export const changeInlineToMediaCard = (editorAnalyticsAPI, forceFocusSelector)
73
72
  previousType: ACTION_SUBJECT_ID.MEDIA_INLINE
74
73
  }
75
74
  })(tr);
76
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
77
- const $endOfNode = tr.doc.resolve(insertPos + 1);
78
- const newSelection = new NodeSelection($endOfNode);
79
- tr.setSelection(newSelection);
80
- forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector(`.thumbnail-appearance`)(tr);
81
- }
75
+ const $endOfNode = tr.doc.resolve(insertPos + 1);
76
+ const newSelection = new NodeSelection($endOfNode);
77
+ tr.setSelection(newSelection);
78
+ forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector(`.thumbnail-appearance`)(tr);
82
79
  dispatch(tr);
83
80
  }
84
81
  return true;
@@ -115,11 +112,9 @@ export const changeMediaCardToInline = (editorAnalyticsAPI, forceFocusSelector)
115
112
  previousType: ACTION_SUBJECT_ID.MEDIA_GROUP
116
113
  }
117
114
  })(tr);
118
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
119
- const newSelection = NodeSelection.create(tr.doc, state.selection.anchor);
120
- tr.setSelection(newSelection);
121
- forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector(`.inline-appearance`)(tr);
122
- }
115
+ const newSelection = NodeSelection.create(tr.doc, state.selection.anchor);
116
+ tr.setSelection(newSelection);
117
+ forceFocusSelector === null || forceFocusSelector === void 0 ? void 0 : forceFocusSelector(`.inline-appearance`)(tr);
123
118
  dispatch(tr);
124
119
  }
125
120
  return true;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import { INPUT_METHOD, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { commentMessages as messages } from '@atlaskit/editor-common/media';
5
5
  import CommentIcon from '@atlaskit/icon/glyph/comment';
@@ -20,7 +20,7 @@ export const commentButton = (intl, state, api) => {
20
20
  showCommentForBlockNode,
21
21
  setInlineCommentDraftState
22
22
  } = api.annotation.actions;
23
- if (!showCommentForBlockNode(selectMediaNode)(state, dispatch)) {
23
+ if (!showCommentForBlockNode(selectMediaNode, VIEW_METHOD.COMMENT_BUTTON)(state, dispatch)) {
24
24
  var _selectMediaNode$attr;
25
25
  setInlineCommentDraftState(true,
26
26
  // TODO: might need to update to reflect it's from media floating toolbar
@@ -75,6 +75,28 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
75
75
  mediaGroup
76
76
  } = state.schema.nodes;
77
77
  const items = [{
78
+ id: 'editor.media.view.switcher.inline',
79
+ type: 'button',
80
+ icon: IconInline,
81
+ selected: false,
82
+ focusEditoronEnter: true,
83
+ disabled: false,
84
+ onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
85
+ title: intl.formatMessage(cardMessages.inlineTitle),
86
+ testId: 'inline-appearance',
87
+ className: 'inline-appearance' // a11y. uses to force focus on item
88
+ }, {
89
+ id: 'editor.media.view.switcher.thumbnail',
90
+ type: 'button',
91
+ icon: IconCard,
92
+ selected: true,
93
+ disabled: false,
94
+ focusEditoronEnter: true,
95
+ onClick: () => true,
96
+ title: intl.formatMessage(cardMessages.blockTitle),
97
+ testId: 'thumbnail-appearance',
98
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
99
+ }, {
78
100
  type: 'separator'
79
101
  }, generateFilePreviewItem(mediaPluginState, intl), {
80
102
  type: 'separator'
@@ -113,52 +135,6 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
113
135
  onClick: handleRemoveMediaGroup,
114
136
  testId: 'media-toolbar-remove-button'
115
137
  }];
116
- getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8') ?
117
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
118
- items.unshift({
119
- id: 'editor.media.view.switcher.inline',
120
- type: 'button',
121
- icon: IconInline,
122
- selected: false,
123
- focusEditoronEnter: true,
124
- disabled: false,
125
- onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
126
- title: intl.formatMessage(cardMessages.inlineTitle),
127
- testId: 'inline-appearance',
128
- className: 'inline-appearance' // a11y. uses to force focus on item
129
- }, {
130
- id: 'editor.media.view.switcher.thumbnail',
131
- type: 'button',
132
- icon: IconCard,
133
- selected: true,
134
- disabled: false,
135
- focusEditoronEnter: true,
136
- onClick: () => true,
137
- title: intl.formatMessage(cardMessages.blockTitle),
138
- testId: 'thumbnail-appearance',
139
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
140
- }) : items.unshift({
141
- id: 'editor.media.view.switcher',
142
- type: 'dropdown',
143
- title: intl.formatMessage(messages.changeView),
144
- options: [{
145
- id: 'editor.media.view.switcher.inline',
146
- title: intl.formatMessage(cardMessages.inline),
147
- selected: false,
148
- disabled: false,
149
- onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
150
- testId: 'inline-appearance'
151
- }, {
152
- id: 'editor.media.view.switcher.thumbnail',
153
- title: intl.formatMessage(messages.displayThumbnail),
154
- selected: true,
155
- disabled: false,
156
- onClick: () => {
157
- return true;
158
- },
159
- testId: 'thumbnail-appearance'
160
- }]
161
- });
162
138
  return items;
163
139
  };
164
140
  const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) => {
@@ -6,7 +6,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import DownloadIcon from '@atlaskit/icon/glyph/download';
7
7
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
8
8
  import { messages } from '@atlaskit/media-ui';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
9
  import { showLinkingToolbar } from '../commands/linking';
11
10
  import { getMediaLinkingState } from '../pm-plugins/linking';
12
11
  import ImageBorderItem from '../ui/ImageBorder';
@@ -32,6 +31,28 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
32
31
  return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
33
32
  }
34
33
  const items = [{
34
+ id: 'editor.media.view.switcher.inline',
35
+ type: 'button',
36
+ icon: IconInline,
37
+ selected: true,
38
+ disabled: false,
39
+ focusEditoronEnter: true,
40
+ onClick: () => true,
41
+ title: intl.formatMessage(cardMessages.inlineTitle),
42
+ testId: 'inline-appearance',
43
+ className: 'inline-appearance' // a11y. uses to force focus on item
44
+ }, {
45
+ id: 'editor.media.view.switcher.thumbnail',
46
+ type: 'button',
47
+ icon: IconCard,
48
+ selected: false,
49
+ disabled: false,
50
+ focusEditoronEnter: true,
51
+ onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
52
+ title: intl.formatMessage(cardMessages.blockTitle),
53
+ testId: 'thumbnail-appearance',
54
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
55
+ }, {
35
56
  type: 'separator'
36
57
  }, {
37
58
  type: 'custom',
@@ -80,55 +101,6 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
80
101
  onClick: removeInlineCard,
81
102
  testId: 'media-toolbar-remove-button'
82
103
  }];
83
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
84
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
85
- items.unshift({
86
- id: 'editor.media.view.switcher.inline',
87
- type: 'button',
88
- icon: IconInline,
89
- selected: true,
90
- disabled: false,
91
- focusEditoronEnter: true,
92
- onClick: () => true,
93
- title: intl.formatMessage(cardMessages.inlineTitle),
94
- testId: 'inline-appearance',
95
- className: 'inline-appearance' // a11y. uses to force focus on item
96
- }, {
97
- id: 'editor.media.view.switcher.thumbnail',
98
- type: 'button',
99
- icon: IconCard,
100
- selected: false,
101
- disabled: false,
102
- focusEditoronEnter: true,
103
- onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
104
- title: intl.formatMessage(cardMessages.blockTitle),
105
- testId: 'thumbnail-appearance',
106
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
107
- });
108
- } else {
109
- items.unshift({
110
- id: 'editor.media.view.switcher',
111
- type: 'dropdown',
112
- title: intl.formatMessage(messages.changeView),
113
- options: [{
114
- id: 'editor.media.view.switcher.inline',
115
- title: intl.formatMessage(cardMessages.inline),
116
- selected: true,
117
- disabled: false,
118
- onClick: () => {
119
- return true;
120
- },
121
- testId: 'inline-appearance'
122
- }, {
123
- id: 'editor.media.view.switcher.thumbnail',
124
- title: intl.formatMessage(messages.displayThumbnail),
125
- selected: false,
126
- disabled: false,
127
- onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
128
- testId: 'thumbnail-appearance'
129
- }]
130
- });
131
- }
132
104
  return items;
133
105
  };
134
106
  export const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options = {}) => {
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
+ import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
3
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
5
  import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
5
6
  const CommentBadgeWrapper = ({
@@ -41,7 +42,7 @@ const CommentBadgeWrapper = ({
41
42
  const {
42
43
  showCommentForBlockNode
43
44
  } = api.annotation.actions;
44
- showCommentForBlockNode(mediaNode)(state, dispatch);
45
+ showCommentForBlockNode(mediaNode, VIEW_METHOD.BADGE)(state, dispatch);
45
46
  }
46
47
  }, [api.annotation, dispatch, mediaNode, state]);
47
48
  const pos = getPos();
@@ -6,7 +6,6 @@ import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
6
6
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
7
7
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { findParentNodeClosestToPos, isNodeSelection, removeSelectedNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
9
  import { findChangeFromLocation, getChangeMediaAnalytics, getMediaInputResizeAnalyticsEvent } from '../utils/analytics';
11
10
  import { currentMediaInlineNodeWithPos } from '../utils/current-media-node';
12
11
  import { isSelectionMediaSingleNode } from '../utils/media-common';
@@ -74,12 +73,10 @@ export var changeInlineToMediaCard = function changeInlineToMediaCard(editorAnal
74
73
  previousType: ACTION_SUBJECT_ID.MEDIA_INLINE
75
74
  }
76
75
  })(tr);
77
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
78
- var $endOfNode = tr.doc.resolve(insertPos + 1);
79
- var newSelection = new NodeSelection($endOfNode);
80
- tr.setSelection(newSelection);
81
- forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".thumbnail-appearance")(tr);
82
- }
76
+ var $endOfNode = tr.doc.resolve(insertPos + 1);
77
+ var newSelection = new NodeSelection($endOfNode);
78
+ tr.setSelection(newSelection);
79
+ forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".thumbnail-appearance")(tr);
83
80
  dispatch(tr);
84
81
  }
85
82
  return true;
@@ -117,11 +114,9 @@ export var changeMediaCardToInline = function changeMediaCardToInline(editorAnal
117
114
  previousType: ACTION_SUBJECT_ID.MEDIA_GROUP
118
115
  }
119
116
  })(tr);
120
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
121
- var newSelection = NodeSelection.create(tr.doc, state.selection.anchor);
122
- tr.setSelection(newSelection);
123
- forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".inline-appearance")(tr);
124
- }
117
+ var newSelection = NodeSelection.create(tr.doc, state.selection.anchor);
118
+ tr.setSelection(newSelection);
119
+ forceFocusSelector === null || forceFocusSelector === void 0 || forceFocusSelector(".inline-appearance")(tr);
125
120
  dispatch(tr);
126
121
  }
127
122
  return true;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
+ import { INPUT_METHOD, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { commentMessages as messages } from '@atlaskit/editor-common/media';
5
5
  import CommentIcon from '@atlaskit/icon/glyph/comment';
@@ -21,7 +21,7 @@ export var commentButton = function commentButton(intl, state, api) {
21
21
  var _api$annotation$actio = api.annotation.actions,
22
22
  showCommentForBlockNode = _api$annotation$actio.showCommentForBlockNode,
23
23
  setInlineCommentDraftState = _api$annotation$actio.setInlineCommentDraftState;
24
- if (!showCommentForBlockNode(selectMediaNode)(state, dispatch)) {
24
+ if (!showCommentForBlockNode(selectMediaNode, VIEW_METHOD.COMMENT_BUTTON)(state, dispatch)) {
25
25
  var _selectMediaNode$attr;
26
26
  setInlineCommentDraftState(true,
27
27
  // TODO: might need to update to reflect it's from media floating toolbar
@@ -77,6 +77,30 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
77
77
  }
78
78
  var mediaGroup = state.schema.nodes.mediaGroup;
79
79
  var items = [{
80
+ id: 'editor.media.view.switcher.inline',
81
+ type: 'button',
82
+ icon: IconInline,
83
+ selected: false,
84
+ focusEditoronEnter: true,
85
+ disabled: false,
86
+ onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
87
+ title: intl.formatMessage(cardMessages.inlineTitle),
88
+ testId: 'inline-appearance',
89
+ className: 'inline-appearance' // a11y. uses to force focus on item
90
+ }, {
91
+ id: 'editor.media.view.switcher.thumbnail',
92
+ type: 'button',
93
+ icon: IconCard,
94
+ selected: true,
95
+ disabled: false,
96
+ focusEditoronEnter: true,
97
+ onClick: function onClick() {
98
+ return true;
99
+ },
100
+ title: intl.formatMessage(cardMessages.blockTitle),
101
+ testId: 'thumbnail-appearance',
102
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
103
+ }, {
80
104
  type: 'separator'
81
105
  }, generateFilePreviewItem(mediaPluginState, intl), {
82
106
  type: 'separator'
@@ -115,54 +139,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
115
139
  onClick: handleRemoveMediaGroup,
116
140
  testId: 'media-toolbar-remove-button'
117
141
  }];
118
- getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8') ?
119
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
120
- items.unshift({
121
- id: 'editor.media.view.switcher.inline',
122
- type: 'button',
123
- icon: IconInline,
124
- selected: false,
125
- focusEditoronEnter: true,
126
- disabled: false,
127
- onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
128
- title: intl.formatMessage(cardMessages.inlineTitle),
129
- testId: 'inline-appearance',
130
- className: 'inline-appearance' // a11y. uses to force focus on item
131
- }, {
132
- id: 'editor.media.view.switcher.thumbnail',
133
- type: 'button',
134
- icon: IconCard,
135
- selected: true,
136
- disabled: false,
137
- focusEditoronEnter: true,
138
- onClick: function onClick() {
139
- return true;
140
- },
141
- title: intl.formatMessage(cardMessages.blockTitle),
142
- testId: 'thumbnail-appearance',
143
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
144
- }) : items.unshift({
145
- id: 'editor.media.view.switcher',
146
- type: 'dropdown',
147
- title: intl.formatMessage(messages.changeView),
148
- options: [{
149
- id: 'editor.media.view.switcher.inline',
150
- title: intl.formatMessage(cardMessages.inline),
151
- selected: false,
152
- disabled: false,
153
- onClick: changeMediaCardToInline(editorAnalyticsAPI, forceFocusSelector),
154
- testId: 'inline-appearance'
155
- }, {
156
- id: 'editor.media.view.switcher.thumbnail',
157
- title: intl.formatMessage(messages.displayThumbnail),
158
- selected: true,
159
- disabled: false,
160
- onClick: function onClick() {
161
- return true;
162
- },
163
- testId: 'thumbnail-appearance'
164
- }]
165
- });
166
142
  return items;
167
143
  };
168
144
  var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi) {
@@ -6,7 +6,6 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import DownloadIcon from '@atlaskit/icon/glyph/download';
7
7
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
8
8
  import { messages } from '@atlaskit/media-ui';
9
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
9
  import { showLinkingToolbar } from '../commands/linking';
11
10
  import { getMediaLinkingState } from '../pm-plugins/linking';
12
11
  import ImageBorderItem from '../ui/ImageBorder';
@@ -31,6 +30,30 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
31
30
  return getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState, options);
32
31
  }
33
32
  var items = [{
33
+ id: 'editor.media.view.switcher.inline',
34
+ type: 'button',
35
+ icon: IconInline,
36
+ selected: true,
37
+ disabled: false,
38
+ focusEditoronEnter: true,
39
+ onClick: function onClick() {
40
+ return true;
41
+ },
42
+ title: intl.formatMessage(cardMessages.inlineTitle),
43
+ testId: 'inline-appearance',
44
+ className: 'inline-appearance' // a11y. uses to force focus on item
45
+ }, {
46
+ id: 'editor.media.view.switcher.thumbnail',
47
+ type: 'button',
48
+ icon: IconCard,
49
+ selected: false,
50
+ disabled: false,
51
+ focusEditoronEnter: true,
52
+ onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
53
+ title: intl.formatMessage(cardMessages.blockTitle),
54
+ testId: 'thumbnail-appearance',
55
+ className: 'thumbnail-appearance' // a11y. uses to force focus on item
56
+ }, {
34
57
  type: 'separator'
35
58
  }, {
36
59
  type: 'custom',
@@ -79,57 +102,6 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
79
102
  onClick: removeInlineCard,
80
103
  testId: 'media-toolbar-remove-button'
81
104
  }];
82
- if (getBooleanFF('platform.editor.ally-media-file-dropdown_1kxo8')) {
83
- // TODO: after removing Feature Flag move items back to previous array definition instead of unshift
84
- items.unshift({
85
- id: 'editor.media.view.switcher.inline',
86
- type: 'button',
87
- icon: IconInline,
88
- selected: true,
89
- disabled: false,
90
- focusEditoronEnter: true,
91
- onClick: function onClick() {
92
- return true;
93
- },
94
- title: intl.formatMessage(cardMessages.inlineTitle),
95
- testId: 'inline-appearance',
96
- className: 'inline-appearance' // a11y. uses to force focus on item
97
- }, {
98
- id: 'editor.media.view.switcher.thumbnail',
99
- type: 'button',
100
- icon: IconCard,
101
- selected: false,
102
- disabled: false,
103
- focusEditoronEnter: true,
104
- onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
105
- title: intl.formatMessage(cardMessages.blockTitle),
106
- testId: 'thumbnail-appearance',
107
- className: 'thumbnail-appearance' // a11y. uses to force focus on item
108
- });
109
- } else {
110
- items.unshift({
111
- id: 'editor.media.view.switcher',
112
- type: 'dropdown',
113
- title: intl.formatMessage(messages.changeView),
114
- options: [{
115
- id: 'editor.media.view.switcher.inline',
116
- title: intl.formatMessage(cardMessages.inline),
117
- selected: true,
118
- disabled: false,
119
- onClick: function onClick() {
120
- return true;
121
- },
122
- testId: 'inline-appearance'
123
- }, {
124
- id: 'editor.media.view.switcher.thumbnail',
125
- title: intl.formatMessage(messages.displayThumbnail),
126
- selected: false,
127
- disabled: false,
128
- onClick: changeInlineToMediaCard(editorAnalyticsAPI, forceFocusSelector),
129
- testId: 'thumbnail-appearance'
130
- }]
131
- });
132
- }
133
105
  return items;
134
106
  };
135
107
  export var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl, mediaPluginState, hoverDecoration, editorAnalyticsAPI, pluginInjectionApi, mediaLinkingState) {
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useCallback, useMemo, useState } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
+ import { VIEW_METHOD } from '@atlaskit/editor-common/analytics';
4
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
6
  import { CommentBadge as CommentBadgeComponent } from '@atlaskit/editor-common/media-single';
6
7
  var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
@@ -36,7 +37,7 @@ var CommentBadgeWrapper = function CommentBadgeWrapper(_ref) {
36
37
  var onClick = useCallback(function () {
37
38
  if (api.annotation && mediaNode) {
38
39
  var showCommentForBlockNode = api.annotation.actions.showCommentForBlockNode;
39
- showCommentForBlockNode(mediaNode)(state, dispatch);
40
+ showCommentForBlockNode(mediaNode, VIEW_METHOD.BADGE)(state, dispatch);
40
41
  }
41
42
  }, [api.annotation, dispatch, mediaNode, state]);
42
43
  var pos = getPos();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,10 +37,10 @@
37
37
  "@atlaskit/analytics-namespaced-context": "^6.9.0",
38
38
  "@atlaskit/analytics-next": "^9.3.0",
39
39
  "@atlaskit/button": "^17.14.0",
40
- "@atlaskit/editor-common": "^80.1.0",
40
+ "@atlaskit/editor-common": "^80.4.0",
41
41
  "@atlaskit/editor-palette": "1.6.0",
42
42
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
43
- "@atlaskit/editor-plugin-annotation": "1.8.0",
43
+ "@atlaskit/editor-plugin-annotation": "1.9.1",
44
44
  "@atlaskit/editor-plugin-decorations": "^1.1.0",
45
45
  "@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
46
46
  "@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/media-ui": "^25.10.0",
65
65
  "@atlaskit/media-viewer": "^48.5.0",
66
66
  "@atlaskit/platform-feature-flags": "^0.2.0",
67
- "@atlaskit/primitives": "^6.1.0",
67
+ "@atlaskit/primitives": "^6.2.0",
68
68
  "@atlaskit/textfield": "^6.3.0",
69
69
  "@atlaskit/theme": "^12.8.0",
70
70
  "@atlaskit/tokens": "^1.48.0",
@@ -136,9 +136,6 @@
136
136
  "platform.editor.a11y-media-resizing_b5v0o": {
137
137
  "type": "boolean"
138
138
  },
139
- "platform.editor.ally-media-file-dropdown_1kxo8": {
140
- "type": "boolean"
141
- },
142
139
  "platform.editor.allow-extended-panel": {
143
140
  "type": "boolean"
144
141
  },