@atlaskit/editor-plugin-media 2.3.14 → 2.3.16

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/nodeviews/mediaGroup.js +2 -2
  3. package/dist/cjs/nodeviews/mediaGroupNext.js +2 -2
  4. package/dist/cjs/nodeviews/mediaInline.js +2 -1
  5. package/dist/cjs/nodeviews/mediaNodeView/index.js +3 -1
  6. package/dist/cjs/nodeviews/mediaNodeView/media.js +13 -1
  7. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +3 -3
  8. package/dist/cjs/ui/Media/DropPlaceholder.js +3 -3
  9. package/dist/cjs/ui/MediaLinkingToolbar.js +4 -4
  10. package/dist/cjs/ui/ToolbarMedia/index.js +2 -2
  11. package/dist/cjs/ui/toolbar/alt-text.js +20 -1
  12. package/dist/cjs/ui/toolbar/comments.js +1 -2
  13. package/dist/cjs/ui/toolbar/index.js +64 -84
  14. package/dist/cjs/ui/toolbar/mediaInline.js +80 -74
  15. package/dist/cjs/ui/toolbar/pixel-resizing.js +28 -3
  16. package/dist/cjs/ui/toolbar/utils.js +12 -1
  17. package/dist/es2019/nodeviews/mediaGroup.js +1 -1
  18. package/dist/es2019/nodeviews/mediaGroupNext.js +1 -1
  19. package/dist/es2019/nodeviews/mediaInline.js +2 -1
  20. package/dist/es2019/nodeviews/mediaNodeView/index.js +3 -1
  21. package/dist/es2019/nodeviews/mediaNodeView/media.js +13 -1
  22. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +2 -2
  23. package/dist/es2019/ui/Media/DropPlaceholder.js +2 -2
  24. package/dist/es2019/ui/MediaLinkingToolbar.js +2 -2
  25. package/dist/es2019/ui/ToolbarMedia/index.js +1 -1
  26. package/dist/es2019/ui/toolbar/alt-text.js +20 -0
  27. package/dist/es2019/ui/toolbar/comments.js +1 -2
  28. package/dist/es2019/ui/toolbar/index.js +59 -79
  29. package/dist/es2019/ui/toolbar/mediaInline.js +84 -76
  30. package/dist/es2019/ui/toolbar/pixel-resizing.js +28 -1
  31. package/dist/es2019/ui/toolbar/utils.js +11 -0
  32. package/dist/esm/nodeviews/mediaGroup.js +1 -1
  33. package/dist/esm/nodeviews/mediaGroupNext.js +1 -1
  34. package/dist/esm/nodeviews/mediaInline.js +2 -1
  35. package/dist/esm/nodeviews/mediaNodeView/index.js +3 -1
  36. package/dist/esm/nodeviews/mediaNodeView/media.js +13 -1
  37. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +2 -2
  38. package/dist/esm/ui/Media/DropPlaceholder.js +2 -2
  39. package/dist/esm/ui/MediaLinkingToolbar.js +2 -2
  40. package/dist/esm/ui/ToolbarMedia/index.js +1 -1
  41. package/dist/esm/ui/toolbar/alt-text.js +19 -0
  42. package/dist/esm/ui/toolbar/comments.js +1 -2
  43. package/dist/esm/ui/toolbar/index.js +59 -79
  44. package/dist/esm/ui/toolbar/mediaInline.js +78 -72
  45. package/dist/esm/ui/toolbar/pixel-resizing.js +25 -0
  46. package/dist/esm/ui/toolbar/utils.js +11 -0
  47. package/dist/types/nodeviews/mediaNodeView/media.d.ts +1 -0
  48. package/dist/types/ui/toolbar/alt-text.d.ts +4 -2
  49. package/dist/types/ui/toolbar/pixel-resizing.d.ts +6 -2
  50. package/dist/types/ui/toolbar/utils.d.ts +2 -0
  51. package/dist/types-ts4.5/nodeviews/mediaNodeView/media.d.ts +1 -0
  52. package/dist/types-ts4.5/ui/toolbar/alt-text.d.ts +4 -2
  53. package/dist/types-ts4.5/ui/toolbar/pixel-resizing.d.ts +6 -2
  54. package/dist/types-ts4.5/ui/toolbar/utils.d.ts +2 -0
  55. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 2.3.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131525](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131525)
