@atlaskit/editor-common 74.7.4 → 74.7.6

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,17 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 74.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0edc12510fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0edc12510fb) - Updating types, examples and general clean up of Resizer component
8
+
9
+ ## 74.7.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`12d33fa653a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/12d33fa653a) - [ED-17762] Fix nested table rescale logic when the context menu opens
14
+
3
15
  ## 74.7.4
4
16
 
5
17
  ### Patch Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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 = "74.7.4";
19
+ var packageVersion = "74.7.6";
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
@@ -38,12 +38,25 @@ var getParentNodeWidth = function getParentNodeWidth(pos, state, containerWidth,
38
38
  layout = breakoutMark.attrs.mode;
39
39
  }
40
40
  var parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
41
+
42
+ // TODO: ED-15663
43
+ // Please, do not copy or use this kind of code below
44
+ // @ts-ignore
45
+ var contextPanelPluginKey = {
46
+ key: 'contextPanelPluginKey$',
47
+ getState: function getState(state) {
48
+ return state['contextPanelPluginKey$'];
49
+ }
50
+ };
41
51
  if (node.type === schema.nodes.layoutSection) {
52
+ var _contextPanelPluginKe, _contextPanelPluginKe2;
42
53
  parentWidth += _editorSharedStyles.akLayoutGutterOffset * 2; // extra width that gets added to layout
43
54
 
44
- if (containerWidth.width > _editorSharedStyles.gridMediumMaxWidth) {
55
+ // Calculate width of parent layout column when
56
+ // Parallel layout with viewport greater than 1024px
57
+ // OR side panel of an extension is open and change the node width to smaller than containerWidth
58
+ if (containerWidth.width > _editorSharedStyles.gridMediumMaxWidth || ((_contextPanelPluginKe = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe === void 0 ? void 0 : _contextPanelPluginKe.contents.length) > 0 && ((_contextPanelPluginKe2 = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe2 === void 0 ? void 0 : _contextPanelPluginKe2.contents[0]) !== undefined) {
45
59
  parentWidth -= (_layout.LAYOUT_SECTION_MARGIN + 2) * (node.childCount - 1); // margin between sections
46
-
47
60
  var $pos = state.doc.resolve(pos);
48
61
  var column = (0, _prosemirrorUtils.findParentNodeOfTypeClosestToPos)($pos, [state.schema.nodes.layoutColumn]);
49
62
  if (column && column.node && !isNaN(column.node.attrs.width)) {
@@ -1,30 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = ResizerNext;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
11
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+ var _react = _interopRequireWildcard(require("react"));
10
14
  var _classnames3 = _interopRequireDefault(require("classnames"));
11
15
  var _reResizable = require("re-resizable");
12
16
  var _resizer = require("../styles/shared/resizer");
17
+ var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "resizeRatio", "innerPadding"];
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
20
  function ResizerNext(props) {
14
21
  var _classnames, _classnames2;
15
- var resizable = _react.default.useRef(null);
16
- var handleResize = props.handleResize,
22
+ var _useState = (0, _react.useState)(false),
23
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
24
+ isResizing = _useState2[0],
25
+ setIsResizing = _useState2[1];
26
+ var resizable = (0, _react.useRef)(null);
27
+ var width = props.width,
28
+ children = props.children,
29
+ handleClassName = props.handleClassName,
30
+ className = props.className,
31
+ handleResize = props.handleResize,
17
32
  handleResizeStart = props.handleResizeStart,
18
33
  handleResizeStop = props.handleResizeStop,
19
- _props$handlerHeightS = props.handlerHeightSize,
20
- handlerHeightSize = _props$handlerHeightS === void 0 ? 'medium' : _props$handlerHeightS,
34
+ _props$handleHeightSi = props.handleHeightSize,
35
+ handleHeightSize = _props$handleHeightSi === void 0 ? 'medium' : _props$handleHeightSi,
21
36
  _props$handleAlignmen = props.handleAlignmentMethod,
22
37
  handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen,
23
38
  _props$resizeRatio = props.resizeRatio,
24
- resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio;
39
+ resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio,
40
+ _props$innerPadding = props.innerPadding,
41
+ innerPadding = _props$innerPadding === void 0 ? _resizer.resizerHandlePadding : _props$innerPadding,
42
+ otherProps = (0, _objectWithoutProperties2.default)(props, _excluded);
25
43
  var onResizeStart = _react.default.useCallback(function (event) {
26
44
  // prevent creating a drag event on Firefox
27
45
  event.preventDefault();
46
+ setIsResizing(true);
28
47
  handleResizeStart();
29
48
  }, [handleResizeStart]);
30
49
  var onResize = _react.default.useCallback(function (_event, _direction, _elementRef, delta) {
@@ -51,13 +70,13 @@ function ResizerNext(props) {
51
70
  width: resizableCurrent.state.original.width,
52
71
  height: resizableCurrent.state.original.height
53
72
  };
73
+ setIsResizing(false);
54
74
  handleResizeStop(originalState, delta);
55
75
  }, [handleResizeStop]);
56
76
  var handles = {
57
- left: (0, _classnames3.default)((_classnames = {}, (0, _defineProperty2.default)(_classnames, "".concat(props.handleClassName, "-left"), !!props.handleClassName), (0, _defineProperty2.default)(_classnames, _resizer.resizerHandleLeftClassName, !props.handleClassName), (0, _defineProperty2.default)(_classnames, _resizer.resizerHandlerClassName[handlerHeightSize], true), (0, _defineProperty2.default)(_classnames, _resizer.resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames)),
58
- right: (0, _classnames3.default)((_classnames2 = {}, (0, _defineProperty2.default)(_classnames2, "".concat(props.handleClassName, "-right"), !!props.handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleRightClassName, !props.handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandlerClassName[handlerHeightSize], true), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
77
+ left: (0, _classnames3.default)(_resizer.resizerHandlerClassName[handleHeightSize], (_classnames = {}, (0, _defineProperty2.default)(_classnames, "".concat(handleClassName, "-left"), !!handleClassName), (0, _defineProperty2.default)(_classnames, _resizer.resizerHandleLeftClassName, !handleClassName), (0, _defineProperty2.default)(_classnames, _resizer.resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames)),
78
+ right: (0, _classnames3.default)(_resizer.resizerHandlerClassName[handleHeightSize], (_classnames2 = {}, (0, _defineProperty2.default)(_classnames2, "".concat(handleClassName, "-right"), !!handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleRightClassName, !handleClassName), (0, _defineProperty2.default)(_classnames2, _resizer.resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
59
79
  };
60
- var innerPadding = props.innerPadding || _resizer.resizerHandlePadding;
61
80
  var handleStyles = {
62
81
  left: {
63
82
  width: '24px',
@@ -72,27 +91,22 @@ function ResizerNext(props) {
72
91
  pointerEvents: 'auto'
73
92
  }
74
93
  };
75
- var className = (0, _classnames3.default)(props.className, _resizer.resizerItemClassName);
76
- return /*#__PURE__*/_react.default.createElement(_reResizable.Resizable, {
94
+ var resizerClassName = (0, _classnames3.default)(className, _resizer.resizerItemClassName, {
95
+ 'is-resizing': isResizing
96
+ });
97
+ return /*#__PURE__*/_react.default.createElement(_reResizable.Resizable, (0, _extends2.default)({
77
98
  ref: resizable,
78
99
  size: {
79
- width: props.width,
100
+ width: width,
80
101
  // just content itself (no paddings)
81
102
  height: 'auto'
82
103
  },
83
- maxWidth: props.maxWidth,
84
- minWidth: props.minWidth,
85
- className: className,
86
- enable: props.enable,
104
+ className: resizerClassName,
87
105
  handleClasses: handles,
88
106
  handleStyles: handleStyles,
89
- handleWrapperStyle: props.handleWrapperStyle // is used to override the style of resize handles wrapper, needed for media when it is selected and caption appears makes sure the handlers won't jump.
90
- ,
91
- handleComponent: props.handleComponent // in media was added as a workaround to fix Up arrow key bug when media has caption and the cursor is place below the image. Our epic has a separate ticket to address this problem.
92
- ,
93
107
  onResizeStart: onResizeStart,
94
108
  onResize: onResize,
95
109
  onResizeStop: onResizeStop,
96
110
  resizeRatio: resizeRatio
97
- }, props.children);
111
+ }, otherProps), children);
98
112
  }
@@ -24,7 +24,7 @@ var _templateObject, _templateObject2, _templateObject3;
24
24
  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); }; }
25
25
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "74.7.4";
27
+ var packageVersion = "74.7.6";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -45,7 +45,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
45
45
  }
46
46
  });
47
47
  exports.messages = messages;
48
- var BORDER_RADIUS = "var(--ds-radius-100, 4px)";
48
+ var BORDER_RADIUS = "var(--ds-border-radius-100, 4px)";
49
49
  var EXPAND_COLLAPSED_BACKGROUND = "var(--ds-background-neutral-subtle, transparent)";
50
50
  var EXPAND_SELECTED_BACKGROUND = (0, _components.themed)({
51
51
  light: "var(--ds-surface, rgba(255, 255, 255, 0.6))",
@@ -71,7 +71,7 @@ var expandIconWrapperStyle = function expandIconWrapperStyle(props) {
71
71
  return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n cursor: pointer;\n display: flex;\n color: ", ";\n border-radius: ", ";\n width: 24px;\n height: 24px;\n\n &:hover {\n background: ", ";\n }\n\n svg {\n transition: transform 0.2s ", ";\n }\n"])), (0, _components.themed)({
72
72
  light: "var(--ds-icon, ".concat(colors.N90, ")"),
73
73
  dark: "var(--ds-icon, #d9dde3)"
74
- })(props), "var(--ds-radius-100, 4px)", "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"), _editorSharedStyles.akEditorSwoopCubicBezier);
74
+ })(props), "var(--ds-border-radius-100, 4px)", "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"), _editorSharedStyles.akEditorSwoopCubicBezier);
75
75
  };
76
76
  var expandIconWrapperExpandedStyle = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n svg {\n transform: rotate(90deg);\n }\n"])));
77
77
  var expandLayoutWrapperStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: ", ";\n height: ", ";\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.7.4",
3
+ "version": "74.7.6",
4
4
  "sideEffects": false
5
5
  }
