@atlaskit/editor-common 112.3.0 → 112.3.2

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,21 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 112.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`644dd3e13dd7b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/644dd3e13dd7b) -
8
+ Add analytics for remix button block click
9
+ - Updated dependencies
10
+
11
+ ## 112.3.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [`2b33e02e33a67`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2b33e02e33a67) -
16
+ [ux] [EDITOR-5880] paste menu position fix so it sticks on screen when pasting large content
17
+ - Updated dependencies
18
+
3
19
  ## 112.3.0
4
20
 
5
21
  ### Minor Changes
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "112.2.3";
22
+ var packageVersion = "0.0.0-development";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "112.2.3";
27
+ var packageVersion = "0.0.0-development";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -88,6 +88,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
88
88
  fitHeight = props.fitHeight,
89
89
  fitWidth = props.fitWidth,
90
90
  boundariesElement = props.boundariesElement,
91
+ minPopupMargin = props.minPopupMargin,
91
92
  offset = props.offset,
92
93
  onPositionCalculated = props.onPositionCalculated,
93
94
  onPlacementChanged = props.onPlacementChanged,
@@ -117,7 +118,8 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
117
118
  offset: offset,
118
119
  allowOutOfBounds: allowOutOfBounds,
119
120
  rect: rect,
120
- boundariesElement: (0, _platformFeatureFlags.fg)('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined
121
+ boundariesElement: (0, _platformFeatureFlags.fg)('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined,
122
+ minPopupMargin: minPopupMargin
121
123
  });
122
124
  position = onPositionCalculated ? onPositionCalculated(position) : position;
123
125
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -106,7 +106,8 @@ var calculateHorizontalPlacement = function calculateHorizontalPlacement(_ref) {
106
106
  popupClientWidth = _ref.popupClientWidth,
107
107
  offset = _ref.offset,
108
108
  _ref$allowOutOfBounds = _ref.allowOutOfBounds,
109
- allowOutOfBounds = _ref$allowOutOfBounds === void 0 ? false : _ref$allowOutOfBounds;
109
+ allowOutOfBounds = _ref$allowOutOfBounds === void 0 ? false : _ref$allowOutOfBounds,
110
+ minPopupMargin = _ref.minPopupMargin;
110
111
  var position = {};
111
112
  if (placement === 'left') {
112
113
  position.left = Math.ceil(targetLeft - popupOffsetParentLeft + (isPopupParentBody ? 0 : popupOffsetParentScrollLeft) + offset[0]);
@@ -120,23 +121,22 @@ var calculateHorizontalPlacement = function calculateHorizontalPlacement(_ref) {
120
121
  }
121
122
  if (!allowOutOfBounds) {
122
123
  if (position.left !== undefined) {
123
- position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth);
124
+ position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
124
125
  }
125
126
  if (position.right !== undefined) {
126
- position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth);
127
+ position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
127
128
  }
128
129
  }
129
130
  return position;
130
131
  };
131
132
  var getPopupXInsideParent = function getPopupXInsideParent(x, popupClientWidth, popupOffsetParentClientWidth) {
132
- // minimum distance the popup can be from the edge of its parent
133
- var minPopupMargin = 1;
133
+ var minMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
134
134
  // prevent going too far right
135
135
  if (popupOffsetParentClientWidth < x + popupClientWidth) {
136
- x = popupOffsetParentClientWidth - popupClientWidth - minPopupMargin;
136
+ x = popupOffsetParentClientWidth - popupClientWidth - minMargin;
137
137
  }
138
138
  // prevent going too far left
139
- return Math.max(minPopupMargin, x);
139
+ return Math.max(minMargin, x);
140
140
  };
141
141
  var calculateVerticalStickBottom = function calculateVerticalStickBottom(_ref2) {
142
142
  var target = _ref2.target,
@@ -232,7 +232,8 @@ function calculatePosition(_ref5) {
232
232
  _ref5$allowOutOfBound = _ref5.allowOutOfBounds,
233
233
  allowOutOfBounds = _ref5$allowOutOfBound === void 0 ? false : _ref5$allowOutOfBound,
234
234
  rect = _ref5.rect,
235
- boundariesElement = _ref5.boundariesElement;
235
+ boundariesElement = _ref5.boundariesElement,
236
+ minPopupMargin = _ref5.minPopupMargin;
236
237
  var position = {};
237
238
  if (!target || !popup || !popup.offsetParent) {
238
239
  return position;
@@ -320,7 +321,8 @@ function calculatePosition(_ref5) {
320
321
  popupOffsetParentClientWidth: popup.offsetParent.clientWidth,
321
322
  popupClientWidth: popup.clientWidth || 0,
322
323
  offset: offset,
323
- allowOutOfBounds: allowOutOfBounds
324
+ allowOutOfBounds: allowOutOfBounds,
325
+ minPopupMargin: minPopupMargin
324
326
  });
325
327
  position = _objectSpread(_objectSpread({}, position), horizontalPosition);
326
328
  return position;
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "112.2.3";
7
+ const packageVersion = "0.0.0-development";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "112.2.3";
17
+ const packageVersion = "0.0.0-development";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -64,6 +64,7 @@ export default class Popup extends React.Component {
64
64
  fitHeight,
65
65
  fitWidth,
66
66
  boundariesElement,
67
+ minPopupMargin,
67
68
  offset,
68
69
  onPositionCalculated,
69
70
  onPlacementChanged,
@@ -94,7 +95,8 @@ export default class Popup extends React.Component {
94
95
  offset: offset,
95
96
  allowOutOfBounds,
96
97
  rect,
97
- boundariesElement: fg('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined
98
+ boundariesElement: fg('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined,
99
+ minPopupMargin
98
100
  });
99
101
  position = onPositionCalculated ? onPositionCalculated(position) : position;
100
102
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -92,7 +92,8 @@ const calculateHorizontalPlacement = ({
92
92
  popupOffsetParentClientWidth,
93
93
  popupClientWidth,
94
94
  offset,
95
- allowOutOfBounds = false
95
+ allowOutOfBounds = false,
96
+ minPopupMargin
96
97
  }) => {
97
98
  const position = {};
98
99
  if (placement === 'left') {
@@ -107,23 +108,21 @@ const calculateHorizontalPlacement = ({
107
108
  }
108
109
  if (!allowOutOfBounds) {
109
110
  if (position.left !== undefined) {
110
- position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth);
111
+ position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
111
112
  }
112
113
  if (position.right !== undefined) {
113
- position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth);
114
+ position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
114
115
  }
115
116
  }
116
117
  return position;
117
118
  };
118
- const getPopupXInsideParent = (x, popupClientWidth, popupOffsetParentClientWidth) => {
119
- // minimum distance the popup can be from the edge of its parent
120
- const minPopupMargin = 1;
119
+ const getPopupXInsideParent = (x, popupClientWidth, popupOffsetParentClientWidth, minMargin = 1) => {
121
120
  // prevent going too far right
122
121
  if (popupOffsetParentClientWidth < x + popupClientWidth) {
123
- x = popupOffsetParentClientWidth - popupClientWidth - minPopupMargin;
122
+ x = popupOffsetParentClientWidth - popupClientWidth - minMargin;
124
123
  }
125
124
  // prevent going too far left
126
- return Math.max(minPopupMargin, x);
125
+ return Math.max(minMargin, x);
127
126
  };
128
127
  const calculateVerticalStickBottom = ({
129
128
  target,
@@ -226,7 +225,8 @@ export function calculatePosition({
226
225
  stick,
227
226
  allowOutOfBounds = false,
228
227
  rect,
229
- boundariesElement
228
+ boundariesElement,
229
+ minPopupMargin
230
230
  }) {
231
231
  let position = {};
232
232
  if (!target || !popup || !popup.offsetParent) {
@@ -318,7 +318,8 @@ export function calculatePosition({
318
318
  popupOffsetParentClientWidth: popup.offsetParent.clientWidth,
319
319
  popupClientWidth: popup.clientWidth || 0,
320
320
  offset,
321
- allowOutOfBounds
321
+ allowOutOfBounds,
322
+ minPopupMargin
322
323
  });
323
324
  position = {
324
325
  ...position,
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "112.2.3";
13
+ var packageVersion = "0.0.0-development";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "112.2.3";
24
+ var packageVersion = "0.0.0-development";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -81,6 +81,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
81
81
  fitHeight = props.fitHeight,
82
82
  fitWidth = props.fitWidth,
83
83
  boundariesElement = props.boundariesElement,
84
+ minPopupMargin = props.minPopupMargin,
84
85
  offset = props.offset,
85
86
  onPositionCalculated = props.onPositionCalculated,
86
87
  onPlacementChanged = props.onPlacementChanged,
@@ -110,7 +111,8 @@ var Popup = /*#__PURE__*/function (_React$Component) {
110
111
  offset: offset,
111
112
  allowOutOfBounds: allowOutOfBounds,
112
113
  rect: rect,
113
- boundariesElement: fg('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined
114
+ boundariesElement: fg('platform_editor_link_popup_position_fix_aifc') ? boundariesElement || document.body : undefined,
115
+ minPopupMargin: minPopupMargin
114
116
  });
115
117
  position = onPositionCalculated ? onPositionCalculated(position) : position;
116
118
  if (typeof position.top !== 'undefined' && absoluteOffset !== null && absoluteOffset !== void 0 && absoluteOffset.top) {
@@ -92,7 +92,8 @@ var calculateHorizontalPlacement = function calculateHorizontalPlacement(_ref) {
92
92
  popupClientWidth = _ref.popupClientWidth,
93
93
  offset = _ref.offset,
94
94
  _ref$allowOutOfBounds = _ref.allowOutOfBounds,
95
- allowOutOfBounds = _ref$allowOutOfBounds === void 0 ? false : _ref$allowOutOfBounds;
95
+ allowOutOfBounds = _ref$allowOutOfBounds === void 0 ? false : _ref$allowOutOfBounds,
96
+ minPopupMargin = _ref.minPopupMargin;
96
97
  var position = {};
97
98
  if (placement === 'left') {
98
99
  position.left = Math.ceil(targetLeft - popupOffsetParentLeft + (isPopupParentBody ? 0 : popupOffsetParentScrollLeft) + offset[0]);
@@ -106,23 +107,22 @@ var calculateHorizontalPlacement = function calculateHorizontalPlacement(_ref) {
106
107
  }
107
108
  if (!allowOutOfBounds) {
108
109
  if (position.left !== undefined) {
109
- position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth);
110
+ position.left = getPopupXInsideParent(position.left, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
110
111
  }
111
112
  if (position.right !== undefined) {
112
- position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth);
113
+ position.right = getPopupXInsideParent(position.right, popupClientWidth, popupOffsetParentClientWidth, minPopupMargin);
113
114
  }
114
115
  }
115
116
  return position;
116
117
  };
117
118
  var getPopupXInsideParent = function getPopupXInsideParent(x, popupClientWidth, popupOffsetParentClientWidth) {
118
- // minimum distance the popup can be from the edge of its parent
119
- var minPopupMargin = 1;
119
+ var minMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
120
120
  // prevent going too far right
121
121
  if (popupOffsetParentClientWidth < x + popupClientWidth) {
122
- x = popupOffsetParentClientWidth - popupClientWidth - minPopupMargin;
122
+ x = popupOffsetParentClientWidth - popupClientWidth - minMargin;
123
123
  }
124
124
  // prevent going too far left
125
- return Math.max(minPopupMargin, x);
125
+ return Math.max(minMargin, x);
126
126
  };
127
127
  var calculateVerticalStickBottom = function calculateVerticalStickBottom(_ref2) {
128
128
  var target = _ref2.target,
@@ -218,7 +218,8 @@ export function calculatePosition(_ref5) {
218
218
  _ref5$allowOutOfBound = _ref5.allowOutOfBounds,
219
219
  allowOutOfBounds = _ref5$allowOutOfBound === void 0 ? false : _ref5$allowOutOfBound,
220
220
  rect = _ref5.rect,
221
- boundariesElement = _ref5.boundariesElement;
221
+ boundariesElement = _ref5.boundariesElement,
222
+ minPopupMargin = _ref5.minPopupMargin;
222
223
  var position = {};
223
224
  if (!target || !popup || !popup.offsetParent) {
224
225
  return position;
@@ -306,7 +307,8 @@ export function calculatePosition(_ref5) {
306
307
  popupOffsetParentClientWidth: popup.offsetParent.clientWidth,
307
308
  popupClientWidth: popup.clientWidth || 0,
308
309
  offset: offset,
309
- allowOutOfBounds: allowOutOfBounds
310
+ allowOutOfBounds: allowOutOfBounds,
311
+ minPopupMargin: minPopupMargin
310
312
  });
311
313
  position = _objectSpread(_objectSpread({}, position), horizontalPosition);
312
314
  return position;
@@ -15,6 +15,7 @@ export interface Props {
15
15
  /** Enable focus trap to contain the user's focus within the popup */
16
16
  focusTrap?: boolean | FocusTrapOptions;
17
17
  forcePlacement?: boolean;
18
+ minPopupMargin?: number;
18
19
  mountTo?: HTMLElement;
19
20
  offset?: number[];
20
21
  onPlacementChanged?: (placement: [string, string]) => void;
@@ -7,6 +7,7 @@ export interface Position {
7
7
  export interface CalculatePositionParams {
8
8
  allowOutOfBounds?: boolean;
9
9
  boundariesElement?: HTMLElement;
10
+ minPopupMargin?: number;
10
11
  offset: number[];
11
12
  placement: [string, string];
12
13
  popup?: HTMLElement;
@@ -29,7 +30,7 @@ export declare function calculatePlacement(target: HTMLElement, boundariesElemen
29
30
  * Calculates relative coordinates for placing popup along with the target.
30
31
  * Uses placement from calculatePlacement.
31
32
  */
32
- export declare function calculatePosition({ placement, target, popup, offset, stick, allowOutOfBounds, rect, boundariesElement, }: CalculatePositionParams): Position;
33
+ export declare function calculatePosition({ placement, target, popup, offset, stick, allowOutOfBounds, rect, boundariesElement, minPopupMargin, }: CalculatePositionParams): Position;
33
34
  export declare function validatePosition(popup: HTMLElement): boolean;
34
35
  /**
35
36
  * Traverse DOM Tree upwards looking for popup parents with "overflow: scroll".
@@ -15,6 +15,7 @@ export interface Props {
15
15
  /** Enable focus trap to contain the user's focus within the popup */
16
16
  focusTrap?: boolean | FocusTrapOptions;
17
17
  forcePlacement?: boolean;
18
+ minPopupMargin?: number;
18
19
  mountTo?: HTMLElement;
19
20
  offset?: number[];
20
21
  onPlacementChanged?: (placement: [
@@ -7,6 +7,7 @@ export interface Position {
7
7
  export interface CalculatePositionParams {
8
8
  allowOutOfBounds?: boolean;
9
9
  boundariesElement?: HTMLElement;
10
+ minPopupMargin?: number;
10
11
  offset: number[];
11
12
  placement: [
12
13
  string,
@@ -35,7 +36,7 @@ export declare function calculatePlacement(target: HTMLElement, boundariesElemen
35
36
  * Calculates relative coordinates for placing popup along with the target.
36
37
  * Uses placement from calculatePlacement.
37
38
  */
38
- export declare function calculatePosition({ placement, target, popup, offset, stick, allowOutOfBounds, rect, boundariesElement, }: CalculatePositionParams): Position;
39
+ export declare function calculatePosition({ placement, target, popup, offset, stick, allowOutOfBounds, rect, boundariesElement, minPopupMargin, }: CalculatePositionParams): Position;
39
40
  export declare function validatePosition(popup: HTMLElement): boolean;
40
41
  /**
41
42
  * Traverse DOM Tree upwards looking for popup parents with "overflow: scroll".
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "112.3.0",
3
+ "version": "112.3.2",
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/"
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@atlaskit/activity-provider": "^2.5.0",
33
- "@atlaskit/adf-schema": "^52.2.0",
33
+ "@atlaskit/adf-schema": "^52.3.0",
34
34
  "@atlaskit/adf-utils": "^19.27.0",
35
35
  "@atlaskit/afm-i18n-platform-editor-editor-common": "2.18.0",
36
36
  "@atlaskit/analytics-listeners": "^10.0.0",
@@ -82,7 +82,7 @@
82
82
  "@atlaskit/task-decision": "^19.3.0",
83
83
  "@atlaskit/textfield": "^8.2.0",
84
84
  "@atlaskit/theme": "^22.0.0",
85
- "@atlaskit/tmp-editor-statsig": "^38.1.0",
85
+ "@atlaskit/tmp-editor-statsig": "^39.0.0",
86
86
  "@atlaskit/tokens": "^11.1.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",