@atlaskit/editor-common 78.31.5 → 78.33.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/collab/index.js +8 -17
  3. package/dist/cjs/monitoring/error.js +1 -1
  4. package/dist/cjs/ui/DropList/index.js +1 -1
  5. package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.js +6 -3
  6. package/dist/cjs/ui-menu/ColorPickerButton/index.js +2 -1
  7. package/dist/es2019/collab/index.js +20 -21
  8. package/dist/es2019/monitoring/error.js +1 -1
  9. package/dist/es2019/ui/DropList/index.js +1 -1
  10. package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.js +6 -3
  11. package/dist/es2019/ui-menu/ColorPickerButton/index.js +2 -1
  12. package/dist/esm/collab/index.js +8 -14
  13. package/dist/esm/monitoring/error.js +1 -1
  14. package/dist/esm/ui/DropList/index.js +1 -1
  15. package/dist/esm/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.js +6 -3
  16. package/dist/esm/ui-menu/ColorPickerButton/index.js +2 -1
  17. package/dist/types/collab/index.d.ts +2 -5
  18. package/dist/types/types/floating-toolbar.d.ts +1 -0
  19. package/dist/types/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.d.ts +2 -2
  20. package/dist/types/ui-menu/ArrowKeyNavigationProvider/types.d.ts +1 -0
  21. package/dist/types/ui-menu/ColorPickerButton/index.d.ts +2 -1
  22. package/dist/types-ts4.5/collab/index.d.ts +2 -5
  23. package/dist/types-ts4.5/types/floating-toolbar.d.ts +1 -0
  24. package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/ColorPaletteArrowKeyNavigationProvider/index.d.ts +2 -2
  25. package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/types.d.ts +1 -0
  26. package/dist/types-ts4.5/ui-menu/ColorPickerButton/index.d.ts +2 -1
  27. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 78.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#91653](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/91653) [`57a3511f76c1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/57a3511f76c1) - ECA11Y-203: Added cursor back to the cell, after changing cell background
8
+
9
+ ## 78.32.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#86433](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86433) [`88ca3b199a49`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/88ca3b199a49) - [ux] EDF-412 Collaborators avatars and telepointer colors are tokenised.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
3
19
  ## 78.31.5
4
20
 
5
21
  ### Patch Changes
@@ -1,19 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports.tintDirtyTransaction = exports.telepointerStyle = exports.isDirtyTransaction = exports.colors = exports.TELEPOINTER_DIM_CLASS = exports.PROVIDER_ERROR_CODE = exports.DisconnectReason = void 0;
7
+ exports.tintDirtyTransaction = exports.telepointerStyle = exports.isDirtyTransaction = exports.TELEPOINTER_DIM_CLASS = exports.PROVIDER_ERROR_CODE = exports.DisconnectReason = void 0;
9
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
9
  var _react = require("@emotion/react");
11
- var _adfSchema = require("@atlaskit/adf-schema");
12
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
13
- var themeColors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
11
+ var _tokens = require("@atlaskit/tokens");
14
12
  var _templateObject;
15
- 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); }
16
- 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 && Object.prototype.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; }
17
13
  // Format of the payload returned by the callback function passed to the collab provider
18
14
  // that gets called when syncing with the back-end service fails.
19
15
  // Format of the document and its metadata returned from the collab provider
@@ -122,23 +118,18 @@ var DisconnectReason = exports.DisconnectReason = /*#__PURE__*/function (Disconn
122
118
  DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
123
119
  return DisconnectReason;
124
120
  }({});
