@atlaskit/editor-common 75.3.1 → 75.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/monitoring/error.js +1 -1
  3. package/dist/cjs/preset/builder.js +48 -48
  4. package/dist/cjs/ui/DropList/index.js +1 -1
  5. package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  6. package/dist/cjs/ui-menu/Dropdown/index.js +3 -2
  7. package/dist/cjs/ui-menu/DropdownMenu/index.js +2 -2
  8. package/dist/cjs/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  9. package/dist/cjs/ui-menu/ToolbarButton/index.js +1 -1
  10. package/dist/cjs/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  11. package/dist/es2019/monitoring/error.js +1 -1
  12. package/dist/es2019/preset/builder.js +48 -48
  13. package/dist/es2019/ui/DropList/index.js +1 -1
  14. package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  15. package/dist/es2019/ui-menu/Dropdown/index.js +3 -2
  16. package/dist/es2019/ui-menu/DropdownMenu/index.js +3 -2
  17. package/dist/es2019/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  18. package/dist/es2019/ui-menu/ToolbarButton/index.js +1 -1
  19. package/dist/es2019/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  20. package/dist/esm/monitoring/error.js +1 -1
  21. package/dist/esm/preset/builder.js +48 -48
  22. package/dist/esm/ui/DropList/index.js +1 -1
  23. package/dist/esm/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +6 -6
  24. package/dist/esm/ui-menu/Dropdown/index.js +3 -2
  25. package/dist/esm/ui-menu/DropdownMenu/index.js +3 -2
  26. package/dist/esm/ui-menu/ToolbarArrowKeyNavigationProvider/index.js +8 -8
  27. package/dist/esm/ui-menu/ToolbarButton/index.js +1 -1
  28. package/dist/esm/ui-react/with-react-editor-view-outer-listeners.js +4 -5
  29. package/dist/types/analytics/types/inline-comment-events.d.ts +2 -2
  30. package/dist/types/types/floating-toolbar.d.ts +4 -3
  31. package/dist/types/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.d.ts +1 -1
  32. package/dist/types/ui-menu/Dropdown/index.d.ts +3 -2
  33. package/dist/types/ui-menu/DropdownMenu/index.d.ts +1 -2
  34. package/dist/types/ui-menu/ToolbarButton/index.d.ts +3 -3
  35. package/dist/types-ts4.5/analytics/types/inline-comment-events.d.ts +2 -2
  36. package/dist/types-ts4.5/types/floating-toolbar.d.ts +4 -3
  37. package/dist/types-ts4.5/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.d.ts +1 -1
  38. package/dist/types-ts4.5/ui-menu/Dropdown/index.d.ts +3 -2
  39. package/dist/types-ts4.5/ui-menu/DropdownMenu/index.d.ts +1 -2
  40. package/dist/types-ts4.5/ui-menu/ToolbarButton/index.d.ts +3 -3
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 75.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`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
8
+
9
+ ### Patch Changes
10
+
11
+ - [`b092b2cb3b7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b092b2cb3b7) - Dummy change as workaround for product integrator pipeline. This change fixes comment spacing.
12
+
3
13
  ## 75.3.1
4
14
 
5
15
  ### 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 = "75.3.1";
19
+ var packageVersion = "75.4.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -34,21 +34,21 @@ var EditorPresetBuilder = /*#__PURE__*/function () {
34
34
  nextOrTuple].concat((0, _toConsumableArray2.default)(this.data)));
35
35
  }
36
36
 
37
- //hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
38
- // pluginToAdd: Plugin,
39
- //): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
40
- // const hasPluginQueryExists = this.data.find((pluginEntry) => {
41
- // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
42
- // pluginEntry,
43
- // )
44
- // ? pluginEntry
45
- // : pluginEntry[0];
37
+ // hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
38
+ // pluginToAdd: Plugin,
39
+ // ): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
40
+ // const hasPluginQueryExists = this.data.find((pluginEntry) => {
41
+ // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
42
+ // pluginEntry,
43
+ // )
44
+ // ? pluginEntry
45
+ // : pluginEntry[0];
46
46
 
47
- // return pluginFunction === pluginToAdd;
48
- // });
47
+ // return pluginFunction === pluginToAdd;
48
+ // });
49
49
 
50
- // return Boolean(hasPluginQueryExists);
51
- //}
50
+ // return Boolean(hasPluginQueryExists);
51
+ // }
52
52
  }, {
53
53
  key: "maybeAdd",
54
54
  value: function maybeAdd(pluginToAdd, add) {
@@ -145,41 +145,41 @@ var EditorPresetBuilder = /*#__PURE__*/function () {
145
145
  }
146
146
 
147
147
  // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
148
- //import type {
149
- // ExtractPluginDependencies,
150
- //} from '../types/next-editor-plugin';
151
- //type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
152
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
153
- // ? Plugin extends NextEditorPlugin<any, any>
154
- // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
155
- // ? MaybeEditorPresetBuilder
156
- // : never
157
- // : never
158
- // : never;
159
- // Because how our plugins are added in the preset, we can't use the type safe system
160
- // in the EditorPresetBuilder.
161
- // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
162
- //maybeAdd<
163
- // MaybePlugin extends NextEditorPlugin<any, any>,
164
- // MaybePluginNames extends string[],
165
- // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
166
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<
167
- // MaybePluginNames,
168
- // MaybeStackPlugins
169
- // >,
170
- //>(
171
- // pluginToAdd: MaybePlugin,
172
- // add: (
173
- // pluginToAdd: MaybePlugin,
174
- // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
175
- // ) => MaybeEditorPresetBuilder,
176
- //): MaybeEditorPresetBuilder | this {
177
- // return add(
178
- // pluginToAdd,
179
- // // @ts-ignore
180
- // this as any,
181
- // );
182
- //}
148
+ // import type {
149
+ // ExtractPluginDependencies,
150
+ // } from '../types/next-editor-plugin';
151
+ // type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
152
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
153
+ // ? Plugin extends NextEditorPlugin<any, any>
154
+ // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
155
+ // ? MaybeEditorPresetBuilder
156
+ // : never
157
+ // : never
158
+ // : never;
159
+ // Because how our plugins are added in the preset, we can't use the type safe system
160
+ // in the EditorPresetBuilder.
161
+ // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
162
+ // maybeAdd<
163
+ // MaybePlugin extends NextEditorPlugin<any, any>,
164
+ // MaybePluginNames extends string[],
165
+ // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
166
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<
167
+ // MaybePluginNames,
168
+ // MaybeStackPlugins
169
+ // >,
170
+ // >(
171
+ // pluginToAdd: MaybePlugin,
172
+ // add: (
173
+ // pluginToAdd: MaybePlugin,
174
+ // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
175
+ // ) => MaybeEditorPresetBuilder,
176
+ // ): MaybeEditorPresetBuilder | this {
177
+ // return add(
178
+ // pluginToAdd,
179
+ // // @ts-ignore
180
+ // this as any,
181
+ // );
182
+ // }
183
183
  }]);
