@atlaskit/editor-core 187.44.4 → 187.44.7

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 (35) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +5 -3
  3. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  4. package/dist/cjs/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
  5. package/dist/cjs/plugins/status/actions.js +15 -2
  6. package/dist/cjs/plugins/status/index.js +2 -2
  7. package/dist/cjs/plugins/status/ui/statusPicker.js +69 -4
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +5 -3
  10. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  11. package/dist/es2019/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
  12. package/dist/es2019/plugins/status/actions.js +16 -2
  13. package/dist/es2019/plugins/status/index.js +2 -2
  14. package/dist/es2019/plugins/status/ui/statusPicker.js +70 -2
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +5 -3
  17. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -1
  18. package/dist/esm/plugins/selection/pm-plugins/events/create-selection-between.js +10 -3
  19. package/dist/esm/plugins/status/actions.js +15 -2
  20. package/dist/esm/plugins/status/index.js +2 -2
  21. package/dist/esm/plugins/status/ui/statusPicker.js +68 -3
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
  24. package/dist/types/plugins/status/actions.d.ts +2 -2
  25. package/dist/types/plugins/status/plugin.d.ts +1 -1
  26. package/dist/types/plugins/status/types.d.ts +5 -1
  27. package/dist/types/plugins/status/ui/statusPicker.d.ts +12 -5
  28. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Dropdown.d.ts +1 -0
  29. package/dist/types-ts4.5/plugins/status/actions.d.ts +2 -2
  30. package/dist/types-ts4.5/plugins/status/plugin.d.ts +1 -1
  31. package/dist/types-ts4.5/plugins/status/types.d.ts +5 -1
  32. package/dist/types-ts4.5/plugins/status/ui/statusPicker.d.ts +12 -5
  33. package/package.json +8 -4
  34. package/report.api.md +17 -2
  35. package/tmp/api-report-tmp.d.ts +15 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.44.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`beb32df5147`](https://bitbucket.org/atlassian/atlassian-frontend/commits/beb32df5147) - [ECA11Y-45] [ECA11Y-22] Change the tab key handling the status popup to improve accessibility.
8
+ - Updated dependencies
9
+
10
+ ## 187.44.6
11
+
12
+ ### Patch Changes
13
+
14
+ - [`21305ee6254`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21305ee6254) - ED-19874 Align the dropdown with the floating toolbar if there is a single button in the toolbar
15
+ - [`f7f51be4eac`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f7f51be4eac) - [ux] ED-19784: Adjust logic in onCreateSelectionBetween logic to prevent premature selections on multi-line selections inside block nodes.
16
+ - Updated dependencies
17
+
3
18
  ## 187.44.4
4
19
 
5
20
  ### Patch Changes
@@ -28,7 +28,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
28
28
  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) { (0, _defineProperty2.default)(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; }
29
29
  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); }; }
30
30
  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; } }
31
- var dropdownExpandContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px -4px;\n"])));
31
+ var dropdownExpandContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin: 0px ", ";\n"])), "var(--ds-space-negative-050, -4px)");
32
32
  var iconGroup = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n"])));