@@ -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 = "74.7.4";
3
+ const packageVersion = "74.7.6";
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
@@ -32,12 +32,25 @@ export const getParentNodeWidth = (pos, state, containerWidth, isFullWidthModeEn
32
32
  layout = breakoutMark.attrs.mode;
33
33
  }
34
34
  let parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
35
+
36
+ // TODO: ED-15663
37
+ // Please, do not copy or use this kind of code below
38
+ // @ts-ignore
39
+ const contextPanelPluginKey = {
40
+ key: 'contextPanelPluginKey$',
41
+ getState: state => {
42
+ return state['contextPanelPluginKey$'];
43
+ }
44
+ };
35
45
  if (node.type === schema.nodes.layoutSection) {
46
+ var _contextPanelPluginKe, _contextPanelPluginKe2;
36
47
  parentWidth += akLayoutGutterOffset * 2; // extra width that gets added to layout
37
48
 
38
- if (containerWidth.width > gridMediumMaxWidth) {
49
+ // Calculate width of parent layout column when
50
+ // Parallel layout with viewport greater than 1024px
51
+ // OR side panel of an extension is open and change the node width to smaller than containerWidth
52
+ if (containerWidth.width > gridMediumMaxWidth || ((_contextPanelPluginKe = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe === void 0 ? void 0 : _contextPanelPluginKe.contents.length) > 0 && ((_contextPanelPluginKe2 = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe2 === void 0 ? void 0 : _contextPanelPluginKe2.contents[0]) !== undefined) {
39
53
  parentWidth -= (LAYOUT_SECTION_MARGIN + 2) * (node.childCount - 1); // margin between sections
40
-
41
54
  const $pos = state.doc.resolve(pos);
42
55
  const column = findParentNodeOfTypeClosestToPos($pos, [state.schema.nodes.layoutColumn]);
43
56
  if (column && column.node && !isNaN(column.node.attrs.width)) {
@@ -1,20 +1,29 @@
1
- import React from 'react';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useRef, useState } from 'react';
2
3
  import classnames from 'classnames';
3
4
  import { Resizable } from 're-resizable';
4
5
  import { resizerHandleLeftClassName, resizerHandlePadding, resizerHandlerClassName, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleZIndex, resizerItemClassName } from '../styles/shared/resizer';
5
6
  export default function ResizerNext(props) {
6
- const resizable = React.useRef(null);
7
+ const [isResizing, setIsResizing] = useState(false);
8
+ const resizable = useRef(null);
7
9
  const {
10
+ width,
11
+ children,
12
+ handleClassName,
13
+ className,
8
14
  handleResize,
9
15
  handleResizeStart,
10
16
  handleResizeStop,
11
- handlerHeightSize = 'medium',
17
+ handleHeightSize = 'medium',
12
18
  handleAlignmentMethod = 'center',
13
- resizeRatio = 1
19
+ resizeRatio = 1,
20
+ innerPadding = resizerHandlePadding,
21
+ ...otherProps
14
22
  } = props;
15
23
  const onResizeStart = React.useCallback(event => {
16
24
  // prevent creating a drag event on Firefox
17
25
  event.preventDefault();
26
+ setIsResizing(true);
18
27
  handleResizeStart();
19
28
  }, [handleResizeStart]);
20
29
  const onResize = React.useCallback((_event, _direction, _elementRef, delta) => {
@@ -41,23 +50,21 @@ export default function ResizerNext(props) {
41
50
  width: resizableCurrent.state.original.width,
42
51
  height: resizableCurrent.state.original.height
43
52
  };
53
+ setIsResizing(false);
44
54
  handleResizeStop(originalState, delta);
45
55
  }, [handleResizeStop]);
46
56
  const handles = {
47
- left: classnames({
48
- [`${props.handleClassName}-left`]: !!props.handleClassName,
49
- [resizerHandleLeftClassName]: !props.handleClassName,
50
- [resizerHandlerClassName[handlerHeightSize]]: true,
57
+ left: classnames(resizerHandlerClassName[handleHeightSize], {
58
+ [`${handleClassName}-left`]: !!handleClassName,
59
+ [resizerHandleLeftClassName]: !handleClassName,
51
60
  [resizerHandleStickyClassName]: handleAlignmentMethod === 'sticky'
52
61
  }),
53
- right: classnames({
54
- [`${props.handleClassName}-right`]: !!props.handleClassName,
55
- [resizerHandleRightClassName]: !props.handleClassName,
56
- [resizerHandlerClassName[handlerHeightSize]]: true,
62
+ right: classnames(resizerHandlerClassName[handleHeightSize], {
63
+ [`${handleClassName}-right`]: !!handleClassName,
64
+ [resizerHandleRightClassName]: !handleClassName,
57
65
  [resizerHandleStickyClassName]: handleAlignmentMethod === 'sticky'
58
66
  })
59
67
  };
60
- const innerPadding = props.innerPadding || resizerHandlePadding;
61
68
  const handleStyles = {
62
69
  left: {
63
70
  width: '24px',
@@ -72,27 +79,22 @@ export default function ResizerNext(props) {
72
79
  pointerEvents: 'auto'
73
80
  }
74
81
  };
75
- const className = classnames(props.className, resizerItemClassName);
76
- return /*#__PURE__*/React.createElement(Resizable, {
82
+ const resizerClassName = classnames(className, resizerItemClassName, {
83
+ 'is-resizing': isResizing
84
+ });
85
+ return /*#__PURE__*/React.createElement(Resizable, _extends({
77
86
  ref: resizable,
78
87
  size: {
79
- width: props.width,
88
+ width,
80
89
  // just content itself (no paddings)
81
90
  height: 'auto'
82
91
  },
83
- maxWidth: props.maxWidth,
84
- minWidth: props.minWidth,
85
- className: className,
86
- enable: props.enable,
92
+ className: resizerClassName,
87
93
  handleClasses: handles,
88
94
  handleStyles: handleStyles,
89
- handleWrapperStyle: props.handleWrapperStyle // is used to override the style of resize handles wrapper, needed for media when it is selected and caption appears makes sure the handlers won't jump.
90
- ,
91
- handleComponent: props.handleComponent // in media was added as a workaround to fix Up arrow key bug when media has caption and the cursor is place below the image. Our epic has a separate ticket to address this problem.
92
- ,
93
95
  onResizeStart: onResizeStart,
94
96
  onResize: onResize,
95
97
  onResizeStop: onResizeStop,
96
98
  resizeRatio: resizeRatio
97
- }, props.children);
99
+ }, otherProps), children);
98
100
  }
@@ -8,7 +8,7 @@ import { themed } from '@atlaskit/theme/components';
8
8
  import { borderRadius } from '@atlaskit/theme/constants';
9
9
  import Layer from '../Layer';
10
10
  const packageName = "@atlaskit/editor-common";
11
- const packageVersion = "74.7.4";
11
+ const packageVersion = "74.7.6";
12
12
  const halfFocusRing = 1;
13
13
  const dropOffset = '0, 8';
14
14
  class DropList extends Component {
@@ -30,7 +30,7 @@ export const messages = defineMessages({
30
30
  description: 'Placeholder text for an expand node title input field'
31
31
  }
32
32
  });
33
- const BORDER_RADIUS = "var(--ds-radius-100, 4px)";
33
+ const BORDER_RADIUS = "var(--ds-border-radius-100, 4px)";
34
34
  const EXPAND_COLLAPSED_BACKGROUND = "var(--ds-background-neutral-subtle, transparent)";
35
35
  const EXPAND_SELECTED_BACKGROUND = themed({
36
36
  light: "var(--ds-surface, rgba(255, 255, 255, 0.6))",
@@ -57,7 +57,7 @@ const expandIconWrapperStyle = props => css`
57
57
  light: `var(--ds-icon, ${colors.N90})`,
58
58
  dark: "var(--ds-icon, #d9dde3)"
59
59
  })(props)};
60
- border-radius: ${"var(--ds-radius-100, 4px)"};
60
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
61
61
  width: 24px;
62
62
  height: 24px;
63
63
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.7.4",
3
+ "version": "74.7.6",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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 = "74.7.4";
9
+ var packageVersion = "74.7.6";
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
@@ -30,12 +30,25 @@ export var getParentNodeWidth = function getParentNodeWidth(pos, state, containe
30
30
  layout = breakoutMark.attrs.mode;
31
31
  }
32
32
  var parentWidth = calcBreakoutNodeWidth(layout, containerWidth, isFullWidthModeEnabled);
33
+
34
+ // TODO: ED-15663
35
+ // Please, do not copy or use this kind of code below
36
+ // @ts-ignore
37
+ var contextPanelPluginKey = {
38
+ key: 'contextPanelPluginKey$',
39
+ getState: function getState(state) {
40
+ return state['contextPanelPluginKey$'];
41
+ }
42
+ };
33
43
  if (node.type === schema.nodes.layoutSection) {
44
+ var _contextPanelPluginKe, _contextPanelPluginKe2;
34
45
  parentWidth += akLayoutGutterOffset * 2; // extra width that gets added to layout
35
46
 
36
- if (containerWidth.width > gridMediumMaxWidth) {
47
+ // Calculate width of parent layout column when
48
+ // Parallel layout with viewport greater than 1024px
49
+ // OR side panel of an extension is open and change the node width to smaller than containerWidth
50
+ if (containerWidth.width > gridMediumMaxWidth || ((_contextPanelPluginKe = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe === void 0 ? void 0 : _contextPanelPluginKe.contents.length) > 0 && ((_contextPanelPluginKe2 = contextPanelPluginKey.getState(state)) === null || _contextPanelPluginKe2 === void 0 ? void 0 : _contextPanelPluginKe2.contents[0]) !== undefined) {
37
51
  parentWidth -= (LAYOUT_SECTION_MARGIN + 2) * (node.childCount - 1); // margin between sections
38
-
39
52
  var $pos = state.doc.resolve(pos);
40
53
  var column = findParentNodeOfTypeClosestToPos($pos, [state.schema.nodes.layoutColumn]);
41
54
  if (column && column.node && !isNaN(column.node.attrs.width)) {
@@ -1,23 +1,39 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React from 'react';
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ var _excluded = ["width", "children", "handleClassName", "className", "handleResize", "handleResizeStart", "handleResizeStop", "handleHeightSize", "handleAlignmentMethod", "resizeRatio", "innerPadding"];
6
+ import React, { useRef, useState } from 'react';
3
7
  import classnames from 'classnames';
4
8
  import { Resizable } from 're-resizable';
5
9
  import { resizerHandleLeftClassName, resizerHandlePadding, resizerHandlerClassName, resizerHandleRightClassName, resizerHandleStickyClassName, resizerHandleZIndex, resizerItemClassName } from '../styles/shared/resizer';
6
10
  export default function ResizerNext(props) {
7
11
  var _classnames, _classnames2;
8
- var resizable = React.useRef(null);
9
- var handleResize = props.handleResize,
12
+ var _useState = useState(false),
13
+ _useState2 = _slicedToArray(_useState, 2),
14
+ isResizing = _useState2[0],
15
+ setIsResizing = _useState2[1];
16
+ var resizable = useRef(null);
17
+ var width = props.width,
18
+ children = props.children,
19
+ handleClassName = props.handleClassName,
20
+ className = props.className,
21
+ handleResize = props.handleResize,
10
22
  handleResizeStart = props.handleResizeStart,
11
23
  handleResizeStop = props.handleResizeStop,
12
- _props$handlerHeightS = props.handlerHeightSize,
13
- handlerHeightSize = _props$handlerHeightS === void 0 ? 'medium' : _props$handlerHeightS,
24
+ _props$handleHeightSi = props.handleHeightSize,
25
+ handleHeightSize = _props$handleHeightSi === void 0 ? 'medium' : _props$handleHeightSi,
14
26
  _props$handleAlignmen = props.handleAlignmentMethod,
15
27
  handleAlignmentMethod = _props$handleAlignmen === void 0 ? 'center' : _props$handleAlignmen,
16
28
  _props$resizeRatio = props.resizeRatio,
17
- resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio;
29
+ resizeRatio = _props$resizeRatio === void 0 ? 1 : _props$resizeRatio,
30
+ _props$innerPadding = props.innerPadding,
31
+ innerPadding = _props$innerPadding === void 0 ? resizerHandlePadding : _props$innerPadding,
32
+ otherProps = _objectWithoutProperties(props, _excluded);
18
33
  var onResizeStart = React.useCallback(function (event) {
19
34
  // prevent creating a drag event on Firefox
20
35
  event.preventDefault();
36
+ setIsResizing(true);
21
37
  handleResizeStart();
22
38
  }, [handleResizeStart]);
23
39
  var onResize = React.useCallback(function (_event, _direction, _elementRef, delta) {
@@ -44,13 +60,13 @@ export default function ResizerNext(props) {
44
60
  width: resizableCurrent.state.original.width,
45
61
  height: resizableCurrent.state.original.height
46
62
  };
63
+ setIsResizing(false);
47
64
  handleResizeStop(originalState, delta);
48
65
  }, [handleResizeStop]);
49
66
  var handles = {
50
- left: classnames((_classnames = {}, _defineProperty(_classnames, "".concat(props.handleClassName, "-left"), !!props.handleClassName), _defineProperty(_classnames, resizerHandleLeftClassName, !props.handleClassName), _defineProperty(_classnames, resizerHandlerClassName[handlerHeightSize], true), _defineProperty(_classnames, resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames)),
51
- right: classnames((_classnames2 = {}, _defineProperty(_classnames2, "".concat(props.handleClassName, "-right"), !!props.handleClassName), _defineProperty(_classnames2, resizerHandleRightClassName, !props.handleClassName), _defineProperty(_classnames2, resizerHandlerClassName[handlerHeightSize], true), _defineProperty(_classnames2, resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
67
+ left: classnames(resizerHandlerClassName[handleHeightSize], (_classnames = {}, _defineProperty(_classnames, "".concat(handleClassName, "-left"), !!handleClassName), _defineProperty(_classnames, resizerHandleLeftClassName, !handleClassName), _defineProperty(_classnames, resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames)),
68
+ right: classnames(resizerHandlerClassName[handleHeightSize], (_classnames2 = {}, _defineProperty(_classnames2, "".concat(handleClassName, "-right"), !!handleClassName), _defineProperty(_classnames2, resizerHandleRightClassName, !handleClassName), _defineProperty(_classnames2, resizerHandleStickyClassName, handleAlignmentMethod === 'sticky'), _classnames2))
52
69
  };
53
- var innerPadding = props.innerPadding || resizerHandlePadding;
54
70
  var handleStyles = {
55
71
  left: {
56
72
  width: '24px',
@@ -65,27 +81,22 @@ export default function ResizerNext(props) {
65
81
  pointerEvents: 'auto'
66
82
  }
67
83
  };
68
- var className = classnames(props.className, resizerItemClassName);
69
- return /*#__PURE__*/React.createElement(Resizable, {
84
+ var resizerClassName = classnames(className, resizerItemClassName, {
85
+ 'is-resizing': isResizing
86
+ });
87
+ return /*#__PURE__*/React.createElement(Resizable, _extends({
70
88
  ref: resizable,
71
89
  size: {
72
- width: props.width,
90
+ width: width,
73
91
  // just content itself (no paddings)
74
92
  height: 'auto'
75
93
  },
76
- maxWidth: props.maxWidth,
77
- minWidth: props.minWidth,
78
- className: className,
79
- enable: props.enable,
94
+ className: resizerClassName,
80
95
  handleClasses: handles,
81
96
  handleStyles: handleStyles,
82
- handleWrapperStyle: props.handleWrapperStyle // is used to override the style of resize handles wrapper, needed for media when it is selected and caption appears makes sure the handlers won't jump.
83
- ,
84
- handleComponent: props.handleComponent // in media was added as a workaround to fix Up arrow key bug when media has caption and the cursor is place below the image. Our epic has a separate ticket to address this problem.
85
- ,
86
97
  onResizeStart: onResizeStart,
87
98
  onResize: onResize,
88
99
  onResizeStop: onResizeStop,
89
100
  resizeRatio: resizeRatio
90
- }, props.children);
101
+ }, otherProps), children);
91
102
  }
@@ -18,7 +18,7 @@ import { themed } from '@atlaskit/theme/components';
18
18
  import { borderRadius } from '@atlaskit/theme/constants';
19
19
  import Layer from '../Layer';
20
20
  var packageName = "@atlaskit/editor-common";
21
- var packageVersion = "74.7.4";
21
+ var packageVersion = "74.7.6";
22
22
  var halfFocusRing = 1;
23
23
  var dropOffset = '0, 8';
24
24
  var DropList = /*#__PURE__*/function (_Component) {
@@ -34,7 +34,7 @@ export var messages = defineMessages({
34
34
  description: 'Placeholder text for an expand node title input field'
35
35
  }
36
36
  });
37
- var BORDER_RADIUS = "var(--ds-radius-100, 4px)";
37
+ var BORDER_RADIUS = "var(--ds-border-radius-100, 4px)";
38
38
  var EXPAND_COLLAPSED_BACKGROUND = "var(--ds-background-neutral-subtle, transparent)";
39
39
  var EXPAND_SELECTED_BACKGROUND = themed({
40
40
  light: "var(--ds-surface, rgba(255, 255, 255, 0.6))",
@@ -59,7 +59,7 @@ var expandIconWrapperStyle = function expandIconWrapperStyle(props) {
59
59
  return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n color: ", ";\n border-radius: ", ";\n width: 24px;\n height: 24px;\n\n &:hover {\n background: ", ";\n }\n\n svg {\n transition: transform 0.2s ", ";\n }\n"])), themed({
60
60
  light: "var(--ds-icon, ".concat(colors.N90, ")"),
61
61
  dark: "var(--ds-icon, #d9dde3)"
62
- })(props), "var(--ds-radius-100, 4px)", "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"), akEditorSwoopCubicBezier);
62
+ })(props), "var(--ds-border-radius-100, 4px)", "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"), akEditorSwoopCubicBezier);
63
63
  };
64
64
  var expandIconWrapperExpandedStyle = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n svg {\n transform: rotate(90deg);\n }\n"])));
65
65
  export var expandLayoutWrapperStyle = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n"])), "var(--ds-space-300, 24px)", "var(--ds-space-300, 24px)");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.7.4",
3
+ "version": "74.7.6",
4
4
  "sideEffects": false
5
5
  }
@@ -1,14 +1,10 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { HandleComponent } from 're-resizable';
3
- import { EnabledHandles, HandleAlignmentMethod, HandleResize, HandlerHeightSizeType } from './types';
4
- export interface ResizableNumberSize {
5
- width: number;
6
- height: number;
7
- }
3
+ import { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandleResize } from './types';
8
4
  export type ResizerProps = {
9
5
  enable: EnabledHandles;
10
6
  width: number;
11
- handleResizeStart: () => number;
7
+ handleResizeStart: () => void;
12
8
  handleResize: HandleResize;
13
9
  handleResizeStop: HandleResize;
14
10
  innerPadding?: number;
@@ -18,7 +14,7 @@ export type ResizerProps = {
18
14
  maxWidth?: number;
19
15
  handleWrapperStyle?: React.CSSProperties;
20
16
  handleComponent?: HandleComponent;
21
- handlerHeightSize?: HandlerHeightSizeType;
17
+ handleHeightSize?: HandleHeightSizeType;
22
18
  handleAlignmentMethod?: HandleAlignmentMethod;
23
19
  resizeRatio?: number;
24
20
  };
@@ -1,2 +1,2 @@
1
1
  export { default as ResizerNext } from './Resizer';
2
- export type { HandlerHeightSizeType, EnabledHandles } from './types';
2
+ export type { HandleHeightSizeType, EnabledHandles, HandleResize, } from './types';
@@ -3,18 +3,17 @@ export type EnabledHandles = {
3
3
  left?: boolean;
4
4
  right?: boolean;
5
5
  };
6
+ export type Dimensions = {
7
+ width: number;
8
+ height: number;
9
+ };
6
10
  export type HandleResize = (newWidth: {
7
11
  x: number;
8
12
  y: number;
9
- width: number;
10
- height: number;
11
- }, delta: {
12
- width: number;
13
- height: number;
14
- }) => number;
13
+ } & Dimensions, delta: Dimensions) => void;
15
14
  export type HandleStyles = {
16
15
  right?: React.CSSProperties;
17
16
  left?: React.CSSProperties;
18
17
  };
19
- export type HandlerHeightSizeType = 'small' | 'medium' | 'large';
18
+ export type HandleHeightSizeType = 'small' | 'medium' | 'large';
20
19
  export type HandleAlignmentMethod = 'center' | 'sticky';
@@ -1,14 +1,10 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { HandleComponent } from 're-resizable';
3
- import { EnabledHandles, HandleAlignmentMethod, HandleResize, HandlerHeightSizeType } from './types';
4
- export interface ResizableNumberSize {
5
- width: number;
6
- height: number;
7
- }
3
+ import { EnabledHandles, HandleAlignmentMethod, HandleHeightSizeType, HandleResize } from './types';
8
4
  export type ResizerProps = {
9
5
  enable: EnabledHandles;
10
6
  width: number;
11
- handleResizeStart: () => number;
7
+ handleResizeStart: () => void;
12
8
  handleResize: HandleResize;
13
9
  handleResizeStop: HandleResize;
14
10
  innerPadding?: number;
@@ -18,7 +14,7 @@ export type ResizerProps = {
18
14
  maxWidth?: number;
19
15
  handleWrapperStyle?: React.CSSProperties;
20
16
  handleComponent?: HandleComponent;
21
- handlerHeightSize?: HandlerHeightSizeType;
17
+ handleHeightSize?: HandleHeightSizeType;
22
18
  handleAlignmentMethod?: HandleAlignmentMethod;
23
19
  resizeRatio?: number;
24
20
  };
@@ -1,2 +1,2 @@
1
1
  export { default as ResizerNext } from './Resizer';
2
- export type { HandlerHeightSizeType, EnabledHandles } from './types';
2
+ export type { HandleHeightSizeType, EnabledHandles, HandleResize, } from './types';
@@ -3,18 +3,17 @@ export type EnabledHandles = {
3
3
  left?: boolean;
4
4
  right?: boolean;
5
5
  };
6
+ export type Dimensions = {
7
+ width: number;
8
+ height: number;
9
+ };
6
10
  export type HandleResize = (newWidth: {
7
11
  x: number;
8
12
  y: number;
9
- width: number;
10
- height: number;
11
- }, delta: {
12
- width: number;
13
- height: number;
14
- }) => number;
13
+ } & Dimensions, delta: Dimensions) => void;
15
14
  export type HandleStyles = {
16
15
  right?: React.CSSProperties;
17
16
  left?: React.CSSProperties;
18
17
  };
19
- export type HandlerHeightSizeType = 'small' | 'medium' | 'large';
18
+ export type HandleHeightSizeType = 'small' | 'medium' | 'large';
20
19
  export type HandleAlignmentMethod = 'center' | 'sticky';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "74.7.4",
3
+ "version": "74.7.6",
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/"
@@ -71,7 +71,7 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@atlaskit/activity-provider": "^2.4.0",
74
- "@atlaskit/adf-schema": "^25.8.0",
74
+ "@atlaskit/adf-schema": "^25.9.0",
75
75
  "@atlaskit/adf-utils": "^18.4.0",
76
76
  "@atlaskit/analytics-listeners": "^8.7.0",
77
77
  "@atlaskit/analytics-namespaced-context": "^6.7.0",
@@ -98,7 +98,7 @@
98
98
  "@atlaskit/smart-user-picker": "^6.1.0",
99
99
  "@atlaskit/task-decision": "^17.6.0",
100
100
  "@atlaskit/theme": "^12.5.0",
101
- "@atlaskit/tokens": "^1.5.0",
101
+ "@atlaskit/tokens": "^1.6.0",
102
102
  "@atlaskit/tooltip": "^17.8.0",
103
103
  "@atlaskit/ufo": "^0.2.0",
104
104
  "@atlaskit/width-detector": "^4.1.0",