184
184
  return EditorPresetBuilder;
185
185
  }();
@@ -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 = "75.3.1";
27
+ var packageVersion = "75.4.0";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var DropList = /*#__PURE__*/function (_Component) {
@@ -78,14 +78,14 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
78
78
  var _wrapperRef$current;
79
79
  var targetElement = event.target;
80
80
 
81
- //Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
81
+ // Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
82
82
  if (event.key === 'Tab' && closeOnTab) {
83
83
  handleClose(event);
84
84
  keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleTab();
85
85
  return;
86
86
  }
87
87
 
88
- //To trap the focus inside the toolbar using left and right arrow keys
88
+ // To trap the focus inside the toolbar using left and right arrow keys
89
89
  var focusableElements = getFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
90
90
  if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
91
91
  return;
@@ -111,10 +111,10 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
111
111
  break;
112
112
  }
113
113
 
114
- //ArrowLeft/Right on the menu should close the menus
115
- //then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
114
+ // ArrowLeft/Right on the menu should close the menus
115
+ // then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
116
116
  case 'ArrowLeft':
117
- //Filter out the events from outside the menu
117
+ // Filter out the events from outside the menu
118
118
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
119
119
  return;
120
120
  }
@@ -124,7 +124,7 @@ var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvider(_re
124
124
  }
125
125
  break;
126
126
  case 'ArrowRight':
127
- //Filter out the events from outside the menu
127
+ // Filter out the events from outside the menu
128
128
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
129
129
  return;
130
130
  }
