@atlaskit/editor-plugin-media 3.0.4 → 3.0.6

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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/nodeviews/mediaSingle.js +5 -4
  3. package/dist/cjs/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  4. package/dist/cjs/pm-plugins/pixel-resizing/ui/pixel-entry.js +24 -1
  5. package/dist/cjs/ui/MediaLinkingToolbar.js +5 -2
  6. package/dist/es2019/nodeviews/mediaSingle.js +4 -3
  7. package/dist/es2019/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  8. package/dist/es2019/pm-plugins/pixel-resizing/ui/pixel-entry.js +23 -1
  9. package/dist/es2019/ui/MediaLinkingToolbar.js +5 -2
  10. package/dist/esm/nodeviews/mediaSingle.js +5 -4
  11. package/dist/esm/pm-plugins/alt-text/ui/AltTextEdit.js +1 -1
  12. package/dist/esm/pm-plugins/pixel-resizing/ui/pixel-entry.js +23 -1
  13. package/dist/esm/ui/MediaLinkingToolbar.js +5 -2
  14. package/dist/types/pm-plugins/pixel-resizing/index.d.ts +1 -1
  15. package/dist/types/pm-plugins/pixel-resizing/ui/index.d.ts +2 -2
  16. package/dist/types/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
  17. package/dist/types/ui/MediaPicker/ClipboardWrapper.d.ts +2 -2
  18. package/dist/types/ui/MediaPicker/DropzoneWrapper.d.ts +1 -1
  19. package/dist/types/ui/MediaPicker/PickerFacadeProvider.d.ts +2 -2
  20. package/dist/types/ui/toolbar/pixel-resizing.d.ts +4 -4
  21. package/dist/types/ui/toolbar/utils.d.ts +1 -1
  22. package/dist/types-ts4.5/pm-plugins/pixel-resizing/index.d.ts +1 -1
  23. package/dist/types-ts4.5/pm-plugins/pixel-resizing/ui/index.d.ts +2 -2
  24. package/dist/types-ts4.5/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
  25. package/dist/types-ts4.5/ui/MediaPicker/ClipboardWrapper.d.ts +2 -2
  26. package/dist/types-ts4.5/ui/MediaPicker/DropzoneWrapper.d.ts +1 -1
  27. package/dist/types-ts4.5/ui/MediaPicker/PickerFacadeProvider.d.ts +2 -2
  28. package/dist/types-ts4.5/ui/toolbar/pixel-resizing.d.ts +4 -4
  29. package/dist/types-ts4.5/ui/toolbar/utils.d.ts +1 -1
  30. package/package.json +23 -17
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 3.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#157322](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/157322)
8
+ [`0e61040734cef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e61040734cef) -
9
+ [ED-27842] Consolidate extraneous no_cursor flags into one flag for full rollout
10
+ - Updated dependencies
11
+
12
+ ## 3.0.5
13
+
14
+ ### Patch Changes
15
+
16
+ - [#154892](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154892)
17
+ [`406f074dcf056`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/406f074dcf056) -
18
+ [ux] When media's floating toolbar option's popups for "Alt text", "Add link" or "Resize" are
19
+ closed by space key press, the focus should be set on "View more" button.
20
+
3
21
  ## 3.0.4
4
22
 
5
23
  ### Patch Changes
@@ -612,12 +612,13 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
612
612
  editorDisabled = _useSharedState.editorDisabled,
613
613
  viewMode = _useSharedState.viewMode;
614
614
  var hasHadInteraction = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.hasHadInteraction');
615
+ var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.interactionState');
615
616
  var mediaProvider = (0, _react.useMemo)(function () {
616
617
  return mediaProviderPromise ? Promise.resolve(mediaProviderPromise) : undefined;
617
618
  }, [mediaProviderPromise]);
618
619
  var isSelectedAndInteracted = (0, _react.useCallback)(function () {
619
- return Boolean(selected() && hasHadInteraction !== false);
620
- }, [hasHadInteraction, selected]);
620
+ return Boolean(selected() && ((0, _platformFeatureFlags.fg)('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : hasHadInteraction !== false));
621
+ }, [hasHadInteraction, interactionState, selected]);
621
622
  if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2__media_single') || (0, _platformFeatureFlags.fg)('platform_editor_react18_phase2__media_single_jira')) {
622
623
  return (0, _react2.jsx)(_mediaSingleNext.MediaSingleNodeNext, {
623
624
  width: width || 0,
@@ -629,7 +630,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
629
630
  mediaOptions: mediaOptions,
630
631
  view: view,
631
632
  fullWidthMode: fullWidthMode,
632
- selected: (0, _platformFeatureFlags.fg)('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
633
+ selected: (0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
633
634
  eventDispatcher: eventDispatcher,
634
635
  addPendingTask: addPendingTask,
635
636
  isDrafting: isDrafting,
@@ -652,7 +653,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
652
653
  mediaOptions: mediaOptions,
653
654
  view: view,
654
655
  fullWidthMode: fullWidthMode,
655
- selected: (0, _platformFeatureFlags.fg)('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
656
+ selected: (0, _platformFeatureFlags.fg)('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
656
657
  eventDispatcher: eventDispatcher,
657
658
  addPendingTask: addPendingTask,
658
659
  isDrafting: isDrafting,
@@ -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
  }
@@ -526,8 +526,9 @@ const MediaSingleNodeWrapper = ({
526
526
  viewMode
527
527
  } = useSharedState(pluginInjectionApi);
528
528
  const hasHadInteraction = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.hasHadInteraction');
529
+ const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
529
530
  const mediaProvider = useMemo(() => mediaProviderPromise ? Promise.resolve(mediaProviderPromise) : undefined, [mediaProviderPromise]);
530
- const isSelectedAndInteracted = useCallback(() => Boolean(selected() && hasHadInteraction !== false), [hasHadInteraction, selected]);
531
+ const isSelectedAndInteracted = useCallback(() => Boolean(selected() && (fg('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : hasHadInteraction !== false)), [hasHadInteraction, interactionState, selected]);
531
532
  if (fg('platform_editor_react18_phase2__media_single') || fg('platform_editor_react18_phase2__media_single_jira')) {
532
533
  return jsx(MediaSingleNodeNext, {
533
534
  width: width || 0,
@@ -539,7 +540,7 @@ const MediaSingleNodeWrapper = ({
539
540
  mediaOptions: mediaOptions,
540
541
  view: view,
541
542
  fullWidthMode: fullWidthMode,
542
- selected: fg('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
543
+ selected: fg('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
543
544
  eventDispatcher: eventDispatcher,
544
545
  addPendingTask: addPendingTask,
545
546
  isDrafting: isDrafting,
@@ -562,7 +563,7 @@ const MediaSingleNodeWrapper = ({
562
563
  mediaOptions: mediaOptions,
563
564
  view: view,
564
565
  fullWidthMode: fullWidthMode,
565
- selected: fg('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
566
+ selected: fg('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
566
567
  eventDispatcher: eventDispatcher,
567
568
  addPendingTask: addPendingTask,
568
569
  isDrafting: isDrafting,
@@ -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
  }
@@ -607,12 +607,13 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
607
607
  editorDisabled = _useSharedState.editorDisabled,
608
608
  viewMode = _useSharedState.viewMode;
609
609
  var hasHadInteraction = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.hasHadInteraction');
610
+ var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
610
611
  var mediaProvider = useMemo(function () {
611
612
  return mediaProviderPromise ? Promise.resolve(mediaProviderPromise) : undefined;
612
613
  }, [mediaProviderPromise]);
613
614
  var isSelectedAndInteracted = useCallback(function () {
614
- return Boolean(selected() && hasHadInteraction !== false);
615
- }, [hasHadInteraction, selected]);
615
+ return Boolean(selected() && (fg('platform_editor_interaction_api_refactor') ? interactionState !== 'hasNotHadInteraction' : hasHadInteraction !== false));
616
+ }, [hasHadInteraction, interactionState, selected]);
616
617
  if (fg('platform_editor_react18_phase2__media_single') || fg('platform_editor_react18_phase2__media_single_jira')) {
617
618
  return jsx(MediaSingleNodeNext, {
618
619
  width: width || 0,
@@ -624,7 +625,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
624
625
  mediaOptions: mediaOptions,
625
626
  view: view,
626
627
  fullWidthMode: fullWidthMode,
627
- selected: fg('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
628
+ selected: fg('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
628
629
  eventDispatcher: eventDispatcher,
629
630
  addPendingTask: addPendingTask,
630
631
  isDrafting: isDrafting,
@@ -647,7 +648,7 @@ var MediaSingleNodeWrapper = function MediaSingleNodeWrapper(_ref6) {
647
648
  mediaOptions: mediaOptions,
648
649
  view: view,
649
650
  fullWidthMode: fullWidthMode,
650
- selected: fg('platform_editor_no_selection_until_interaction') ? isSelectedAndInteracted : selected,
651
+ selected: fg('platform_editor_no_cursor_on_live_doc_init') ? isSelectedAndInteracted : selected,
651
652
  eventDispatcher: eventDispatcher,
652
653
  addPendingTask: addPendingTask,
653
654
  isDrafting: isDrafting,
@@ -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
  }
@@ -1,5 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
2
+ import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
3
  declare const createCommand: <A = {
4
4
  type: "openPixelEditor";
5
5
  } | {
@@ -4,8 +4,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
5
5
  import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import { MediaNextEditorPluginType } from '../../../mediaPluginType';
8
- import { MediaPluginState } from '../../../types';
7
+ import type { MediaNextEditorPluginType } from '../../../mediaPluginType';
8
+ import type { MediaPluginState } from '../../../types';
9
9
  export type Props = {
10
10
  editorView: EditorView;
11
11
  selectedMediaSingleNode: ContentNodeWithPos;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  isOpen?: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  featureFlags?: MediaFeatureFlags;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  isActive: boolean;
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaClientConfig } from '@atlaskit/media-core';
4
4
  import type { BrowserConfig, ClipboardConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
5
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
5
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
6
6
  import PickerFacade from '../../pm-plugins/picker-facade';
7
7
  interface ChildrenProps {
8
8
  config: ClipboardConfig | BrowserConfig | DropzoneConfig;
@@ -1,8 +1,8 @@
1
- import { IntlShape } from 'react-intl-next';
2
- import { FloatingToolbarConfig, FloatingToolbarOverflowDropdownOptions, Command } from '@atlaskit/editor-common/types';
1
+ import { type IntlShape } from 'react-intl-next';
2
+ import { type FloatingToolbarConfig, type FloatingToolbarOverflowDropdownOptions, type Command } from '@atlaskit/editor-common/types';
3
3
  import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { Props } from '../../pm-plugins/pixel-resizing/ui';
6
- import { MediaOptions, MediaToolbarBaseConfig } from '../../types';
5
+ import { type Props } from '../../pm-plugins/pixel-resizing/ui';
6
+ import type { MediaOptions, MediaToolbarBaseConfig } from '../../types';
7
7
  export declare const getPixelResizingToolbar: (toolbarBaseConfig: MediaToolbarBaseConfig, { pluginInjectionApi, intl, pluginState, hoverDecoration, isEditorFullWidthEnabled, triggerButtonSelector, }: Omit<Props, 'editorView' | 'selectedMediaSingleNode'>) => FloatingToolbarConfig;
8
8
  export declare const getResizeDropdownOption: (mediaOptions: MediaOptions, state: EditorState, formatMessage: IntlShape['formatMessage'], selectedNodeType?: NodeType) => FloatingToolbarOverflowDropdownOptions<Command>;
@@ -1,6 +1,6 @@
1
1
  import type { ExternalMediaAttributes, MediaADFAttrs, RichMediaLayout } from '@atlaskit/adf-schema';
2
2
  import type { LayoutIcon } from '@atlaskit/editor-common/card';
3
- import { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
3
+ import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
4
4
  import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
@@ -1,5 +1,5 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
2
+ import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
3
3
  declare const createCommand: <A = {
4
4
  type: "openPixelEditor";
5
5
  } | {
@@ -4,8 +4,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
5
5
  import { type ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
- import { MediaNextEditorPluginType } from '../../../mediaPluginType';
8
- import { MediaPluginState } from '../../../types';
7
+ import type { MediaNextEditorPluginType } from '../../../mediaPluginType';
8
+ import type { MediaPluginState } from '../../../types';
9
9
  export type Props = {
10
10
  editorView: EditorView;
11
11
  selectedMediaSingleNode: ContentNodeWithPos;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  isOpen?: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  featureFlags?: MediaFeatureFlags;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
4
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
5
5
  type Props = {
6
6
  api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
7
7
  isActive: boolean;
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { MediaClientConfig } from '@atlaskit/media-core';
4
4
  import type { BrowserConfig, ClipboardConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
5
- import { MediaNextEditorPluginType } from '../../mediaPluginType';
5
+ import type { MediaNextEditorPluginType } from '../../mediaPluginType';
6
6
  import PickerFacade from '../../pm-plugins/picker-facade';
7
7
  interface ChildrenProps {
8
8
  config: ClipboardConfig | BrowserConfig | DropzoneConfig;
@@ -1,8 +1,8 @@
1
- import { IntlShape } from 'react-intl-next';
2
- import { FloatingToolbarConfig, FloatingToolbarOverflowDropdownOptions, Command } from '@atlaskit/editor-common/types';
1
+ import { type IntlShape } from 'react-intl-next';
2
+ import { type FloatingToolbarConfig, type FloatingToolbarOverflowDropdownOptions, type Command } from '@atlaskit/editor-common/types';
3
3
  import { NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { Props } from '../../pm-plugins/pixel-resizing/ui';
6
- import { MediaOptions, MediaToolbarBaseConfig } from '../../types';
5
+ import { type Props } from '../../pm-plugins/pixel-resizing/ui';
6
+ import type { MediaOptions, MediaToolbarBaseConfig } from '../../types';
7
7
  export declare const getPixelResizingToolbar: (toolbarBaseConfig: MediaToolbarBaseConfig, { pluginInjectionApi, intl, pluginState, hoverDecoration, isEditorFullWidthEnabled, triggerButtonSelector, }: Omit<Props, 'editorView' | 'selectedMediaSingleNode'>) => FloatingToolbarConfig;
8
8
  export declare const getResizeDropdownOption: (mediaOptions: MediaOptions, state: EditorState, formatMessage: IntlShape['formatMessage'], selectedNodeType?: NodeType) => FloatingToolbarOverflowDropdownOptions<Command>;
@@ -1,6 +1,6 @@
1
1
  import type { ExternalMediaAttributes, MediaADFAttrs, RichMediaLayout } from '@atlaskit/adf-schema';
2
2
  import type { LayoutIcon } from '@atlaskit/editor-common/card';
3
- import { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
3
+ import type { Command, FloatingToolbarItem } from '@atlaskit/editor-common/types';
4
4
  import type { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
5
5
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
6
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
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.6",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,8 +37,8 @@
37
37
  "@atlaskit/adf-schema": "^47.6.0",
38
38
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
39
39
  "@atlaskit/analytics-next": "^11.0.0",
40
- "@atlaskit/button": "^23.0.0",
41
- "@atlaskit/editor-common": "^105.2.0",
40
+ "@atlaskit/button": "^23.2.0",
41
+ "@atlaskit/editor-common": "^105.8.0",
42
42
  "@atlaskit/editor-palette": "^2.1.0",
43
43
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
44
44
  "@atlaskit/editor-plugin-annotation": "^2.8.0",
@@ -50,28 +50,28 @@
50
50
  "@atlaskit/editor-plugin-focus": "^1.5.0",
51
51
  "@atlaskit/editor-plugin-grid": "^2.0.0",
52
52
  "@atlaskit/editor-plugin-guideline": "^2.0.0",
53
- "@atlaskit/editor-plugin-interaction": "^1.0.0",
53
+ "@atlaskit/editor-plugin-interaction": "^1.1.0",
54
54
  "@atlaskit/editor-plugin-selection": "^2.2.0",
55
55
  "@atlaskit/editor-plugin-width": "^3.0.0",
56
56
  "@atlaskit/editor-prosemirror": "7.0.0",
57
57
  "@atlaskit/editor-shared-styles": "^3.4.0",
58
58
  "@atlaskit/editor-tables": "^2.9.0",
59
59
  "@atlaskit/form": "^12.0.0",
60
- "@atlaskit/icon": "^26.0.0",
61
- "@atlaskit/media-card": "^79.2.0",
62
- "@atlaskit/media-client": "^33.0.0",
63
- "@atlaskit/media-client-react": "^4.0.0",
64
- "@atlaskit/media-common": "^12.0.0",
65
- "@atlaskit/media-filmstrip": "^50.0.0",
60
+ "@atlaskit/icon": "^26.1.0",
61
+ "@atlaskit/media-card": "^79.3.0",
62
+ "@atlaskit/media-client": "^33.3.0",
63
+ "@atlaskit/media-client-react": "^4.1.0",
64
+ "@atlaskit/media-common": "^12.1.0",
65
+ "@atlaskit/media-filmstrip": "^50.1.0",
66
66
  "@atlaskit/media-picker": "^69.0.0",
67
- "@atlaskit/media-ui": "^28.1.0",
68
- "@atlaskit/media-viewer": "^52.0.0",
67
+ "@atlaskit/media-ui": "^28.2.0",
68
+ "@atlaskit/media-viewer": "^52.1.0",
69
69
  "@atlaskit/platform-feature-flags": "^1.1.0",
70
- "@atlaskit/primitives": "^14.7.0",
70
+ "@atlaskit/primitives": "^14.8.0",
71
71
  "@atlaskit/textfield": "^8.0.0",
72
72
  "@atlaskit/theme": "^18.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^4.21.0",
74
- "@atlaskit/tokens": "^4.8.0",
73
+ "@atlaskit/tmp-editor-statsig": "^4.23.0",
74
+ "@atlaskit/tokens": "^4.9.0",
75
75
  "@atlaskit/tooltip": "^20.0.0",
76
76
  "@babel/runtime": "^7.0.0",
77
77
  "@emotion/react": "^11.7.1",
@@ -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"
@@ -184,7 +184,7 @@
184
184
  "platform_editor_fix_image_size_diff_during_ssr": {
185
185
  "type": "boolean"
186
186
  },
187
- "platform_editor_no_selection_until_interaction": {
187
+ "platform_editor_no_cursor_on_live_doc_init": {
188
188
  "type": "boolean"
189
189
  },
190
190
  "platform_editor_controls_patch_7": {
@@ -201,6 +201,12 @@
201
201
  },
202
202
  "platform_editor_controls_patch_8": {
203
203
  "type": "boolean"
204
+ },
205
+ "platform_editor_controls_patch_9": {
206
+ "type": "boolean"
207
+ },
208
+ "platform_editor_interaction_api_refactor": {
209
+ "type": "boolean"
204
210
  }
205
211
  },
206
212
  "stricter": {