@atlaskit/editor-plugin-media 3.0.4 → 3.0.5

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,14 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 3.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#154892](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154892)
8
+ [`406f074dcf056`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/406f074dcf056) -
9
+ [ux] When media's floating toolbar option's popups for "Alt text", "Add link" or "Resize" are
10
+ closed by space key press, the focus should be set on "View more" button.
11
+
3
12
  ## 3.0.4
4
13
 
5
14
  ### Patch Changes
@@ -139,7 +139,7 @@ var AltTextEditComponent = exports.AltTextEditComponent = /*#__PURE__*/function
139
139
  if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8')) {
140
140
  _this.closeMediaAltTextMenuAndSetFocus();
141
141
  } else {
142
- _this.closeMediaAltTextMenu(); // Why do we close the menu on blur? Is it a bug?
142
+ _this.closeMediaAltTextMenu();
143
143
  }
144
144
  });
145
145
  (0, _defineProperty2.default)(_this, "handleClearText", function () {
@@ -24,6 +24,7 @@ var _constants = require("./constants");
24
24
  var _styles = require("./styles");
25
25
  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); }
26
26
  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; }
27
+ /* eslint-disable jsdoc/check-tag-names */
27
28
  /**
28
29
  * @jsxRuntime classic
29
30
  * @jsx jsx
@@ -31,6 +32,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
31
32
 
32
33
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
33
34
 
35
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives
36
+
34
37
  var pixelSizingLabel = (0, _primitives.xcss)({
35
38
  gridArea: 'label',
36
39
  lineHeight: "var(--ds-space-300, 24px)"
@@ -300,6 +303,26 @@ var PixelEntryComponentNext = exports.PixelEntryComponentNext = function PixelEn
300
303
  }, shouldSetFocus);
301
304
  }
302
305
  }, [computedWidth, computedHeight, handleCloseAndSave]);
306
+ var handleCloseButtonKeyDown = (0, _react.useCallback)(function (event) {
307
+ if (event.key === 'Enter' || event.key === ' ') {
308
+ event.preventDefault();
309
+ var shouldSetFocus = true;
310
+ handleCloseAndSave({
311
+ inputWidth: computedWidth,
312
+ inputHeight: computedHeight
313
+ }, shouldSetFocus);
314
+ }
315
+ }, [computedWidth, computedHeight, handleCloseAndSave]);
316
+ var getButtonKeyDownHandler = function getButtonKeyDownHandler() {
317
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
318
+ if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8') && !(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9')) {
319
+ return handleKeyDown;
320
+ } else if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9')) {
321
+ return handleCloseButtonKeyDown;
322
+ } else {
323
+ return undefined;
324
+ }
325
+ };
303
326
  return (0, _react2.jsx)(_primitives.Box, {
304
327
  xcss: [pixelEntryWrapperStyles, isViewMode && pixelEntryWrapperViewModeStyles]
305
328
  }, (0, _react2.jsx)(_primitives.Inline, {
@@ -367,6 +390,6 @@ var PixelEntryComponentNext = exports.PixelEntryComponentNext = function PixelEn
367
390
  inputHeight: computedHeight
368
391
  });
369
392
  },
370
- onKeyDown: (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_8') ? handleKeyDown : undefined
393
+ onKeyDown: getButtonKeyDownHandler()
371
394
  }))));
372
395
  };
@@ -22,6 +22,7 @@ var _ui = require("@atlaskit/editor-common/ui");
22
22
  var _utils = require("@atlaskit/editor-common/utils");
23
23
  var _linkBrokenEditorUnlink = _interopRequireDefault(require("@atlaskit/icon/core/migration/link-broken--editor-unlink"));
24
24
  var _chevronLeftChevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-left--chevron-left-large"));
25
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
25
26
  var _colors = require("@atlaskit/theme/colors");
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); }
27
28
  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; }
@@ -134,7 +135,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
134
135
  });
135
136
  },
136
137
  onKeyDown: function onKeyDown(event) {
137
- if (event.key === 'Enter') {
138
+ if (event.key === 'Enter' || event.key === ' ' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9')) {
139
+ event.preventDefault();
138
140
  _this.handleOnBack({
139
141
  url: value,
140
142
  inputMethod: currentInputMethod
@@ -176,7 +178,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
176
178
  return _this.handleUnlink();
177
179
  },
178
180
  onKeyDown: function onKeyDown(event) {
179
- if (event.key === 'Enter') {
181
+ if (event.key === 'Enter' || event.key === ' ' && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9')) {
182
+ event.preventDefault();
180
183
  _this.handleUnlink(true);
181
184
  }
182
185
  }
@@ -128,7 +128,7 @@ export class AltTextEditComponent extends React.Component {
128
128
  if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8')) {
129
129
  this.closeMediaAltTextMenuAndSetFocus();
130
130
  } else {
131
- this.closeMediaAltTextMenu(); // Why do we close the menu on blur? Is it a bug?
131
+ this.closeMediaAltTextMenu();
132
132
  }
133
133
  });
134
134
  _defineProperty(this, "handleClearText", () => {
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ /* eslint-disable jsdoc/check-tag-names */
2
3
  /**
3
4
  * @jsxRuntime classic
4
5
  * @jsx jsx
@@ -12,6 +13,7 @@ import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
12
13
  import Form, { Field } from '@atlaskit/form';
13
14
  import CloseIcon from '@atlaskit/icon/core/close';
14
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives
15
17
  import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
16
18
  import Textfield from '@atlaskit/textfield';
17
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -282,6 +284,26 @@ export const PixelEntryComponentNext = ({
282
284
  }, shouldSetFocus);
283
285
  }
284
286
  }, [computedWidth, computedHeight, handleCloseAndSave]);
287
+ const handleCloseButtonKeyDown = useCallback(event => {
288
+ if (event.key === 'Enter' || event.key === ' ') {
289
+ event.preventDefault();
290
+ const shouldSetFocus = true;
291
+ handleCloseAndSave({
292
+ inputWidth: computedWidth,
293
+ inputHeight: computedHeight
294
+ }, shouldSetFocus);
295
+ }
296
+ }, [computedWidth, computedHeight, handleCloseAndSave]);
297
+ const getButtonKeyDownHandler = () => {
298
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
299
+ if (fg('platform_editor_controls_patch_8') && !fg('platform_editor_controls_patch_9')) {
300
+ return handleKeyDown;
301
+ } else if (fg('platform_editor_controls_patch_9')) {
302
+ return handleCloseButtonKeyDown;
303
+ } else {
304
+ return undefined;
305
+ }
306
+ };
285
307
  return jsx(Box, {
286
308
  xcss: [pixelEntryWrapperStyles, isViewMode && pixelEntryWrapperViewModeStyles]
287
309
  }, jsx(Inline, {
@@ -347,6 +369,6 @@ export const PixelEntryComponentNext = ({
347
369
  inputHeight: computedHeight
348
370
  });
349
371
  },
350
- onKeyDown: fg('platform_editor_controls_patch_8') ? handleKeyDown : undefined
372
+ onKeyDown: getButtonKeyDownHandler()
351
373
  }))));
352
374
  };
@@ -17,6 +17,7 @@ PanelTextInput } from '@atlaskit/editor-common/ui';
17
17
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
18
18
  import EditorUnlinkIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
19
19
  import ChevronLeftLargeIcon from '@atlaskit/icon/utility/migration/chevron-left--chevron-left-large';
20
+ import { fg } from '@atlaskit/platform-feature-flags';
20
21
  import { R400 } from '@atlaskit/theme/colors';
21
22
  const validationWrapper = css({
22
23
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
@@ -126,7 +127,8 @@ class LinkAddToolbar extends React.PureComponent {
126
127
  inputMethod: currentInputMethod
127
128
  }),
128
129
  onKeyDown: event => {
129
- if (event.key === 'Enter') {
130
+ if (event.key === 'Enter' || event.key === ' ' && fg('platform_editor_controls_patch_9')) {
131
+ event.preventDefault();
130
132
  this.handleOnBack({
131
133
  url: value,
132
134
  inputMethod: currentInputMethod
@@ -166,7 +168,8 @@ class LinkAddToolbar extends React.PureComponent {
166
168
  }),
167
169
  onClick: () => this.handleUnlink(),
168
170
  onKeyDown: event => {
169
- if (event.key === 'Enter') {
171
+ if (event.key === 'Enter' || event.key === ' ' && fg('platform_editor_controls_patch_9')) {
172
+ event.preventDefault();
170
173
  this.handleUnlink(true);
171
174
  }
172
175
  }
@@ -136,7 +136,7 @@ export var AltTextEditComponent = /*#__PURE__*/function (_React$Component) {
136
136
  if (editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_8')) {
137
137
  _this.closeMediaAltTextMenuAndSetFocus();
138
138
  } else {
139
- _this.closeMediaAltTextMenu(); // Why do we close the menu on blur? Is it a bug?
139
+ _this.closeMediaAltTextMenu();
140
140
  }
141
141
  });
