@atlaskit/editor-common 96.5.7 → 96.6.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,26 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 96.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#180750](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/180750)
8
+ [`f019b16b9161a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f019b16b9161a) -
9
+ [ux] Introduces access to the ExtensionAPI from extension module quickInsert actions
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 96.5.8
16
+
17
+ ### Patch Changes
18
+
19
+ - [#179714](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/179714)
20
+ [`7216b07b8cbe7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7216b07b8cbe7) -
21
+ [ux] ED-26058 Support dyanmic visibility of media badges based on media size
22
+ - Updated dependencies
23
+
3
24
  ## 96.5.7
4
25
 
5
26
  ### Patch Changes
@@ -9,9 +9,11 @@ exports.MediaBadges = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _debounce = _interopRequireDefault(require("lodash/debounce"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _primitives = require("@atlaskit/primitives");
13
14
  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); }
14
15
  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; }
16
+ var MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
15
17
  var containerStyles = (0, _primitives.xcss)({
16
18
  display: 'flex',
17
19
  position: 'absolute',
@@ -43,6 +45,12 @@ var getBadgeSize = function getBadgeSize(width, height) {
43
45
  // width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
44
46
  return width && width < 70 || height && height < 70 ? 'small' : 'medium';
45
47
  };
48
+ var getBadgeVisible = function getBadgeVisible(width, height) {
49
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_support_media_badge_visibility')) {
50
+ return true;
51
+ }
52
+ return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
53
+ };
46
54
  var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
47
55
  var children = _ref.children,
48
56
  mediaElement = _ref.mediaElement,
@@ -55,6 +63,10 @@ var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
55
63
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
56
64
  badgeSize = _useState2[0],
57
65
  setBadgeSize = _useState2[1];
66
+ var _useState3 = (0, _react.useState)(getBadgeVisible(mediaWidth, mediaHeight)),
67
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
68
+ visible = _useState4[0],
69
+ setVisible = _useState4[1];
58
70
  (0, _react.useEffect)(function () {
59
71
  var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
60
72
  var _entries = (0, _slicedToArray2.default)(entries, 1),
@@ -63,6 +75,9 @@ var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
63
75
  width = _entry$contentRect.width,
64
76
  height = _entry$contentRect.height;
65
77
  setBadgeSize(getBadgeSize(width, height));
78
+ if ((0, _platformFeatureFlags.fg)('platform_editor_support_media_badge_visibility')) {
79
+ setVisible(getBadgeVisible(width, height));
80
+ }
66
81
  }));
67
82
  if (mediaElement) {
68
83
  observer.observe(mediaElement);
@@ -73,7 +88,8 @@ var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
73
88
  }, [mediaElement]);
74
89
  if (typeof children === 'function') {
75
90
  children = children({
76
- badgeSize: badgeSize
91
+ badgeSize: badgeSize,
92
+ visible: visible
77
93
  });
78
94
  }