8
+ [`cb8403ffb5a8b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cb8403ffb5a8b) -
9
+ ENGHEALTH-23697 Iconography update for editor-plugin-media
10
+ - Updated dependencies
11
+
12
+ ## 2.3.15
13
+
14
+ ### Patch Changes
15
+
16
+ - [#131280](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131280)
17
+ [`9ff92ea2432f2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ff92ea2432f2) -
18
+ [ED-27082] Fix media overflow toolbar to show correct options + update separators between button
19
+ groups
20
+ - Updated dependencies
21
+
3
22
  ## 2.3.14
4
23
 
5
24
  ### Patch Changes
@@ -20,7 +20,7 @@ var _media = require("@atlaskit/editor-common/media");
20
20
  var _providerFactory = require("@atlaskit/editor-common/provider-factory");
21
21
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
22
22
  var _utils = require("@atlaskit/editor-common/utils");
23
- var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
23
+ var _closeEditorClose = _interopRequireDefault(require("@atlaskit/icon/core/migration/close--editor-close"));
24
24
  var _mediaCommon = require("@atlaskit/media-common");
25
25
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
26
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -162,7 +162,7 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
162
162
  shouldEnableDownloadButton: mediaOptions.enableDownloadButton,
163
163
  actions: [{
164
164
  handler: disabled || !_this.mediaPluginState ? function () {} : _this.mediaPluginState.handleMediaNodeRemoval.bind(null, undefined, getNodePos),
165
- icon: /*#__PURE__*/_react.default.createElement(_close.default, {
165
+ icon: /*#__PURE__*/_react.default.createElement(_closeEditorClose.default, {
166
166
  label: _this.props.intl.formatMessage(_media.nodeViewsMessages.mediaGroupDeleteLabel)
167
167
  })
168
168
  }]
@@ -15,7 +15,7 @@ var _reactIntlNext = require("react-intl-next");
15
15
  var _hooks = require("@atlaskit/editor-common/hooks");
16
16
  var _media = require("@atlaskit/editor-common/media");
17
17
  var _utils = require("@atlaskit/editor-common/utils");
18
- var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
18
+ var _closeEditorClose = _interopRequireDefault(require("@atlaskit/icon/core/migration/close--editor-close"));
19
19
  var _mediaCommon = require("@atlaskit/media-common");
20
20
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
21
21
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -82,7 +82,7 @@ var prepareFilmstripItem = function prepareFilmstripItem(_ref) {
82
82
  shouldEnableDownloadButton: enableDownloadButton,
83
83
  actions: [{
84
84
  handler: handleMediaNodeRemoval.bind(null, undefined, getNodePos),
85
- icon: /*#__PURE__*/_react.default.createElement(_close.default, {
85
+ icon: /*#__PURE__*/_react.default.createElement(_closeEditorClose.default, {
86
86
  label: intl.formatMessage(_media.nodeViewsMessages.mediaGroupDeleteLabel)
87
87
  })
88
88
  }]
@@ -205,7 +205,8 @@ var MediaInline = exports.MediaInline = function MediaInline(props) {
205
205
  border: {
206
206
  borderSize: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.size,
207
207
  borderColor: borderMark === null || borderMark === void 0 ? void 0 : borderMark.attrs.color
208
- }
208
+ },
209
+ isViewOnly: props.editorViewMode
209
210
  });
210
211
  }
211
212
  return (0, _react2.jsx)(_MediaViewerContainer.MediaViewerContainer, {
@@ -70,6 +70,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
70
70
  });
71
71
  (0, _defineProperty2.default)(_this, "renderMediaNodeWithState", function (contextIdentifierProvider) {
72
72
  return function (_ref2) {
73
+ var _this$reactComponentP;
73
74
  var editorWidth = _ref2.width,
74
75
  mediaProvider = _ref2.mediaProvider;
75
76
  var getPos = _this.getPos;
@@ -110,7 +111,8 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
110
111
  mediaProvider: mediaProvider,
111
112
  contextIdentifierProvider: contextIdentifierProvider,
112
113
  mediaOptions: mediaOptions,
113
- onExternalImageLoaded: _this.onExternalImageLoaded
114
+ onExternalImageLoaded: _this.onExternalImageLoaded,
115
+ isViewOnly: ((_this$reactComponentP = _this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.sharedState.currentState()) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.mode) === 'view'
114
116
  });
115
117
  };
116
118
  });
