@atlaskit/editor-plugin-media 1.43.8 → 1.43.10

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,22 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.43.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#98950](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98950)
8
+ [`497556595c03a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/497556595c03a) -
9
+ ED-26125 remove fg platform_editor_media_previewer_bugfix
10
+
11
+ ## 1.43.9
12
+
13
+ ### Patch Changes
14
+
15
+ - [#97992](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97992)
16
+ [`129bc0e5c4f11`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/129bc0e5c4f11) -
17
+ ED-26104 fix editing captions on edge browsers
18
+ - Updated dependencies
19
+
3
20
  ## 1.43.8
4
21
 
5
22
  ### Patch Changes
@@ -279,7 +279,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
279
279
  contentComponent: function contentComponent(_ref12) {
280
280
  var editorView = _ref12.editorView,
281
281
  appearance = _ref12.appearance;
282
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') && /*#__PURE__*/_react.default.createElement(MediaViewerFunctionalComponent, {
282
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(MediaViewerFunctionalComponent, {
283
283
  api: api,
284
284
  editorView: editorView
285
285
  }), /*#__PURE__*/_react.default.createElement(MediaPickerFunctionalComponent, {
@@ -974,7 +974,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
974
974
  },
975
975
  handleDoubleClickOn: function handleDoubleClickOn(view) {
976
976
  var _pluginInjectionApi$e;
977
- if (!(0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') || !(0, _platformFeatureFlags.fg)('platform_editor_media_interaction_improvements')) {
977
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_media_interaction_improvements')) {
978
978
  return;
979
979
  }
980
980
  var isLivePagesViewMode = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) === 'view';
@@ -37,7 +37,29 @@ var placeholderButton = (0, _primitives.xcss)({
37
37
  // Remove this component
38
38
  var CaptionPlaceholder = exports.CaptionPlaceholder = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
39
39
  var onClick = _ref.onClick;
40
+ var handlePointerDown = (0, _react.useCallback)(function (e) {
41
+ e.preventDefault();
42
+ onClick();
43
+ }, [onClick]);
40
44
  var message = (0, _platformFeatureFlags.fg)('platform_editor_media_interaction_improvements') ? _objectSpread({}, _media.captionMessages.placeholderWithDoubleClickPrompt) : _objectSpread({}, _media.captionMessages.placeholder);
45
+
46
+ // This issue is a temporary fix for users being able to edit captions on edge browsers. This will be removed
47
+ // replaced with CaptionPlaceholderButton in the near future and this code can be removed.
48
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_edit_caption_on_edge')) {
49
+ return (
50
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
51
+ (0, _react2.jsx)("span", {
52
+ ref: ref,
53
+ css: placeholder,
54
+ onPointerDown: handlePointerDown,
55
+ "data-id": _mediaSingle.CAPTION_PLACEHOLDER_ID,
56
+ "data-testid": "caption-placeholder"
57
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage
58
+ // Ignored via go/ees005
59
+ // eslint-disable-next-line react/jsx-props-no-spreading
60
+ , message))
61
+ );
62
+ }
41
63
  return (
42
64
  // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
43
65
  (0, _react2.jsx)("span", {
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.handleShowMediaViewer = exports.generateFilePreviewItem = exports.floatingToolbar = void 0;
8
+ exports.handleShowMediaViewer = exports.floatingToolbar = void 0;
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
@@ -41,7 +41,6 @@ var _PixelEntry = require("../../ui/PixelEntry");
41
41
  var _altText2 = require("./alt-text");
42
42
  var _commands = require("./commands");
43
43
  var _comments = require("./comments");
44
- var _filePreviewItem = require("./filePreviewItem");
45
44
  var _imageBorder = require("./imageBorder");
46
45
  var _layoutGroup = require("./layout-group");
47
46
  var _linking3 = require("./linking");
@@ -73,20 +72,6 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
73
72
  }
74
73
  return true;
75
74
  };
76
- var generateFilePreviewItem = exports.generateFilePreviewItem = function generateFilePreviewItem(mediaPluginState, intl) {
77
- return {
78
- type: 'custom',
79
- fallback: [],
80
- render: function render() {
81
- return /*#__PURE__*/_react.default.createElement(_filePreviewItem.FilePreviewItem, {
82
- key: "editor.media.card.preview",
83
- mediaPluginState: mediaPluginState,
84
- intl: intl
85
- });
86
- },
87
- supportsViewMode: true
88
- };
89
- };
90
75
  var handleShowMediaViewer = exports.handleShowMediaViewer = function handleShowMediaViewer(_ref) {
91
76
  var api = _ref.api,
92
77
  mediaPluginState = _ref.mediaPluginState;
@@ -132,7 +117,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
132
117
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
133
118
  }, {
134
119
  type: 'separator'
135
- }, (0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') ? {
120
+ }, {
136
121
  id: 'editor.media.viewer',
137
122
  testId: 'file-preview-toolbar-button',
138
123
  type: 'button',
@@ -147,7 +132,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
147
132
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
148
133
  },
149
134
  supportsViewMode: true
150
- } : generateFilePreviewItem(mediaPluginState, intl), {
135
+ }, {
151
136
  type: 'separator'
152
137
  }, {
153
138
  id: 'editor.media.card.download',
@@ -489,7 +474,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
489
474
  var _selectedMediaSingleNode = (0, _utils2.getSelectedMediaSingle)(state);
490
475
  var mediaNode = _selectedMediaSingleNode === null || _selectedMediaSingleNode === void 0 ? void 0 : _selectedMediaSingleNode.node.content.firstChild;
491
476
  if (!(0, _mediaSingle2.isVideo)(mediaNode === null || mediaNode === void 0 || (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
492
- toolbarButtons.push((0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') ? {
477
+ toolbarButtons.push({
493
478
  id: 'editor.media.viewer',
494
479
  testId: 'file-preview-toolbar-button',
495
480
  type: 'button',
@@ -504,7 +489,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
504
489
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
505
490
  },
506
491
  supportsViewMode: true
507
- } : generateFilePreviewItem(pluginState, intl), {
492
+ }, {
508
493
  type: 'separator',
509
494
  supportsViewMode: true
510
495
  });
@@ -73,7 +73,7 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
73
73
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
74
74
  }, {
75
75
  type: 'separator'
76
- }, (0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') ? {
76
+ }, {
77
77
  id: 'editor.media.viewer',
78
78
  testId: 'file-preview-toolbar-button',
79
79
  type: 'button',
@@ -87,7 +87,7 @@ var generateMediaInlineFloatingToolbar = exports.generateMediaInlineFloatingTool
87
87
  api: pluginInjectionApi
88
88
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
89
89
  }
90
- } : (0, _index.generateFilePreviewItem)(mediaPluginState, intl), {
90
+ }, {
91
91
  type: 'separator'
92
92
  }, {
93
93
  id: 'editor.media.card.download',
@@ -245,7 +245,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
245
245
 
246
246
  //Image Preview
247
247
  if (options.allowImagePreview) {
248
- inlineImageItems.push((0, _platformFeatureFlags.fg)('platform_editor_media_previewer_bugfix') ? {
248
+ inlineImageItems.push({
249
249
  id: 'editor.media.viewer',
250
250
  testId: 'file-preview-toolbar-button',
251
251
  type: 'button',
@@ -260,7 +260,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
260
260
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
261
261
  },
262
262
  supportsViewMode: true
263
- } : (0, _index.generateFilePreviewItem)(mediaPluginState, intl), {
263
+ }, {
264
264
  type: 'separator',
265
265
  supportsViewMode: true
266
266
  });
@@ -277,7 +277,7 @@ export const mediaPlugin = ({
277
277
  editorView,
278
278
  appearance
279
279
  }) {
280
- return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_editor_media_previewer_bugfix') && /*#__PURE__*/React.createElement(MediaViewerFunctionalComponent, {
280
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MediaViewerFunctionalComponent, {
281
281
  api: api,
282
282
  editorView: editorView
283
283
  }), /*#__PURE__*/React.createElement(MediaPickerFunctionalComponent, {
@@ -362,7 +362,7 @@ export class MediaPluginStateImplementation {
362
362
  if (!selectedNode) {
363
363
  return false;
364
364
  }
365
- let {
365
+ const {
366
366
  from
367
367
  } = view.state.selection;
368
368
  // Ignored via go/ees005
@@ -861,7 +861,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
861
861
  },
862
862
  handleDoubleClickOn: view => {
863
863
  var _pluginInjectionApi$e, _pluginInjectionApi$e2;
864
- if (!fg('platform_editor_media_previewer_bugfix') || !fg('platform_editor_media_interaction_improvements')) {
864
+ if (!fg('platform_editor_media_interaction_improvements')) {
865
865
  return;
866
866
  }
867
867
  const isLivePagesViewMode = (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) === 'view';
@@ -913,7 +913,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
913
913
 
914
914
  // only if targeting interactive elements fe. button, slider, range, dropdown
915
915
  if (allowedTargets && allowedTargets in targetsAndButtons) {
916
- let targetRelatedA11YKeys = targetsAndButtons[allowedTargets];
916
+ const targetRelatedA11YKeys = targetsAndButtons[allowedTargets];
917
917
  const allowedKeys = new Set(targetRelatedA11YKeys);
918
918
  if (allowedKeys.has(event.key) || allowedKeys.has(event.code)) {
919
919
  // allow event to bubble to be handled by react handlers
@@ -30,11 +30,33 @@ const placeholderButton = xcss({
30
30
  export const CaptionPlaceholder = /*#__PURE__*/React.forwardRef(({
31
31
  onClick
32
32
  }, ref) => {
33
+ const handlePointerDown = useCallback(e => {
34
+ e.preventDefault();
35
+ onClick();
36
+ }, [onClick]);
33
37
  const message = fg('platform_editor_media_interaction_improvements') ? {
34
38
  ...messages.placeholderWithDoubleClickPrompt
35
39
  } : {
36
40
  ...messages.placeholder
37
41
  };
42
+
43
+ // This issue is a temporary fix for users being able to edit captions on edge browsers. This will be removed
44
+ // replaced with CaptionPlaceholderButton in the near future and this code can be removed.
45
+ if (fg('platform_editor_fix_edit_caption_on_edge')) {
46
+ return (
47
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
48
+ jsx("span", {
49
+ ref: ref,
50
+ css: placeholder,
51
+ onPointerDown: handlePointerDown,
52
+ "data-id": CAPTION_PLACEHOLDER_ID,
53
+ "data-testid": "caption-placeholder"
54
+ }, jsx(FormattedMessage
55
+ // Ignored via go/ees005
56
+ // eslint-disable-next-line react/jsx-props-no-spreading
57
+ , message))
58
+ );
59
+ }
38
60
  return (
39
61
  // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
40
62
  jsx("span", {
@@ -31,7 +31,6 @@ import { FullWidthDisplay, PixelEntry } from '../../ui/PixelEntry';
31
31
  import { altTextButton, getAltTextToolbar } from './alt-text';
32
32
  import { changeMediaCardToInline, changeMediaSingleToMediaInline, setBorderMark, toggleBorderMark, updateMediaSingleWidth } from './commands';
33
33
  import { commentButton } from './comments';
34
- import { FilePreviewItem } from './filePreviewItem';
35
34
  import { shouldShowImageBorder } from './imageBorder';
36
35
  import { LayoutGroup } from './layout-group';
37
36
  import { getLinkingToolbar, shouldShowMediaLinkToolbar } from './linking';
@@ -59,20 +58,6 @@ const handleRemoveMediaGroup = (state, dispatch) => {
59
58
  }
60
59
  return true;
61
60
  };
62
- export const generateFilePreviewItem = (mediaPluginState, intl) => {
63
- return {
64
- type: 'custom',
65
- fallback: [],
66
- render: () => {
67
- return /*#__PURE__*/React.createElement(FilePreviewItem, {
68
- key: "editor.media.card.preview",
69
- mediaPluginState: mediaPluginState,
70
- intl: intl
71
- });
72
- },
73
- supportsViewMode: true
74
- };
75
- };
76
61
  export const handleShowMediaViewer = ({
77
62
  api,
78
63
  mediaPluginState
@@ -119,7 +104,7 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
119
104
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
120
105
  }, {
121
106
  type: 'separator'
122
- }, fg('platform_editor_media_previewer_bugfix') ? {
107
+ }, {
123
108
  id: 'editor.media.viewer',
124
109
  testId: 'file-preview-toolbar-button',
125
110
  type: 'button',
@@ -134,7 +119,7 @@ const generateMediaCardFloatingToolbar = (state, intl, mediaPluginState, hoverDe
134
119
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
135
120
  },
136
121
  supportsViewMode: true
137
- } : generateFilePreviewItem(mediaPluginState, intl), {
122
+ }, {
138
123
  type: 'separator'
139
124
  }, {
140
125
  id: 'editor.media.card.download',
@@ -493,7 +478,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
493
478
  const selectedMediaSingleNode = getSelectedMediaSingle(state);
494
479
  const mediaNode = selectedMediaSingleNode === null || selectedMediaSingleNode === void 0 ? void 0 : selectedMediaSingleNode.node.content.firstChild;
495
480
  if (!isVideo(mediaNode === null || mediaNode === void 0 ? void 0 : (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
496
- toolbarButtons.push(fg('platform_editor_media_previewer_bugfix') ? {
481
+ toolbarButtons.push({
497
482
  id: 'editor.media.viewer',
498
483
  testId: 'file-preview-toolbar-button',
499
484
  type: 'button',
@@ -508,7 +493,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
508
493
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
509
494
  },
510
495
  supportsViewMode: true
511
- } : generateFilePreviewItem(pluginState, intl), {
496
+ }, {
512
497
  type: 'separator',
513
498
  supportsViewMode: true
514
499
  });
@@ -23,7 +23,7 @@ import { changeInlineToMediaCard, changeMediaInlineToMediaSingle, removeInlineCa
23
23
  import { shouldShowImageBorder } from './imageBorder';
24
24
  import { LinkToolbarAppearance } from './linking-toolbar-appearance';
25
25
  import { downloadMedia } from './utils';
26
- import { generateFilePreviewItem, handleShowMediaViewer } from './index';
26
+ import { handleShowMediaViewer } from './index';
27
27
  export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi, options = {}
28
28
  // Ignored via go/ees005
29
29
  // eslint-disable-next-line @typescript-eslint/max-params
@@ -65,7 +65,7 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
65
65
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
66
66
  }, {
67
67
  type: 'separator'
68
- }, fg('platform_editor_media_previewer_bugfix') ? {
68
+ }, {
69
69
  id: 'editor.media.viewer',
70
70
  testId: 'file-preview-toolbar-button',
71
71
  type: 'button',
@@ -79,7 +79,7 @@ export const generateMediaInlineFloatingToolbar = (state, intl, mediaPluginState
79
79
  api: pluginInjectionApi
80
80
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
81
81
  }
82
- } : generateFilePreviewItem(mediaPluginState, intl), {
82
+ }, {
83
83
  type: 'separator'
84
84
  }, {
85
85
  id: 'editor.media.card.download',
@@ -245,7 +245,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
245
245
 
246
246
  //Image Preview
247
247
  if (options.allowImagePreview) {
248
- inlineImageItems.push(fg('platform_editor_media_previewer_bugfix') ? {
248
+ inlineImageItems.push({
249
249
  id: 'editor.media.viewer',
250
250
  testId: 'file-preview-toolbar-button',
251
251
  type: 'button',
@@ -260,7 +260,7 @@ const getMediaInlineImageToolbar = (state, intl, mediaPluginState, hoverDecorati
260
260
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
261
261
  },
262
262
  supportsViewMode: true
263
- } : generateFilePreviewItem(mediaPluginState, intl), {
263
+ }, {
264
264
  type: 'separator',
265
265
  supportsViewMode: true
266
266
  });
@@ -269,7 +269,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
269
269
  contentComponent: function contentComponent(_ref12) {
270
270
  var editorView = _ref12.editorView,
271
271
  appearance = _ref12.appearance;
272
- return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_editor_media_previewer_bugfix') && /*#__PURE__*/React.createElement(MediaViewerFunctionalComponent, {
272
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MediaViewerFunctionalComponent, {
273
273
  api: api,
274
274
  editorView: editorView
275
275
  }), /*#__PURE__*/React.createElement(MediaPickerFunctionalComponent, {
@@ -965,7 +965,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
965
965
  },
966
966
  handleDoubleClickOn: function handleDoubleClickOn(view) {
967
967
  var _pluginInjectionApi$e;
968
- if (!fg('platform_editor_media_previewer_bugfix') || !fg('platform_editor_media_interaction_improvements')) {
968
+ if (!fg('platform_editor_media_interaction_improvements')) {
969
969
  return;
970
970
  }
971
971
  var isLivePagesViewMode = (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) === 'view';
@@ -28,7 +28,29 @@ var placeholderButton = xcss({
28
28
  // Remove this component
29
29
  export var CaptionPlaceholder = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
30
30
  var onClick = _ref.onClick;
31
+ var handlePointerDown = useCallback(function (e) {
32
+ e.preventDefault();
33
+ onClick();
34
+ }, [onClick]);
31
35
  var message = fg('platform_editor_media_interaction_improvements') ? _objectSpread({}, messages.placeholderWithDoubleClickPrompt) : _objectSpread({}, messages.placeholder);
36
+
37
+ // This issue is a temporary fix for users being able to edit captions on edge browsers. This will be removed
38
+ // replaced with CaptionPlaceholderButton in the near future and this code can be removed.
39
+ if (fg('platform_editor_fix_edit_caption_on_edge')) {
40
+ return (
41
+ // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
42
+ jsx("span", {
43
+ ref: ref,
44
+ css: placeholder,
45
+ onPointerDown: handlePointerDown,
46
+ "data-id": CAPTION_PLACEHOLDER_ID,
47
+ "data-testid": "caption-placeholder"
48
+ }, jsx(FormattedMessage
49
+ // Ignored via go/ees005
50
+ // eslint-disable-next-line react/jsx-props-no-spreading
51
+ , message))
52
+ );
53
+ }
32
54
  return (
33
55
  // eslint-disable-next-line @atlaskit/design-system/use-primitives-text, jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
34
56
  jsx("span", {
@@ -35,7 +35,6 @@ import { FullWidthDisplay, PixelEntry } from '../../ui/PixelEntry';
35
35
  import { altTextButton, getAltTextToolbar } from './alt-text';
36
36
  import { changeMediaCardToInline, changeMediaSingleToMediaInline, setBorderMark, toggleBorderMark, updateMediaSingleWidth } from './commands';
37
37
  import { commentButton } from './comments';
38
- import { FilePreviewItem } from './filePreviewItem';
39
38
  import { shouldShowImageBorder } from './imageBorder';
40
39
  import { LayoutGroup } from './layout-group';
41
40
  import { getLinkingToolbar, shouldShowMediaLinkToolbar } from './linking';
@@ -63,20 +62,6 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
63
62
  }
64
63
  return true;
65
64
  };
66
- export var generateFilePreviewItem = function generateFilePreviewItem(mediaPluginState, intl) {
67
- return {
68
- type: 'custom',
69
- fallback: [],
70
- render: function render() {
71
- return /*#__PURE__*/React.createElement(FilePreviewItem, {
72
- key: "editor.media.card.preview",
73
- mediaPluginState: mediaPluginState,
74
- intl: intl
75
- });
76
- },
77
- supportsViewMode: true
78
- };
79
- };
80
65
  export var handleShowMediaViewer = function handleShowMediaViewer(_ref) {
81
66
  var api = _ref.api,
82
67
  mediaPluginState = _ref.mediaPluginState;
@@ -122,7 +107,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
122
107
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
123
108
  }, {
124
109
  type: 'separator'
125
- }, fg('platform_editor_media_previewer_bugfix') ? {
110
+ }, {
126
111
  id: 'editor.media.viewer',
127
112
  testId: 'file-preview-toolbar-button',
128
113
  type: 'button',
@@ -137,7 +122,7 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
137
122
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
138
123
  },
139
124
  supportsViewMode: true
140
- } : generateFilePreviewItem(mediaPluginState, intl), {
125
+ }, {
141
126
  type: 'separator'
142
127
  }, {
143
128
  id: 'editor.media.card.download',
@@ -479,7 +464,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
479
464
  var _selectedMediaSingleNode = getSelectedMediaSingle(state);
480
465
  var mediaNode = _selectedMediaSingleNode === null || _selectedMediaSingleNode === void 0 ? void 0 : _selectedMediaSingleNode.node.content.firstChild;
481
466
  if (!isVideo(mediaNode === null || mediaNode === void 0 || (_mediaNode$attrs = mediaNode.attrs) === null || _mediaNode$attrs === void 0 ? void 0 : _mediaNode$attrs.__fileMimeType)) {
482
- toolbarButtons.push(fg('platform_editor_media_previewer_bugfix') ? {
467
+ toolbarButtons.push({
483
468
  id: 'editor.media.viewer',
484
469
  testId: 'file-preview-toolbar-button',
485
470
  type: 'button',
@@ -494,7 +479,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
494
479
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
495
480
  },
496
481
  supportsViewMode: true
497
- } : generateFilePreviewItem(pluginState, intl), {
482
+ }, {
498
483
  type: 'separator',
499
484
  supportsViewMode: true
500
485
  });
@@ -23,7 +23,7 @@ import { changeInlineToMediaCard, changeMediaInlineToMediaSingle, removeInlineCa
23
23
  import { shouldShowImageBorder } from './imageBorder';
24
24
  import { LinkToolbarAppearance } from './linking-toolbar-appearance';
25
25
  import { downloadMedia } from './utils';
26
- import { generateFilePreviewItem, handleShowMediaViewer } from './index';
26
+ import { handleShowMediaViewer } from './index';
27
27
  export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration, pluginInjectionApi) {
28
28
  var _pluginInjectionApi$a, _pluginInjectionApi$f;
29
29
  var options = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
@@ -63,7 +63,7 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
63
63
  className: 'thumbnail-appearance' // a11y. uses to force focus on item
64
64
  }, {
65
65
  type: 'separator'
66
- }, fg('platform_editor_media_previewer_bugfix') ? {
66
+ }, {
67
67
  id: 'editor.media.viewer',
68
68
  testId: 'file-preview-toolbar-button',
69
69
  type: 'button',
@@ -77,7 +77,7 @@ export var generateMediaInlineFloatingToolbar = function generateMediaInlineFloa
77
77
  api: pluginInjectionApi
78
78
  })) !== null && _handleShowMediaViewe !== void 0 ? _handleShowMediaViewe : false;
79
79
  }
80
- } : generateFilePreviewItem(mediaPluginState, intl), {
80
+ }, {
81
81
  type: 'separator'
82
82
  }, {
83
83
  id: 'editor.media.card.download',
@@ -235,7 +235,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
235
235
 
236
236
  //Image Preview
237
237
  if (options.allowImagePreview) {
238
- inlineImageItems.push(fg('platform_editor_media_previewer_bugfix') ? {
238
+ inlineImageItems.push({
239
239
  id: 'editor.media.viewer',
240
240
  testId: 'file-preview-toolbar-button',
241
241
  type: 'button',
@@ -250,7 +250,7 @@ var getMediaInlineImageToolbar = function getMediaInlineImageToolbar(state, intl
250
250
  })) !== null && _handleShowMediaViewe2 !== void 0 ? _handleShowMediaViewe2 : false;
251
251
  },
252
252
  supportsViewMode: true
253
- } : generateFilePreviewItem(mediaPluginState, intl), {
253
+ }, {
254
254
  type: 'separator',
255
255
  supportsViewMode: true
256
256
  });
@@ -1,10 +1,9 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  import type { MediaPluginState } from '../../pm-plugins/types';
6
6
  import type { MediaFloatingToolbarOptions } from '../../types';
7
- export declare const generateFilePreviewItem: (mediaPluginState: MediaPluginState, intl: IntlShape) => FloatingToolbarItem<Command>;
8
7
  export declare const handleShowMediaViewer: ({ api, mediaPluginState, }: {
9
8
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
10
9
  mediaPluginState: MediaPluginState;
@@ -1,10 +1,9 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
- import type { Command, ExtractInjectionAPI, FloatingToolbarConfig, FloatingToolbarItem } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI, FloatingToolbarConfig } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  import type { MediaPluginState } from '../../pm-plugins/types';
6
6
  import type { MediaFloatingToolbarOptions } from '../../types';
7
- export declare const generateFilePreviewItem: (mediaPluginState: MediaPluginState, intl: IntlShape) => FloatingToolbarItem<Command>;
8
7
  export declare const handleShowMediaViewer: ({ api, mediaPluginState, }: {
9
8
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
10
9
  mediaPluginState: MediaPluginState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.43.8",
3
+ "version": "1.43.10",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-common": "^97.2.0",
40
40
  "@atlaskit/editor-palette": "1.6.3",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
42
- "@atlaskit/editor-plugin-annotation": "1.26.7",
42
+ "@atlaskit/editor-plugin-annotation": "1.26.8",
43
43
  "@atlaskit/editor-plugin-connectivity": "^1.1.0",
44
44
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
45
45
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
@@ -67,7 +67,7 @@
67
67
  "@atlaskit/primitives": "^13.3.0",
68
68
  "@atlaskit/textfield": "^6.7.0",
69
69
  "@atlaskit/theme": "^14.0.0",
70
- "@atlaskit/tmp-editor-statsig": "^2.29.0",
70
+ "@atlaskit/tmp-editor-statsig": "^2.30.0",
71
71
  "@atlaskit/tokens": "^2.5.0",
72
72
  "@atlaskit/tooltip": "^19.0.0",
73
73
  "@babel/runtime": "^7.0.0",
@@ -133,9 +133,6 @@
133
133
  "platform_editor_media_batch_updates": {
134
134
  "type": "boolean"
135
135
  },
136
- "platform_editor_media_previewer_bugfix": {
137
- "type": "boolean"
138
- },
139
136
  "platform_editor_media_interaction_improvements": {
140
137
  "type": "boolean"
141
138
  },
@@ -162,6 +159,9 @@
162
159
  },
163
160
  "platform_editor_media_block_default": {
164
161
  "type": "boolean"
162
+ },
163
+ "platform_editor_fix_edit_caption_on_edge": {
164
+ "type": "boolean"
165
165
  }
166
166
  },
167
167
  "stricter": {
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.FilePreviewItem = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- var _react = _interopRequireWildcard(require("react"));
11
- var _ui = require("@atlaskit/editor-common/ui");
12
- var _maximize = _interopRequireDefault(require("@atlaskit/icon/core/maximize"));
13
- var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
14
- var _mediaUi = require("@atlaskit/media-ui");
15
- var _PortalWrapper = require("../../ui/MediaViewer/PortalWrapper");
16
- var _utils = require("./utils");
17
- 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); }
18
- 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; }
19
- // This function will eventially be removed when platform_editor_media_previewer_bugfix is cleaned up
20
- var FilePreviewItem = exports.FilePreviewItem = function FilePreviewItem(_ref) {
21
- var mediaPluginState = _ref.mediaPluginState,
22
- intl = _ref.intl;
23
- var _useState = (0, _react.useState)(false),
24
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
25
- isMediaViewerVisible = _useState2[0],
26
- setMediaViewerVisible = _useState2[1];
27
- var showMediaViewer = function showMediaViewer() {
28
- setMediaViewerVisible(true);
29
- };
30
- var onMediaViewerClose = function onMediaViewerClose() {
31
- setMediaViewerVisible(false);
32
- };
33
- var selectedNodeAttrs = (0, _utils.getSelectedNearestMediaContainerNodeAttrs)(mediaPluginState);
34
- var shouldRenderMediaViewer = selectedNodeAttrs && mediaPluginState.mediaClientConfig && isMediaViewerVisible;
35
- var tooltipContent = intl.formatMessage(_mediaUi.messages.preview);
36
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
37
- testId: "file-preview-toolbar-button",
38
- key: "editor.media.card.preview",
39
- onClick: showMediaViewer,
40
- icon: /*#__PURE__*/_react.default.createElement(_maximize.default, {
41
- color: "currentColor",
42
- spacing: "spacious",
43
- label: "file preview",
44
- LEGACY_fallbackIcon: _filePreview.default
45
- }),
46
- tooltipContent: tooltipContent
47
- }), shouldRenderMediaViewer && /*#__PURE__*/_react.default.createElement(_PortalWrapper.RenderMediaViewer
48
- // Ignored via go/ees005
49
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
50
- , {
51
- mediaClientConfig: mediaPluginState.mediaClientConfig,
52
- onClose: onMediaViewerClose,
53
- selectedNodeAttrs: selectedNodeAttrs
54
- }));
55
- };
@@ -1,42 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/ui';
3
- import MaximizeIcon from '@atlaskit/icon/core/maximize';
4
- import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
5
- import { messages } from '@atlaskit/media-ui';
6
- import { RenderMediaViewer } from '../../ui/MediaViewer/PortalWrapper';
7
- import { getSelectedNearestMediaContainerNodeAttrs } from './utils';
8
- // This function will eventially be removed when platform_editor_media_previewer_bugfix is cleaned up
9
- export const FilePreviewItem = ({
10
- mediaPluginState,
11
- intl
12
- }) => {
13
- const [isMediaViewerVisible, setMediaViewerVisible] = useState(false);
14
- const showMediaViewer = () => {
15
- setMediaViewerVisible(true);
16
- };
17
- const onMediaViewerClose = () => {
18
- setMediaViewerVisible(false);
19
- };
20
- const selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrs(mediaPluginState);
21
- const shouldRenderMediaViewer = selectedNodeAttrs && mediaPluginState.mediaClientConfig && isMediaViewerVisible;
22
- const tooltipContent = intl.formatMessage(messages.preview);
23
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolbarButton, {
24
- testId: "file-preview-toolbar-button",
25
- key: "editor.media.card.preview",
26
- onClick: showMediaViewer,
27
- icon: /*#__PURE__*/React.createElement(MaximizeIcon, {
28
- color: "currentColor",
29
- spacing: "spacious",
30
- label: "file preview",
31
- LEGACY_fallbackIcon: FilePreviewIcon
32
- }),
33
- tooltipContent: tooltipContent
34
- }), shouldRenderMediaViewer && /*#__PURE__*/React.createElement(RenderMediaViewer
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
- , {
38
- mediaClientConfig: mediaPluginState.mediaClientConfig,
39
- onClose: onMediaViewerClose,
40
- selectedNodeAttrs: selectedNodeAttrs
41
- }));
42
- };
@@ -1,45 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useState } from 'react';
3
- import { FloatingToolbarButton as ToolbarButton } from '@atlaskit/editor-common/ui';
4
- import MaximizeIcon from '@atlaskit/icon/core/maximize';
5
- import FilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
6
- import { messages } from '@atlaskit/media-ui';
7
- import { RenderMediaViewer } from '../../ui/MediaViewer/PortalWrapper';
8
- import { getSelectedNearestMediaContainerNodeAttrs } from './utils';
9
- // This function will eventially be removed when platform_editor_media_previewer_bugfix is cleaned up
10
- export var FilePreviewItem = function FilePreviewItem(_ref) {
11
- var mediaPluginState = _ref.mediaPluginState,
12
- intl = _ref.intl;
13
- var _useState = useState(false),
14
- _useState2 = _slicedToArray(_useState, 2),
15
- isMediaViewerVisible = _useState2[0],
16
- setMediaViewerVisible = _useState2[1];
17
- var showMediaViewer = function showMediaViewer() {
18
- setMediaViewerVisible(true);
19
- };
20
- var onMediaViewerClose = function onMediaViewerClose() {
21
- setMediaViewerVisible(false);
22
- };
23
- var selectedNodeAttrs = getSelectedNearestMediaContainerNodeAttrs(mediaPluginState);
24
- var shouldRenderMediaViewer = selectedNodeAttrs && mediaPluginState.mediaClientConfig && isMediaViewerVisible;
25
- var tooltipContent = intl.formatMessage(messages.preview);
26
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolbarButton, {
27
- testId: "file-preview-toolbar-button",
28
- key: "editor.media.card.preview",
29
- onClick: showMediaViewer,
30
- icon: /*#__PURE__*/React.createElement(MaximizeIcon, {
31
- color: "currentColor",
32
- spacing: "spacious",
33
- label: "file preview",
34
- LEGACY_fallbackIcon: FilePreviewIcon
35
- }),
36
- tooltipContent: tooltipContent
37
- }), shouldRenderMediaViewer && /*#__PURE__*/React.createElement(RenderMediaViewer
38
- // Ignored via go/ees005
39
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
- , {
41
- mediaClientConfig: mediaPluginState.mediaClientConfig,
42
- onClose: onMediaViewerClose,
43
- selectedNodeAttrs: selectedNodeAttrs
44
- }));
45
- };
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import type { IntlShape } from 'react-intl-next';
3
- import type { MediaPluginState } from '../../pm-plugins/types';
4
- interface FilePreviewProps {
5
- mediaPluginState: MediaPluginState;
6
- intl: IntlShape;
7
- }
8
- export declare const FilePreviewItem: ({ mediaPluginState, intl }: FilePreviewProps) => JSX.Element;
9
- export {};
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import type { IntlShape } from 'react-intl-next';
3
- import type { MediaPluginState } from '../../pm-plugins/types';
4
- interface FilePreviewProps {
5
- mediaPluginState: MediaPluginState;
6
- intl: IntlShape;
7
- }
8
- export declare const FilePreviewItem: ({ mediaPluginState, intl }: FilePreviewProps) => JSX.Element;
9
- export {};