79
95
  if (!mediaElement || _react.default.Children.count(children) === 0) {
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  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; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "96.5.7";
20
+ var packageVersion = "96.6.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // TODO: Sanitise the URL instead of just removing it
@@ -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 = "96.5.7";
26
+ var packageVersion = "96.6.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,8 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import debounce from 'lodash/debounce';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { Box, xcss } from '@atlaskit/primitives';
5
+ const MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
4
6
  const containerStyles = xcss({
5
7
  display: 'flex',
6
8
  position: 'absolute',
@@ -32,6 +34,12 @@ const getBadgeSize = (width, height) => {
32
34
  // width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
33
35
  return width && width < 70 || height && height < 70 ? 'small' : 'medium';
34
36
  };
37
+ const getBadgeVisible = (width, height) => {
38
+ if (!fg('platform_editor_support_media_badge_visibility')) {
39
+ return true;
40
+ }
41
+ return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
42
+ };
35
43
  export const MediaBadges = ({
36
44
  children,
37
45
  mediaElement,
@@ -41,6 +49,7 @@ export const MediaBadges = ({
41
49
  useMinimumZIndex = false
42
50
  }) => {
43
51
  const [badgeSize, setBadgeSize] = useState(getBadgeSize(mediaWidth, mediaHeight));
52
+ const [visible, setVisible] = useState(getBadgeVisible(mediaWidth, mediaHeight));
44
53
  useEffect(() => {
45
54
  const observer = new ResizeObserver(debounce(entries => {
46
55
  const [entry] = entries;
@@ -49,6 +58,9 @@ export const MediaBadges = ({
49
58
  height
50
59
  } = entry.contentRect;
51
60
  setBadgeSize(getBadgeSize(width, height));
61
+ if (fg('platform_editor_support_media_badge_visibility')) {
62
+ setVisible(getBadgeVisible(width, height));
63
+ }
52
64
  }));
53
65
  if (mediaElement) {
54
66
  observer.observe(mediaElement);
@@ -59,7 +71,8 @@ export const MediaBadges = ({
59
71
  }, [mediaElement]);
60
72
  if (typeof children === 'function') {
61
73
  children = children({
62
- badgeSize
74
+ badgeSize,
75
+ visible
63
76
  });
64
77
  }
65
78
  if (!mediaElement || React.Children.count(children) === 0) {
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "96.5.7";
4
+ const packageVersion = "96.6.0";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // TODO: Sanitise the URL instead of just removing it
@@ -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 = "96.5.7";
16
+ const packageVersion = "96.6.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,7 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import debounce from 'lodash/debounce';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { Box, xcss } from '@atlaskit/primitives';
6
+ var MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
5
7
  var containerStyles = xcss({
6
8
  display: 'flex',
7
9
  position: 'absolute',
@@ -33,6 +35,12 @@ var getBadgeSize = function getBadgeSize(width, height) {
33
35
  // width is the original width of image, not resized or currently rendered to user. Defaulting to medium for now
34
36
  return width && width < 70 || height && height < 70 ? 'small' : 'medium';
35
37
  };
38
+ var getBadgeVisible = function getBadgeVisible(width, height) {
39
+ if (!fg('platform_editor_support_media_badge_visibility')) {
40
+ return true;
41
+ }
42
+ return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
43
+ };
36
44
  export var MediaBadges = function MediaBadges(_ref) {
37
45
  var children = _ref.children,
38
46
  mediaElement = _ref.mediaElement,
@@ -45,6 +53,10 @@ export var MediaBadges = function MediaBadges(_ref) {
45
53
  _useState2 = _slicedToArray(_useState, 2),
46
54
  badgeSize = _useState2[0],
47
55
  setBadgeSize = _useState2[1];
56
+ var _useState3 = useState(getBadgeVisible(mediaWidth, mediaHeight)),
57
+ _useState4 = _slicedToArray(_useState3, 2),
58
+ visible = _useState4[0],
59
+ setVisible = _useState4[1];
48
60
  useEffect(function () {
49
61
  var observer = new ResizeObserver(debounce(function (entries) {
50
62
  var _entries = _slicedToArray(entries, 1),
@@ -53,6 +65,9 @@ export var MediaBadges = function MediaBadges(_ref) {
53
65
  width = _entry$contentRect.width,
54
66
  height = _entry$contentRect.height;
55
67
  setBadgeSize(getBadgeSize(width, height));
68
+ if (fg('platform_editor_support_media_badge_visibility')) {
69
+ setVisible(getBadgeVisible(width, height));
70
+ }
56
71
  }));
57
72
  if (mediaElement) {
58
73
  observer.observe(mediaElement);
@@ -63,7 +78,8 @@ export var MediaBadges = function MediaBadges(_ref) {
63
78
  }, [mediaElement]);
64
79
  if (typeof children === 'function') {
65
80
  children = children({
66
- badgeSize: badgeSize
81
+ badgeSize: badgeSize,
82
+ visible: visible
67
83
  });
68
84
  }
69
85
  if (!mediaElement || React.Children.count(children) === 0) {
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "96.5.7";
10
+ var packageVersion = "96.6.0";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // TODO: Sanitise the URL instead of just removing it
@@ -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 = "96.5.7";
23
+ var packageVersion = "96.6.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import type { ADFEntity } from '@atlaskit/adf-utils/types';
3
- import type { ExtensionParams, MultiBodiedExtensionActions, UpdateExtension } from './extension-handler';
3
+ import type { ExtensionAPI, ExtensionParams, MultiBodiedExtensionActions, UpdateExtension } from './extension-handler';
4
4
  import type { ExtensionIconModule, MaybeESModule } from './extension-manifest-common';
5
5
  import type { ContextualToolbar } from './extension-manifest-toolbar-item';
6
6
  import type { Parameters } from './extension-parameters';
@@ -23,7 +23,7 @@ export type ExtensionModuleActionObject<T extends Parameters = Parameters> = {
23
23
  parameters?: T;
24
24
  };
25
25
  export type MaybeADFEntity = MaybeESModule<ADFEntity | Array<ADFEntity> | void>;
26
- export type ExtensionModuleActionHandler = () => Promise<MaybeADFEntity>;
26
+ export type ExtensionModuleActionHandler = (extensionAPI: ExtensionAPI) => Promise<MaybeADFEntity>;
27
27
  export type ExtensionModuleAction<T extends Parameters = Parameters> = ExtensionModuleActionObject<T> | ExtensionModuleActionHandler;
28
28
  export type ExtensionModule<T extends Parameters = Parameters> = {
29
29
  key: string;
@@ -7,6 +7,7 @@ type ExternalImageBadgeProps = {
7
7
  useMinimumZIndex?: boolean;
8
8
  children: ReactNode | ((props: {
9
9
  badgeSize: 'medium' | 'small';
10
+ visible: boolean;
10
11
  }) => ReactNode);
11
12
  };
12
13
  export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, useMinimumZIndex, }: ExternalImageBadgeProps) => JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import type { ADFEntity } from '@atlaskit/adf-utils/types';
3
- import type { ExtensionParams, MultiBodiedExtensionActions, UpdateExtension } from './extension-handler';
3
+ import type { ExtensionAPI, ExtensionParams, MultiBodiedExtensionActions, UpdateExtension } from './extension-handler';
4
4
  import type { ExtensionIconModule, MaybeESModule } from './extension-manifest-common';
5
5
  import type { ContextualToolbar } from './extension-manifest-toolbar-item';
6
6
  import type { Parameters } from './extension-parameters';
@@ -23,7 +23,7 @@ export type ExtensionModuleActionObject<T extends Parameters = Parameters> = {
23
23
  parameters?: T;
24
24
  };
25
25
  export type MaybeADFEntity = MaybeESModule<ADFEntity | Array<ADFEntity> | void>;
26
- export type ExtensionModuleActionHandler = () => Promise<MaybeADFEntity>;
26
+ export type ExtensionModuleActionHandler = (extensionAPI: ExtensionAPI) => Promise<MaybeADFEntity>;
27
27
  export type ExtensionModuleAction<T extends Parameters = Parameters> = ExtensionModuleActionObject<T> | ExtensionModuleActionHandler;
28
28
  export type ExtensionModule<T extends Parameters = Parameters> = {
29
29
  key: string;
@@ -7,6 +7,7 @@ type ExternalImageBadgeProps = {
7
7
  useMinimumZIndex?: boolean;
8
8
  children: ReactNode | ((props: {
9
9
  badgeSize: 'medium' | 'small';
10
+ visible: boolean;
10
11
  }) => ReactNode);
11
12
  };
12
13
  export declare const MediaBadges: ({ children, mediaElement, mediaWidth, mediaHeight, extendedResizeOffset, useMinimumZIndex, }: ExternalImageBadgeProps) => JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "96.5.7",
3
+ "version": "96.6.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/"
@@ -133,14 +133,14 @@
133
133
  "@atlaskit/icon-object": "^6.9.0",
134
134
  "@atlaskit/link-datasource": "^3.15.0",
135
135
  "@atlaskit/link-picker": "^1.47.0",
136
- "@atlaskit/media-card": "^78.15.0",
136
+ "@atlaskit/media-card": "^78.16.0",
137
137
  "@atlaskit/media-client": "^28.6.0",
138
138
  "@atlaskit/media-client-react": "^2.4.0",
139
139
  "@atlaskit/media-common": "^11.7.0",
140
140
  "@atlaskit/media-file-preview": "^0.9.0",
141
141
  "@atlaskit/media-picker": "^67.0.0",
142
- "@atlaskit/media-ui": "^27.0.0",
143
- "@atlaskit/media-viewer": "49.4.5",
142
+ "@atlaskit/media-ui": "^27.1.0",
143
+ "@atlaskit/media-viewer": "49.5.0",
144
144
  "@atlaskit/mention": "^23.4.0",
145
145
  "@atlaskit/menu": "^2.13.0",
146
146
  "@atlaskit/onboarding": "^12.2.0",
@@ -154,7 +154,7 @@
154
154
  "@atlaskit/spinner": "^16.3.0",
155
155
  "@atlaskit/task-decision": "^17.11.0",
156
156
  "@atlaskit/textfield": "^6.7.0",
157
- "@atlaskit/tmp-editor-statsig": "^2.27.0",
157
+ "@atlaskit/tmp-editor-statsig": "^2.28.0",
158
158
  "@atlaskit/tokens": "^2.5.0",
159
159
  "@atlaskit/tooltip": "^19.0.0",
160
160
  "@atlaskit/width-detector": "^4.3.0",
@@ -191,7 +191,7 @@
191
191
  },
192
192
  "devDependencies": {
193
193
  "@af/visual-regression": "*",
194
- "@atlaskit/media-core": "^34.3.0",
194
+ "@atlaskit/media-core": "^34.4.0",
195
195
  "@atlaskit/media-test-helpers": "^34.7.0",
196
196
  "@atlaskit/util-data-test": "^17.13.0",
197
197
  "@atlaskit/visual-regression": "*",
@@ -315,6 +315,9 @@
315
315
  },
316
316
  "platform_editor_table_row_span_fix": {
317
317
  "type": "boolean"
318
+ },
319
+ "platform_editor_support_media_badge_visibility": {
320
+ "type": "boolean"
318
321
  }
319
322
  }
320
323
  }