33
33
  var CompositeIcon = function CompositeIcon(_ref) {
34
34
  var icon = _ref.icon;
@@ -121,7 +121,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
121
121
  buttonTestId = _this$props2.buttonTestId,
122
122
  dropdownWidth = _this$props2.dropdownWidth,
123
123
  editorView = _this$props2.editorView,
124
- dropdownListId = _this$props2.dropdownListId;
124
+ dropdownListId = _this$props2.dropdownListId,
125
+ alignDropdownWithToolbar = _this$props2.alignDropdownWithToolbar;
125
126
  var trigger;
126
127
  if (icon) {
127
128
  var TriggerIcon = hideExpandIcon ? icon : (0, _react2.jsx)(CompositeIcon, {
@@ -175,7 +176,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
175
176
  fitHeight: fitHeight + fitTolerance,
176
177
  trigger: trigger,
177
178
  editorView: editorView,
178
- dropdownListId: dropdownListId
179
+ dropdownListId: dropdownListId,
180
+ alignDropdownWithParentElement: alignDropdownWithToolbar
179
181
  }, Array.isArray(options) ? this.renderArrayOptions(options) : options.render({
180
182
  hide: this.hide,
181
183
  dispatchCommand: dispatchCommand
@@ -149,7 +149,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
149
149
  buttonTestId: item.testId,
150
150
  editorView: editorView,
151
151
  setDisableParentScroll: scrollable ? setDisableScroll : undefined,
152
- dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList")
152
+ dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
153
+ alignDropdownWithToolbar: items.length === 1
153
154
  });
154
155
  case 'select':
155
156
  if (item.selectType === 'list') {
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.onCreateSelectionBetween = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
+ function isNodeContentEmpty(maybeNode) {
9
+ return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
10
+ }
8
11
  function findEmptySelectableParentNodePosition($pos, isValidPosition) {
9
12
  var doc = $pos.doc;
10
13
  if ($pos.pos + 1 > doc.content.size) {
@@ -42,8 +45,7 @@ var checkPositionNode = function checkPositionNode($pos) {
42
45
  if (maybeNode.isAtom) {
43
46
  return true;
44
47
  }
45
- var isParentEmpty = maybeNode.content.size === 0 || maybeNode.textContent === '';
46
- return isParentEmpty && _state.NodeSelection.isSelectable(maybeNode);
48
+ return isNodeContentEmpty(maybeNode) && _state.NodeSelection.isSelectable(maybeNode);
47
49
  };
48
50
  function findNextSelectionPosition(_ref) {
49
51
  var $targetHead = _ref.$targetHead,
@@ -60,7 +62,7 @@ function findNextSelectionPosition(_ref) {
60
62
  return null;
61
63
  }
62
64
  var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
63
- var _$head$parent;
65
+ var _$head$parent, _$head$parent2;
64
66
  if ($anchor.pos === $head.pos) {
65
67
  return null;
66
68
  }
@@ -72,6 +74,11 @@ var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor,
72
74
  if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
73
75
  return null;
74
76
  }
77
+
78
+ // If head is at the beginning of a non-empty textblock, let ProseMirror handle the text selection
79
+ if ((_$head$parent2 = $head.parent) !== null && _$head$parent2 !== void 0 && _$head$parent2.isTextblock && !isNodeContentEmpty($head.parent) && $head.parentOffset === 0) {
80
+ return null;
81
+ }
75
82
  var $nextHeadPosition = findNextSelectionPosition({
76
83
  $targetHead: $head,
77
84
  $anchor: $anchor,
@@ -114,12 +114,23 @@ var removeStatus = function removeStatus(showStatusPickerAt) {
114
114
  };
115
115
  };
116
116
  exports.removeStatus = removeStatus;
117
- var commitStatusPicker = function commitStatusPicker() {
117
+ var handleClosingByArrows = function handleClosingByArrows(closingMethod, state, showStatusPickerAt, tr) {
118
+ if (closingMethod === 'arrowLeft') {
119
+ // put cursor right before status Lozenge
120
+ tr = tr.setSelection(_state.Selection.near(state.tr.doc.resolve(showStatusPickerAt), -1));
121
+ } else if (closingMethod === 'arrowRight') {
122
+ // put cursor right after status Lozenge
123
+ tr = tr.setSelection(_state.Selection.near(state.tr.doc.resolve(showStatusPickerAt + 1)));
124
+ }
125
+ };
126
+ var commitStatusPicker = function commitStatusPicker(closingPayload) {
118
127
  return function (editorView) {
119
128
  var state = editorView.state,
120
129
  dispatch = editorView.dispatch;
121
130
  var _ref2 = _pluginKey.pluginKey.getState(state) || {},
122
131
  showStatusPickerAt = _ref2.showStatusPickerAt;
132
+ var _ref3 = closingPayload || {},
133
+ closingMethod = _ref3.closingMethod;
123
134
  if (!showStatusPickerAt) {
124
135
  return;
125
136
  }
@@ -132,7 +143,9 @@ var commitStatusPicker = function commitStatusPicker() {
132
143
  showStatusPickerAt: null,
133
144
  isNew: false
134
145
  });
135
- if (statusNode.attrs.text) {
146
+ if (closingMethod) {
147
+ handleClosingByArrows(closingMethod, state, showStatusPickerAt, tr);
148
+ } else if (statusNode.attrs.text) {
136
149
  // still has content - keep content
137
150
  // move selection after status if selection did not change
138
151
  if (tr.selection.from === showStatusPickerAt) {
@@ -79,8 +79,8 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
79
79
  onTextChanged: function onTextChanged(status) {
80
80
  (0, _actions.updateStatus)(status)(editorView.state, editorView.dispatch);
81
81
  },
82
- closeStatusPicker: function closeStatusPicker() {
83
- (0, _actions.commitStatusPicker)()(editorView);
82
+ closeStatusPicker: function closeStatusPicker(closingPayload) {
83
+ (0, _actions.commitStatusPicker)(closingPayload)(editorView);
84
84
  },
85
85
  onEnter: function onEnter() {
86
86
  (0, _actions.commitStatusPicker)()(editorView);
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = exports.StatusPickerWithoutAnalytcs = exports.InputMethod = void 0;
7
+ exports.default = exports.closingMethods = exports.StatusPickerWithoutAnalytcs = exports.InputMethod = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
@@ -36,7 +36,13 @@ var InputMethod = /*#__PURE__*/function (InputMethod) {
36
36
  return InputMethod;
37
37
  }({});
38
38
  exports.InputMethod = InputMethod;
39
- var pickerContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(_colors.N0, ")"), "var(--ds-space-100, 8px)", (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
39
+ var closingMethods = /*#__PURE__*/function (closingMethods) {
40
+ closingMethods["ArrowLeft"] = "arrowLeft";
41
+ closingMethods["ArrowRight"] = "arrowRight";
42
+ return closingMethods;
43
+ }({});
44
+ exports.closingMethods = closingMethods;
45
+ var pickerContainer = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n :focus {\n outline: none;\n }\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(_colors.N0, ")"), "var(--ds-space-100, 8px)", (0, _constants.borderRadius)(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
40
46
  var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
41
47
  (0, _inherits2.default)(StatusPickerWithoutAnalytcs, _React$Component);
42
48
  var _super = _createSuper(StatusPickerWithoutAnalytcs);
@@ -57,6 +63,55 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
57
63
  _this.inputMethod = InputMethod.escKey;
58
64
  _this.props.onEnter(_this.state);
59
65
  });
66
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleTabPress", function (event) {
67
+ var colorButtons = event.currentTarget.querySelectorAll('button');
68
+ var inputField = event.currentTarget.querySelector('input');
69
+ var isInputFocussed = document.activeElement === inputField;
70
+ var isButtonFocussed = Array.from(colorButtons).some(function (buttonElement) {
71
+ var _document;
72
+ return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
73
+ });
74
+ if (event !== null && event !== void 0 && event.shiftKey) {
75
+ /* shift + tab */
76
+ if (isInputFocussed) {
77
+ colorButtons[0].focus();
78
+ event.preventDefault();
79
+ }
80
+ /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
81
+ To correctly set focus to the input field instead of the first color button we need to set focus manually
82
+ */
83
+ if (isButtonFocussed) {
84
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
85
+ event.preventDefault();
86
+ }
87
+ } else {
88
+ /* tab */
89
+ if (isButtonFocussed) {
90
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
91
+ event.preventDefault();
92
+ }
93
+ }
94
+ });
95
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleArrow", function (event, closingMethod) {
96
+ var _document2;
97
+ if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === _this.popupBodyWrapper.current) {
98
+ var _this$popupBodyWrappe, _this$popupBodyWrappe2;
99
+ event.preventDefault();
100
+ (_this$popupBodyWrappe = _this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 ? void 0 : (_this$popupBodyWrappe2 = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe2 === void 0 ? void 0 : _this$popupBodyWrappe2.blur();
101
+ _this.props.closeStatusPicker({
102
+ closingMethod: closingMethod
103
+ });
104
+ }
105
+ });
106
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onKeyDown", function (event) {
107
+ var isTabPressed = event.key === 'Tab';
108
+ if (isTabPressed) {
109
+ return _this.handleTabPress(event);
110
+ }
111
+ if (event.key in closingMethods) {
112
+ return _this.handleArrow(event, closingMethods[event.key]);
113
+ }
114
+ });
60
115
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onColorHover", function (color) {
61
116
  _this.createStatusAnalyticsAndFireFunc({
62
117
  action: 'hovered',
@@ -120,6 +175,7 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
120
175
  });
121
176
  _this.state = _this.extractStateFromProps(props);
122
177
  _this.createStatusAnalyticsAndFireFunc = (0, _analytics.createStatusAnalyticsAndFire)(props.createAnalyticsEvent);
178
+ _this.popupBodyWrapper = /*#__PURE__*/_react.default.createRef();
123
179
  return _this;
124
180
  }
125
181
  (0, _createClass2.default)(StatusPickerWithoutAnalytcs, [{
@@ -172,6 +228,11 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
172
228
  value: function componentDidMount() {
173
229
  this.reset();
174
230
  this.fireStatusPopupOpenedAnalytics(this.state);
231
+ if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
232
+ var _this$popupBodyWrappe3, _this$popupBodyWrappe4;
233
+ // Wrapper should be focused only if status already exists otherwise input field will receive focus
234
+ (_this$popupBodyWrappe3 = this.popupBodyWrapper) === null || _this$popupBodyWrappe3 === void 0 ? void 0 : (_this$popupBodyWrappe4 = _this$popupBodyWrappe3.current) === null || _this$popupBodyWrappe4 === void 0 ? void 0 : _this$popupBodyWrappe4.focus();
235
+ }
175
236
  }
176
237
  }, {
177
238
  key: "componentWillUnmount",
@@ -226,10 +287,14 @@ var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
226
287
  fitHeight: 40,
227
288
  mountTo: mountTo,
228
289
  boundariesElement: boundariesElement,
229
- scrollableElement: scrollableElement
290
+ scrollableElement: scrollableElement,
291
+ closeOnTab: false
230
292
  }, (0, _react2.jsx)("div", {
231
293
  css: pickerContainer,
232
- onClick: this.handlePopupClick
294
+ tabIndex: -1,
295
+ ref: this.popupBodyWrapper,
296
+ onClick: this.handlePopupClick,
297
+ onKeyDown: this.onKeyDown
233
298
  }, (0, _react2.jsx)(_picker.StatusPicker, {
234
299
  autoFocus: isNew,
235
300
  selectedColor: color,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.44.4";
9
+ var version = "187.44.7";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -8,7 +8,7 @@ import UiDropdown from '../../../ui/Dropdown';
8
8
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
9
9
  import DropdownMenu, { itemSpacing, menuItemDimensions } from './DropdownMenu';
10
10
  const dropdownExpandContainer = css`
11
- margin: 0px -4px;
11
+ margin: 0px ${"var(--ds-space-negative-050, -4px)"};
12
12
  `;
13
13
  const iconGroup = css`
14
14
  display: flex;
@@ -97,7 +97,8 @@ export default class Dropdown extends Component {
97
97
  buttonTestId,
98
98
  dropdownWidth,
99
99
  editorView,
100
- dropdownListId
100
+ dropdownListId,
101
+ alignDropdownWithToolbar
101
102
  } = this.props;
102
103
  let trigger;
103
104
  if (icon) {
@@ -152,7 +153,8 @@ export default class Dropdown extends Component {
152
153
  fitHeight: fitHeight + fitTolerance,
153
154
  trigger: trigger,
154
155
  editorView: editorView,
155
- dropdownListId: dropdownListId
156
+ dropdownListId: dropdownListId,
157
+ alignDropdownWithParentElement: alignDropdownWithToolbar
156
158
  }, Array.isArray(options) ? this.renderArrayOptions(options) : options.render({
157
159
  hide: this.hide,
158
160
  dispatchCommand
@@ -116,7 +116,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
116
116
  buttonTestId: item.testId,
117
117
  editorView: editorView,
118
118
  setDisableParentScroll: scrollable ? setDisableScroll : undefined,
119
- dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList`
119
+ dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && `${item.id}-dropdownList`,
120
+ alignDropdownWithToolbar: items.length === 1
120
121
  });
121
122
  case 'select':
122
123
  if (item.selectType === 'list') {
@@ -1,4 +1,7 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ function isNodeContentEmpty(maybeNode) {
3
+ return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
4
+ }
2
5
  function findEmptySelectableParentNodePosition($pos, isValidPosition) {
3
6
  const {
4
7
  doc
@@ -38,8 +41,7 @@ const checkPositionNode = $pos => {
38
41
  if (maybeNode.isAtom) {
39
42
  return true;
40
43
  }
41
- const isParentEmpty = maybeNode.content.size === 0 || maybeNode.textContent === '';
42
- return isParentEmpty && NodeSelection.isSelectable(maybeNode);
44
+ return isNodeContentEmpty(maybeNode) && NodeSelection.isSelectable(maybeNode);
43
45
  };
44
46
  function findNextSelectionPosition({
45
47
  $targetHead,
@@ -57,7 +59,7 @@ function findNextSelectionPosition({
57
59
  return null;
58
60
  }
59
61
  export const onCreateSelectionBetween = (view, $anchor, $head) => {
60
- var _$head$parent;
62
+ var _$head$parent, _$head$parent2;
61
63
  if ($anchor.pos === $head.pos) {
62
64
  return null;
63
65
  }
@@ -69,6 +71,11 @@ export const onCreateSelectionBetween = (view, $anchor, $head) => {
69
71
  if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
70
72
  return null;
71
73
  }
74
+
75
+ // If head is at the beginning of a non-empty textblock, let ProseMirror handle the text selection
76
+ if ((_$head$parent2 = $head.parent) !== null && _$head$parent2 !== void 0 && _$head$parent2.isTextblock && !isNodeContentEmpty($head.parent) && $head.parentOffset === 0) {
77
+ return null;
78
+ }
72
79
  const $nextHeadPosition = findNextSelectionPosition({
73
80
  $targetHead: $head,
74
81
  $anchor,
@@ -94,7 +94,16 @@ export const removeStatus = showStatusPickerAt => (state, dispatch) => {
94
94
  }
95
95
  return true;
96
96
  };
97
- export const commitStatusPicker = () => editorView => {
97
+ const handleClosingByArrows = (closingMethod, state, showStatusPickerAt, tr) => {
98
+ if (closingMethod === 'arrowLeft') {
99
+ // put cursor right before status Lozenge
100
+ tr = tr.setSelection(Selection.near(state.tr.doc.resolve(showStatusPickerAt), -1));
101
+ } else if (closingMethod === 'arrowRight') {
102
+ // put cursor right after status Lozenge
103
+ tr = tr.setSelection(Selection.near(state.tr.doc.resolve(showStatusPickerAt + 1)));
104
+ }
105
+ };
106
+ export const commitStatusPicker = closingPayload => editorView => {
98
107
  const {
99
108
  state,
100
109
  dispatch
@@ -102,6 +111,9 @@ export const commitStatusPicker = () => editorView => {
102
111
  const {
103
112
  showStatusPickerAt
104
113
  } = pluginKey.getState(state) || {};
114
+ const {
115
+ closingMethod
116
+ } = closingPayload || {};
105
117
  if (!showStatusPickerAt) {
106
118
  return;
107
119
  }
@@ -114,7 +126,9 @@ export const commitStatusPicker = () => editorView => {
114
126
  showStatusPickerAt: null,
115
127
  isNew: false
116
128
  });
117
- if (statusNode.attrs.text) {
129
+ if (closingMethod) {
130
+ handleClosingByArrows(closingMethod, state, showStatusPickerAt, tr);
131
+ } else if (statusNode.attrs.text) {
118
132
  // still has content - keep content
119
133
  // move selection after status if selection did not change
120
134
  if (tr.selection.from === showStatusPickerAt) {
@@ -74,8 +74,8 @@ const baseStatusPlugin = ({
74
74
  onTextChanged: status => {
75
75
  updateStatus(status)(editorView.state, editorView.dispatch);
76
76
  },
77
- closeStatusPicker: () => {
78
- commitStatusPicker()(editorView);
77
+ closeStatusPicker: closingPayload => {
78
+ commitStatusPicker(closingPayload)(editorView);
79
79
  },
80
80
  onEnter: () => {
81
81
  commitStatusPicker()(editorView);
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  /** @jsx jsx */
3
+
3
4
  import React from 'react';
4
5
  import { css, jsx } from '@emotion/react';
5
6
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -18,11 +19,19 @@ export let InputMethod = /*#__PURE__*/function (InputMethod) {
18
19
  InputMethod["enterKey"] = "enterKey";
19
20
  return InputMethod;
20
21
  }({});
22
+ export let closingMethods = /*#__PURE__*/function (closingMethods) {
23
+ closingMethods["ArrowLeft"] = "arrowLeft";
24
+ closingMethods["ArrowRight"] = "arrowRight";
25
+ return closingMethods;
26
+ }({});
21
27
  const pickerContainer = css`
22
28
  background: ${`var(--ds-surface-overlay, ${N0})`};
23
29
  padding: ${"var(--ds-space-100, 8px)"} 0;
24
30
  border-radius: ${borderRadius()}px;
25
31
  box-shadow: ${"var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))"};
32
+ :focus {
33
+ outline: none;
34
+ }
26
35
  input {
27
36
  text-transform: uppercase;
28
37
  }
@@ -43,6 +52,55 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
43
52
  this.inputMethod = InputMethod.escKey;
44
53
  this.props.onEnter(this.state);
45
54
  });
55
+ _defineProperty(this, "handleTabPress", event => {
56
+ const colorButtons = event.currentTarget.querySelectorAll('button');
57
+ const inputField = event.currentTarget.querySelector('input');
58
+ const isInputFocussed = document.activeElement === inputField;
59
+ const isButtonFocussed = Array.from(colorButtons).some(buttonElement => {
60
+ var _document;
61
+ return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
62
+ });
63
+ if (event !== null && event !== void 0 && event.shiftKey) {
64
+ /* shift + tab */
65
+ if (isInputFocussed) {
66
+ colorButtons[0].focus();
67
+ event.preventDefault();
68
+ }
69
+ /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
70
+ To correctly set focus to the input field instead of the first color button we need to set focus manually
71
+ */
72
+ if (isButtonFocussed) {
73
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
74
+ event.preventDefault();
75
+ }
76
+ } else {
77
+ /* tab */
78
+ if (isButtonFocussed) {
79
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
80
+ event.preventDefault();
81
+ }
82
+ }
83
+ });
84
+ _defineProperty(this, "handleArrow", (event, closingMethod) => {
85
+ var _document2;
86
+ if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === this.popupBodyWrapper.current) {
87
+ var _this$popupBodyWrappe, _this$popupBodyWrappe2;
88
+ event.preventDefault();
89
+ (_this$popupBodyWrappe = this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 ? void 0 : (_this$popupBodyWrappe2 = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe2 === void 0 ? void 0 : _this$popupBodyWrappe2.blur();
90
+ this.props.closeStatusPicker({
91
+ closingMethod
92
+ });
93
+ }
94
+ });
95
+ _defineProperty(this, "onKeyDown", event => {
96
+ const isTabPressed = event.key === 'Tab';
97
+ if (isTabPressed) {
98
+ return this.handleTabPress(event);
99
+ }
100
+ if (event.key in closingMethods) {
101
+ return this.handleArrow(event, closingMethods[event.key]);
102
+ }
103
+ });
46
104
  _defineProperty(this, "onColorHover", color => {
47
105
  this.createStatusAnalyticsAndFireFunc({
48
106
  action: 'hovered',
@@ -106,6 +164,7 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
106
164
  _defineProperty(this, "handlePopupClick", event => event.nativeEvent.stopImmediatePropagation());
107
165
  this.state = this.extractStateFromProps(props);
108
166
  this.createStatusAnalyticsAndFireFunc = createStatusAnalyticsAndFire(props.createAnalyticsEvent);
167
+ this.popupBodyWrapper = /*#__PURE__*/React.createRef();
109
168
  }
110
169
  fireStatusPopupOpenedAnalytics(state) {
111
170
  const {
@@ -153,6 +212,11 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
153
212
  componentDidMount() {
154
213
  this.reset();
155
214
  this.fireStatusPopupOpenedAnalytics(this.state);
215
+ if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
216
+ var _this$popupBodyWrappe3, _this$popupBodyWrappe4;
217
+ // Wrapper should be focused only if status already exists otherwise input field will receive focus
218
+ (_this$popupBodyWrappe3 = this.popupBodyWrapper) === null || _this$popupBodyWrappe3 === void 0 ? void 0 : (_this$popupBodyWrappe4 = _this$popupBodyWrappe3.current) === null || _this$popupBodyWrappe4 === void 0 ? void 0 : _this$popupBodyWrappe4.focus();
219
+ }
156
220
  }
157
221
  componentWillUnmount() {
158
222
  this.fireStatusPopupClosedAnalytics(this.state);
@@ -203,10 +267,14 @@ export class StatusPickerWithoutAnalytcs extends React.Component {
203
267
  fitHeight: 40,
204
268
  mountTo: mountTo,
205
269
  boundariesElement: boundariesElement,
206
- scrollableElement: scrollableElement
270
+ scrollableElement: scrollableElement,
271
+ closeOnTab: false
207
272
  }, jsx("div", {
208
273
  css: pickerContainer,
209
- onClick: this.handlePopupClick
274
+ tabIndex: -1,
275
+ ref: this.popupBodyWrapper,
276
+ onClick: this.handlePopupClick,
277
+ onKeyDown: this.onKeyDown
210
278
  }, jsx(AkStatusPicker, {
211
279
  autoFocus: isNew,
212
280
  selectedColor: color,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.44.4";
2
+ export const version = "187.44.7";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -19,7 +19,7 @@ import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
19
19
  import UiDropdown from '../../../ui/Dropdown';
20
20
  import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
21
21
  import DropdownMenu, { itemSpacing, menuItemDimensions } from './DropdownMenu';
22
- var dropdownExpandContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0px -4px;\n"])));
22
+ var dropdownExpandContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0px ", ";\n"])), "var(--ds-space-negative-050, -4px)");
23
23
  var iconGroup = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n"])));
24
24
  var CompositeIcon = function CompositeIcon(_ref) {
25
25
  var icon = _ref.icon;
@@ -112,7 +112,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
112
112
  buttonTestId = _this$props2.buttonTestId,
113
113
  dropdownWidth = _this$props2.dropdownWidth,
114
114
  editorView = _this$props2.editorView,
115
- dropdownListId = _this$props2.dropdownListId;
115
+ dropdownListId = _this$props2.dropdownListId,
116
+ alignDropdownWithToolbar = _this$props2.alignDropdownWithToolbar;
116
117
  var trigger;
117
118
  if (icon) {
118
119
  var TriggerIcon = hideExpandIcon ? icon : jsx(CompositeIcon, {
@@ -166,7 +167,8 @@ var Dropdown = /*#__PURE__*/function (_Component) {
166
167
  fitHeight: fitHeight + fitTolerance,
167
168
  trigger: trigger,
168
169
  editorView: editorView,
169
- dropdownListId: dropdownListId
170
+ dropdownListId: dropdownListId,
171
+ alignDropdownWithParentElement: alignDropdownWithToolbar
170
172
  }, Array.isArray(options) ? this.renderArrayOptions(options) : options.render({
171
173
  hide: this.hide,
172
174
  dispatchCommand: dispatchCommand
@@ -139,7 +139,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
139
139
  buttonTestId: item.testId,
140
140
  editorView: editorView,
141
141
  setDisableParentScroll: scrollable ? setDisableScroll : undefined,
142
- dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList")
142
+ dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
143
+ alignDropdownWithToolbar: items.length === 1
143
144
  });
144
145
  case 'select':
145
146
  if (item.selectType === 'list') {
@@ -1,4 +1,7 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ function isNodeContentEmpty(maybeNode) {
3
+ return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
4
+ }
2
5
  function findEmptySelectableParentNodePosition($pos, isValidPosition) {
3
6
  var doc = $pos.doc;
4
7
  if ($pos.pos + 1 > doc.content.size) {
@@ -36,8 +39,7 @@ var checkPositionNode = function checkPositionNode($pos) {
36
39
  if (maybeNode.isAtom) {
37
40
  return true;
38
41
  }
39
- var isParentEmpty = maybeNode.content.size === 0 || maybeNode.textContent === '';
40
- return isParentEmpty && NodeSelection.isSelectable(maybeNode);
42
+ return isNodeContentEmpty(maybeNode) && NodeSelection.isSelectable(maybeNode);
41
43
  };
42
44
  function findNextSelectionPosition(_ref) {
43
45
  var $targetHead = _ref.$targetHead,
@@ -54,7 +56,7 @@ function findNextSelectionPosition(_ref) {
54
56
  return null;
55
57
  }
56
58
  export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $anchor, $head) {
57
- var _$head$parent;
59
+ var _$head$parent, _$head$parent2;
58
60
  if ($anchor.pos === $head.pos) {
59
61
  return null;
60
62
  }
@@ -66,6 +68,11 @@ export var onCreateSelectionBetween = function onCreateSelectionBetween(view, $a
66
68
  if ($head.depth === 1 && ((_$head$parent = $head.parent) === null || _$head$parent === void 0 ? void 0 : _$head$parent.type.name) === 'paragraph') {
67
69
  return null;
68
70
  }
71
+
72
+ // If head is at the beginning of a non-empty textblock, let ProseMirror handle the text selection
73
+ if ((_$head$parent2 = $head.parent) !== null && _$head$parent2 !== void 0 && _$head$parent2.isTextblock && !isNodeContentEmpty($head.parent) && $head.parentOffset === 0) {
74
+ return null;
75
+ }
69
76
  var $nextHeadPosition = findNextSelectionPosition({
70
77
  $targetHead: $head,
71
78
  $anchor: $anchor,
@@ -101,12 +101,23 @@ export var removeStatus = function removeStatus(showStatusPickerAt) {
101
101
  return true;
102
102
  };
103
103
  };
104
- export var commitStatusPicker = function commitStatusPicker() {
104
+ var handleClosingByArrows = function handleClosingByArrows(closingMethod, state, showStatusPickerAt, tr) {
105
+ if (closingMethod === 'arrowLeft') {
106
+ // put cursor right before status Lozenge
107
+ tr = tr.setSelection(Selection.near(state.tr.doc.resolve(showStatusPickerAt), -1));
108
+ } else if (closingMethod === 'arrowRight') {
109
+ // put cursor right after status Lozenge
110
+ tr = tr.setSelection(Selection.near(state.tr.doc.resolve(showStatusPickerAt + 1)));
111
+ }
112
+ };
113
+ export var commitStatusPicker = function commitStatusPicker(closingPayload) {
105
114
  return function (editorView) {
106
115
  var state = editorView.state,
107
116
  dispatch = editorView.dispatch;
108
117
  var _ref2 = pluginKey.getState(state) || {},
109
118
  showStatusPickerAt = _ref2.showStatusPickerAt;
119
+ var _ref3 = closingPayload || {},
120
+ closingMethod = _ref3.closingMethod;
110
121
  if (!showStatusPickerAt) {
111
122
  return;
112
123
  }
@@ -119,7 +130,9 @@ export var commitStatusPicker = function commitStatusPicker() {
119
130
  showStatusPickerAt: null,
120
131
  isNew: false
121
132
  });
122
- if (statusNode.attrs.text) {
133
+ if (closingMethod) {
134
+ handleClosingByArrows(closingMethod, state, showStatusPickerAt, tr);
135
+ } else if (statusNode.attrs.text) {
123
136
  // still has content - keep content
124
137
  // move selection after status if selection did not change
125
138
  if (tr.selection.from === showStatusPickerAt) {
@@ -72,8 +72,8 @@ var baseStatusPlugin = function baseStatusPlugin(_ref) {
72
72
  onTextChanged: function onTextChanged(status) {
73
73
  updateStatus(status)(editorView.state, editorView.dispatch);
74
74
  },
75
- closeStatusPicker: function closeStatusPicker() {
76
- commitStatusPicker()(editorView);
75
+ closeStatusPicker: function closeStatusPicker(closingPayload) {
76
+ commitStatusPicker(closingPayload)(editorView);
77
77
  },
78
78
  onEnter: function onEnter() {
79
79
  commitStatusPicker()(editorView);
@@ -10,6 +10,7 @@ var _templateObject;
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  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; } }
12
12
  /** @jsx jsx */
13
+
13
14
  import React from 'react';
14
15
  import { css, jsx } from '@emotion/react';
15
16
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
@@ -28,7 +29,12 @@ export var InputMethod = /*#__PURE__*/function (InputMethod) {
28
29
  InputMethod["enterKey"] = "enterKey";
29
30
  return InputMethod;
30
31
  }({});
31
- var pickerContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(N0, ")"), "var(--ds-space-100, 8px)", borderRadius(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
32
+ export var closingMethods = /*#__PURE__*/function (closingMethods) {
33
+ closingMethods["ArrowLeft"] = "arrowLeft";
34
+ closingMethods["ArrowRight"] = "arrowRight";
35
+ return closingMethods;
36
+ }({});
37
+ var pickerContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n padding: ", " 0;\n border-radius: ", "px;\n box-shadow: ", ";\n :focus {\n outline: none;\n }\n input {\n text-transform: uppercase;\n }\n"])), "var(--ds-surface-overlay, ".concat(N0, ")"), "var(--ds-space-100, 8px)", borderRadius(), "var(--ds-shadow-overlay, 0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25))");
32
38
  export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component) {
33
39
  _inherits(StatusPickerWithoutAnalytcs, _React$Component);
34
40
  var _super = _createSuper(StatusPickerWithoutAnalytcs);
@@ -49,6 +55,55 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
49
55
  _this.inputMethod = InputMethod.escKey;
50
56
  _this.props.onEnter(_this.state);
51
57
  });
58
+ _defineProperty(_assertThisInitialized(_this), "handleTabPress", function (event) {
59
+ var colorButtons = event.currentTarget.querySelectorAll('button');
60
+ var inputField = event.currentTarget.querySelector('input');
61
+ var isInputFocussed = document.activeElement === inputField;
62
+ var isButtonFocussed = Array.from(colorButtons).some(function (buttonElement) {
63
+ var _document;
64
+ return ((_document = document) === null || _document === void 0 ? void 0 : _document.activeElement) === buttonElement;
65
+ });
66
+ if (event !== null && event !== void 0 && event.shiftKey) {
67
+ /* shift + tab */
68
+ if (isInputFocussed) {
69
+ colorButtons[0].focus();
70
+ event.preventDefault();
71
+ }
72
+ /* After the user presses shift + tab the color-palette component updates tab index for the first color to be 0.
73
+ To correctly set focus to the input field instead of the first color button we need to set focus manually
74
+ */
75
+ if (isButtonFocussed) {
76
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
77
+ event.preventDefault();
78
+ }
79
+ } else {
80
+ /* tab */
81
+ if (isButtonFocussed) {
82
+ inputField === null || inputField === void 0 ? void 0 : inputField.focus();
83
+ event.preventDefault();
84
+ }
85
+ }
86
+ });
87
+ _defineProperty(_assertThisInitialized(_this), "handleArrow", function (event, closingMethod) {
88
+ var _document2;
89
+ if (((_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.activeElement) === _this.popupBodyWrapper.current) {
90
+ var _this$popupBodyWrappe, _this$popupBodyWrappe2;
91
+ event.preventDefault();
92
+ (_this$popupBodyWrappe = _this.popupBodyWrapper) === null || _this$popupBodyWrappe === void 0 ? void 0 : (_this$popupBodyWrappe2 = _this$popupBodyWrappe.current) === null || _this$popupBodyWrappe2 === void 0 ? void 0 : _this$popupBodyWrappe2.blur();
93
+ _this.props.closeStatusPicker({
94
+ closingMethod: closingMethod
95
+ });
96
+ }
97
+ });
98
+ _defineProperty(_assertThisInitialized(_this), "onKeyDown", function (event) {
99
+ var isTabPressed = event.key === 'Tab';
100
+ if (isTabPressed) {
101
+ return _this.handleTabPress(event);
102
+ }
103
+ if (event.key in closingMethods) {
104
+ return _this.handleArrow(event, closingMethods[event.key]);
105
+ }
106
+ });
52
107
  _defineProperty(_assertThisInitialized(_this), "onColorHover", function (color) {
53
108
  _this.createStatusAnalyticsAndFireFunc({
54
109
  action: 'hovered',
@@ -112,6 +167,7 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
112
167
  });
113
168
  _this.state = _this.extractStateFromProps(props);
114
169
  _this.createStatusAnalyticsAndFireFunc = createStatusAnalyticsAndFire(props.createAnalyticsEvent);
170
+ _this.popupBodyWrapper = /*#__PURE__*/React.createRef();
115
171
  return _this;
116
172
  }
117
173
  _createClass(StatusPickerWithoutAnalytcs, [{
@@ -164,6 +220,11 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
164
220
  value: function componentDidMount() {
165
221
  this.reset();
166
222
  this.fireStatusPopupOpenedAnalytics(this.state);
223
+ if (typeof this.props.isNew === 'boolean' && this.props.isNew === false) {
224
+ var _this$popupBodyWrappe3, _this$popupBodyWrappe4;
225
+ // Wrapper should be focused only if status already exists otherwise input field will receive focus
226
+ (_this$popupBodyWrappe3 = this.popupBodyWrapper) === null || _this$popupBodyWrappe3 === void 0 ? void 0 : (_this$popupBodyWrappe4 = _this$popupBodyWrappe3.current) === null || _this$popupBodyWrappe4 === void 0 ? void 0 : _this$popupBodyWrappe4.focus();
227
+ }
167
228
  }
168
229
  }, {
169
230
  key: "componentWillUnmount",
@@ -218,10 +279,14 @@ export var StatusPickerWithoutAnalytcs = /*#__PURE__*/function (_React$Component
218
279
  fitHeight: 40,
219
280
  mountTo: mountTo,
220
281
  boundariesElement: boundariesElement,
221
- scrollableElement: scrollableElement
282
+ scrollableElement: scrollableElement,
283
+ closeOnTab: false
222
284
  }, jsx("div", {
223
285
  css: pickerContainer,
224
- onClick: this.handlePopupClick
286
+ tabIndex: -1,
287
+ ref: this.popupBodyWrapper,
288
+ onClick: this.handlePopupClick,
289
+ onKeyDown: this.onKeyDown
225
290
  }, jsx(AkStatusPicker, {
226
291
  autoFocus: isNew,
227
292
  selectedColor: color,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.44.4";
2
+ export var version = "187.44.7";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -21,6 +21,7 @@ export interface Props {
21
21
  setDisableParentScroll?: (disable: boolean) => void;
22
22
  editorView?: EditorView;
23
23
  dropdownListId?: string;
24
+ alignDropdownWithToolbar?: boolean;
24
25
  }
25
26
  export interface State {
26
27
  isOpen: boolean;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { Command } from '../../types';
4
4
  import type { TOOLBAR_MENU_TYPE } from '../insert-block/ui/ToolbarInsertBlock/types';
5
- import type { StatusType } from './types';
5
+ import type { StatusType, ClosingPayload } from './types';
6
6
  export declare const DEFAULT_STATUS: StatusType;
7
7
  export declare const createStatus: (showStatusPickerAtOffset?: number) => (insert: (node: Node | Object | string, opts: {
8
8
  selectInlineNode: boolean;
@@ -11,4 +11,4 @@ export declare const updateStatus: (status?: StatusType) => Command;
11
11
  export declare const updateStatusWithAnalytics: (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
12
12
  export declare const setStatusPickerAt: (showStatusPickerAt: number | null) => (state: EditorState, dispatch: (tr: Transaction) => void) => boolean;
13
13
  export declare const removeStatus: (showStatusPickerAt: number) => Command;
14
- export declare const commitStatusPicker: () => (editorView: EditorView) => void;
14
+ export declare const commitStatusPicker: (closingPayload?: ClosingPayload) => (editorView: EditorView) => void;
@@ -2,6 +2,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { PMPluginFactoryParams } from '../../types';
3
3
  import type { StatusPluginOptions } from './types';
4
4
  export { pluginKey, pluginKeyName } from './plugin-key';
5
- export type { StatusState, StatusType } from './types';
5
+ export type { StatusState, StatusType, ClosingPayload } from './types';
6
6
  declare const createPlugin: (pmPluginFactoryParams: PMPluginFactoryParams, options?: StatusPluginOptions) => SafePlugin<any>;
7
7
  export default createPlugin;
@@ -1,4 +1,5 @@
1
- import { Color as ColorType } from '@atlaskit/status/element';
1
+ import type { Color as ColorType } from '@atlaskit/status/element';
2
+ import type { closingMethods } from './ui/statusPicker';
2
3
  export type StatusType = {
3
4
  color: ColorType;
4
5
  text: string;
@@ -12,3 +13,6 @@ export interface StatusPluginOptions {
12
13
  menuDisabled: boolean;
13
14
  allowZeroWidthSpaceAfter?: boolean;
14
15
  }
16
+ export type ClosingPayload = {
17
+ closingMethod: closingMethods;
18
+ };
@@ -1,17 +1,20 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
- import { ColorType as Color } from '@atlaskit/status/picker';
6
- import { StatusType } from '../plugin';
3
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { ColorType as Color } from '@atlaskit/status/picker';
5
+ import type { StatusType, ClosingPayload } from '../plugin';
7
6
  export declare enum InputMethod {
8
7
  blur = "blur",
9
8
  escKey = "escKey",
10
9
  enterKey = "enterKey"
11
10
  }
11
+ export declare enum closingMethods {
12
+ ArrowLeft = "arrowLeft",
13
+ ArrowRight = "arrowRight"
14
+ }
12
15
  export interface Props {
13
16
  target: HTMLElement | null;
14
- closeStatusPicker: () => void;
17
+ closeStatusPicker: (closingPayload?: ClosingPayload) => void;
15
18
  onSelect: (status: StatusType) => void;
16
19
  onTextChanged: (status: StatusType, isNew: boolean) => void;
17
20
  onEnter: (status: StatusType) => void;
@@ -34,6 +37,7 @@ export declare class StatusPickerWithoutAnalytcs extends React.Component<Props,
34
37
  private startTime;
35
38
  private inputMethod?;
36
39
  private createStatusAnalyticsAndFireFunc;
40
+ private popupBodyWrapper;
37
41
  constructor(props: Props);
38
42
  private fireStatusPopupOpenedAnalytics;
39
43
  private fireStatusPopupClosedAnalytics;
@@ -44,6 +48,9 @@ export declare class StatusPickerWithoutAnalytcs extends React.Component<Props,
44
48
  private extractStateFromProps;
45
49
  handleClickOutside: (event: Event) => void;
46
50
  private handleEscapeKeydown;
51
+ private handleTabPress;
52
+ private handleArrow;
53
+ private onKeyDown;
47
54
  render(): jsx.JSX.Element | null;
48
55
  private onColorHover;
49
56
  private onColorClick;
@@ -21,6 +21,7 @@ export interface Props {
21
21
  setDisableParentScroll?: (disable: boolean) => void;
22
22
  editorView?: EditorView;
23
23
  dropdownListId?: string;
24
+ alignDropdownWithToolbar?: boolean;
24
25
  }
25
26
  export interface State {
26
27
  isOpen: boolean;
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
3
  import type { Command } from '../../types';
4
4
  import type { TOOLBAR_MENU_TYPE } from '../insert-block/ui/ToolbarInsertBlock/types';
5
- import type { StatusType } from './types';
5
+ import type { StatusType, ClosingPayload } from './types';
6
6
  export declare const DEFAULT_STATUS: StatusType;
7
7
  export declare const createStatus: (showStatusPickerAtOffset?: number) => (insert: (node: Node | Object | string, opts: {
8
8
  selectInlineNode: boolean;
@@ -11,4 +11,4 @@ export declare const updateStatus: (status?: StatusType) => Command;
11
11
  export declare const updateStatusWithAnalytics: (inputMethod: TOOLBAR_MENU_TYPE, status?: StatusType) => Command;
12
12
  export declare const setStatusPickerAt: (showStatusPickerAt: number | null) => (state: EditorState, dispatch: (tr: Transaction) => void) => boolean;
13
13
  export declare const removeStatus: (showStatusPickerAt: number) => Command;
14
- export declare const commitStatusPicker: () => (editorView: EditorView) => void;
14
+ export declare const commitStatusPicker: (closingPayload?: ClosingPayload) => (editorView: EditorView) => void;
@@ -2,6 +2,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { PMPluginFactoryParams } from '../../types';
3
3
  import type { StatusPluginOptions } from './types';
4
4
  export { pluginKey, pluginKeyName } from './plugin-key';
5
- export type { StatusState, StatusType } from './types';
5
+ export type { StatusState, StatusType, ClosingPayload } from './types';
6
6
  declare const createPlugin: (pmPluginFactoryParams: PMPluginFactoryParams, options?: StatusPluginOptions) => SafePlugin<any>;
7
7
  export default createPlugin;
@@ -1,4 +1,5 @@
1
- import { Color as ColorType } from '@atlaskit/status/element';
1
+ import type { Color as ColorType } from '@atlaskit/status/element';
2
+ import type { closingMethods } from './ui/statusPicker';
2
3
  export type StatusType = {
3
4
  color: ColorType;
4
5
  text: string;
@@ -12,3 +13,6 @@ export interface StatusPluginOptions {
12
13
  menuDisabled: boolean;
13
14
  allowZeroWidthSpaceAfter?: boolean;
14
15
  }
16
+ export type ClosingPayload = {
17
+ closingMethod: closingMethods;
18
+ };
@@ -1,17 +1,20 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
- import { ColorType as Color } from '@atlaskit/status/picker';
6
- import { StatusType } from '../plugin';
3
+ import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import type { ColorType as Color } from '@atlaskit/status/picker';
5
+ import type { StatusType, ClosingPayload } from '../plugin';
7
6
  export declare enum InputMethod {
8
7
  blur = "blur",
9
8
  escKey = "escKey",
10
9
  enterKey = "enterKey"
11
10
  }
11
+ export declare enum closingMethods {
12
+ ArrowLeft = "arrowLeft",
13
+ ArrowRight = "arrowRight"
14
+ }
12
15
  export interface Props {
13
16
  target: HTMLElement | null;
14
- closeStatusPicker: () => void;
17
+ closeStatusPicker: (closingPayload?: ClosingPayload) => void;
15
18
  onSelect: (status: StatusType) => void;
16
19
  onTextChanged: (status: StatusType, isNew: boolean) => void;
17
20
  onEnter: (status: StatusType) => void;
@@ -34,6 +37,7 @@ export declare class StatusPickerWithoutAnalytcs extends React.Component<Props,
34
37
  private startTime;
35
38
  private inputMethod?;
36
39
  private createStatusAnalyticsAndFireFunc;
40
+ private popupBodyWrapper;
37
41
  constructor(props: Props);
38
42
  private fireStatusPopupOpenedAnalytics;
39
43
  private fireStatusPopupClosedAnalytics;
@@ -44,6 +48,9 @@ export declare class StatusPickerWithoutAnalytcs extends React.Component<Props,
44
48
  private extractStateFromProps;
45
49
  handleClickOutside: (event: Event) => void;
46
50
  private handleEscapeKeydown;
51
+ private handleTabPress;
52
+ private handleArrow;
53
+ private onKeyDown;
47
54
  render(): jsx.JSX.Element | null;
48
55
  private onColorHover;
49
56
  private onColorClick;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.44.4",
3
+ "version": "187.44.7",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.10.0",
58
- "@atlaskit/editor-common": "^75.3.0",
58
+ "@atlaskit/editor-common": "^75.5.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
@@ -81,7 +81,7 @@
81
81
  "@atlaskit/editor-plugin-placeholder": "^0.1.0",
82
82
  "@atlaskit/editor-plugin-quick-insert": "^0.1.0",
83
83
  "@atlaskit/editor-plugin-rule": "^0.1.0",
84
- "@atlaskit/editor-plugin-table": "^3.0.0",
84
+ "@atlaskit/editor-plugin-table": "^3.1.0",
85
85
  "@atlaskit/editor-plugin-text-formatting": "^0.4.0",
86
86
  "@atlaskit/editor-plugin-type-ahead": "^0.3.0",
87
87
  "@atlaskit/editor-plugin-unsupported-content": "^0.2.0",
@@ -156,7 +156,7 @@
156
156
  "@atlaskit/collab-provider": "9.12.3",
157
157
  "@atlaskit/dropdown-menu": "^11.14.0",
158
158
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
159
- "@atlaskit/editor-plugin-table": "^3.0.0",
159
+ "@atlaskit/editor-plugin-table": "^3.1.0",
160
160
  "@atlaskit/flag": "^15.2.0",
161
161
  "@atlaskit/icon-object": "^6.3.0",
162
162
  "@atlaskit/inline-dialog": "^13.6.0",
@@ -283,6 +283,10 @@
283
283
  "platform.media-experience.cardv2_7zann": {
284
284
  "type": "boolean",
285
285
  "referenceOnly": "true"
286
+ },
287
+ "platform.editor.table.overflow-state-analytics": {
288
+ "type": "boolean",
289
+ "referenceOnly": "true"
286
290
  }
287
291
  }
288
292
  }
package/report.api.md CHANGED
@@ -35,7 +35,7 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
35
35
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
36
36
  import { clearEditorContent } from '@atlaskit/editor-common/commands';
37
37
  import type { CollabEditOptions } from '@atlaskit/editor-common/collab';
38
- import { Color } from '@atlaskit/status/element';
38
+ import type { Color } from '@atlaskit/status/element';
39
39
  import { Command as Command_2 } from '@atlaskit/editor-common/types';
40
40
  import { ComponentType } from 'react';
41
41
  import type { compositionPlugin } from '@atlaskit/editor-plugin-composition';
@@ -303,6 +303,19 @@ type CloseOptions = {
303
303
  attachCommand?: Command_2;
304
304
  };
305
305
 
306
+ // @public (undocumented)
307
+ enum closingMethods {
308
+ // (undocumented)
309
+ ArrowLeft = 'arrowLeft',
310
+ // (undocumented)
311
+ ArrowRight = 'arrowRight',
312
+ }
313
+
314
+ // @public (undocumented)
315
+ type ClosingPayload = {
316
+ closingMethod: closingMethods;
317
+ };
318
+
306
319
  // @public (undocumented)
307
320
  interface CodeBlockOptions extends LongPressSelectionPluginOptions {
308
321
  // (undocumented)
@@ -359,7 +372,9 @@ export type Command = (
359
372
  export type CommandDispatch = (tr: Transaction) => void;
360
373
 
361
374
  // @public (undocumented)
362
- export const commitStatusPicker: () => (editorView: EditorView) => void;
375
+ export const commitStatusPicker: (
376
+ closingPayload?: ClosingPayload,
377
+ ) => (editorView: EditorView) => void;
363
378
 
364
379
  // @public (undocumented)
365
380
  export function ContextPanel(props: Props_4): jsx.JSX.Element;
@@ -24,7 +24,7 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
24
24
  import { CardProvider } from '@atlaskit/editor-common/provider-factory';
25
25
  import { clearEditorContent } from '@atlaskit/editor-common/commands';
26
26
  import type { CollabEditOptions } from '@atlaskit/editor-common/collab';
27
- import { Color } from '@atlaskit/status/element';
27
+ import type { Color } from '@atlaskit/status/element';
28
28
  import { Command as Command_2 } from '@atlaskit/editor-common/types';
29
29
  import { ComponentType } from 'react';
30
30
  import type { compositionPlugin } from '@atlaskit/editor-plugin-composition';
@@ -289,6 +289,19 @@ type CloseOptions = {
289
289
  attachCommand?: Command_2;
290
290
  };
291
291
 
292
+ // @public (undocumented)
293
+ enum closingMethods {
294
+ // (undocumented)
295
+ ArrowLeft = "arrowLeft",
296
+ // (undocumented)
297
+ ArrowRight = "arrowRight"
298
+ }
299
+
300
+ // @public (undocumented)
301
+ type ClosingPayload = {
302
+ closingMethod: closingMethods;
303
+ };
304
+
292
305
  // @public (undocumented)
293
306
  interface CodeBlockOptions extends LongPressSelectionPluginOptions {
294
307
  // (undocumented)
@@ -338,7 +351,7 @@ export type Command = (state: EditorState, dispatch?: CommandDispatch, view?: Ed
338
351
  export type CommandDispatch = (tr: Transaction) => void;
339
352
 
340
353
  // @public (undocumented)
341
- export const commitStatusPicker: () => (editorView: EditorView) => void;
354
+ export const commitStatusPicker: (closingPayload?: ClosingPayload) => (editorView: EditorView) => void;
342
355
 
343
356
  // @public (undocumented)
344
357
  export function ContextPanel(props: Props_4): jsx.JSX.Element;