@atlaskit/editor-common 134.1.2 → 134.1.3

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,13 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 134.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`96fcf7d06fe72`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/96fcf7d06fe72) -
8
+ Fixed `Layer` not calling `onPositioned` when the top layer is on.
9
+ - Updated dependencies
10
+
3
11
  ## 134.1.2
4
12
 
5
13
  ### Patch Changes
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "134.1.1";
30
+ var packageVersion = "134.1.2";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "134.1.1";
26
+ var packageVersion = "134.1.2";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -236,12 +236,23 @@ var popperInteropModifiers = [{
236
236
  enabled: false
237
237
  }];
238
238
  function usePopperInteropModifiers(_ref2) {
239
- var onPositioned = _ref2.onPositioned;
239
+ var isContentShown = _ref2.isContentShown,
240
+ onPositioned = _ref2.onPositioned;
240
241
  var onPositionedRef = (0, _react.useRef)(onPositioned);
241
242
  var hasPositionedRef = (0, _react.useRef)(false);
242
243
  (0, _react.useLayoutEffect)(function () {
243
244
  onPositionedRef.current = onPositioned;
244
245
  }, [onPositioned]);
246
+
247
+ // On the top-layer path `@atlaskit/popper` ignores `modifiers`: CSS Anchor Positioning places
248
+ // the content when it mounts. So report the first position once the content is shown.
249
+ (0, _react.useLayoutEffect)(function () {
250
+ if (!(0, _fg.fg)('platform-dst-top-layer') || !isContentShown || hasPositionedRef.current) {
251
+ return;
252
+ }
253
+ hasPositionedRef.current = true;
254
+ onPositionedRef.current();
255
+ }, [isContentShown]);
245
256
  return (0, _react.useMemo)(function () {
246
257
  return [].concat(popperInteropModifiers, [{
247
258
  name: 'editorLayerFirstPositioned',
@@ -270,7 +281,9 @@ function PopperInterop(_ref3) {
270
281
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
271
282
  referenceElement = _useState2[0],
272
283
  setReferenceElement = _useState2[1];
284
+ var isContentShown = Boolean(content && referenceElement);
273
285
  var modifiers = usePopperInteropModifiers({
286
+ isContentShown: isContentShown,
274
287
  onPositioned: onPositioned
275
288
  });
276
289
  // Popper v2 compares the offset prop by reference, so memoise to avoid re-running positioning every render.
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "134.1.1";
16
+ const packageVersion = "134.1.2";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "134.1.1";
16
+ const packageVersion = "134.1.2";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -206,6 +206,7 @@ const popperInteropModifiers = [{
206
206
  enabled: false
207
207
  }];
208
208
  function usePopperInteropModifiers({
209
+ isContentShown,
209
210
  onPositioned
210
211
  }) {
211
212
  const onPositionedRef = useRef(onPositioned);
@@ -213,6 +214,16 @@ function usePopperInteropModifiers({
213
214
  useLayoutEffect(() => {
214
215
  onPositionedRef.current = onPositioned;
215
216
  }, [onPositioned]);
217
+
218
+ // On the top-layer path `@atlaskit/popper` ignores `modifiers`: CSS Anchor Positioning places
219
+ // the content when it mounts. So report the first position once the content is shown.
220
+ useLayoutEffect(() => {
221
+ if (!fg('platform-dst-top-layer') || !isContentShown || hasPositionedRef.current) {
222
+ return;
223
+ }
224
+ hasPositionedRef.current = true;
225
+ onPositionedRef.current();
226
+ }, [isContentShown]);
216
227
  return useMemo(() => [...popperInteropModifiers, {
217
228
  name: 'editorLayerFirstPositioned',
218
229
  enabled: true,
@@ -237,7 +248,9 @@ function PopperInterop({
237
248
  }) {
238
249
  const targetRef = useRef(null);
239
250
  const [referenceElement, setReferenceElement] = useState(null);
251
+ const isContentShown = Boolean(content && referenceElement);
240
252
  const modifiers = usePopperInteropModifiers({
253
+ isContentShown,
241
254
  onPositioned
242
255
  });
243
256
  // Popper v2 compares the offset prop by reference, so memoise to avoid re-running positioning every render.
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
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 = "134.1.1";
22
+ var packageVersion = "134.1.2";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "134.1.1";
23
+ var packageVersion = "134.1.2";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -228,12 +228,23 @@ var popperInteropModifiers = [{
228
228
  enabled: false
229
229
  }];
230
230
  function usePopperInteropModifiers(_ref2) {
231
- var onPositioned = _ref2.onPositioned;
231
+ var isContentShown = _ref2.isContentShown,
232
+ onPositioned = _ref2.onPositioned;
232
233
  var onPositionedRef = useRef(onPositioned);
233
234
  var hasPositionedRef = useRef(false);
234
235
  useLayoutEffect(function () {
235
236
  onPositionedRef.current = onPositioned;
236
237
  }, [onPositioned]);
238
+
239
+ // On the top-layer path `@atlaskit/popper` ignores `modifiers`: CSS Anchor Positioning places
240
+ // the content when it mounts. So report the first position once the content is shown.
241
+ useLayoutEffect(function () {
242
+ if (!fg('platform-dst-top-layer') || !isContentShown || hasPositionedRef.current) {
243
+ return;
244
+ }
245
+ hasPositionedRef.current = true;
246
+ onPositionedRef.current();
247
+ }, [isContentShown]);
237
248
  return useMemo(function () {
238
249
  return [].concat(popperInteropModifiers, [{
239
250
  name: 'editorLayerFirstPositioned',
@@ -262,7 +273,9 @@ function PopperInterop(_ref3) {
262
273
  _useState2 = _slicedToArray(_useState, 2),
263
274
  referenceElement = _useState2[0],
264
275
  setReferenceElement = _useState2[1];
276
+ var isContentShown = Boolean(content && referenceElement);
265
277
  var modifiers = usePopperInteropModifiers({
278
+ isContentShown: isContentShown,
266
279
  onPositioned: onPositioned
267
280
  });
268
281
  // Popper v2 compares the offset prop by reference, so memoise to avoid re-running positioning every render.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "134.1.2",
3
+ "version": "134.1.3",
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/"
@@ -180,6 +180,9 @@
180
180
  "type": "boolean",
181
181
  "referenceOnly": true
182
182
  },
183
+ "platform-dst-top-layer": {
184
+ "type": "boolean"
185
+ },
183
186
  "platform-dst-tokens-finesse": {
184
187
  "type": "boolean",
185
188
  "referenceOnly": true