@atlaskit/editor-common 74.9.1 → 74.10.0

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,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`ac5a05f5929`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac5a05f5929) - We are testing an upgrade to the `focus-trap` dependency behind a feature flag. If this fix is successful it will be available in a later release.
8
+
9
+ ## 74.9.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`87070f514cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/87070f514cd) - [ux] ED-18024 Adds an enter keydown handler on the main toolbar droplist (BlockInsertMenuLegacy) to prevent the editor capturing the keypress when the keyboard is used to insert nodes.
14
+
3
15
  ## 74.9.1
4
16
 
5
17
  ### Patch Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "74.9.1";
19
+ var packageVersion = "74.10.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.9.1";
27
+ var packageVersion = "74.10.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -19,10 +19,12 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
19
19
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
20
20
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
21
21
  var _react = _interopRequireDefault(require("react"));
22
- var _focusTrap = _interopRequireDefault(require("focus-trap"));
22
+ var _focusTrap = require("focus-trap");
23
+ var _focusTrapV = _interopRequireDefault(require("focus-trap-v2"));
23
24
  var _rafSchd = _interopRequireDefault(require("raf-schd"));
24
25
  var _reactDom = require("react-dom");
25
26
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
27
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
28
  var _utils = require("./utils");
27
29
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
28
30
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -75,7 +77,11 @@ var Popup = /*#__PURE__*/function (_React$Component) {
75
77
  fallbackFocus: popup,
76
78
  returnFocusOnDeactivate: false
77
79
  };
78
- _this.focusTrap = (0, _focusTrap.default)(popup, trapConfig);
80
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.focus-trap-upgrade_p2cei')) {
81
+ _this.focusTrap = (0, _focusTrap.createFocusTrap)(popup, trapConfig);
82
+ } else {
83
+ _this.focusTrap = (0, _focusTrapV.default)(popup, trapConfig);
84
+ }
79
85
  _this.focusTrap.activate();
80
86
  }));
81
87
  return _this;
@@ -179,6 +179,10 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
179
179
  isTriggerNotTabbable: true,
180
180
  handleClickOutside: this.handleClose,
181
181
  handleEscapeKeydown: this.handleCloseAndFocus,
182
+ handleEnterKeydown: function handleEnterKeydown(e) {
183
+ e.preventDefault();
184
+ e.stopPropagation();
185
+ },
182
186
  targetRef: this.state.target
