@atlaskit/editor-plugin-block-menu 4.0.14 → 4.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-block-menu
2
2
 
3
+ ## 4.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [`26917199e153a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26917199e153a) -
8
+ ED-29473 Add inputMethod attribute for block menu opened and switch inputMethod and triggeredFrom
9
+ attributes for element converted event
10
+ - Updated dependencies
11
+
12
+ ## 4.0.15
13
+
14
+ ### Patch Changes
15
+
16
+ - [`d5cf7cd71a821`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d5cf7cd71a821) -
17
+ ED-29124: Fixed format neste menu on top of top toolbar
18
+ - Updated dependencies
19
+
3
20
  ## 4.0.14
4
21
 
5
22
  ### Patch Changes
@@ -137,8 +137,8 @@ var formatNode = exports.formatNode = function formatNode(api) {
137
137
  from: sourceTypeName,
138
138
  to: targetType,
139
139
  eventCategory: (0, _utils2.getConversionType)(sourceTypeName, targetType),
140
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
141
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU,
140
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.MOUSE,
141
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.BLOCK_MENU,
142
142
  conversionSource: 'emptyList'
143
143
  }
144
144
  })(newTr);
@@ -178,8 +178,8 @@ var formatNode = exports.formatNode = function formatNode(api) {
178
178
  from: _sourceTypeName,
179
179
  to: targetType,
180
180
  eventCategory: (0, _utils2.getConversionType)(_sourceTypeName, targetType),
181
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
182
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU,
181
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.MOUSE,
182
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.BLOCK_MENU,
183
183
  conversionSource: conversionSource
184
184
  }
185
185
  })(_newTr);
@@ -235,8 +235,8 @@ var formatNode = exports.formatNode = function formatNode(api) {
235
235
  from: _sourceTypeName2,
236
236
  to: targetType,
237
237
  eventCategory: (0, _utils2.getConversionType)(_sourceTypeName2, targetType),
238
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.MOUSE,
239
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.BLOCK_MENU
238
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || _analytics.INPUT_METHOD.MOUSE,
239
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || _analytics.INPUT_METHOD.BLOCK_MENU
240
240
  }
241
241
  })(_newTr2);
242
242
  }
@@ -102,7 +102,7 @@ var BlockMenu = function BlockMenu(_ref2) {
102
102
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU,
103
103
  eventType: _analytics.EVENT_TYPE.UI,
104
104
  attributes: {
105
- inputMethod: _analytics.INPUT_METHOD.MOUSE
105
+ inputMethod: openedViaKeyboard ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE
106
106
  }
107
107
  });
108
108
  }
@@ -110,7 +110,7 @@ var BlockMenu = function BlockMenu(_ref2) {
110
110
  // Update the previous state
111
111
  prevIsMenuOpenRef.current = isMenuOpen;
112
112
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen'));
113
- }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent]);
113
+ }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent, openedViaKeyboard]);
114
114
  if (!isMenuOpen) {
115
115
  return null;
116
116
  }
@@ -41,7 +41,6 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
41
41
  action: _analytics.ACTION.CLICKED,
42
42
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
43
43
  attributes: {
44
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
45
44
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.COPY_CONTENT
46
45
  },
47
46
  eventType: _analytics.EVENT_TYPE.UI
@@ -33,7 +33,6 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
33
33
  action: _analytics.ACTION.CLICKED,
34
34
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
35
35
  attributes: {
36
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
37
36
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.COPY_LINK_TO_BLOCK
38
37
  },
39
38
  eventType: _analytics.EVENT_TYPE.UI
@@ -27,7 +27,7 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
27
27
  var _useIntl = (0, _reactIntlNext.useIntl)(),
28
28
  formatMessage = _useIntl.formatMessage;
