@atlaskit/editor-common 95.6.3 → 95.7.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,20 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 95.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#168624](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168624)
8
+ [`6d928c0cb9227`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6d928c0cb9227) -
9
+ [ux] [ED-25832] Hide external image badges for atlassian.com domains
10
+
11
+ ### Patch Changes
12
+
13
+ - [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
14
+ [`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
15
+ Bump adf-schema to 46.0.0
16
+ - Updated dependencies
17
+
3
18
  ## 95.6.3
4
19
 
5
20
  ### Patch Changes
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.ExternalImageBadge = void 0;
7
+ exports.isUnbadgedHostname = exports.ExternalImageBadge = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _info = _interopRequireDefault(require("@atlaskit/icon/glyph/info"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _primitives = require("@atlaskit/primitives");
12
13
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
13
14
  var _media = require("../media");
@@ -17,10 +18,35 @@ var baseStyles = (0, _primitives.xcss)({
17
18
  lineHeight: "var(--ds-space-200, 16px)",
18
19
  cursor: 'pointer'
19
20
  });
21
+
22
+ // On cleanup of 'platform_editor_hide_external_media_badge', make types non-optional
23
+
24
+ var NO_EXTERNAL_BADGE_HOSTS = ['atlassian.com'];
25
+ var isUnbadgedHostname = exports.isUnbadgedHostname = function isUnbadgedHostname(hostname) {
26
+ return Boolean(hostname &&
27
+ // Do not show badge for atlassian domains and subdomains
28
+ NO_EXTERNAL_BADGE_HOSTS.some(function (host) {
29
+ return hostname === host || hostname.endsWith(".".concat(host));
30
+ }));
31
+ };
20
32
  var ExternalImageBadge = exports.ExternalImageBadge = function ExternalImageBadge(_ref) {
21
- var badgeSize = _ref.badgeSize;
33
+ var badgeSize = _ref.badgeSize,
34
+ type = _ref.type,
35
+ url = _ref.url;
22
36
  var intl = (0, _reactIntlNext.useIntl)();
23
37
  var message = intl.formatMessage(_media.externalMediaMessages.externalMediaFile);
38
+ if ((0, _platformFeatureFlags.fg)('platform_editor_hide_external_media_badge')) {
39
+ var hostname;
40
+ try {
41
+ var _URL = new URL(url || '');
42
+ hostname = _URL.hostname;
43
+ } catch (e) {
44
+ // If the URL is invalid (or empty), just carry on showing the badge
45
+ }
46
+ if (type !== 'external' || isUnbadgedHostname(hostname)) {
47
+ return null;
48
+ }
49
+ }
24
50
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
25
51
  padding: badgeSize === 'medium' ? 'space.050' : 'space.0',
26
52
  xcss: baseStyles,
@@ -46,6 +46,16 @@ var toolbarMessages = exports.toolbarMessages = (0, _reactIntlNext.defineMessage
46
46
  defaultMessage: 'Three columns with sidebars layout',
47
47
  description: 'Layout with 3 columns laid out as 25% - 50% - 25%'
48
48
  },
49
+ threeColumnsWithLeftSidebars: {
50
+ id: 'fabric.editor.threeColumnsWithLeftSidebars',
51
+ defaultMessage: 'Three columns with left sidebar layout',
52
+ description: 'Layout with 3 columns laid out as 25% - 25% - 50%'
53
+ },
54
+ threeColumnsWithRightSidebars: {
55
+ id: 'fabric.editor.threeColumnsWithRightSidebars',
56
+ defaultMessage: 'Three columns with right sidebar layout',
57
+ description: 'Layout with 3 columns laid out as 50% - 25% - 25%'
58
+ },
49
59
  floatingToolbarRadioGroupAriaLabel: {
50
60
  id: 'fabric.editor.floatingToolbar.floatingToolbarRadioGroupAriaLabel',
51
61
  defaultMessage: 'Layout options',
@@ -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 = "95.6.3";
20
+ var packageVersion = "95.7.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
@@ -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 = "95.6.3";
27
+ var packageVersion = "95.7.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import InfoIcon from '@atlaskit/icon/glyph/info';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { Box, xcss } from '@atlaskit/primitives';
5
6
  import Tooltip from '@atlaskit/tooltip';
6
7
  import { externalMediaMessages } from '../media';
@@ -10,11 +11,33 @@ const baseStyles = xcss({
10
11
  lineHeight: "var(--ds-space-200, 16px)",
11
12
  cursor: 'pointer'
12
13
  });
14
+
15
+ // On cleanup of 'platform_editor_hide_external_media_badge', make types non-optional
16
+
17
+ const NO_EXTERNAL_BADGE_HOSTS = ['atlassian.com'];
18
+ export const isUnbadgedHostname = hostname => Boolean(hostname &&
19
+ // Do not show badge for atlassian domains and subdomains
20
+ NO_EXTERNAL_BADGE_HOSTS.some(host => hostname === host || hostname.endsWith(`.${host}`)));
13
21
  export const ExternalImageBadge = ({
14
- badgeSize
22
+ badgeSize,
23
+ type,
24
+ url
15
25
  }) => {
16
26
  const intl = useIntl();
17
27
  const message = intl.formatMessage(externalMediaMessages.externalMediaFile);
28
+ if (fg('platform_editor_hide_external_media_badge')) {
29
+ let hostname;
30
+ try {
31
+ ({
32
+ hostname
33
+ } = new URL(url || ''));
34
+ } catch (e) {
35
+ // If the URL is invalid (or empty), just carry on showing the badge
36
+ }
37
+ if (type !== 'external' || isUnbadgedHostname(hostname)) {
38
+ return null;
39
+ }
40
+ }
18
41
  return /*#__PURE__*/React.createElement(Box, {
19
42
  padding: badgeSize === 'medium' ? 'space.050' : 'space.0',
20
43
  xcss: baseStyles,
@@ -40,6 +40,16 @@ export const toolbarMessages = defineMessages({
40
40
  defaultMessage: 'Three columns with sidebars layout',
41
41
  description: 'Layout with 3 columns laid out as 25% - 50% - 25%'
42
42
  },
43
+ threeColumnsWithLeftSidebars: {
44
+ id: 'fabric.editor.threeColumnsWithLeftSidebars',
45
+ defaultMessage: 'Three columns with left sidebar layout',
46
+ description: 'Layout with 3 columns laid out as 25% - 25% - 50%'
47
+ },
48
+ threeColumnsWithRightSidebars: {
49
+ id: 'fabric.editor.threeColumnsWithRightSidebars',
50
+ defaultMessage: 'Three columns with right sidebar layout',
51
+ description: 'Layout with 3 columns laid out as 50% - 25% - 25%'
52
+ },
43
53
  floatingToolbarRadioGroupAriaLabel: {
44
54
  id: 'fabric.editor.floatingToolbar.floatingToolbarRadioGroupAriaLabel',
45
55
  defaultMessage: 'Layout options',
@@ -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 = "95.6.3";
4
+ const packageVersion = "95.7.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 = "95.6.3";
16
+ const packageVersion = "95.7.0";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  class DropList extends Component {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
3
  import InfoIcon from '@atlaskit/icon/glyph/info';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { Box, xcss } from '@atlaskit/primitives';
5
6
  import Tooltip from '@atlaskit/tooltip';
6
7
  import { externalMediaMessages } from '../media';
@@ -10,10 +11,35 @@ var baseStyles = xcss({
10
11
  lineHeight: "var(--ds-space-200, 16px)",
11
12
  cursor: 'pointer'
12
13
  });
14
+
15
+ // On cleanup of 'platform_editor_hide_external_media_badge', make types non-optional
16
+
17
+ var NO_EXTERNAL_BADGE_HOSTS = ['atlassian.com'];
18
+ export var isUnbadgedHostname = function isUnbadgedHostname(hostname) {
19
+ return Boolean(hostname &&
20
+ // Do not show badge for atlassian domains and subdomains
21
+ NO_EXTERNAL_BADGE_HOSTS.some(function (host) {
22
+ return hostname === host || hostname.endsWith(".".concat(host));
23
+ }));
24
+ };
13
25
  export var ExternalImageBadge = function ExternalImageBadge(_ref) {
14
- var badgeSize = _ref.badgeSize;
26
+ var badgeSize = _ref.badgeSize,
27
+ type = _ref.type,
28
+ url = _ref.url;
15
29
  var intl = useIntl();
16
30
  var message = intl.formatMessage(externalMediaMessages.externalMediaFile);
31
+ if (fg('platform_editor_hide_external_media_badge')) {
32
+ var hostname;
33
+ try {
34
+ var _URL = new URL(url || '');
35
+ hostname = _URL.hostname;
36
+ } catch (e) {
37
+ // If the URL is invalid (or empty), just carry on showing the badge
38
+ }
39
+ if (type !== 'external' || isUnbadgedHostname(hostname)) {
40
+ return null;
41
+ }
42
+ }
17
43
  return /*#__PURE__*/React.createElement(Box, {
18
44
  padding: badgeSize === 'medium' ? 'space.050' : 'space.0',
19
45
  xcss: baseStyles,
@@ -40,6 +40,16 @@ export var toolbarMessages = defineMessages({
40
40
  defaultMessage: 'Three columns with sidebars layout',
41
41
  description: 'Layout with 3 columns laid out as 25% - 50% - 25%'
42
42
  },
43
+ threeColumnsWithLeftSidebars: {
44
+ id: 'fabric.editor.threeColumnsWithLeftSidebars',
45
+ defaultMessage: 'Three columns with left sidebar layout',
46
+ description: 'Layout with 3 columns laid out as 25% - 25% - 50%'
47
+ },
48
+ threeColumnsWithRightSidebars: {
49
+ id: 'fabric.editor.threeColumnsWithRightSidebars',
50
+ defaultMessage: 'Three columns with right sidebar layout',
51
+ description: 'Layout with 3 columns laid out as 50% - 25% - 25%'
52
+ },
43
53
  floatingToolbarRadioGroupAriaLabel: {
44
54
  id: 'fabric.editor.floatingToolbar.floatingToolbarRadioGroupAriaLabel',
45
55
  defaultMessage: 'Layout options',
@@ -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 = "95.6.3";
10
+ var packageVersion = "95.7.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
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
21
21
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "95.6.3";
24
+ var packageVersion = "95.7.0";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { type MediaType } from '@atlaskit/adf-schema';
2
3
  type ExternalImageBadgeProps = {
3
4
  badgeSize: 'medium' | 'small';
5
+ type?: MediaType;
6
+ url?: string | undefined;
4
7
  };
5
- export declare const ExternalImageBadge: ({ badgeSize }: ExternalImageBadgeProps) => JSX.Element;
8
+ export declare const isUnbadgedHostname: (hostname: string | undefined) => boolean;
9
+ export declare const ExternalImageBadge: ({ badgeSize, type, url }: ExternalImageBadgeProps) => JSX.Element | null;
6
10
  export {};
@@ -39,6 +39,16 @@ export declare const toolbarMessages: {
39
39
  defaultMessage: string;
40
40
  description: string;
41
41
  };
42
+ threeColumnsWithLeftSidebars: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ threeColumnsWithRightSidebars: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
42
52
  floatingToolbarRadioGroupAriaLabel: {
43
53
  id: string;
44
54
  defaultMessage: string;
@@ -1,6 +1,10 @@
1
1
  /// <reference types="react" />
2
+ import { type MediaType } from '@atlaskit/adf-schema';
2
3
  type ExternalImageBadgeProps = {
3
4
  badgeSize: 'medium' | 'small';
5
+ type?: MediaType;
6
+ url?: string | undefined;
4
7
  };
5
- export declare const ExternalImageBadge: ({ badgeSize }: ExternalImageBadgeProps) => JSX.Element;
8
+ export declare const isUnbadgedHostname: (hostname: string | undefined) => boolean;
9
+ export declare const ExternalImageBadge: ({ badgeSize, type, url }: ExternalImageBadgeProps) => JSX.Element | null;
6
10
  export {};
@@ -39,6 +39,16 @@ export declare const toolbarMessages: {
39
39
  defaultMessage: string;
40
40
  description: string;
41
41
  };
42
+ threeColumnsWithLeftSidebars: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ threeColumnsWithRightSidebars: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
42
52
  floatingToolbarRadioGroupAriaLabel: {
43
53
  id: string;
44
54
  defaultMessage: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "95.6.3",
3
+ "version": "95.7.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/"
@@ -111,7 +111,7 @@
111
111
  },
112
112
  "dependencies": {
113
113
  "@atlaskit/activity-provider": "^2.5.0",
114
- "@atlaskit/adf-schema": "^44.2.0",
114
+ "@atlaskit/adf-schema": "^46.1.0",
115
115
  "@atlaskit/adf-utils": "^19.13.0",
116
116
  "@atlaskit/analytics-listeners": "^8.13.0",
117
117
  "@atlaskit/analytics-namespaced-context": "^6.12.0",
@@ -152,7 +152,7 @@
152
152
  "@atlaskit/smart-user-picker": "^6.11.0",
153
153
  "@atlaskit/spinner": "^16.3.0",
154
154
  "@atlaskit/task-decision": "^17.11.0",
155
- "@atlaskit/textfield": "^6.5.0",
155
+ "@atlaskit/textfield": "^6.6.0",
156
156
  "@atlaskit/tmp-editor-statsig": "^2.21.0",
157
157
  "@atlaskit/tokens": "^2.3.0",
158
158
  "@atlaskit/tooltip": "^18.9.0",
@@ -293,6 +293,9 @@
293
293
  },
294
294
  "platform_editor_use_nested_table_pm_nodes": {
295
295
  "type": "boolean"
296
+ },
297
+ "platform_editor_hide_external_media_badge": {
298
+ "type": "boolean"
296
299
  }
297
300
  }
298
301
  }