@@ -21,6 +21,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
21
21
  var _utils = require("@atlaskit/editor-common/utils");
22
22
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
23
23
  var _mediaCard = require("@atlaskit/media-card");
24
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
25
  var _pluginKey = require("../../pm-plugins/plugin-key");
25
26
  var _styles = require("../styles");
26
27
  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); }
@@ -63,6 +64,13 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
63
64
  (0, _defineProperty2.default)(_this, "selectMediaSingleFromCard", function (_ref2) {
64
65
  var event = _ref2.event;
65
66
  _this.selectMediaSingle(event);
67
+
68
+ // In edit mode (node content wrapper has contenteditable set to true), link redirection is disabled by default
69
+ // We need to call "stopPropagation" here in order to prevent in editor view mode, the browser from navigating to
70
+ // another URL if the media node is wrapped in a link mark.
71
+ if (_this.props.isViewOnly && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
72
+ event.preventDefault();
73
+ }
66
74
  });
67
75
  (0, _defineProperty2.default)(_this, "selectMediaSingle", function (event) {
68
76
  var propPos = _this.props.getPos();
@@ -70,9 +78,13 @@ var MediaNode = exports.MediaNode = /*#__PURE__*/function (_Component) {
70
78
  return;
71
79
  }
72
80
 
81
+ // NOTE: This does not prevent the link navigation in the editor view mode, .preventDefault is needed (see selectMediaSingleFromCard)
82
+ // Hence it should be removed
73
83
  // We need to call "stopPropagation" here in order to prevent the browser from navigating to
74
84
  // another URL if the media node is wrapped in a link mark.
75
- event.stopPropagation();
85
+ if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
86
+ event.stopPropagation();
87
+ }
76
88
  var state = _this.props.view.state;
77
89
  if (event.shiftKey) {
78
90
  // don't select text if there is current selection in a table (as this would override selected cells)
@@ -20,8 +20,8 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
20
20
  var _media = require("@atlaskit/editor-common/media");
21
21
  var _ui = require("@atlaskit/editor-common/ui");
22
22
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
23
- var _chevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-left-large"));
24
- var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/glyph/cross-circle"));
23
+ var _crossCircle = _interopRequireDefault(require("@atlaskit/icon/core/migration/cross-circle"));
24
+ var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-left--chevron-left-large"));
25
25
  var _colors = require("@atlaskit/theme/colors");
26
26
  var _commands = require("../commands");
27
27
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -196,7 +196,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
196
196
  css: buttonWrapperStyles
197
197
  }, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
198
198
  title: formatMessage(_media.altTextMessages.back),
199
- icon: (0, _react2.jsx)(_chevronLeftLarge.default, {
199
+ icon: (0, _react2.jsx)(_chevronLeftChevronLeftLarge.default, {
200
200
  label: formatMessage(_media.altTextMessages.back)
201
201
  }),
202
202
  tooltipContent: backButtonMessageComponent,
@@ -9,7 +9,7 @@ var _react = require("@emotion/react");
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _media = require("@atlaskit/editor-common/media");
12
- var _documentFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/document-filled"));
12
+ var _fileDocumentFilled = _interopRequireDefault(require("@atlaskit/icon/core/migration/file--document-filled"));
13
13
  var _colors = require("@atlaskit/theme/colors");
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
  var _media2 = require("../../nodeviews/mediaNodeView/media");
@@ -48,9 +48,9 @@ var IconWrapperComponent = function IconWrapperComponent(props) {
48
48
  var dropPlaceholderLabel = _media.dropPlaceholderMessages.dropPlaceholderLabel;
49
49
  return (0, _react.jsx)("div", {
50
50
  css: iconWrapperStyles
51
- }, (0, _react.jsx)(_documentFilled.default, {
51
+ }, (0, _react.jsx)(_fileDocumentFilled.default, {
52
52
  label: intl.formatMessage(dropPlaceholderLabel),
53
- size: "medium"
53
+ LEGACY_size: "medium"
54
54
  }));
55
55
  };
56
56
  var IntlIconWrapper = (0, _reactIntlNext.injectIntl)(IconWrapperComponent);
@@ -20,8 +20,8 @@ var _media = require("@atlaskit/editor-common/media");
20
20
  var _messages = require("@atlaskit/editor-common/messages");
21
21
  var _ui = require("@atlaskit/editor-common/ui");
22
22
  var _utils = require("@atlaskit/editor-common/utils");
23
- var _chevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-left-large"));
24
- var _unlink = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/unlink"));
23
+ var _linkBrokenEditorUnlink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-broken--editor-unlink"));
24
+ var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-left--chevron-left-large"));
25
25
  var _colors = require("@atlaskit/theme/colors");
26
26
  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); }
27
27
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -124,7 +124,7 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
124
124
  css: buttonWrapper
125
125
  }, (0, _react2.jsx)(_ui.FloatingToolbarButton, {
126
126
  title: formatLinkAddressText,
127
- icon: (0, _react2.jsx)(_chevronLeftLarge.default, {
127
+ icon: (0, _react2.jsx)(_chevronLeftChevronLeftLarge.default, {
128
128
  label: formatLinkAddressText
129
129
  }),
130
130
  onClick: function onClick() {
@@ -161,7 +161,7 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
161
161
  htmlFor: "media-link-search-input"
162
162
  }, formatMessage(_messages.linkToolbarMessages.searchInput)), (0, _utils.normalizeUrl)(displayUrl) && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(_ui.FloatingToolbarSeparator, null), (0, _react2.jsx)(_ui.FloatingToolbarButton, {
163
163
  title: formatUnlinkText,
164
- icon: (0, _react2.jsx)(_unlink.default, {
164
+ icon: (0, _react2.jsx)(_linkBrokenEditorUnlink.default, {
165
165
  label: formatUnlinkText
166
166
  }),
167
167
  onClick: _this.handleUnlink
@@ -10,7 +10,7 @@ var _reactIntlNext = require("react-intl-next");
10
10
  var _hooks = require("@atlaskit/editor-common/hooks");
11
11
  var _media = require("@atlaskit/editor-common/media");
12
12
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
13
- var _attachment = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/attachment"));
13
+ var _attachmentEditorAttachment = _interopRequireDefault(require("@atlaskit/icon/core/migration/attachment--editor-attachment"));
14
14
  var onClickMediaButton = function onClickMediaButton(pluginState) {
15
15
  return function () {
16
16
  pluginState.showMediaPicker();
@@ -34,7 +34,7 @@ var ToolbarMedia = function ToolbarMedia(_ref) {
34
34
  disabled: isDisabled,
35
35
  title: intl.formatMessage(toolbarMediaTitle),
36
36
  spacing: isReducedSpacing ? 'none' : 'default',
37
- iconBefore: /*#__PURE__*/_react.default.createElement(_attachment.default, {
37
+ iconBefore: /*#__PURE__*/_react.default.createElement(_attachmentEditorAttachment.default, {
38
38
  label: intl.formatMessage(toolbarMediaTitle)
39
39
  })
40
40
  });
@@ -4,15 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getAltTextToolbar = exports.altTextButton = void 0;
7
+ exports.getAltTextToolbar = exports.getAltTextDropdownOption = exports.altTextButton = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _keymaps = require("@atlaskit/editor-common/keymaps");
11
11
  var _media = require("@atlaskit/editor-common/media");
12
12
  var _styles = require("@atlaskit/editor-common/styles");
13
13
  var _ui = require("@atlaskit/editor-common/ui");
14
+ var _state = require("@atlaskit/editor-prosemirror/state");
15
+ var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
14
16
  var _commands = require("../../pm-plugins/alt-text/commands");
15
17
  var _AltTextEdit = _interopRequireDefault(require("../../pm-plugins/alt-text/ui/AltTextEdit"));
18
+ var _isType = require("../../pm-plugins/utils/is-type");
16
19
  var _mediaCommon = require("../../pm-plugins/utils/media-common");
17
20
  var _commands2 = require("./commands");
18
21
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -80,4 +83,20 @@ var getAltTextToolbar = exports.getAltTextToolbar = function getAltTextToolbar(t
80
83
  className: _styles.MediaSharedClassNames.FLOATING_TOOLBAR_COMPONENT,
81
84
  items: [altTextEditComponent(options)]
82
85
  });
86
+ };
87
+ var getAltTextDropdownOption = exports.getAltTextDropdownOption = function getAltTextDropdownOption(state, formatMessage, allowAltTextOnImages, selectedNodeType, editorAnalyticsAPI) {
88
+ var _state$schema$nodes = state.schema.nodes,
89
+ mediaSingle = _state$schema$nodes.mediaSingle,
90
+ mediaInline = _state$schema$nodes.mediaInline;
91
+ var mediaType = state.selection instanceof _state.NodeSelection && state.selection.node.attrs.type;
92
+ if (allowAltTextOnImages && (selectedNodeType === mediaSingle || selectedNodeType === mediaInline && (0, _isType.isImage)(mediaType))) {
93
+ return [{
94
+ title: formatMessage(_media.altTextMessages.addAltText),
95
+ onClick: (0, _commands.openMediaAltTextMenu)(editorAnalyticsAPI),
96
+ icon: /*#__PURE__*/_react.default.createElement(_text.default, {
97
+ label: ""
98
+ })
99
+ }];
100
+ }
101
+ return [];
83
102
  };
@@ -11,7 +11,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
11
11
  var _media = require("@atlaskit/editor-common/media");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
14
- var _comment2 = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
15
14
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
15
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
17
16
  var _commentWithDotIcon = require("./assets/commentWithDotIcon");
@@ -47,7 +46,7 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
47
46
  type: 'button',
48
47
  testId: 'add-comment-media-button',
49
48
  icon: _comment.default,
50
- iconFallback: hasActiveComments ? _commentWithDotIcon.CommentWithDotIcon : _comment2.default,
49
+ iconFallback: hasActiveComments ? _commentWithDotIcon.CommentWithDotIcon : _comment.default,
51
50
  title: (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? title : buttonLabel,
52
51
  showTitle: (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? undefined : true,
53
52
  onClick: onClickHandler,
@@ -12,7 +12,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _react = _interopRequireDefault(require("react"));
13
13
  var _analytics = require("@atlaskit/editor-common/analytics");
14
14
  var _card = require("@atlaskit/editor-common/card");
15
- var _media = require("@atlaskit/editor-common/media");
16
15
  var _mediaInline = require("@atlaskit/editor-common/media-inline");
17
16
  var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
18
17
  var _state2 = require("@atlaskit/editor-prosemirror/state");
@@ -20,33 +19,29 @@ var _utils = require("@atlaskit/editor-prosemirror/utils");
20
19
  var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
21
20
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
22
21
  var _growDiagonal = _interopRequireDefault(require("@atlaskit/icon/core/grow-diagonal"));
23
- var _growHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/grow-horizontal"));
24
22
  var _imageFullscreen = _interopRequireDefault(require("@atlaskit/icon/core/image-fullscreen"));
25
23
  var _imageInline = _interopRequireDefault(require("@atlaskit/icon/core/image-inline"));
26
24
  var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
25
+ var _deleteEditorRemove = _interopRequireDefault(require("@atlaskit/icon/core/migration/delete--editor-remove"));
27
26
  var _download = _interopRequireDefault(require("@atlaskit/icon/core/migration/download"));
28
27
  var _smartLinkCard = _interopRequireDefault(require("@atlaskit/icon/core/smart-link-card"));
29
- var _text = _interopRequireDefault(require("@atlaskit/icon/core/text"));
30
28
  var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
31
- var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
32
29
  var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
33
30
  var _mediaUi = require("@atlaskit/media-ui");
34
31
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
35
32
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
36
33
  var _styles = require("../../nodeviews/styles");
37
34
  var _altText = require("../../pm-plugins/alt-text");
38
- var _commands = require("../../pm-plugins/alt-text/commands");
39
35
  var _linking = require("../../pm-plugins/commands/linking");
40
36
  var _linking2 = require("../../pm-plugins/linking");
41
37
  var _pixelResizing = require("../../pm-plugins/pixel-resizing");
42
- var _commands2 = require("../../pm-plugins/pixel-resizing/commands");
43
38
  var _ui = require("../../pm-plugins/pixel-resizing/ui");
44
39
  var _pluginKey = require("../../pm-plugins/plugin-key");
45
40
  var _currentMediaNode = require("../../pm-plugins/utils/current-media-node");
46
41
  var _mediaSingle = require("../../pm-plugins/utils/media-single");
47
42
  var _ImageBorder = _interopRequireDefault(require("../../ui/ImageBorder"));
48
43
  var _altText2 = require("./alt-text");
49
- var _commands3 = require("./commands");
44
+ var _commands = require("./commands");
50
45
  var _comments = require("./comments");
51
46
  var _imageBorder = require("./imageBorder");
52
47
  var _layoutGroup = require("./layout-group");
@@ -99,6 +94,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
99
94
  testId: 'file-preview-toolbar-button',
100
95
  type: 'button',
101
96
  icon: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _growDiagonal.default : _maximize.default,
97
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
102
98
  iconFallback: _filePreview.default,
103
99
  title: intl.formatMessage(_mediaUi.messages.preview),
104
100
  onClick: function onClick() {
@@ -138,7 +134,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
138
134
  selected: false,
139
135
  focusEditoronEnter: true,
140
136
  disabled: false,
141
- onClick: (0, _commands3.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
137
+ onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
142
138
  title: intl.formatMessage(_messages.cardMessages.inlineTitle),
143
139
  testId: 'inline-appearance',
144
140
  className: 'inline-appearance' // a11y. uses to force focus on item
@@ -178,7 +174,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
178
174
  appearance: 'danger',
179
175
  focusEditoronEnter: true,
180
176
  icon: _delete.default,
181
- iconFallback: _remove.default,
177
+ iconFallback: _deleteEditorRemove.default,
182
178
  onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
183
179
  onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
184
180
  onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
@@ -191,7 +187,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
191
187
  var options = [{
192
188
  id: 'editor.media.view.switcher.inline',
193
189
  title: intl.formatMessage(_messages.cardMessages.inlineTitle),
194
- onClick: (0, _commands3.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
190
+ onClick: (0, _commands.changeMediaCardToInline)(editorAnalyticsAPI, forceFocusSelector),
195
191
  icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
196
192
  label: "",
197
193
  spacing: "spacious"
@@ -226,7 +222,6 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
226
222
  fullHeight: true
227
223
  }, download, {
228
224
  type: 'separator',
229
- fullHeight: true,
230
225
  supportsViewMode: true
231
226
  }, preview, {
232
227
  type: 'separator',
@@ -251,6 +246,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
251
246
  var toolbarButtons = [];
252
247
  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 : {},
253
248
  hoverDecoration = _ref2.hoverDecoration;
249
+ var isEditorControlsEnabled = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
254
250
  if ((0, _imageBorder.shouldShowImageBorder)(state)) {
255
251
  toolbarButtons.push({
256
252
  type: 'custom',
@@ -265,11 +261,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
265
261
  return /*#__PURE__*/_react.default.createElement(_ImageBorder.default, {
266
262
  toggleBorder: function toggleBorder() {
267
263
  var _pluginInjectionApi$a;
268
- (0, _commands3.toggleBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
264
+ (0, _commands.toggleBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(state, dispatch);
269
265
  },
270
266
  setBorder: function setBorder(attrs) {
271
267
  var _pluginInjectionApi$a2;
272
- (0, _commands3.setBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
268
+ (0, _commands.setBorderMark)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(attrs)(state, dispatch);
273
269
  },
274
270
  borderMark: borderMark,
275
271
  intl: intl
@@ -337,7 +333,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
337
333
  var hasCaption = (0, _utils.contains)(selectedNode.node, state.schema.nodes.caption);
338
334
  var inlineSwitcherTitle = intl.formatMessage(hasCaption ? _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImageCaptionWarning : _messages.mediaAndEmbedToolbarMessages.changeToMediaInlineImage);
339
335
  var floatingSwitcherTitle = intl.formatMessage(_messages.mediaAndEmbedToolbarMessages.changeToMediaSingle);
340
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
336
+ if (!isEditorControlsEnabled) {
341
337
  var _pluginInjectionApi$a4;
342
338
  toolbarButtons.push({
343
339
  type: 'button',
@@ -352,7 +348,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
352
348
  LEGACY_fallbackIcon: _card.IconInline
353
349
  });
354
350
  },
355
- onClick: (0, _commands3.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
351
+ onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions),
356
352
  testId: 'image-inline-appearance'
357
353
  }, {
358
354
  type: 'button',
@@ -381,7 +377,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
381
377
  var _options2 = [{
382
378
  id: 'editor.media.convert.mediainline',
383
379
  title: inlineTitle,
384
- onClick: (0, _commands3.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
380
+ onClick: (0, _commands.changeMediaSingleToMediaInline)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a5 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a5 === void 0 ? void 0 : _pluginInjectionApi$a5.actions),
385
381
  icon: /*#__PURE__*/_react.default.createElement(_imageInline.default, {
386
382
  color: "currentColor",
387
383
  spacing: "spacious",
@@ -473,14 +469,14 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
473
469
  }
474
470
  return [sizeInput];
475
471
  }
476
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
472
+ if (!isEditorControlsEnabled) {
477
473
  toolbarButtons.push(sizeInput);
478
474
  toolbarButtons.push({
479
475
  type: 'separator'
480
476
  });
481
477
  }
482
478
  }
483
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
479
+ if (!isEditorControlsEnabled) {
484
480
  if (allowCommentsOnMedia) {
485
481
  toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi), {
486
482
  type: 'separator',
@@ -543,6 +539,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
543
539
  testId: 'file-preview-toolbar-button',
544
540
  type: 'button',
545
541
  icon: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _growDiagonal.default : _maximize.default,
542
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
546
543
  iconFallback: _filePreview.default,
547
544
  title: intl.formatMessage(_mediaUi.messages.preview),
548
545
  onClick: function onClick() {
@@ -578,29 +575,45 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
578
575
  supportsViewMode: true
579
576
  });
580
577
  }
581
- if (allowAltTextOnImages && (0, _experiments.editorExperiment)('platform_editor_controls', 'control')) {
582
- var _pluginInjectionApi$a7;
583
- toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions), {
584
- type: 'separator'
578
+ if (!isEditorControlsEnabled) {
579
+ if (allowAltTextOnImages) {
580
+ var _pluginInjectionApi$a7;
581
+ toolbarButtons.push((0, _altText2.altTextButton)(intl, state, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a7 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a7 === void 0 ? void 0 : _pluginInjectionApi$a7.actions), {
582
+ type: 'separator'
583
+ });
584
+ }
585
+ var removeButton = {
586
+ id: 'editor.media.delete',
587
+ type: 'button',
588
+ appearance: 'danger',
589
+ focusEditoronEnter: true,
590
+ icon: _delete.default,
591
+ iconFallback: _deleteEditorRemove.default,
592
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
593
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
594
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
595
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
596
+ title: intl.formatMessage(_messages.default.remove),
597
+ onClick: remove,
598
+ testId: 'media-toolbar-remove-button',
599
+ supportsViewMode: false
600
+ };
601
+ var items = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [{
602
+ type: 'copy-button',
603
+ items: [{
604
+ state: state,
605
+ formatMessage: intl.formatMessage,
606
+ nodeType: mediaSingle
607
+ }],
608
+ supportsViewMode: true
609
+ }]);
610
+ items.push({
611
+ type: 'separator',
612
+ supportsViewMode: false
585
613
  });
586
- }
587
- var removeButton = {
588
- id: 'editor.media.delete',
589
- type: 'button',
590
- appearance: 'danger',
591
- focusEditoronEnter: true,
592
- icon: _delete.default,
593
- iconFallback: _remove.default,
594
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
595
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
596
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
597
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
598
- title: intl.formatMessage(_messages.default.remove),
599
- onClick: remove,
600
- testId: 'media-toolbar-remove-button',
601
- supportsViewMode: false
602
- };
603
- if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
614
+ items.push(removeButton);
615
+ return items;
616
+ } else {
604
617
  // Preview Support
605
618
  if (allowAdvancedToolBarOptions && allowImagePreview) {
606
619
  var _mediaNode$attrs2;
@@ -613,6 +626,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
613
626
  testId: 'file-preview-toolbar-button',
614
627
  type: 'button',
615
628
  icon: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _growDiagonal.default : _maximize.default,
629
+ // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
616
630
  iconFallback: _filePreview.default,
617
631
  title: intl.formatMessage(_mediaUi.messages.preview),
618
632
  onClick: function onClick() {
@@ -626,8 +640,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
626
640
  supportsViewMode: true
627
641
  }, {
628
642
  type: 'separator',
629
- supportsViewMode: true,
630
- fullHeight: true
643
+ supportsViewMode: true
631
644
  });
632
645
  }
633
646
  }
@@ -636,8 +649,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
636
649
  if (allowLinking && (0, _linking3.shouldShowMediaLinkToolbar)(state) && mediaLinkingState && mediaLinkingState.editable) {
637
650
  toolbarButtons.push((0, _linking3.getOpenLinkToolbarButtonOption)(intl, mediaLinkingState, pluginInjectionApi), {
638
651
  type: 'separator',
639
- supportsViewMode: true,
640
- fullHeight: true
652
+ supportsViewMode: true
641
653
  });
642
654
  }
643
655
  isViewOnly && toolbarButtons.push({
@@ -653,26 +665,11 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
653
665
  supportsViewMode: true
654
666
  });
655
667
  if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
656
- // TODO: ED-26962 - add separator when overflow menu is added
668
+ (0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
657
669
  toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi));
658
670
  }
659
671
  return toolbarButtons;
660
672
  }
661
- var items = [].concat((0, _toConsumableArray2.default)(toolbarButtons), [{
662
- type: 'copy-button',
663
- items: [{
664
- state: state,
665
- formatMessage: intl.formatMessage,
666
- nodeType: mediaSingle
667
- }],
668
- supportsViewMode: true
669
- }]);
670
- items.push({
671
- type: 'separator',
672
- supportsViewMode: false
673
- });
674
- items.push(removeButton);
675
- return items;
676
673
  };
677
674
  var getMediaTypeMessage = function getMediaTypeMessage(selectedNodeTypeSingle) {
678
675
  var mediaType = Object.keys(mediaTypeMessages).find(function (key) {
@@ -774,34 +771,17 @@ var floatingToolbar = exports.floatingToolbar = function floatingToolbar(state,
774
771
  }
775
772
  if (!mediaPluginState.isResizing && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
776
773
  var _pluginInjectionApi$a9;
777
- var lastItem = items.at(-1);
778
- if ((lastItem === null || lastItem === void 0 ? void 0 : lastItem.type) === 'separator') {
779
- lastItem.fullHeight = true;
780
- } else if (items.length) {
781
- items.push({
782
- type: 'separator',
783
- fullHeight: true
774
+ (0, _utils2.updateToFullHeightSeparator)(items);
775
+ var customOptions = [].concat((0, _toConsumableArray2.default)((0, _linking3.getLinkingDropdownOptions)(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), (0, _toConsumableArray2.default)((0, _altText2.getAltTextDropdownOption)(state, intl.formatMessage, allowAltTextOnImages, selectedNodeType, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions)), (0, _toConsumableArray2.default)((0, _pixelResizing2.getResizeDropdownOption)(options, state, intl.formatMessage, selectedNodeType)));
776
+ if (customOptions.length) {
777
+ customOptions.push({
778
+ type: 'separator'
784
779
  });
785
780
  }
786
- var altTextTitle = intl.formatMessage(_media.altTextMessages.addAltText);
787
781
  items.push({
788
782
  type: 'overflow-dropdown',
789
- options: [].concat((0, _toConsumableArray2.default)((0, _linking3.getLinkingDropdownOptions)(state, intl, mediaLinkingState, allowMediaInline && selectedNodeType && selectedNodeType === mediaInline, allowLinking, isViewOnly)), [{
790
- title: altTextTitle,
791
- onClick: (0, _commands.openMediaAltTextMenu)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a9 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a9 === void 0 ? void 0 : _pluginInjectionApi$a9.actions),
792
- icon: /*#__PURE__*/_react.default.createElement(_text.default, {
793
- label: ""
794
- })
795
- }, {
796
- title: 'Resize',
797
- onClick: (0, _commands2.openPixelEditor)(),
798
- icon: /*#__PURE__*/_react.default.createElement(_growHorizontal.default, {
799
- label: ""
800
- }),
801
- testId: 'media-pixel-resizing-dropdown-option'
802
- }, {
803
- type: 'separator'
804
- }, {
783
+ id: 'media',
784
+ options: [].concat((0, _toConsumableArray2.default)(customOptions), [{
805
785
  title: 'Copy',
806
786
  onClick: function onClick() {
807
787
  var _pluginInjectionApi$c4, _pluginInjectionApi$f3;