29
29
  var nodeTypes = Object.values((api === null || api === void 0 || (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 || (_api$core$sharedState = _api$core$sharedState.schema) === null || _api$core$sharedState === void 0 ? void 0 : _api$core$sharedState.nodes) || {});
30
- var onClick = function onClick() {
30
+ var onClick = function onClick(e) {
31
31
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
32
32
  var _api$analytics, _api$blockControls;
33
33
  var tr = _ref2.tr;
@@ -35,7 +35,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
35
35
  action: _analytics.ACTION.CLICKED,
36
36
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
37
37
  attributes: {
38
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
39
38
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.DELETE
40
39
  },
41
40
  eventType: _analytics.EVENT_TYPE.UI
@@ -35,7 +35,6 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
35
35
  action: _analytics.ACTION.CLICKED,
36
36
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
37
37
  attributes: {
38
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
39
38
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.FORMAT_MENU
40
39
  },
41
40
  eventType: _analytics.EVENT_TYPE.UI
@@ -55,6 +54,7 @@ var FormatMenuComponent = exports.FormatMenuComponent = function FormatMenuCompo
55
54
  enableMaxHeight: true,
56
55
  isDisabled: isDisabled,
57
56
  onClick: handleClick,
58
- dropdownTestId: "editor-nested-turn-into-menu"
57
+ dropdownTestId: "editor-nested-turn-into-menu",
58
+ shouldFitContainer: (0, _platformFeatureFlags.fg)('platform_editor_block_menu_shouldfitcontainer') ? true : undefined
59
59
  }, children);
60
60
  };
@@ -34,7 +34,6 @@ var MoveDownDropdownItemContent = function MoveDownDropdownItemContent(_ref) {
34
34
  action: _analytics.ACTION.CLICKED,
35
35
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
36
36
  attributes: {
37
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
38
37
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.MOVE_DOWN
39
38
  },
40
39
  eventType: _analytics.EVENT_TYPE.UI
@@ -34,7 +34,6 @@ var MoveUpDropdownItemContent = function MoveUpDropdownItemContent(_ref) {
34
34
  action: _analytics.ACTION.CLICKED,
35
35
  actionSubject: _analytics.ACTION_SUBJECT.BLOCK_MENU_ITEM,
36
36
  attributes: {
37
- inputMethod: _analytics.INPUT_METHOD.MOUSE,
38
37
  menuItemName: _consts.BLOCK_MENU_ITEM_NAME.MOVE_UP
39
38
  },
40
39
  eventType: _analytics.EVENT_TYPE.UI
@@ -142,8 +142,8 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
142
142
  from: sourceTypeName,
143
143
  to: targetType,
144
144
  eventCategory: getConversionType(sourceTypeName, targetType),
145
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
146
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
145
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
146
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU,
147
147
  conversionSource: 'emptyList'
148
148
  }
149
149
  })(newTr);
@@ -183,8 +183,8 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
183
183
  from: sourceTypeName,
184
184
  to: targetType,
185
185
  eventCategory: getConversionType(sourceTypeName, targetType),
186
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
187
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
186
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
187
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU,
188
188
  conversionSource
189
189
  }
190
190
  })(newTr);
@@ -240,8 +240,8 @@ export const formatNode = api => (targetType, analyticsAttrs) => {
240
240
  from: sourceTypeName,
241
241
  to: targetType,
242
242
  eventCategory: getConversionType(sourceTypeName, targetType),
243
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
244
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU
243
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
244
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU
245
245
  }
246
246
  })(newTr);
247
247
  }
@@ -92,7 +92,7 @@ const BlockMenu = ({
92
92
  actionSubject: ACTION_SUBJECT.BLOCK_MENU,
93
93
  eventType: EVENT_TYPE.UI,
94
94
  attributes: {
95
- inputMethod: INPUT_METHOD.MOUSE
95
+ inputMethod: openedViaKeyboard ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE
96
96
  }
97
97
  });
98
98
  }