@@ -80,9 +80,10 @@ var Dropdown = /*#__PURE__*/function (_PureComponent) {
80
80
  fitWidth = _this$props.fitWidth,
81
81
  zIndex = _this$props.zIndex,
82
82
  arrowKeyNavigationProviderOptions = _this$props.arrowKeyNavigationProviderOptions,
83
- dropdownListId = _this$props.dropdownListId;
83
+ dropdownListId = _this$props.dropdownListId,
84
+ alignDropdownWithParentElement = _this$props.alignDropdownWithParentElement;
84
85
  return /*#__PURE__*/_react.default.createElement(_Popup.default, {
85
- target: target,
86
+ target: alignDropdownWithParentElement ? target === null || target === void 0 ? void 0 : target.closest("[data-testid='editor-floating-toolbar'") : target,
86
87
  mountTo: mountTo,
87
88
  boundariesElement: boundariesElement,
88
89
  scrollableElement: scrollableElement,
@@ -333,8 +333,8 @@ function DropdownMenuItem(_ref) {
333
333
  var DropdownMenuWithKeyboardNavigation = /*#__PURE__*/_react.default.memo(function (_ref2) {
334
334
  var props = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(_ref2), _ref2));
335
335
  var keyDownHandlerContext = (0, _react.useContext)(_ToolbarArrowKeyNavigationProvider.KeyDownHandlerContext);
336
- //This context is to handle the tab, Arrow Right/Left key events for dropdown.
337
- //Default context has the void callbacks for above key events
336
+ // This context is to handle the tab, Arrow Right/Left key events for dropdown.
337
+ // Default context has the void callbacks for above key events
338
338
  return (0, _react2.jsx)(DropdownMenuWrapper, (0, _extends2.default)({
339
339
  arrowKeyNavigationProviderOptions: _objectSpread(_objectSpread({}, props.arrowKeyNavigationProviderOptions), {}, {
340
340
  keyDownHandlerContext: keyDownHandlerContext
@@ -115,15 +115,15 @@ var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigationProvid
115
115
  */
116
116
  var handleKeyDown = function handleKeyDown(event) {
117
117
  var _document$querySelect, _document$querySelect2, _wrapperRef$current;
118
- //To trap the focus inside the horizontal toolbar for left and right arrow keys
118
+ // To trap the focus inside the horizontal toolbar for left and right arrow keys
119
119
  var targetElement = event.target;
120
120
 
121
- //To filter out the events outside the child component
121
+ // To filter out the events outside the child component
122
122
  if (!targetElement.closest("".concat(childComponentSelector))) {
123
123
  return;
124
124
  }
125
125
 
126
- //The key events are from child components such as dropdown menus / popups are ignored
126
+ // The key events are from child components such as dropdown menus / popups are ignored
127
127
  if ((_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
128
128
  return;
129
129
  }
@@ -137,15 +137,15 @@ var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigationProvid
137
137
  return;
138
138
  }
139
139
 
140
- //This is kind of hack to reset the current focused toolbar item
141
- //to handle some use cases such as Tab in/out of main toolbar
140
+ // This is kind of hack to reset the current focused toolbar item
141
+ // to handle some use cases such as Tab in/out of main toolbar
142
142
  if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
143
143
  selectedItemIndex.current = -1;
144
144
  } else {
145
145
  selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
146
146
  }
147
147
 
148
- //do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
148
+ // do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
149
149
  var allowScrollToElement = !(editorAppearance === 'comment' && !!useStickyToolbar);
150
150
  switch (event.key) {
151
151
  case 'ArrowRight':
@@ -168,7 +168,7 @@ var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigationProvid
168
168
  }
169
169
  };
170
170
  var globalKeyDownHandler = function globalKeyDownHandler(event) {
171
- //To focus the first element in the toolbar
171
+ // To focus the first element in the toolbar
172
172
  if (isShortcutToFocusToolbar(event)) {
173
173
  var _filteredFocusableEle4, _filteredFocusableEle5;
174
174
  var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
@@ -212,7 +212,7 @@ function getFocusableElements(rootNode) {
212
212
  return Array.from(focusableModalElements);
213
213
  }
214
214
  function getFilteredFocusableElements(rootNode) {
215
- //The focusable elements from child components such as dropdown menus / popups are ignored
215
+ // The focusable elements from child components such as dropdown menus / popups are ignored
216
216
  return getFocusableElements(rootNode).filter(function (elm) {
217
217
  var style = window.getComputedStyle(elm);
218
218
  // ignore invisible element to avoid losing focus
@@ -16,7 +16,7 @@ var _analytics = require("../../analytics");
16
16
  var _styles = _interopRequireDefault(require("./styles"));
17
17
  var _templateObject; // This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/index.tsx`
18
18
  // If you make any change here, copy it to above file as well
19
- // and notify about the change in #team-fc-editor-ai-dev channel.
19
+ // and notify about the change in #team-fc-editor-ai-dev channel.
20
20
  /** @jsx jsx */
21
21
  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); }
22
22
  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; }
@@ -42,7 +42,7 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
42
42
  if (_this.props.handleClickOutside) {
43
43
  var _this$props$editorVie;
44
44
  _this.props.handleClickOutside(evt);
45
- //When the menus are closed by clicking outside the focus is set on editor.
45
+ // When the menus are closed by clicking outside the focus is set on editor.
46
46
  if (!((_this$props$editorVie = _this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
47
47
  var _this$props$editorVie2;
48
48
  (_this$props$editorVie2 = _this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
@@ -58,12 +58,12 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
58
58
  evt.preventDefault();
59
59
  evt.stopPropagation();
60
60
  _this.props.handleEscapeKeydown(evt);
61
- //on 'Esc', Focus is handled in 'handleEscapeKeydown'.
61
+ // on 'Esc', Focus is handled in 'handleEscapeKeydown'.
62
62
  return false;
63
63
  } else if (evt.code === 'Enter' && _this.props.handleEnterKeydown) {
64
64
  _this.props.handleEnterKeydown(evt);
65
65
  } else if (evt.code === 'Tab' && _this.props.handleEscapeKeydown && _this.props.closeOnTab) {
66
- //The menus should be closed when the tab is pressed as it takes the focus out of the menu
66
+ // The menus should be closed when the tab is pressed as it takes the focus out of the menu
67
67
  _this.props.handleEscapeKeydown(evt);
68
68
  }
69
69
  });
@@ -77,8 +77,7 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
77
77
  }
78
78
  if (this.props.handleEscapeKeydown) {
79
79
  var _this$props$editorRef;
80
- //
81
- //Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
80
+ // Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
82
81
  (((_this$props$editorRef = this.props.editorRef) === null || _this$props$editorRef === void 0 ? void 0 : _this$props$editorRef.current) || this.props.targetRef || document).addEventListener('keydown', this.handleKeydown, false);
83
82
  }
84
83
  }
@@ -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 = "75.3.1";
3
+ const packageVersion = "75.4.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -14,21 +14,21 @@ export class EditorPresetBuilder {
14
14
  nextOrTuple, ...this.data);
15
15
  }
16
16
 
17
- //hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
18
- // pluginToAdd: Plugin,
19
- //): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
20
- // const hasPluginQueryExists = this.data.find((pluginEntry) => {
21
- // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
22
- // pluginEntry,
23
- // )
24
- // ? pluginEntry
25
- // : pluginEntry[0];
17
+ // hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
18
+ // pluginToAdd: Plugin,
19
+ // ): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
20
+ // const hasPluginQueryExists = this.data.find((pluginEntry) => {
21
+ // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
22
+ // pluginEntry,
23
+ // )
24
+ // ? pluginEntry
25
+ // : pluginEntry[0];
26
26
 
27
- // return pluginFunction === pluginToAdd;
28
- // });
27
+ // return pluginFunction === pluginToAdd;
28
+ // });
29
29
 
30
- // return Boolean(hasPluginQueryExists);
31
- //}
30
+ // return Boolean(hasPluginQueryExists);
31
+ // }
32
32
 
33
33
  maybeAdd(pluginToAdd, add) {
34
34
  return add(pluginToAdd,
@@ -106,39 +106,39 @@ export class EditorPresetBuilder {
106
106
  }
107
107
 
108
108
  // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
109
- //import type {
110
- // ExtractPluginDependencies,
111
- //} from '../types/next-editor-plugin';
112
- //type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
113
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
114
- // ? Plugin extends NextEditorPlugin<any, any>
115
- // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
116
- // ? MaybeEditorPresetBuilder
117
- // : never
118
- // : never
119
- // : never;
120
- // Because how our plugins are added in the preset, we can't use the type safe system
121
- // in the EditorPresetBuilder.
122
- // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
123
- //maybeAdd<
124
- // MaybePlugin extends NextEditorPlugin<any, any>,
125
- // MaybePluginNames extends string[],
126
- // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
127
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<
128
- // MaybePluginNames,
129
- // MaybeStackPlugins
130
- // >,
131
- //>(
132
- // pluginToAdd: MaybePlugin,
133
- // add: (
134
- // pluginToAdd: MaybePlugin,
135
- // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
136
- // ) => MaybeEditorPresetBuilder,
137
- //): MaybeEditorPresetBuilder | this {
138
- // return add(
139
- // pluginToAdd,
140
- // // @ts-ignore
141
- // this as any,
142
- // );
143
- //}
109
+ // import type {
110
+ // ExtractPluginDependencies,
111
+ // } from '../types/next-editor-plugin';
112
+ // type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
113
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
114
+ // ? Plugin extends NextEditorPlugin<any, any>
115
+ // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
116
+ // ? MaybeEditorPresetBuilder
117
+ // : never
118
+ // : never
119
+ // : never;
120
+ // Because how our plugins are added in the preset, we can't use the type safe system
121
+ // in the EditorPresetBuilder.
122
+ // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
123
+ // maybeAdd<
124
+ // MaybePlugin extends NextEditorPlugin<any, any>,
125
+ // MaybePluginNames extends string[],
126
+ // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
127
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<
128
+ // MaybePluginNames,
129
+ // MaybeStackPlugins
130
+ // >,
131
+ // >(
132
+ // pluginToAdd: MaybePlugin,
133
+ // add: (
134
+ // pluginToAdd: MaybePlugin,
135
+ // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
136
+ // ) => MaybeEditorPresetBuilder,
137
+ // ): MaybeEditorPresetBuilder | this {
138
+ // return add(
139
+ // pluginToAdd,
140
+ // // @ts-ignore
141
+ // this as any,
142
+ // );
143
+ // }
144
144
  }
@@ -9,7 +9,7 @@ import { themed } from '@atlaskit/theme/components';
9
9
  import { borderRadius } from '@atlaskit/theme/constants';
10
10
  import Layer from '../Layer';
11
11
  const packageName = "@atlaskit/editor-common";
12
- const packageVersion = "75.3.1";
12
+ const packageVersion = "75.4.0";
13
13
  const halfFocusRing = 1;
14
14
  const dropOffset = '0, 8';
15
15
  class DropList extends Component {
@@ -63,14 +63,14 @@ export const MenuArrowKeyNavigationProvider = ({
63
63
  var _wrapperRef$current;
64
64
  const targetElement = event.target;
65
65
 
66
- //Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
66
+ // Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
67
67
  if (event.key === 'Tab' && closeOnTab) {
68
68
  handleClose(event);
69
69
  keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleTab();
70
70
  return;
71
71
  }
72
72
 
73
- //To trap the focus inside the toolbar using left and right arrow keys
73
+ // To trap the focus inside the toolbar using left and right arrow keys
74
74
  const focusableElements = getFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
75
75
  if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
76
76
  return;
@@ -96,10 +96,10 @@ export const MenuArrowKeyNavigationProvider = ({
96
96
  break;
97
97
  }
98
98
 
99
- //ArrowLeft/Right on the menu should close the menus
100
- //then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
99
+ // ArrowLeft/Right on the menu should close the menus
100
+ // then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
101
101
  case 'ArrowLeft':
102
- //Filter out the events from outside the menu
102
+ // Filter out the events from outside the menu
103
103
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
104
104
  return;
105
105
  }
@@ -109,7 +109,7 @@ export const MenuArrowKeyNavigationProvider = ({
109
109
  }
110
110
  break;
111
111
  case 'ArrowRight':
112
- //Filter out the events from outside the menu
112
+ // Filter out the events from outside the menu
113
113
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
114
114
  return;
115
115
  }
@@ -56,10 +56,11 @@ export class Dropdown extends PureComponent {
56
56
  fitWidth,
57
57
  zIndex,
58
58
  arrowKeyNavigationProviderOptions,
59
- dropdownListId
59
+ dropdownListId,
60
+ alignDropdownWithParentElement
60
61
  } = this.props;
61
62
  return /*#__PURE__*/React.createElement(Popup, {
62
- target: target,
63
+ target: alignDropdownWithParentElement ? target === null || target === void 0 ? void 0 : target.closest("[data-testid='editor-floating-toolbar'") : target,
63
64
  mountTo: mountTo,
64
65
  boundariesElement: boundariesElement,
65
66
  scrollableElement: scrollableElement,
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  /** @jsx jsx */
4
+
4
5
  import React, { PureComponent, useContext } from 'react';
5
6
  import { css, jsx } from '@emotion/react';
6
7
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
@@ -325,8 +326,8 @@ export const DropdownMenuWithKeyboardNavigation = /*#__PURE__*/React.memo(({
325
326
  ...props
326
327
  }) => {
327
328
  const keyDownHandlerContext = useContext(KeyDownHandlerContext);
328
- //This context is to handle the tab, Arrow Right/Left key events for dropdown.
329
- //Default context has the void callbacks for above key events
329
+ // This context is to handle the tab, Arrow Right/Left key events for dropdown.
330
+ // Default context has the void callbacks for above key events
330
331
  return jsx(DropdownMenuWrapper, _extends({
331
332
  arrowKeyNavigationProviderOptions: {
332
333
  ...props.arrowKeyNavigationProviderOptions,
@@ -109,15 +109,15 @@ export const ToolbarArrowKeyNavigationProvider = ({
109
109
  */
110
110
  const handleKeyDown = event => {
111
111
  var _document$querySelect, _document$querySelect2, _wrapperRef$current;
112
- //To trap the focus inside the horizontal toolbar for left and right arrow keys
112
+ // To trap the focus inside the horizontal toolbar for left and right arrow keys
113
113
  const targetElement = event.target;
114
114
 
115
- //To filter out the events outside the child component
115
+ // To filter out the events outside the child component
116
116
  if (!targetElement.closest(`${childComponentSelector}`)) {
117
117
  return;
118
118
  }
119
119
 
120
- //The key events are from child components such as dropdown menus / popups are ignored
120
+ // The key events are from child components such as dropdown menus / popups are ignored
121
121
  if ((_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
122
122
  return;
123
123
  }
@@ -131,15 +131,15 @@ export const ToolbarArrowKeyNavigationProvider = ({
131
131
  return;
132
132
  }
133
133
 
134
- //This is kind of hack to reset the current focused toolbar item
135
- //to handle some use cases such as Tab in/out of main toolbar
134
+ // This is kind of hack to reset the current focused toolbar item
135
+ // to handle some use cases such as Tab in/out of main toolbar
136
136
  if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
137
137
  selectedItemIndex.current = -1;
138
138
  } else {
139
139
  selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
140
140
  }
141
141
 
142
- //do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
142
+ // do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
143
143
  const allowScrollToElement = !(editorAppearance === 'comment' && !!useStickyToolbar);
144
144
  switch (event.key) {
145
145
  case 'ArrowRight':
@@ -162,7 +162,7 @@ export const ToolbarArrowKeyNavigationProvider = ({
162
162
  }
163
163
  };
164
164
  const globalKeyDownHandler = event => {
165
- //To focus the first element in the toolbar
165
+ // To focus the first element in the toolbar
166
166
  if (isShortcutToFocusToolbar(event)) {
167
167
  var _filteredFocusableEle4, _filteredFocusableEle5;
168
168
  const filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
@@ -205,7 +205,7 @@ function getFocusableElements(rootNode) {
205
205
  return Array.from(focusableModalElements);
206
206
  }
207
207
  function getFilteredFocusableElements(rootNode) {
208
- //The focusable elements from child components such as dropdown menus / popups are ignored
208
+ // The focusable elements from child components such as dropdown menus / popups are ignored
209
209
  return getFocusableElements(rootNode).filter(elm => {
210
210
  const style = window.getComputedStyle(elm);
211
211
  // ignore invisible element to avoid losing focus
@@ -1,6 +1,6 @@
1
1
  // This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/index.tsx`
2
2
  // If you make any change here, copy it to above file as well
3
- // and notify about the change in #team-fc-editor-ai-dev channel.
3
+ // and notify about the change in #team-fc-editor-ai-dev channel.
4
4
  /** @jsx jsx */
5
5
  import React, { useCallback } from 'react';
6
6
  import { css, jsx } from '@emotion/react';
@@ -17,7 +17,7 @@ class WithOutsideClick extends PureComponent {
17
17
  if (this.props.handleClickOutside) {
18
18
  var _this$props$editorVie;
19
19
  this.props.handleClickOutside(evt);
20
- //When the menus are closed by clicking outside the focus is set on editor.
20
+ // When the menus are closed by clicking outside the focus is set on editor.
21
21
  if (!((_this$props$editorVie = this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
22
22
  var _this$props$editorVie2;
23
23
  (_this$props$editorVie2 = this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
@@ -33,12 +33,12 @@ class WithOutsideClick extends PureComponent {
33
33
  evt.preventDefault();
34
34
  evt.stopPropagation();
35
35
  this.props.handleEscapeKeydown(evt);
36
- //on 'Esc', Focus is handled in 'handleEscapeKeydown'.
36
+ // on 'Esc', Focus is handled in 'handleEscapeKeydown'.
37
37
  return false;
38
38
  } else if (evt.code === 'Enter' && this.props.handleEnterKeydown) {
39
39
  this.props.handleEnterKeydown(evt);
40
40
  } else if (evt.code === 'Tab' && this.props.handleEscapeKeydown && this.props.closeOnTab) {
41
- //The menus should be closed when the tab is pressed as it takes the focus out of the menu
41
+ // The menus should be closed when the tab is pressed as it takes the focus out of the menu
42
42
  this.props.handleEscapeKeydown(evt);
43
43
  }
44
44
  });
@@ -49,8 +49,7 @@ class WithOutsideClick extends PureComponent {
49
49
  }
50
50
  if (this.props.handleEscapeKeydown) {
51
51
  var _this$props$editorRef;
52
- //
53
- //Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
52
+ // Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
54
53
  (((_this$props$editorRef = this.props.editorRef) === null || _this$props$editorRef === void 0 ? void 0 : _this$props$editorRef.current) || this.props.targetRef || document).addEventListener('keydown', this.handleKeydown, false);
55
54
  }
56
55
  }
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "75.3.1";
9
+ var packageVersion = "75.4.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -27,21 +27,21 @@ export var EditorPresetBuilder = /*#__PURE__*/function () {
27
27
  nextOrTuple].concat(_toConsumableArray(this.data)));
28
28
  }
29
29
 
30
- //hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
31
- // pluginToAdd: Plugin,
32
- //): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
33
- // const hasPluginQueryExists = this.data.find((pluginEntry) => {
34
- // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
35
- // pluginEntry,
36
- // )
37
- // ? pluginEntry
38
- // : pluginEntry[0];
30
+ // hasPlugin<Plugin extends NextEditorPlugin<any, any>>(
31
+ // pluginToAdd: Plugin,
32
+ // ): this is TryCastEditorPresetBuilderByCheckingPlugins<this, Plugin> {
33
+ // const hasPluginQueryExists = this.data.find((pluginEntry) => {
34
+ // const pluginFunction: NextEditorPlugin<any, any> = !Array.isArray(
35
+ // pluginEntry,
36
+ // )
37
+ // ? pluginEntry
38
+ // : pluginEntry[0];
39
39
 
40
- // return pluginFunction === pluginToAdd;
41
- // });
40
+ // return pluginFunction === pluginToAdd;
41
+ // });
42
42
 
43
- // return Boolean(hasPluginQueryExists);
44
- //}
43
+ // return Boolean(hasPluginQueryExists);
44
+ // }
45
45
  }, {
46
46
  key: "maybeAdd",
47
47
  value: function maybeAdd(pluginToAdd, add) {
@@ -138,41 +138,41 @@ export var EditorPresetBuilder = /*#__PURE__*/function () {
138
138
  }
139
139
 
140
140
  // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
141
- //import type {
142
- // ExtractPluginDependencies,
143
- //} from '../types/next-editor-plugin';
144
- //type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
145
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
146
- // ? Plugin extends NextEditorPlugin<any, any>
147
- // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
148
- // ? MaybeEditorPresetBuilder
149
- // : never
150
- // : never
151
- // : never;
152
- // Because how our plugins are added in the preset, we can't use the type safe system
153
- // in the EditorPresetBuilder.
154
- // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
155
- //maybeAdd<
156
- // MaybePlugin extends NextEditorPlugin<any, any>,
157
- // MaybePluginNames extends string[],
158
- // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
159
- // MaybeEditorPresetBuilder extends EditorPresetBuilder<
160
- // MaybePluginNames,
161
- // MaybeStackPlugins
162
- // >,
163
- //>(
164
- // pluginToAdd: MaybePlugin,
165
- // add: (
166
- // pluginToAdd: MaybePlugin,
167
- // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
168
- // ) => MaybeEditorPresetBuilder,
169
- //): MaybeEditorPresetBuilder | this {
170
- // return add(
171
- // pluginToAdd,
172
- // // @ts-ignore
173
- // this as any,
174
- // );
175
- //}
141
+ // import type {
142
+ // ExtractPluginDependencies,
143
+ // } from '../types/next-editor-plugin';
144
+ // type TryCastEditorPresetBuilderByCheckingDependencies<MaybeEditorPresetBuilder, Plugin> =
145
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<any, infer StackPlugins>
146
+ // ? Plugin extends NextEditorPlugin<any, any>
147
+ // ? ExtractPluginDependencies<Plugin>[number] extends StackPlugins[number]
148
+ // ? MaybeEditorPresetBuilder
149
+ // : never
150
+ // : never
151
+ // : never;
152
+ // Because how our plugins are added in the preset, we can't use the type safe system
153
+ // in the EditorPresetBuilder.
154
+ // TODO: ED-17023 - Bring back type safety to the EditorPresetBuilder.add preset
155
+ // maybeAdd<
156
+ // MaybePlugin extends NextEditorPlugin<any, any>,
157
+ // MaybePluginNames extends string[],
158
+ // MaybeStackPlugins extends AllEditorPresetPluginTypes[],
159
+ // MaybeEditorPresetBuilder extends EditorPresetBuilder<
160
+ // MaybePluginNames,
161
+ // MaybeStackPlugins
162
+ // >,
163
+ // >(
164
+ // pluginToAdd: MaybePlugin,
165
+ // add: (
166
+ // pluginToAdd: MaybePlugin,
167
+ // maybeEditorPresetBuilder: TryCastEditorPresetBuilderByCheckingDependencies<this, MaybePlugin>,
168
+ // ) => MaybeEditorPresetBuilder,
169
+ // ): MaybeEditorPresetBuilder | this {
170
+ // return add(
171
+ // pluginToAdd,
172
+ // // @ts-ignore
173
+ // this as any,
174
+ // );
175
+ // }
176
176
  }]);
177
177
  return EditorPresetBuilder;
178
178
  }();
@@ -19,7 +19,7 @@ import { themed } from '@atlaskit/theme/components';
19
19
  import { borderRadius } from '@atlaskit/theme/constants';
20
20
  import Layer from '../Layer';
21
21
  var packageName = "@atlaskit/editor-common";
22
- var packageVersion = "75.3.1";
22
+ var packageVersion = "75.4.0";
23
23
  var halfFocusRing = 1;
24
24
  var dropOffset = '0, 8';
25
25
  var DropList = /*#__PURE__*/function (_Component) {
@@ -68,14 +68,14 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
68
68
  var _wrapperRef$current;
69
69
  var targetElement = event.target;
70
70
 
71
- //Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
71
+ // Tab key on menu items can be handled in the parent components of dropdown menus with KeydownHandlerContext
72
72
  if (event.key === 'Tab' && closeOnTab) {
73
73
  handleClose(event);
74
74
  keyDownHandlerContext === null || keyDownHandlerContext === void 0 ? void 0 : keyDownHandlerContext.handleTab();
75
75
  return;
76
76
  }
77
77
 
78
- //To trap the focus inside the toolbar using left and right arrow keys
78
+ // To trap the focus inside the toolbar using left and right arrow keys
79
79
  var focusableElements = getFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
80
80
  if (!focusableElements || (focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) === 0) {
81
81
  return;
@@ -101,10 +101,10 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
101
101
  break;
102
102
  }
103
103
 
104
- //ArrowLeft/Right on the menu should close the menus
105
- //then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
104
+ // ArrowLeft/Right on the menu should close the menus
105
+ // then logic to retain the focus can be handled in the parent components with KeydownHandlerContext
106
106
  case 'ArrowLeft':
107
- //Filter out the events from outside the menu
107
+ // Filter out the events from outside the menu
108
108
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
109
109
  return;
110
110
  }
@@ -114,7 +114,7 @@ export var MenuArrowKeyNavigationProvider = function MenuArrowKeyNavigationProvi
114
114
  }
115
115
  break;
116
116
  case 'ArrowRight':
117
- //Filter out the events from outside the menu
117
+ // Filter out the events from outside the menu
118
118
  if (!targetElement.closest('.custom-key-handler-wrapper')) {
119
119
  return;
120
120
  }
@@ -70,9 +70,10 @@ export var Dropdown = /*#__PURE__*/function (_PureComponent) {
70
70
  fitWidth = _this$props.fitWidth,
71
71
  zIndex = _this$props.zIndex,
72
72
  arrowKeyNavigationProviderOptions = _this$props.arrowKeyNavigationProviderOptions,
73
- dropdownListId = _this$props.dropdownListId;
73
+ dropdownListId = _this$props.dropdownListId,
74
+ alignDropdownWithParentElement = _this$props.alignDropdownWithParentElement;
74
75
  return /*#__PURE__*/React.createElement(Popup, {
75
- target: target,
76
+ target: alignDropdownWithParentElement ? target === null || target === void 0 ? void 0 : target.closest("[data-testid='editor-floating-toolbar'") : target,
76
77
  mountTo: mountTo,
77
78
  boundariesElement: boundariesElement,
78
79
  scrollableElement: scrollableElement,
@@ -17,6 +17,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  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); }; }
18
18
  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; } }
19
19
  /** @jsx jsx */
20
+
20
21
  import React, { PureComponent, useContext } from 'react';
21
22
  import { css, jsx } from '@emotion/react';
22
23
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
@@ -323,8 +324,8 @@ function DropdownMenuItem(_ref) {
323
324
  export var DropdownMenuWithKeyboardNavigation = /*#__PURE__*/React.memo(function (_ref2) {
324
325
  var props = _extends({}, (_objectDestructuringEmpty(_ref2), _ref2));
325
326
  var keyDownHandlerContext = useContext(KeyDownHandlerContext);
326
- //This context is to handle the tab, Arrow Right/Left key events for dropdown.
327
- //Default context has the void callbacks for above key events
327
+ // This context is to handle the tab, Arrow Right/Left key events for dropdown.
328
+ // Default context has the void callbacks for above key events
328
329
  return jsx(DropdownMenuWrapper, _extends({
329
330
  arrowKeyNavigationProviderOptions: _objectSpread(_objectSpread({}, props.arrowKeyNavigationProviderOptions), {}, {
330
331
  keyDownHandlerContext: keyDownHandlerContext
@@ -105,15 +105,15 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
105
105
  */
106
106
  var handleKeyDown = function handleKeyDown(event) {
107
107
  var _document$querySelect, _document$querySelect2, _wrapperRef$current;
108
- //To trap the focus inside the horizontal toolbar for left and right arrow keys
108
+ // To trap the focus inside the horizontal toolbar for left and right arrow keys
109
109
  var targetElement = event.target;
110
110
 
111
- //To filter out the events outside the child component
111
+ // To filter out the events outside the child component
112
112
  if (!targetElement.closest("".concat(childComponentSelector))) {
113
113
  return;
114
114
  }
115
115
 
116
- //The key events are from child components such as dropdown menus / popups are ignored
116
+ // The key events are from child components such as dropdown menus / popups are ignored
117
117
  if ((_document$querySelect = document.querySelector('[data-role="droplistContent"], [data-test-id="color-picker-menu"], [data-emoji-picker-container="true"]')) !== null && _document$querySelect !== void 0 && _document$querySelect.contains(targetElement) || (_document$querySelect2 = document.querySelector('[data-test-id="color-picker-menu"]')) !== null && _document$querySelect2 !== void 0 && _document$querySelect2.contains(targetElement) || event.key === 'ArrowUp' || event.key === 'ArrowDown' || disableArrowKeyNavigation) {
118
118
  return;
119
119
  }
@@ -127,15 +127,15 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
127
127
  return;
128
128
  }
129
129
 
130
- //This is kind of hack to reset the current focused toolbar item
131
- //to handle some use cases such as Tab in/out of main toolbar
130
+ // This is kind of hack to reset the current focused toolbar item
131
+ // to handle some use cases such as Tab in/out of main toolbar
132
132
  if (!((_wrapperRef$current = wrapperRef.current) !== null && _wrapperRef$current !== void 0 && _wrapperRef$current.contains(targetElement))) {
133
133
  selectedItemIndex.current = -1;
134
134
  } else {
135
135
  selectedItemIndex.current = filteredFocusableElements.indexOf(targetElement) > -1 ? filteredFocusableElements.indexOf(targetElement) : selectedItemIndex.current;
136
136
  }
137
137
 
138
- //do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
138
+ // do not scroll to focused element for sticky toolbar when navigating with arrows to avoid unnesessary scroll jump
139
139
  var allowScrollToElement = !(editorAppearance === 'comment' && !!useStickyToolbar);
140
140
  switch (event.key) {
141
141
  case 'ArrowRight':
@@ -158,7 +158,7 @@ export var ToolbarArrowKeyNavigationProvider = function ToolbarArrowKeyNavigatio
158
158
  }
159
159
  };
160
160
  var globalKeyDownHandler = function globalKeyDownHandler(event) {
161
- //To focus the first element in the toolbar
161
+ // To focus the first element in the toolbar
162
162
  if (isShortcutToFocusToolbar(event)) {
163
163
  var _filteredFocusableEle4, _filteredFocusableEle5;
164
164
  var filteredFocusableElements = getFilteredFocusableElements(wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current);
@@ -201,7 +201,7 @@ function getFocusableElements(rootNode) {
201
201
  return Array.from(focusableModalElements);
202
202
  }
203
203
  function getFilteredFocusableElements(rootNode) {
204
- //The focusable elements from child components such as dropdown menus / popups are ignored
204
+ // The focusable elements from child components such as dropdown menus / popups are ignored
205
205
  return getFocusableElements(rootNode).filter(function (elm) {
206
206
  var style = window.getComputedStyle(elm);
207
207
  // ignore invisible element to avoid losing focus
@@ -5,7 +5,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  // This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/index.tsx`
7
7
  // If you make any change here, copy it to above file as well
8
- // and notify about the change in #team-fc-editor-ai-dev channel.
8
+ // and notify about the change in #team-fc-editor-ai-dev channel.
9
9
  /** @jsx jsx */
10
10
  import React, { useCallback } from 'react';
11
11
  import { css, jsx } from '@emotion/react';
@@ -33,7 +33,7 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
33
33
  if (_this.props.handleClickOutside) {
34
34
  var _this$props$editorVie;
35
35
  _this.props.handleClickOutside(evt);
36
- //When the menus are closed by clicking outside the focus is set on editor.
36
+ // When the menus are closed by clicking outside the focus is set on editor.
37
37
  if (!((_this$props$editorVie = _this.props.editorView) !== null && _this$props$editorVie !== void 0 && _this$props$editorVie.hasFocus())) {
38
38
  var _this$props$editorVie2;
39
39
  (_this$props$editorVie2 = _this.props.editorView) === null || _this$props$editorVie2 === void 0 ? void 0 : _this$props$editorVie2.focus();
@@ -49,12 +49,12 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
49
49
  evt.preventDefault();
50
50
  evt.stopPropagation();
51
51
  _this.props.handleEscapeKeydown(evt);
52
- //on 'Esc', Focus is handled in 'handleEscapeKeydown'.
52
+ // on 'Esc', Focus is handled in 'handleEscapeKeydown'.
53
53
  return false;
54
54
  } else if (evt.code === 'Enter' && _this.props.handleEnterKeydown) {
55
55
  _this.props.handleEnterKeydown(evt);
56
56
  } else if (evt.code === 'Tab' && _this.props.handleEscapeKeydown && _this.props.closeOnTab) {
57
- //The menus should be closed when the tab is pressed as it takes the focus out of the menu
57
+ // The menus should be closed when the tab is pressed as it takes the focus out of the menu
58
58
  _this.props.handleEscapeKeydown(evt);
59
59
  }
60
60
  });
@@ -68,8 +68,7 @@ var WithOutsideClick = /*#__PURE__*/function (_PureComponent) {
68
68
  }
69
69
  if (this.props.handleEscapeKeydown) {
70
70
  var _this$props$editorRef;
71
- //
72
- //Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
71
+ // Attached event to the menu so that 'ESC' events from the opened menu also will be handled.
73
72
  (((_this$props$editorRef = this.props.editorRef) === null || _this$props$editorRef === void 0 ? void 0 : _this$props$editorRef.current) || this.props.targetRef || document).addEventListener('keydown', this.handleKeydown, false);
74
73
  }
75
74
  }
@@ -1,5 +1,5 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
- import { TrackAEP } from './utils';
1
+ import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
+ import type { TrackAEP } from './utils';
3
3
  export type AnnotationActionType = ACTION.INSERTED | ACTION.CLOSED | ACTION.EDITED | ACTION.DELETED | ACTION.OPENED | ACTION.RESOLVED | ACTION.VIEWED;
4
4
  export type AnnotationAEP = TrackAEP<AnnotationActionType, ACTION_SUBJECT.ANNOTATION, ACTION_SUBJECT_ID.INLINE_COMMENT, AnnotationAEPAttributes, undefined>;
5
5
  export type AnnotationAEPAttributes = undefined | {} | AnnotationDraftAEPAttributes | AnnotationResolvedAEPAttributes;
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import { IntlShape } from 'react-intl-next';
3
- import { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { EmojiId } from '@atlaskit/emoji/types';
7
7
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
8
8
  import type { ProviderFactory } from '../provider-factory';
@@ -191,6 +191,7 @@ export type FloatingToolbarDropdown<T extends {}> = {
191
191
  tooltip?: string;
192
192
  dropdownWidth?: number;
193
193
  showSelected?: boolean;
194
+ alignDropdownWithToolbar?: boolean;
194
195
  };
195
196
  type FloatingToolbarExtensionsPlaceholder = {
196
197
  type: 'extensions-placeholder';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { MenuArrowKeyNavigationProviderProps } from '../types';
2
+ import type { MenuArrowKeyNavigationProviderProps } from '../types';
3
3
  /**
4
4
  * This component is a wrapper of vertical menus which listens to keydown events of children
5
5
  * and handles up/down arrow key navigation
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { OpenChangedEvent } from '../../ui/DropList';
3
- import { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
2
+ import type { OpenChangedEvent } from '../../ui/DropList';
3
+ import type { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
4
4
  export interface Props {
5
5
  mountTo?: HTMLElement;
6
6
  boundariesElement?: HTMLElement;
@@ -13,6 +13,7 @@ export interface Props {
13
13
  zIndex?: number;
14
14
  arrowKeyNavigationProviderOptions: ArrowKeyNavigationProviderOptions;
15
15
  dropdownListId?: string;
16
+ alignDropdownWithParentElement?: boolean;
16
17
  }
17
18
  export interface State {
18
19
  target?: HTMLElement;
@@ -1,7 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React, { PureComponent } from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { Props, State } from './types';
3
+ import type { Props, State } from './types';
5
4
  export type { MenuItem } from './types';
6
5
  /**
7
6
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ButtonProps } from '@atlaskit/button/types';
4
- import { PositionType } from '@atlaskit/tooltip';
3
+ import type { ButtonProps } from '@atlaskit/button/types';
4
+ import type { PositionType } from '@atlaskit/tooltip';
5
5
  import { TOOLBAR_ACTION_SUBJECT_ID } from '../../analytics';
6
- import { MenuItem } from '../DropdownMenu';
6
+ import type { MenuItem } from '../DropdownMenu';
7
7
  export declare const TOOLBAR_BUTTON: typeof TOOLBAR_ACTION_SUBJECT_ID;
8
8
  export type Props = {
9
9
  buttonId?: TOOLBAR_ACTION_SUBJECT_ID;
@@ -1,5 +1,5 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
- import { TrackAEP } from './utils';
1
+ import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD } from './enums';
2
+ import type { TrackAEP } from './utils';
3
3
  export type AnnotationActionType = ACTION.INSERTED | ACTION.CLOSED | ACTION.EDITED | ACTION.DELETED | ACTION.OPENED | ACTION.RESOLVED | ACTION.VIEWED;
4
4
  export type AnnotationAEP = TrackAEP<AnnotationActionType, ACTION_SUBJECT.ANNOTATION, ACTION_SUBJECT_ID.INLINE_COMMENT, AnnotationAEPAttributes, undefined>;
5
5
  export type AnnotationAEPAttributes = undefined | {} | AnnotationDraftAEPAttributes | AnnotationResolvedAEPAttributes;
@@ -1,8 +1,8 @@
1
1
  import type React from 'react';
2
- import { IntlShape } from 'react-intl-next';
3
- import { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
2
+ import type { IntlShape } from 'react-intl-next';
3
+ import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
5
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
6
  import type { EmojiId } from '@atlaskit/emoji/types';
7
7
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
8
8
  import type { ProviderFactory } from '../provider-factory';
@@ -191,6 +191,7 @@ export type FloatingToolbarDropdown<T extends {}> = {
191
191
  tooltip?: string;
192
192
  dropdownWidth?: number;
193
193
  showSelected?: boolean;
194
+ alignDropdownWithToolbar?: boolean;
194
195
  };
195
196
  type FloatingToolbarExtensionsPlaceholder = {
196
197
  type: 'extensions-placeholder';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { MenuArrowKeyNavigationProviderProps } from '../types';
2
+ import type { MenuArrowKeyNavigationProviderProps } from '../types';
3
3
  /**
4
4
  * This component is a wrapper of vertical menus which listens to keydown events of children
5
5
  * and handles up/down arrow key navigation
@@ -1,6 +1,6 @@
1
1
  import React, { PureComponent } from 'react';
2
- import { OpenChangedEvent } from '../../ui/DropList';
3
- import { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
2
+ import type { OpenChangedEvent } from '../../ui/DropList';
3
+ import type { ArrowKeyNavigationProviderOptions } from '../ArrowKeyNavigationProvider/types';
4
4
  export interface Props {
5
5
  mountTo?: HTMLElement;
6
6
  boundariesElement?: HTMLElement;
@@ -13,6 +13,7 @@ export interface Props {
13
13
  zIndex?: number;
14
14
  arrowKeyNavigationProviderOptions: ArrowKeyNavigationProviderOptions;
15
15
  dropdownListId?: string;
16
+ alignDropdownWithParentElement?: boolean;
16
17
  }
17
18
  export interface State {
18
19
  target?: HTMLElement;
@@ -1,7 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React, { PureComponent } from 'react';
3
2
  import { jsx } from '@emotion/react';
4
- import { Props, State } from './types';
3
+ import type { Props, State } from './types';
5
4
  export type { MenuItem } from './types';
6
5
  /**
7
6
  * Wrapper around @atlaskit/droplist which uses Popup and Portal to render
@@ -1,9 +1,9 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ButtonProps } from '@atlaskit/button/types';
4
- import { PositionType } from '@atlaskit/tooltip';
3
+ import type { ButtonProps } from '@atlaskit/button/types';
4
+ import type { PositionType } from '@atlaskit/tooltip';
5
5
  import { TOOLBAR_ACTION_SUBJECT_ID } from '../../analytics';
6
- import { MenuItem } from '../DropdownMenu';
6
+ import type { MenuItem } from '../DropdownMenu';
7
7
  export declare const TOOLBAR_BUTTON: typeof TOOLBAR_ACTION_SUBJECT_ID;
8
8
  export type Props = {
9
9
  buttonId?: TOOLBAR_ACTION_SUBJECT_ID;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "75.3.1",
3
+ "version": "75.4.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"