125
- // TODO: https://product-fabric.atlassian.net/browse/DSP-7269
126
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
127
- var colors = exports.colors = [themeColors.R100, themeColors.R300, themeColors.R500, themeColors.Y100, themeColors.Y300, themeColors.Y500, themeColors.G100, themeColors.G300, themeColors.G500, themeColors.T100, themeColors.T300, themeColors.T500, themeColors.B100, themeColors.B300, themeColors.B500, themeColors.P100, themeColors.P300, themeColors.P500, themeColors.N70, themeColors.N200, themeColors.N800].map(function (solid) {
128
- return {
129
- solid: solid,
130
- selection: (0, _adfSchema.hexToRgba)(solid, 0.2)
131
- };
132
- });
133
121
  var telepointerColorStyle = function telepointerColorStyle(color, index) {
134
- return "\n &.color-".concat(index, " {\n background-color: ").concat(color.selection, ";\n &::after {\n background-color: ").concat(color.solid, ";\n color: ", "var(--ds-text-inverse, #fff)", ";\n border-color: ").concat(color.solid, ";\n }\n }\n");
122
+ var _getGlobalTheme = (0, _tokens.getGlobalTheme)(),
123
+ colorMode = _getGlobalTheme.colorMode;
124
+ var backgroundStyle = colorMode === 'dark' ? "linear-gradient(to bottom, ".concat(color, " -800000%, transparent 200000%)") : "linear-gradient(to bottom, ".concat(color, " -850000%, transparent 150000%)");
125
+ return "\n &.color-".concat(index, " {\n background: ").concat(backgroundStyle, ";\n &::after {\n background-color: ").concat(color, ";\n color: ", "var(--ds-text-inverse, #FFFFFF)", ";\n border-color: ").concat(color, ";\n }\n }\n ");
135
126
  };
136
127
  var TELEPOINTER_DIM_CLASS = exports.TELEPOINTER_DIM_CLASS = 'telepointer-dim';
137
128
 
138
129
  // ED-22557: Safely convert to object styling
139
130
  // Disable top: -14px since it is necessary to align to cursor
140
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
141
- var telepointerStyle = exports.telepointerStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .telepointer {\n position: relative;\n transition: opacity 200ms;\n\n &.telepointer-selection {\n line-height: 1.2;\n pointer-events: none;\n user-select: none;\n }\n\n &.telepointer-selection-badge::after {\n content: attr(data-initial);\n position: absolute;\n display: block;\n top: -14px;\n font-size: ", ";\n padding: ", ";\n color: ", ";\n left: 0px;\n border-radius: 2px 2px 2px 0;\n line-height: initial;\n }\n\n &.", " {\n opacity: 0.2;\n }\n\n ", ";\n }\n"])), (0, _editorSharedStyles.relativeFontSizeToBase16)(9), "var(--ds-space-025, 2px)", "var(--ds-text-inverse, white)", TELEPOINTER_DIM_CLASS, colors.map(function (color, index) {
131
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/no-exported-css
132
+ var telepointerStyle = exports.telepointerStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ProseMirror .telepointer {\n position: relative;\n transition: opacity 200ms;\n\n &.telepointer-selection {\n line-height: 1.2;\n pointer-events: none;\n user-select: none;\n }\n\n &.telepointer-selection-badge::after {\n content: attr(data-initial);\n position: absolute;\n display: block;\n top: -14px;\n font-size: ", ";\n padding: ", ";\n color: ", ";\n left: 0px;\n border-radius: 2px 2px 2px 0;\n line-height: initial;\n }\n\n &.", " {\n opacity: 0.2;\n }\n\n ", ";\n }\n"])), (0, _editorSharedStyles.relativeFontSizeToBase16)(9), "var(--ds-space-025, 2px)", "var(--ds-text-inverse, #FFFFFF)", TELEPOINTER_DIM_CLASS, _editorSharedStyles.avatarColors.map(function (color, index) {
142
133
  return telepointerColorStyle(color, index);
143
134
  }));
144
135
  var tintKey = 'collab:isDirtyTransaction';
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
16
16
  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 && Object.prototype.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; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "78.31.5";
19
+ var packageVersion = "78.33.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
20
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "78.31.5";
23
+ var packageVersion = "78.33.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -22,7 +22,8 @@ var ColorPaletteArrowKeyNavigationProvider = exports.ColorPaletteArrowKeyNavigat
22
22
  isPopupPositioned = _ref.isPopupPositioned,