@@ -100,7 +100,7 @@ const BlockMenu = ({
100
100
  // Update the previous state
101
101
  prevIsMenuOpenRef.current = isMenuOpen;
102
102
  api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen'));
103
- }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent]);
103
+ }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent, openedViaKeyboard]);
104
104
  if (!isMenuOpen) {
105
105
  return null;
106
106
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { injectIntl, useIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
5
5
  import { copyHTMLToClipboard } from '@atlaskit/editor-common/clipboard';
6
6
  import { toDOM, copyDomNode } from '@atlaskit/editor-common/copy-button';
@@ -35,7 +35,6 @@ const CopyBlockMenuItem = ({
35
35
  action: ACTION.CLICKED,
36
36
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
37
37
  attributes: {
38
- inputMethod: INPUT_METHOD.MOUSE,
39
38
  menuItemName: BLOCK_MENU_ITEM_NAME.COPY_CONTENT
40
39
  },
41
40
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import LinkIcon from '@atlaskit/icon/core/link';
@@ -28,7 +28,6 @@ const CopyLinkDropdownItemContent = ({
28
28
  action: ACTION.CLICKED,
29
29
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
30
30
  attributes: {
31
- inputMethod: INPUT_METHOD.MOUSE,
32
31
  menuItemName: BLOCK_MENU_ITEM_NAME.COPY_LINK_TO_BLOCK
33
32
  },
34
33
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect } from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
5
5
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -20,7 +20,7 @@ const DeleteDropdownItemContent = ({
20
20
  formatMessage
21
21
  } = useIntl();
22
22
  const nodeTypes = Object.values((api === null || api === void 0 ? void 0 : (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 ? void 0 : (_api$core$sharedState2 = _api$core$sharedState.schema) === null || _api$core$sharedState2 === void 0 ? void 0 : _api$core$sharedState2.nodes) || {});
23
- const onClick = () => {
23
+ const onClick = e => {
24
24
  api === null || api === void 0 ? void 0 : api.core.actions.execute(({
25
25
  tr
26
26
  }) => {
@@ -29,7 +29,6 @@ const DeleteDropdownItemContent = ({
29
29
  action: ACTION.CLICKED,
30
30
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
31
31
  attributes: {
32
- inputMethod: INPUT_METHOD.MOUSE,
33
32
  menuItemName: BLOCK_MENU_ITEM_NAME.DELETE
34
33
  },
35
34
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo, useCallback } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
5
5
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
6
6
  import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
@@ -29,7 +29,6 @@ export const FormatMenuComponent = ({
29
29
  action: ACTION.CLICKED,
30
30
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
31
31
  attributes: {
32
- inputMethod: INPUT_METHOD.MOUSE,
33
32
  menuItemName: BLOCK_MENU_ITEM_NAME.FORMAT_MENU
34
33
  },
35
34
  eventType: EVENT_TYPE.UI
@@ -49,6 +48,7 @@ export const FormatMenuComponent = ({
49
48
  enableMaxHeight: true,
50
49
  isDisabled: isDisabled,
51
50
  onClick: handleClick,
52
- dropdownTestId: "editor-nested-turn-into-menu"
51
+ dropdownTestId: "editor-nested-turn-into-menu",
52
+ shouldFitContainer: fg('platform_editor_block_menu_shouldfitcontainer') ? true : undefined
53
53
  }, children);
54
54
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { DIRECTION } from '@atlaskit/editor-common/types';
@@ -32,7 +32,6 @@ const MoveDownDropdownItemContent = ({
32
32
  action: ACTION.CLICKED,
33
33
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
34
34
  attributes: {
35
- inputMethod: INPUT_METHOD.MOUSE,
36
35
  menuItemName: BLOCK_MENU_ITEM_NAME.MOVE_DOWN
37
36
  },
38
37
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { DIRECTION } from '@atlaskit/editor-common/types';
@@ -32,7 +32,6 @@ const MoveUpDropdownItemContent = ({
32
32
  action: ACTION.CLICKED,
33
33
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
34
34
  attributes: {
35
- inputMethod: INPUT_METHOD.MOUSE,
36
35
  menuItemName: BLOCK_MENU_ITEM_NAME.MOVE_UP
37
36
  },
38
37
  eventType: EVENT_TYPE.UI
@@ -132,8 +132,8 @@ export var formatNode = function formatNode(api) {
132
132
  from: sourceTypeName,
133
133
  to: targetType,
134
134
  eventCategory: getConversionType(sourceTypeName, targetType),
135
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
136
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
135
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
136
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU,
137
137
  conversionSource: 'emptyList'
138
138
  }
139
139
  })(newTr);
@@ -173,8 +173,8 @@ export var formatNode = function formatNode(api) {
173
173
  from: _sourceTypeName,
174
174
  to: targetType,
175
175
  eventCategory: getConversionType(_sourceTypeName, targetType),
176
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
177
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU,
176
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
177
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU,
178
178
  conversionSource: conversionSource
179
179
  }
180
180
  })(_newTr);
@@ -230,8 +230,8 @@ export var formatNode = function formatNode(api) {
230
230
  from: _sourceTypeName2,
231
231
  to: targetType,
232
232
  eventCategory: getConversionType(_sourceTypeName2, targetType),
233
- inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.MOUSE,
234
- triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.BLOCK_MENU
233
+ triggeredFrom: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.triggeredFrom) || INPUT_METHOD.MOUSE,
234
+ inputMethod: (analyticsAttrs === null || analyticsAttrs === void 0 ? void 0 : analyticsAttrs.inputMethod) || INPUT_METHOD.BLOCK_MENU
235
235
  }
236
236
  })(_newTr2);
237
237
  }
@@ -94,7 +94,7 @@ var BlockMenu = function BlockMenu(_ref2) {
94
94
  actionSubject: ACTION_SUBJECT.BLOCK_MENU,
95
95
  eventType: EVENT_TYPE.UI,
96
96
  attributes: {
97
- inputMethod: INPUT_METHOD.MOUSE
97
+ inputMethod: openedViaKeyboard ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE
98
98
  }
99
99
  });
100
100
  }
@@ -102,7 +102,7 @@ var BlockMenu = function BlockMenu(_ref2) {
102
102
  // Update the previous state
103
103
  prevIsMenuOpenRef.current = isMenuOpen;
104
104
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('blockMenuOpen'));
105
- }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent]);
105
+ }, [api, isMenuOpen, menuTriggerBy, selectedByShortcutORDragHandle, hasFocus, shouldShowBlockMenuForEmptyLine, currentUserIntent, openedViaKeyboard]);
106
106
  if (!isMenuOpen) {
107
107
  return null;
108
108
  }
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  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; }
4
4
  import React from 'react';
5
5
  import { injectIntl, useIntl } from 'react-intl-next';
6
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
7
7
  import { messages } from '@atlaskit/editor-common/block-menu';
8
8
  import { copyHTMLToClipboard } from '@atlaskit/editor-common/clipboard';
9
9
  import { toDOM, copyDomNode } from '@atlaskit/editor-common/copy-button';
@@ -34,7 +34,6 @@ var CopyBlockMenuItem = function CopyBlockMenuItem(_ref) {
34
34
  action: ACTION.CLICKED,
35
35
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
36
36
  attributes: {
37
- inputMethod: INPUT_METHOD.MOUSE,
38
37
  menuItemName: BLOCK_MENU_ITEM_NAME.COPY_CONTENT
39
38
  },
40
39
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
6
6
  import LinkIcon from '@atlaskit/icon/core/link';
@@ -24,7 +24,6 @@ var CopyLinkDropdownItemContent = function CopyLinkDropdownItemContent(_ref) {
24
24
  action: ACTION.CLICKED,
25
25
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
26
26
  attributes: {
27
- inputMethod: INPUT_METHOD.MOUSE,
28
27
  menuItemName: BLOCK_MENU_ITEM_NAME.COPY_LINK_TO_BLOCK
29
28
  },
30
29
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback, useEffect } from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
5
5
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
@@ -18,7 +18,7 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
18
18
  var _useIntl = useIntl(),
19
19
  formatMessage = _useIntl.formatMessage;
20
20
  var nodeTypes = Object.values((api === null || api === void 0 || (_api$core$sharedState = api.core.sharedState.currentState()) === null || _api$core$sharedState === void 0 || (_api$core$sharedState = _api$core$sharedState.schema) === null || _api$core$sharedState === void 0 ? void 0 : _api$core$sharedState.nodes) || {});
21
- var onClick = function onClick() {
21
+ var onClick = function onClick(e) {
22
22
  api === null || api === void 0 || api.core.actions.execute(function (_ref2) {
23
23
  var _api$analytics, _api$blockControls;
24
24
  var tr = _ref2.tr;
@@ -26,7 +26,6 @@ var DeleteDropdownItemContent = function DeleteDropdownItemContent(_ref) {
26
26
  action: ACTION.CLICKED,
27
27
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
28
28
  attributes: {
29
- inputMethod: INPUT_METHOD.MOUSE,
30
29
  menuItemName: BLOCK_MENU_ITEM_NAME.DELETE
31
30
  },
32
31
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo, useCallback } from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { messages } from '@atlaskit/editor-common/block-menu';
5
5
  import { blockMenuMessages } from '@atlaskit/editor-common/messages';
6
6
  import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
@@ -26,7 +26,6 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
26
26
  action: ACTION.CLICKED,
27
27
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
28
28
  attributes: {
29
- inputMethod: INPUT_METHOD.MOUSE,
30
29
  menuItemName: BLOCK_MENU_ITEM_NAME.FORMAT_MENU
31
30
  },
32
31
  eventType: EVENT_TYPE.UI
@@ -46,6 +45,7 @@ export var FormatMenuComponent = function FormatMenuComponent(_ref) {
46
45
  enableMaxHeight: true,
47
46
  isDisabled: isDisabled,
48
47
  onClick: handleClick,
49
- dropdownTestId: "editor-nested-turn-into-menu"
48
+ dropdownTestId: "editor-nested-turn-into-menu",
49
+ shouldFitContainer: fg('platform_editor_block_menu_shouldfitcontainer') ? true : undefined
50
50
  }, children);
51
51
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { DIRECTION } from '@atlaskit/editor-common/types';
@@ -27,7 +27,6 @@ var MoveDownDropdownItemContent = function MoveDownDropdownItemContent(_ref) {
27
27
  action: ACTION.CLICKED,
28
28
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
29
29
  attributes: {
30
- inputMethod: INPUT_METHOD.MOUSE,
31
30
  menuItemName: BLOCK_MENU_ITEM_NAME.MOVE_DOWN
32
31
  },
33
32
  eventType: EVENT_TYPE.UI
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useIntl, injectIntl } from 'react-intl-next';
3
- import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
+ import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { blockMenuMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { DIRECTION } from '@atlaskit/editor-common/types';
@@ -27,7 +27,6 @@ var MoveUpDropdownItemContent = function MoveUpDropdownItemContent(_ref) {
27
27
  action: ACTION.CLICKED,
28
28
  actionSubject: ACTION_SUBJECT.BLOCK_MENU_ITEM,
29
29
  attributes: {
30
- inputMethod: INPUT_METHOD.MOUSE,
31
30
  menuItemName: BLOCK_MENU_ITEM_NAME.MOVE_UP
32
31
  },
33
32
  eventType: EVENT_TYPE.UI
@@ -3,7 +3,7 @@ import type { TransformContext } from '@atlaskit/editor-common/transforms';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | 'layoutSection' | 'panel' | 'codeBlock' | 'bulletList' | 'orderedList' | 'taskList';
5
5
  export type FormatNodeAnalyticsAttrs = {
6
- inputMethod: INPUT_METHOD.MOUSE | INPUT_METHOD.KEYBOARD;
7
- triggeredFrom: INPUT_METHOD.BLOCK_MENU;
6
+ inputMethod: INPUT_METHOD.BLOCK_MENU;
7
+ triggeredFrom: INPUT_METHOD.MOUSE | INPUT_METHOD.KEYBOARD;
8
8
  };
9
9
  export type TransformFunction = (context: TransformContext) => Transaction | null;
@@ -3,7 +3,7 @@ import type { TransformContext } from '@atlaskit/editor-common/transforms';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export type FormatNodeTargetType = 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'blockquote' | 'expand' | 'layoutSection' | 'panel' | 'codeBlock' | 'bulletList' | 'orderedList' | 'taskList';
5
5
  export type FormatNodeAnalyticsAttrs = {
6
- inputMethod: INPUT_METHOD.MOUSE | INPUT_METHOD.KEYBOARD;
7
- triggeredFrom: INPUT_METHOD.BLOCK_MENU;
6
+ inputMethod: INPUT_METHOD.BLOCK_MENU;
7
+ triggeredFrom: INPUT_METHOD.MOUSE | INPUT_METHOD.KEYBOARD;
8
8
  };
9
9
  export type TransformFunction = (context: TransformContext) => Transaction | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-block-menu",
3
- "version": "4.0.14",
3
+ "version": "4.0.16",
4
4
  "description": "BlockMenu plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,12 +43,12 @@
43
43
  "@atlaskit/icon-lab": "^5.9.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
45
  "@atlaskit/primitives": "^14.15.0",
46
- "@atlaskit/tmp-editor-statsig": "^13.2.0",
46
+ "@atlaskit/tmp-editor-statsig": "^13.4.0",
47
47
  "@atlaskit/tokens": "^6.4.0",
48
48
  "@babel/runtime": "^7.0.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@atlaskit/editor-common": "^110.5.0",
51
+ "@atlaskit/editor-common": "^110.7.0",
52
52
  "react": "^18.2.0",
53
53
  "react-intl-next": "npm:react-intl@^5.18.1"
54
54
  },
@@ -106,6 +106,9 @@
106
106
  },
107
107
  "platform_editor_block_menu_patch_2": {
108
108
  "type": "boolean"
109
+ },
110
+ "platform_editor_block_menu_shouldfitcontainer": {
111
+ "type": "boolean"
109
112
  }
110
113
  }
111
114
  }