142
142
  _defineProperty(_this, "handleClearText", function () {
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ /* eslint-disable jsdoc/check-tag-names */
3
4
  /**
4
5
  * @jsxRuntime classic
5
6
  * @jsx jsx
@@ -13,6 +14,7 @@ import { pixelEntryMessages as messages } from '@atlaskit/editor-common/media';
13
14
  import Form, { Field } from '@atlaskit/form';
14
15
  import CloseIcon from '@atlaskit/icon/core/close';
15
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives
16
18
  import { Inline, Box, Text, xcss } from '@atlaskit/primitives';
17
19
  import Textfield from '@atlaskit/textfield';
18
20
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -288,6 +290,26 @@ export var PixelEntryComponentNext = function PixelEntryComponentNext(_ref5) {
288
290
  }, shouldSetFocus);
289
291
  }
290
292
  }, [computedWidth, computedHeight, handleCloseAndSave]);
293
+ var handleCloseButtonKeyDown = useCallback(function (event) {
294
+ if (event.key === 'Enter' || event.key === ' ') {
295
+ event.preventDefault();
296
+ var shouldSetFocus = true;
297
+ handleCloseAndSave({
298
+ inputWidth: computedWidth,
299
+ inputHeight: computedHeight
300
+ }, shouldSetFocus);
301
+ }
302
+ }, [computedWidth, computedHeight, handleCloseAndSave]);
303
+ var getButtonKeyDownHandler = function getButtonKeyDownHandler() {
304
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
305
+ if (fg('platform_editor_controls_patch_8') && !fg('platform_editor_controls_patch_9')) {
306
+ return handleKeyDown;
307
+ } else if (fg('platform_editor_controls_patch_9')) {
308
+ return handleCloseButtonKeyDown;
309
+ } else {
310
+ return undefined;
311
+ }
312
+ };
291
313
  return jsx(Box, {
292
314
  xcss: [pixelEntryWrapperStyles, isViewMode && pixelEntryWrapperViewModeStyles]
293
315
  }, jsx(Inline, {
@@ -355,6 +377,6 @@ export var PixelEntryComponentNext = function PixelEntryComponentNext(_ref5) {
355
377
  inputHeight: computedHeight
356
378
  });
357
379
  },
358
- onKeyDown: fg('platform_editor_controls_patch_8') ? handleKeyDown : undefined
380
+ onKeyDown: getButtonKeyDownHandler()
359
381
  }))));
360
382
  };
@@ -24,6 +24,7 @@ PanelTextInput } from '@atlaskit/editor-common/ui';
24
24
  import { normalizeUrl } from '@atlaskit/editor-common/utils';
25
25
  import EditorUnlinkIcon from '@atlaskit/icon/core/migration/link-broken--editor-unlink';
26
26
  import ChevronLeftLargeIcon from '@atlaskit/icon/utility/migration/chevron-left--chevron-left-large';
27
+ import { fg } from '@atlaskit/platform-feature-flags';
27
28
  import { R400 } from '@atlaskit/theme/colors';
28
29
  var validationWrapper = css({
29
30
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
@@ -129,7 +130,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
129
130
  });
130
131
  },
131
132
  onKeyDown: function onKeyDown(event) {
132
- if (event.key === 'Enter') {
133
+ if (event.key === 'Enter' || event.key === ' ' && fg('platform_editor_controls_patch_9')) {
134
+ event.preventDefault();
133
135
  _this.handleOnBack({
134
136
  url: value,
135
137
  inputMethod: currentInputMethod
@@ -171,7 +173,8 @@ var LinkAddToolbar = /*#__PURE__*/function (_React$PureComponent) {
171
173
  return _this.handleUnlink();
172
174
  },
173
175
  onKeyDown: function onKeyDown(event) {
174
- if (event.key === 'Enter') {
176
+ if (event.key === 'Enter' || event.key === ' ' && fg('platform_editor_controls_patch_9')) {
177
+ event.preventDefault();
175
178
  _this.handleUnlink(true);
176
179
  }
177
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -59,7 +59,7 @@
59
59
  "@atlaskit/form": "^12.0.0",
60
60
  "@atlaskit/icon": "^26.0.0",
61
61
  "@atlaskit/media-card": "^79.2.0",
62
- "@atlaskit/media-client": "^33.0.0",
62
+ "@atlaskit/media-client": "^33.1.0",
63
63
  "@atlaskit/media-client-react": "^4.0.0",
64
64
  "@atlaskit/media-common": "^12.0.0",
65
65
  "@atlaskit/media-filmstrip": "^50.0.0",
@@ -85,7 +85,7 @@
85
85
  "typescript": "~5.4.2"
86
86
  },
87
87
  "peerDependencies": {
88
- "@atlaskit/media-core": "^36.0.0",
88
+ "@atlaskit/media-core": "^36.1.0",
89
89
  "react": "^18.2.0",
90
90
  "react-dom": "^18.2.0",
91
91
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -201,6 +201,9 @@
201
201
  },
202
202
  "platform_editor_controls_patch_8": {
203
203
  "type": "boolean"
204
+ },
205
+ "platform_editor_controls_patch_9": {
206
+ "type": "boolean"
204
207
  }
205
208
  },
206
209
  "stricter": {