@atlaskit/editor-common 112.2.3 → 112.3.1

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,25 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 112.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2b33e02e33a67`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2b33e02e33a67) -
8
+ [ux] [EDITOR-5880] paste menu position fix so it sticks on screen when pasting large content
9
+ - Updated dependencies
10
+
11
+ ## 112.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`71fb8b5aa2558`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71fb8b5aa2558) -
16
+ [FFCLEANUP-79003] clean up feature flag platform_editor_blocktaskitem_patch_2
17
+
18
+ ### Patch Changes
19
+
20
+ - [`e8c15530a001b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e8c15530a001b) -
21
+ NO-ISSUE Updated menu labelling for on-paste actions menu
22
+
3
23
  ## 112.2.3
4
24
 
5
25
  ### Patch Changes
@@ -43,7 +43,7 @@ var pasteOptionsToolbarMessages = exports.pasteOptionsToolbarMessages = (0, _rea
43
43
  },
44
44
  pasteMenuActionsTitle: {
45
45
  id: 'fabric.editor.pasteMenuActionsTitle',
46
- defaultMessage: 'Actions',
46
+ defaultMessage: 'Paste actions',
47
47
  description: 'Section title for actions in the paste options menu'
48
48
  }
49
49
  });
@@ -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 = "0.0.0-development";
22
+ var packageVersion = "112.3.0";
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 = "0.0.0-development";
27
+ var packageVersion = "112.3.0";
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;
@@ -285,7 +285,7 @@ var isEmptySelectionAtStart = exports.isEmptySelectionAtStart = function isEmpty
285
285
 
286
286
  // If blockTaskItem is in the schema,
287
287
  // we need to check if the selection is inside a blockTaskItem