23
23
  handleClose = _ref.handleClose,
24
24
  closeOnTab = _ref.closeOnTab,
25
- editorRef = _ref.editorRef;
25
+ editorRef = _ref.editorRef,
26
+ ignoreEscapeKey = _ref.ignoreEscapeKey;
26
27
  var wrapperRef = (0, _react.useRef)(null);
27
28
  var currentSelectedColumnIndex = (0, _react.useRef)(selectedColumnIndex === -1 ? 0 : selectedColumnIndex);
28
29
  var currentSelectedRowIndex = (0, _react.useRef)(selectedRowIndex === -1 ? 0 : selectedRowIndex);
@@ -105,7 +106,9 @@ var ColorPaletteArrowKeyNavigationProvider = exports.ColorPaletteArrowKeyNavigat
105
106
  event.preventDefault();
106
107
  break;
107
108
  case 'Escape':
108
- handleClose(event);
109
+ if (!ignoreEscapeKey) {
110
+ handleClose(event);
111
+ }
109
112
  break;
110
113
  default:
111
114
  return;
@@ -124,7 +127,7 @@ var ColorPaletteArrowKeyNavigationProvider = exports.ColorPaletteArrowKeyNavigat
124
127
  return function () {
125
128
  listenerTargetElement && listenerTargetElement.removeEventListener('keydown', handleKeyDown);
126
129
  };
127
- }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, listenerTargetElement]);
130
+ }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, ignoreEscapeKey, listenerTargetElement]);
128
131
  return /*#__PURE__*/_react.default.createElement("div", {
129
132
  className: "custom-key-handler-wrapper",
130
133
  ref: wrapperRef
@@ -153,7 +153,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
153
153
  return setIsPopupOpen(false);
154
154
  },
155
155
  isOpenedByKeyboard: isOpenedByKeyboard,
156
- isPopupPositioned: isPopupPositioned
156
+ isPopupPositioned: isPopupPositioned,
157
+ ignoreEscapeKey: props.returnEscToButton
157
158
  }, (0, _react2.jsx)(ColorPaletteWithListeners, {
158
159
  cols: props.cols,
159
160
  selectedColor: selectedColor,
@@ -1,7 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
- import { hexToRgba } from '@atlaskit/adf-schema';
3
- import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
4
- import * as themeColors from '@atlaskit/theme/colors';
2
+ import { avatarColors, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
3
+ import { getGlobalTheme } from '@atlaskit/tokens';
5
4
 
6
5
  // Format of the payload returned by the callback function passed to the collab provider
7
6
  // that gets called when syncing with the back-end service fails.
@@ -126,27 +125,27 @@ export let DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
126
125
  DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
127
126
  return DisconnectReason;
128
127
  }({});
129
- // TODO: https://product-fabric.atlassian.net/browse/DSP-7269
130
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
131
- export const colors = [themeColors.R100, themeColors.R300, themeColors.R500, themeColors.Y100, themeColors.Y300, themeColors.Y500, themeColors.G100, themeColors.G300, themeColors.G500, themeColors.T100, themeColors.T300, themeColors.T500, themeColors.B100, themeColors.B300, themeColors.B500, themeColors.P100, themeColors.P300, themeColors.P500, themeColors.N70, themeColors.N200, themeColors.N800].map(solid => ({
132
- solid,
133
- selection: hexToRgba(solid, 0.2)
134
- }));
135
- const telepointerColorStyle = (color, index) => `
136
- &.color-${index} {
137
- background-color: ${color.selection};
138
- &::after {
139
- background-color: ${color.solid};
140
- color: ${"var(--ds-text-inverse, #fff)"};
141
- border-color: ${color.solid};
128
+ const telepointerColorStyle = (color, index) => {
129
+ const {
130
+ colorMode
131
+ } = getGlobalTheme();
132
+ const backgroundStyle = colorMode === 'dark' ? `linear-gradient(to bottom, ${color} -800000%, transparent 200000%)` : `linear-gradient(to bottom, ${color} -850000%, transparent 150000%)`;
133
+ return `
134
+ &.color-${index} {
135
+ background: ${backgroundStyle};
136
+ &::after {
137
+ background-color: ${color};
138
+ color: ${"var(--ds-text-inverse, #FFFFFF)"};
139
+ border-color: ${color};
140
+ }
142
141
  }
143
- }
144
- `;
142
+ `;
143
+ };
145
144
  export const TELEPOINTER_DIM_CLASS = 'telepointer-dim';