183
187
  }, (0, _react2.jsx)("div", {
184
188
  style: {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.9.1",
3
+ "version": "74.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "74.9.1";
3
+ const packageVersion = "74.10.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.9.1";
11
+ const packageVersion = "74.10.0";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -1,9 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
- import createFocusTrap from 'focus-trap';
3
+ import { createFocusTrap } from 'focus-trap';
4
+ import createFocusTrapV2 from 'focus-trap-v2';
4
5
  import rafSchedule from 'raf-schd';
5
6
  import { createPortal } from 'react-dom';
6
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
9
  import { calculatePlacement, calculatePosition, findOverflowScrollParent, validatePosition } from './utils';
8
10
  export default class Popup extends React.Component {
9
11
  constructor(...args) {
@@ -43,7 +45,11 @@ export default class Popup extends React.Component {
43
45
  fallbackFocus: popup,
44
46
  returnFocusOnDeactivate: false
45
47
  };
46
- this.focusTrap = createFocusTrap(popup, trapConfig);
48
+ if (getBooleanFF('platform.design-system-team.focus-trap-upgrade_p2cei')) {
49
+ this.focusTrap = createFocusTrap(popup, trapConfig);
50
+ } else {
51
+ this.focusTrap = createFocusTrapV2(popup, trapConfig);
52
+ }
47
53
  this.focusTrap.activate();
48
54
  }));
49
55
  }
@@ -187,6 +187,10 @@ export default class DropdownMenuWrapper extends PureComponent {
187
187
  isTriggerNotTabbable: true,
188
188
  handleClickOutside: this.handleClose,
189
189
  handleEscapeKeydown: this.handleCloseAndFocus,
190
+ handleEnterKeydown: e => {
191
+ e.preventDefault();
192
+ e.stopPropagation();
193
+ },
190
194
  targetRef: this.state.target
191
195
  }, jsx("div", {
192
196
  style: {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.9.1",
3
+ "version": "74.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "74.9.1";
9
+ var packageVersion = "74.10.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.9.1";
21
+ var packageVersion = "74.10.0";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -10,10 +10,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import React from 'react';
13
- import createFocusTrap from 'focus-trap';
13
+ import { createFocusTrap } from 'focus-trap';
14
+ import createFocusTrapV2 from 'focus-trap-v2';
14
15
  import rafSchedule from 'raf-schd';
15
16
  import { createPortal } from 'react-dom';
16
17
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
18
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
17
19
  import { calculatePlacement, calculatePosition as _calculatePosition, findOverflowScrollParent, validatePosition } from './utils';
18
20
  var Popup = /*#__PURE__*/function (_React$Component) {
19
21
  _inherits(Popup, _React$Component);
@@ -62,7 +64,11 @@ var Popup = /*#__PURE__*/function (_React$Component) {
62
64
  fallbackFocus: popup,
63
65
  returnFocusOnDeactivate: false
64
66
  };
65
- _this.focusTrap = createFocusTrap(popup, trapConfig);
67
+ if (getBooleanFF('platform.design-system-team.focus-trap-upgrade_p2cei')) {
68
+ _this.focusTrap = createFocusTrap(popup, trapConfig);
69
+ } else {
70
+ _this.focusTrap = createFocusTrapV2(popup, trapConfig);
71
+ }
66
72
  _this.focusTrap.activate();
67
73
  }));
68
74
  return _this;
@@ -169,6 +169,10 @@ var DropdownMenuWrapper = /*#__PURE__*/function (_PureComponent) {
169
169
  isTriggerNotTabbable: true,
170
170
  handleClickOutside: this.handleClose,
171
171
  handleEscapeKeydown: this.handleCloseAndFocus,
172
+ handleEnterKeydown: function handleEnterKeydown(e) {
173
+ e.preventDefault();
174
+ e.stopPropagation();
175
+ },
172
176
  targetRef: this.state.target
173
177
  }, jsx("div", {
174
178
  style: {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.9.1",
3
+ "version": "74.10.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { FocusTrap } from 'focus-trap';
2
3
  import { Position } from './utils';
3
4
  export interface Props {
4
5
  zIndex?: number;
@@ -69,7 +70,7 @@ export default class Popup extends React.Component<Props, State> {
69
70
  /**
70
71
  * Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
71
72
  */
72
- handleChangedFocusTrapProp(prevProps: Props): void;
73
+ handleChangedFocusTrapProp(prevProps: Props): void | FocusTrap;
73
74
  componentDidUpdate(prevProps: Props): void;
74
75
  componentDidMount(): void;
75
76
  componentWillUnmount(): void;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { FocusTrap } from 'focus-trap';
2
3
  import { Position } from './utils';
3
4
  export interface Props {
4
5
  zIndex?: number;
@@ -72,7 +73,7 @@ export default class Popup extends React.Component<Props, State> {
72
73
  /**
73
74
  * Handle pausing, unpausing, and initialising (if not yet initialised) of the focus trap
74
75
  */
75
- handleChangedFocusTrapProp(prevProps: Props): void;
76
+ handleChangedFocusTrapProp(prevProps: Props): void | FocusTrap;
76
77
  componentDidUpdate(prevProps: Props): void;
77
78
  componentDidMount(): void;
78
79
  componentWillUnmount(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.9.1",
3
+ "version": "74.10.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -92,7 +92,7 @@
92
92
  "@atlaskit/media-client": "^23.1.0",
93
93
  "@atlaskit/media-picker": "^66.1.0",
94
94
  "@atlaskit/mention": "^22.1.0",
95
- "@atlaskit/menu": "^1.7.0",
95
+ "@atlaskit/menu": "^1.8.0",
96
96
  "@atlaskit/platform-feature-flags": "^0.2.0",
97
97
  "@atlaskit/profilecard": "^19.5.0",
98
98
  "@atlaskit/smart-user-picker": "^6.1.0",
@@ -113,7 +113,8 @@
113
113
  "chromatism": "^2.6.0",
114
114
  "classnames": "^2.2.5",
115
115
  "date-fns": "^2.17.0",
116
- "focus-trap": "^2.4.5",
116
+ "focus-trap": "^7.0.0",
117
+ "focus-trap-v2": "npm:focus-trap@^2.4.5",
117
118
  "linkify-it": "^2.0.3",
118
119
  "lodash": "^4.17.21",
119
120
  "markdown-it": "^12.3.2",
@@ -152,6 +153,7 @@
152
153
  "@atlaskit/util-data-test": "^17.8.0",
153
154
  "@atlaskit/visual-regression": "*",
154
155
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
156
+ "@atlassian/feature-flags-test-utils": "*",
155
157
  "@sentry/types": "^6.18.2",
156
158
  "@testing-library/jest-dom": "^5.16.5",
157
159
  "@testing-library/react": "^12.1.5",
@@ -188,6 +190,9 @@
188
190
  },
189
191
  "platform.design-system-team.menu-selected-state-change_0see9": {
190
192
  "type": "boolean"
193
+ },
194
+ "platform.design-system-team.focus-trap-upgrade_p2cei": {
195
+ "type": "boolean"
191
196
  }
192
197
  }
193
198
  }