288
- if (blockTaskItem && empty && (0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_2')) {
288
+ if (blockTaskItem && empty) {
289
289
  // If the parent is in a textblock,
290
290
  // check if it's nested inside a blockTaskItem
291
291
  if ($from.parent.isTextblock) {
@@ -309,17 +309,8 @@ var isEmptySelectionAtStart = exports.isEmptySelectionAtStart = function isEmpty
309
309
  // Else, check if the parent is a blockTaskItem
310
310
  else if ($from.parent.type === blockTaskItem) {
311
311
  // Check if the selection is at the start of the blockTaskItem
312
- var firstPosInBlockTaskItem = 0;
313
- if ((0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_2')) {
314
- var blockTaskItemDepth = $from.depth;
315
-
316
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
317
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
318
- } else {
319
- var _blockTaskItemDepth = $from.depth - 1;
320
- var DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
321
- firstPosInBlockTaskItem = $from.start(_blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
322
- }
312
+ var blockTaskItemDepth = $from.depth;
313
+ var firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
323
314
 
324
315
  // Is the selection at the first possible position inside the blockTaskItem
325
316
  return $from.pos === firstPosInBlockTaskItem;
@@ -37,7 +37,7 @@ export const pasteOptionsToolbarMessages = defineMessages({
37
37
  },
38
38
  pasteMenuActionsTitle: {
39
39
  id: 'fabric.editor.pasteMenuActionsTitle',
40
- defaultMessage: 'Actions',
40
+ defaultMessage: 'Paste actions',
41
41
  description: 'Section title for actions in the paste options menu'
42
42
  }
43
43
  });
@@ -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 = "0.0.0-development";
7
+ const packageVersion = "112.3.0";
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 = "0.0.0-development";
17
+ const packageVersion = "112.3.0";
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,
@@ -288,7 +288,7 @@ export const isEmptySelectionAtStart = state => {
288
288
 
289
289
  // If blockTaskItem is in the schema,
290
290
  // we need to check if the selection is inside a blockTaskItem
291
- if (blockTaskItem && empty && fg('platform_editor_blocktaskitem_patch_2')) {
291
+ if (blockTaskItem && empty) {
292
292
  // If the parent is in a textblock,
293
293
  // check if it's nested inside a blockTaskItem
294
294
  if ($from.parent.isTextblock) {
@@ -312,17 +312,8 @@ export const isEmptySelectionAtStart = state => {
312
312
  // Else, check if the parent is a blockTaskItem
313
313
  else if ($from.parent.type === blockTaskItem) {
314
314
  // Check if the selection is at the start of the blockTaskItem
315
- let firstPosInBlockTaskItem = 0;
316
- if (fg('platform_editor_blocktaskitem_patch_2')) {
317
- const blockTaskItemDepth = $from.depth;
318
-
319
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
320
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
321
- } else {
322
- const blockTaskItemDepth = $from.depth - 1;
323
- const DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
324
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
325
- }
315
+ const blockTaskItemDepth = $from.depth;
316
+ const firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
326
317
 
327
318
  // Is the selection at the first possible position inside the blockTaskItem
328
319
  return $from.pos === firstPosInBlockTaskItem;
@@ -37,7 +37,7 @@ export var pasteOptionsToolbarMessages = defineMessages({
37
37
  },
38
38
  pasteMenuActionsTitle: {
39
39
  id: 'fabric.editor.pasteMenuActionsTitle',
40
- defaultMessage: 'Actions',
40
+ defaultMessage: 'Paste actions',
41
41
  description: 'Section title for actions in the paste options menu'
42
42
  }
43
43
  });
@@ -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 = "0.0.0-development";
13
+ var packageVersion = "112.3.0";
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 = "0.0.0-development";
24
+ var packageVersion = "112.3.0";
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;
@@ -272,7 +272,7 @@ export var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
272
272
 
273
273
  // If blockTaskItem is in the schema,
274
274
  // we need to check if the selection is inside a blockTaskItem
275
- if (blockTaskItem && empty && fg('platform_editor_blocktaskitem_patch_2')) {
275
+ if (blockTaskItem && empty) {
276
276
  // If the parent is in a textblock,
277
277
  // check if it's nested inside a blockTaskItem
278
278
  if ($from.parent.isTextblock) {
@@ -296,17 +296,8 @@ export var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
296
296
  // Else, check if the parent is a blockTaskItem
297
297
  else if ($from.parent.type === blockTaskItem) {
298
298
  // Check if the selection is at the start of the blockTaskItem
299
- var firstPosInBlockTaskItem = 0;
300
- if (fg('platform_editor_blocktaskitem_patch_2')) {
301
- var blockTaskItemDepth = $from.depth;
302
-
303
- // When cleaning up platform_editor_blocktaskitem_patch_2, set firstPosInBlockTaskItem as const
304
- firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
305
- } else {
306
- var _blockTaskItemDepth = $from.depth - 1;
307
- var DISTANCE_FROM_PARENT_FOR_GAP_CURSOR = 1;
308
- firstPosInBlockTaskItem = $from.start(_blockTaskItemDepth) + DISTANCE_FROM_PARENT_FOR_GAP_CURSOR;
309
- }
299
+ var blockTaskItemDepth = $from.depth;
300
+ var firstPosInBlockTaskItem = $from.start(blockTaskItemDepth);
310
301
 
311
302
  // Is the selection at the first possible position inside the blockTaskItem
312
303
  return $from.pos === firstPosInBlockTaskItem;
@@ -2,7 +2,7 @@ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, buildLayoutDropdown, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';
5
- export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, } from './types';
5
+ export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, EmbedCardTransformAttrs, EmbedCardNodeTransformer, EmbedCardTransformCommandOptions, CreateEmbedCardTransformCommand, EmbedCardTransformers, } from './types';
6
6
  export { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
7
7
  export { appearancePropsMap, getButtonGroupOption } from './link-toolbar-button-group-options';
8
8
  export { getDropdownOption } from './link-toolbar-dropdown-options';
@@ -1,6 +1,6 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { ACTION, EditorAnalyticsAPI, INPUT_METHOD } from '../analytics';
6
6
  import { type CardAppearance, type CardProvider } from '../provider-factory';
@@ -26,10 +26,52 @@ export type GetStartingToolbarItems = (intl: IntlShape, link: string, onEditLink
26
26
  url: string;
27
27
  }, state?: EditorState) => FloatingToolbarItem<Command>[];
28
28
  export type GetEndingToolbarItems = (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
29
+ /**
30
+ * Attributes passed to an embed card node transformer.
31
+ * Contains the URL and layout information needed to transform
32
+ * an embedCard into an alternative node representation.
33
+ */
34
+ export type EmbedCardTransformAttrs = {
35
+ layout?: string;
36
+ originalHeight?: number | null;
37
+ originalWidth?: number | null;
38
+ url: string;
39
+ width?: number;
40
+ };
41
+ /**
42
+ * A generic transformer function that converts embed card attributes into
43
+ * an alternative ProseMirror Node (e.g. a native embed extension node).
44
+ *
45
+ * Returns undefined if the URL is not supported or transformation is not possible.
46
+ */
47
+ export type EmbedCardNodeTransformer = (schema: Schema, attrs: EmbedCardTransformAttrs) => Node | undefined;
48
+ /**
49
+ * Options for creating a transform command that replaces a selected card node
50
+ * with an alternative node representation.
51
+ */
52
+ export type EmbedCardTransformCommandOptions = {
53
+ /**
54
+ * Callback to augment the transaction with additional concerns
55
+ * (e.g. analytics events, datasource stash updates, link metadata).
56
+ */
57
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
58
+ };
59
+ /**
60
+ * A factory function that creates a Command to replace the currently selected
61
+ * card node with an alternative node representation (e.g. a native embed).
62
+ *
63
+ * The returned command should return false if transformation is not possible.
64
+ */
65
+ export type CreateEmbedCardTransformCommand = (options?: EmbedCardTransformCommandOptions) => Command;
66
+ export interface EmbedCardTransformers {
67
+ createEmbedCardTransformCommand: CreateEmbedCardTransformCommand;
68
+ embedCardNodeTransformer: EmbedCardNodeTransformer;
69
+ }
29
70
  export type CardPluginActions = {
30
71
  getEndingToolbarItems: GetEndingToolbarItems;
31
72
  getStartingToolbarItems: GetStartingToolbarItems;
32
73
  hideLinkToolbar: HideLinkToolbarAction;
33
74
  queueCardsFromChangedTr: QueueCardsFromTransactionAction;
75
+ registerEmbedCardTransformer: (transformers: EmbedCardTransformers) => void;
34
76
  setProvider: (provider: Promise<CardProvider>) => Promise<boolean>;
35
77
  };
@@ -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".
@@ -2,7 +2,7 @@ export type { CardOptions, OnClickCallback } from './cardOptions';
2
2
  export { addLinkMetadata, getLinkMetadataFromTransaction, commandWithMetadata } from './utils';
3
3
  export { default as buildLayoutButtons, alignmentIcons, wrappingIcons, layoutToMessages, buildLayoutDropdown, } from './MediaAndEmbedsToolbar';
4
4
  export type { IconMap, LayoutIcon } from './MediaAndEmbedsToolbar';
5
- export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, } from './types';
5
+ export type { OptionConfig, CardPluginActions, QueueCardsFromTransactionAction, HideLinkToolbarAction, ChangeSelectedCardToLink, SetSelectedCardAppearance, CardReplacementInputMethod, EmbedCardTransformAttrs, EmbedCardNodeTransformer, EmbedCardTransformCommandOptions, CreateEmbedCardTransformCommand, EmbedCardTransformers, } from './types';
6
6
  export { LinkToolbarButtonGroup } from './LinkToolbarButtonGroup';
7
7
  export { appearancePropsMap, getButtonGroupOption } from './link-toolbar-button-group-options';
8
8
  export { getDropdownOption } from './link-toolbar-dropdown-options';
@@ -1,6 +1,6 @@
1
1
  import { type IntlShape } from 'react-intl-next';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- import type { Node } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
5
  import type { ACTION, EditorAnalyticsAPI, INPUT_METHOD } from '../analytics';
6
6
  import { type CardAppearance, type CardProvider } from '../provider-factory';
@@ -26,10 +26,52 @@ export type GetStartingToolbarItems = (intl: IntlShape, link: string, onEditLink
26
26
  url: string;
27
27
  }, state?: EditorState) => FloatingToolbarItem<Command>[];
28
28
  export type GetEndingToolbarItems = (intl: IntlShape, link: string) => FloatingToolbarItem<Command>[];
29
+ /**
30
+ * Attributes passed to an embed card node transformer.
31
+ * Contains the URL and layout information needed to transform
32
+ * an embedCard into an alternative node representation.
33
+ */
34
+ export type EmbedCardTransformAttrs = {
35
+ layout?: string;
36
+ originalHeight?: number | null;
37
+ originalWidth?: number | null;
38
+ url: string;
39
+ width?: number;
40
+ };
41
+ /**
42
+ * A generic transformer function that converts embed card attributes into
43
+ * an alternative ProseMirror Node (e.g. a native embed extension node).
44
+ *
45
+ * Returns undefined if the URL is not supported or transformation is not possible.
46
+ */
47
+ export type EmbedCardNodeTransformer = (schema: Schema, attrs: EmbedCardTransformAttrs) => Node | undefined;
48
+ /**
49
+ * Options for creating a transform command that replaces a selected card node
50
+ * with an alternative node representation.
51
+ */
52
+ export type EmbedCardTransformCommandOptions = {
53
+ /**
54
+ * Callback to augment the transaction with additional concerns
55
+ * (e.g. analytics events, datasource stash updates, link metadata).
56
+ */
57
+ augmentTransaction?: (tr: Transaction, state: EditorState) => void;
58
+ };
59
+ /**
60
+ * A factory function that creates a Command to replace the currently selected
61
+ * card node with an alternative node representation (e.g. a native embed).
62
+ *
63
+ * The returned command should return false if transformation is not possible.
64
+ */
65
+ export type CreateEmbedCardTransformCommand = (options?: EmbedCardTransformCommandOptions) => Command;
66
+ export interface EmbedCardTransformers {
67
+ createEmbedCardTransformCommand: CreateEmbedCardTransformCommand;
68
+ embedCardNodeTransformer: EmbedCardNodeTransformer;
69
+ }
29
70
  export type CardPluginActions = {
30
71
  getEndingToolbarItems: GetEndingToolbarItems;
31
72
  getStartingToolbarItems: GetStartingToolbarItems;
32
73
  hideLinkToolbar: HideLinkToolbarAction;
33
74
  queueCardsFromChangedTr: QueueCardsFromTransactionAction;
75
+ registerEmbedCardTransformer: (transformers: EmbedCardTransformers) => void;
34
76
  setProvider: (provider: Promise<CardProvider>) => Promise<boolean>;
35
77
  };
@@ -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.2.3",
3
+ "version": "112.3.1",
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",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/codemod-utils": "^4.2.0",
43
43
  "@atlaskit/css": "^0.19.0",
44
44
  "@atlaskit/custom-steps": "^0.16.0",
45
- "@atlaskit/dropdown-menu": "^16.6.0",
45
+ "@atlaskit/dropdown-menu": "^16.7.0",
46
46
  "@atlaskit/editor-json-transformer": "^8.31.0",
47
47
  "@atlaskit/editor-palette": "^2.1.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
@@ -51,7 +51,7 @@
51
51
  "@atlaskit/editor-toolbar": "^0.19.0",
52
52
  "@atlaskit/editor-toolbar-model": "^0.4.0",
53
53
  "@atlaskit/emoji": "^69.10.0",
54
- "@atlaskit/icon": "^32.0.0",
54
+ "@atlaskit/icon": "^32.1.0",
55
55
  "@atlaskit/icon-object": "^7.4.0",
56
56
  "@atlaskit/link": "^3.3.0",
57
57
  "@atlaskit/link-datasource": "^4.34.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.0.0",
85
+ "@atlaskit/tmp-editor-statsig": "^38.1.0",
86
86
  "@atlaskit/tokens": "^11.1.0",
87
87
  "@atlaskit/tooltip": "^20.14.0",
88
88
  "@atlaskit/width-detector": "^5.0.0",
@@ -172,9 +172,6 @@
172
172
  "platform_editor_typography_ugc": {
173
173
  "type": "boolean"
174
174
  },
175
- "platform_editor_blocktaskitem_patch_2": {
176
- "type": "boolean"
177
- },
178
175
  "platform_editor_blocktaskitem_patch_3": {
179
176
  "type": "boolean"
180
177
  },