146
145
 
147
146
  // ED-22557: Safely convert to object styling
148
147
  // Disable top: -14px since it is necessary to align to cursor
149
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
148
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/no-exported-css
150
149
  export const telepointerStyle = css`
151
150
  .ProseMirror .telepointer {
152
151
  position: relative;
@@ -165,7 +164,7 @@ export const telepointerStyle = css`
165
164
  top: -14px;
166
165
  font-size: ${relativeFontSizeToBase16(9)};
167
166
  padding: ${"var(--ds-space-025, 2px)"};
168
- color: ${"var(--ds-text-inverse, white)"};
167
+ color: ${"var(--ds-text-inverse, #FFFFFF)"};
169
168
  left: 0px;
170
169
  border-radius: 2px 2px 2px 0;
171
170
  line-height: initial;
@@ -175,7 +174,7 @@ export const telepointerStyle = css`
175
174
  opacity: 0.2;
176
175
  }
177
176
 
178
- ${colors.map((color, index) => telepointerColorStyle(color, index))};
177
+ ${avatarColors.map((color, index) => telepointerColorStyle(color, index))};
179
178
  }
180
179
  `;
181
180
  const tintKey = 'collab:isDirtyTransaction';
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "78.31.5";
3
+ const packageVersion = "78.33.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.31.5";
10
+ const packageVersion = "78.33.0";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -11,7 +11,8 @@ export const ColorPaletteArrowKeyNavigationProvider = ({
11
11
  isPopupPositioned,
12
12
  handleClose,
13
13
  closeOnTab,
14
- editorRef
14
+ editorRef,
15
+ ignoreEscapeKey
15
16
  }) => {
16
17
  const wrapperRef = useRef(null);
17
18
  const currentSelectedColumnIndex = useRef(selectedColumnIndex === -1 ? 0 : selectedColumnIndex);
@@ -93,7 +94,9 @@ export const ColorPaletteArrowKeyNavigationProvider = ({
93
94
  event.preventDefault();
94
95
  break;
95
96
  case 'Escape':
96
- handleClose(event);
97
+ if (!ignoreEscapeKey) {
98
+ handleClose(event);
99
+ }
97
100
  break;
98
101
  default:
99
102
  return;
@@ -112,7 +115,7 @@ export const ColorPaletteArrowKeyNavigationProvider = ({
112
115
  return () => {
113
116
  listenerTargetElement && listenerTargetElement.removeEventListener('keydown', handleKeyDown);
114
117
  };
115
- }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, listenerTargetElement]);
118
+ }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, ignoreEscapeKey, listenerTargetElement]);
116
119
  return /*#__PURE__*/React.createElement("div", {
117
120
  className: "custom-key-handler-wrapper",
118
121
  ref: wrapperRef
@@ -133,7 +133,8 @@ const ColorPickerButton = props => {
133
133
  closeOnTab: true,
134
134
  handleClose: () => setIsPopupOpen(false),
135
135
  isOpenedByKeyboard: isOpenedByKeyboard,
136
- isPopupPositioned: isPopupPositioned
136
+ isPopupPositioned: isPopupPositioned,
137
+ ignoreEscapeKey: props.returnEscToButton
137
138
  }, jsx(ColorPaletteWithListeners, {
138
139
  cols: props.cols,
139
140
  selectedColor: selectedColor,
@@ -1,9 +1,8 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
2
  var _templateObject;
3
3
  import { css } from '@emotion/react';
4
- import { hexToRgba } from '@atlaskit/adf-schema';
5
- import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
6
- import * as themeColors from '@atlaskit/theme/colors';
4
+ import { avatarColors, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
+ import { getGlobalTheme } from '@atlaskit/tokens';
7
6
 
8
7
  // Format of the payload returned by the callback function passed to the collab provider
9
8
  // that gets called when syncing with the back-end service fails.
@@ -128,23 +127,18 @@ export var DisconnectReason = /*#__PURE__*/function (DisconnectReason) {
128
127
  DisconnectReason["UNKNOWN_DISCONNECT"] = "UNKNOWN_DISCONNECT";
129
128
  return DisconnectReason;
130
129
  }({});
131
- // TODO: https://product-fabric.atlassian.net/browse/DSP-7269
132
- /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
133
- export var colors = [themeColors.R100, themeColors.R300, themeColors.R500, themeColors.Y100, themeColors.Y300, themeColors.Y500, themeColors.G100, themeColors.G300, themeColors.G500, themeColors.T100, themeColors.T300, themeColors.T500, themeColors.B100, themeColors.B300, themeColors.B500, themeColors.P100, themeColors.P300, themeColors.P500, themeColors.N70, themeColors.N200, themeColors.N800].map(function (solid) {
134
- return {
135
- solid: solid,
136
- selection: hexToRgba(solid, 0.2)
137
- };
138
- });
139
130
  var telepointerColorStyle = function telepointerColorStyle(color, index) {
140
- return "\n &.color-".concat(index, " {\n background-color: ").concat(color.selection, ";\n &::after {\n background-color: ").concat(color.solid, ";\n color: ", "var(--ds-text-inverse, #fff)", ";\n border-color: ").concat(color.solid, ";\n }\n }\n");
131
+ var _getGlobalTheme = getGlobalTheme(),
132
+ colorMode = _getGlobalTheme.colorMode;
133
+ var backgroundStyle = colorMode === 'dark' ? "linear-gradient(to bottom, ".concat(color, " -800000%, transparent 200000%)") : "linear-gradient(to bottom, ".concat(color, " -850000%, transparent 150000%)");
134
+ return "\n &.color-".concat(index, " {\n background: ").concat(backgroundStyle, ";\n &::after {\n background-color: ").concat(color, ";\n color: ", "var(--ds-text-inverse, #FFFFFF)", ";\n border-color: ").concat(color, ";\n }\n }\n ");
141
135
  };
142
136
  export var TELEPOINTER_DIM_CLASS = 'telepointer-dim';
143
137
 
144
138
  // ED-22557: Safely convert to object styling
145
139
  // Disable top: -14px since it is necessary to align to cursor
146
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression
147
- export var telepointerStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .telepointer {\n position: relative;\n transition: opacity 200ms;\n\n &.telepointer-selection {\n line-height: 1.2;\n pointer-events: none;\n user-select: none;\n }\n\n &.telepointer-selection-badge::after {\n content: attr(data-initial);\n position: absolute;\n display: block;\n top: -14px;\n font-size: ", ";\n padding: ", ";\n color: ", ";\n left: 0px;\n border-radius: 2px 2px 2px 0;\n line-height: initial;\n }\n\n &.", " {\n opacity: 0.2;\n }\n\n ", ";\n }\n"])), relativeFontSizeToBase16(9), "var(--ds-space-025, 2px)", "var(--ds-text-inverse, white)", TELEPOINTER_DIM_CLASS, colors.map(function (color, index) {
140
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/design-system/no-exported-css
141
+ export var telepointerStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .ProseMirror .telepointer {\n position: relative;\n transition: opacity 200ms;\n\n &.telepointer-selection {\n line-height: 1.2;\n pointer-events: none;\n user-select: none;\n }\n\n &.telepointer-selection-badge::after {\n content: attr(data-initial);\n position: absolute;\n display: block;\n top: -14px;\n font-size: ", ";\n padding: ", ";\n color: ", ";\n left: 0px;\n border-radius: 2px 2px 2px 0;\n line-height: initial;\n }\n\n &.", " {\n opacity: 0.2;\n }\n\n ", ";\n }\n"])), relativeFontSizeToBase16(9), "var(--ds-space-025, 2px)", "var(--ds-text-inverse, #FFFFFF)", TELEPOINTER_DIM_CLASS, avatarColors.map(function (color, index) {
148
142
  return telepointerColorStyle(color, index);
149
143
  }));
150
144
  var tintKey = 'collab:isDirtyTransaction';
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "78.31.5";
9
+ var packageVersion = "78.33.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
15
15
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
16
16
  import Layer from '../Layer';
17
17
  var packageName = "@atlaskit/editor-common";
18
- var packageVersion = "78.31.5";
18
+ var packageVersion = "78.33.0";
19
19
  var halfFocusRing = 1;
20
20
  var dropOffset = '0, 8';
21
21
  var DropList = /*#__PURE__*/function (_Component) {
@@ -12,7 +12,8 @@ export var ColorPaletteArrowKeyNavigationProvider = function ColorPaletteArrowKe
12
12
  isPopupPositioned = _ref.isPopupPositioned,
13
13
  handleClose = _ref.handleClose,
14
14
  closeOnTab = _ref.closeOnTab,
15
- editorRef = _ref.editorRef;
15
+ editorRef = _ref.editorRef,
16
+ ignoreEscapeKey = _ref.ignoreEscapeKey;
16
17
  var wrapperRef = useRef(null);
17
18
  var currentSelectedColumnIndex = useRef(selectedColumnIndex === -1 ? 0 : selectedColumnIndex);
18
19
  var currentSelectedRowIndex = useRef(selectedRowIndex === -1 ? 0 : selectedRowIndex);
@@ -95,7 +96,9 @@ export var ColorPaletteArrowKeyNavigationProvider = function ColorPaletteArrowKe
95
96
  event.preventDefault();
96
97
  break;
97
98
  case 'Escape':
98
- handleClose(event);
99
+ if (!ignoreEscapeKey) {
100
+ handleClose(event);
101
+ }
99
102
  break;
100
103
  default:
101
104
  return;
@@ -114,7 +117,7 @@ export var ColorPaletteArrowKeyNavigationProvider = function ColorPaletteArrowKe
114
117
  return function () {
115
118
  listenerTargetElement && listenerTargetElement.removeEventListener('keydown', handleKeyDown);
116
119
  };
117
- }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, listenerTargetElement]);
120
+ }, [currentSelectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, wrapperRef, handleClose, closeOnTab, ignoreEscapeKey, listenerTargetElement]);
118
121
  return /*#__PURE__*/React.createElement("div", {
119
122
  className: "custom-key-handler-wrapper",
120
123
  ref: wrapperRef
@@ -146,7 +146,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
146
146
  return setIsPopupOpen(false);
147
147
  },
148
148
  isOpenedByKeyboard: isOpenedByKeyboard,
149
- isPopupPositioned: isPopupPositioned
149
+ isPopupPositioned: isPopupPositioned,
150
+ ignoreEscapeKey: props.returnEscToButton
150
151
  }, jsx(ColorPaletteWithListeners, {
151
152
  cols: props.cols,
152
153
  selectedColor: selectedColor,
@@ -2,6 +2,7 @@ import type { ReactElement } from 'react';
2
2
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
3
3
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
+ import { token } from '@atlaskit/tokens';
5
6
  import type { Providers } from '../provider-factory';
6
7
  export type NewCollabSyncUpErrorAttributes = {
7
8
  lengthOfUnconfirmedSteps?: number;
@@ -389,11 +390,7 @@ export interface CollabAnalyticsProps {
389
390
  export interface CollabEventLocalStepData {
390
391
  steps: Array<Step>;
391
392
  }
392
- export interface Color {
393
- solid: string;
394
- selection: string;
395
- }
396
- export declare const colors: Color[];
393
+ export type Color = ReturnType<typeof token>;
397
394
  export declare const TELEPOINTER_DIM_CLASS = "telepointer-dim";
398
395
  export declare const telepointerStyle: import("@emotion/react").SerializedStyles;
399
396
  export declare const isDirtyTransaction: (tr: Transaction | ReadonlyTransaction) => boolean;
@@ -167,6 +167,7 @@ type FloatingToolbarSelectBase<T extends {}, V = SelectOption> = {
167
167
  hideExpandIcon?: boolean;
168
168
  defaultValue?: V | null;
169
169
  placeholder?: string;
170
+ returnEscToButton?: boolean;
170
171
  onChange: (selected: V) => T;
171
172
  filterOption?: ((option: V, rawInput: string) => boolean) | null;
172
173
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ColorPaletteArrowKeyNavigationProps } from '../types';
2
+ import type { ColorPaletteArrowKeyNavigationProps } from '../types';
3
3
  /**
4
4
  * This component is a wrapper for color picker which listens to keydown events of children
5
5
  * and handles arrow key navigation
6
6
  */
7
- export declare const ColorPaletteArrowKeyNavigationProvider: ({ children, selectedRowIndex, selectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, handleClose, closeOnTab, editorRef, }: React.PropsWithChildren<Omit<ColorPaletteArrowKeyNavigationProps, 'type'>>) => JSX.Element;
7
+ export declare const ColorPaletteArrowKeyNavigationProvider: ({ children, selectedRowIndex, selectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, handleClose, closeOnTab, editorRef, ignoreEscapeKey, }: React.PropsWithChildren<Omit<ColorPaletteArrowKeyNavigationProps, 'type'>>) => JSX.Element;
@@ -21,6 +21,7 @@ export type ColorPaletteArrowKeyNavigationProps = ColorPaletteArrowKeyNavigation
21
21
  handleClose?: SimpleEventHandler<KeyboardEvent>;
22
22
  closeOnTab?: boolean;
23
23
  editorRef: React.RefObject<HTMLDivElement>;
24
+ ignoreEscapeKey?: boolean | false;
24
25
  };
25
26
  export type MenuArrowKeyNavigationOptions = {
26
27
  type: ArrowKeyNavigationType.MENU;
@@ -26,5 +26,6 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsE
26
26
  */
27
27
  skipFocusButtonAfterPick?: boolean | undefined;
28
28
  absoluteOffset?: PopupPosition | undefined;
29
- }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "size" | "currentColor" | "onChange" | "title" | "key" | "placement" | "alignX" | "absoluteOffset" | "analyticsContext" | "cols" | "isAriaExpanded" | "hexToPaletteColor" | "paletteColorTooltipMessages" | "colorPalette" | "mountPoint" | "setDisableParentScroll" | "skipFocusButtonAfterPick"> & React.RefAttributes<any>>;
29
+ returnEscToButton?: boolean | undefined;
30
+ }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "size" | "currentColor" | "onChange" | "title" | "key" | "placement" | "alignX" | "absoluteOffset" | "analyticsContext" | "cols" | "isAriaExpanded" | "returnEscToButton" | "hexToPaletteColor" | "paletteColorTooltipMessages" | "colorPalette" | "mountPoint" | "setDisableParentScroll" | "skipFocusButtonAfterPick"> & React.RefAttributes<any>>;
30
31
  export default _default;
@@ -2,6 +2,7 @@ import type { ReactElement } from 'react';
2
2
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
3
3
  import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
+ import { token } from '@atlaskit/tokens';
5
6
  import type { Providers } from '../provider-factory';
6
7
  export type NewCollabSyncUpErrorAttributes = {
7
8
  lengthOfUnconfirmedSteps?: number;
@@ -389,11 +390,7 @@ export interface CollabAnalyticsProps {
389
390
  export interface CollabEventLocalStepData {
390
391
  steps: Array<Step>;
391
392
  }
392
- export interface Color {
393
- solid: string;
394
- selection: string;
395
- }
396
- export declare const colors: Color[];
393
+ export type Color = ReturnType<typeof token>;
397
394
  export declare const TELEPOINTER_DIM_CLASS = "telepointer-dim";
398
395
  export declare const telepointerStyle: import("@emotion/react").SerializedStyles;
399
396
  export declare const isDirtyTransaction: (tr: Transaction | ReadonlyTransaction) => boolean;
@@ -167,6 +167,7 @@ type FloatingToolbarSelectBase<T extends {}, V = SelectOption> = {
167
167
  hideExpandIcon?: boolean;
168
168
  defaultValue?: V | null;
169
169
  placeholder?: string;
170
+ returnEscToButton?: boolean;
170
171
  onChange: (selected: V) => T;
171
172
  filterOption?: ((option: V, rawInput: string) => boolean) | null;
172
173
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { ColorPaletteArrowKeyNavigationProps } from '../types';
2
+ import type { ColorPaletteArrowKeyNavigationProps } from '../types';
3
3
  /**
4
4
  * This component is a wrapper for color picker which listens to keydown events of children
5
5
  * and handles arrow key navigation
6
6
  */
7
- export declare const ColorPaletteArrowKeyNavigationProvider: ({ children, selectedRowIndex, selectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, handleClose, closeOnTab, editorRef, }: React.PropsWithChildren<Omit<ColorPaletteArrowKeyNavigationProps, 'type'>>) => JSX.Element;
7
+ export declare const ColorPaletteArrowKeyNavigationProvider: ({ children, selectedRowIndex, selectedColumnIndex, isOpenedByKeyboard, isPopupPositioned, handleClose, closeOnTab, editorRef, ignoreEscapeKey, }: React.PropsWithChildren<Omit<ColorPaletteArrowKeyNavigationProps, 'type'>>) => JSX.Element;
@@ -21,6 +21,7 @@ export type ColorPaletteArrowKeyNavigationProps = ColorPaletteArrowKeyNavigation
21
21
  handleClose?: SimpleEventHandler<KeyboardEvent>;
22
22
  closeOnTab?: boolean;
23
23
  editorRef: React.RefObject<HTMLDivElement>;
24
+ ignoreEscapeKey?: boolean | false;
24
25
  };
25
26
  export type MenuArrowKeyNavigationOptions = {
26
27
  type: ArrowKeyNavigationType.MENU;
@@ -26,5 +26,6 @@ declare const _default: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsE
26
26
  */
27
27
  skipFocusButtonAfterPick?: boolean | undefined;
28
28
  absoluteOffset?: PopupPosition | undefined;
29
- }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "size" | "currentColor" | "onChange" | "title" | "key" | "placement" | "alignX" | "absoluteOffset" | "analyticsContext" | "cols" | "isAriaExpanded" | "hexToPaletteColor" | "paletteColorTooltipMessages" | "colorPalette" | "mountPoint" | "setDisableParentScroll" | "skipFocusButtonAfterPick"> & React.RefAttributes<any>>;
29
+ returnEscToButton?: boolean | undefined;
30
+ }, keyof WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "size" | "currentColor" | "onChange" | "title" | "key" | "placement" | "alignX" | "absoluteOffset" | "analyticsContext" | "cols" | "isAriaExpanded" | "returnEscToButton" | "hexToPaletteColor" | "paletteColorTooltipMessages" | "colorPalette" | "mountPoint" | "setDisableParentScroll" | "skipFocusButtonAfterPick"> & React.RefAttributes<any>>;
30
31
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.31.5",
3
+ "version": "78.33.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/"
@@ -108,7 +108,7 @@
108
108
  "@atlaskit/editor-json-transformer": "^8.11.0",
109
109
  "@atlaskit/editor-palette": "1.5.3",
110
110
  "@atlaskit/editor-prosemirror": "4.0.0",
111
- "@atlaskit/editor-shared-styles": "^2.9.0",
111
+ "@atlaskit/editor-shared-styles": "^2.10.0",
112
112
  "@atlaskit/editor-tables": "^2.7.0",
113
113
  "@atlaskit/emoji": "^67.6.0",
114
114
  "@atlaskit/icon": "^22.1.0",