@atlaskit/editor-plugin-block-menu 4.0.15 → 4.0.17
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 +17 -0
- package/dist/cjs/editor-commands/formatNode.js +6 -6
- package/dist/cjs/ui/block-menu.js +2 -2
- package/dist/cjs/ui/copy-block.js +0 -1
- package/dist/cjs/ui/copy-link.js +0 -1
- package/dist/cjs/ui/delete-button.js +1 -2
- package/dist/cjs/ui/format-menu-nested.js +0 -1
- package/dist/cjs/ui/move-down.js +0 -1
- package/dist/cjs/ui/move-up.js +0 -1
- package/dist/cjs/ui/utils/isNestedNode.js +5 -0
- package/dist/es2019/editor-commands/formatNode.js +6 -6
- package/dist/es2019/ui/block-menu.js +2 -2
- package/dist/es2019/ui/copy-block.js +1 -2
- package/dist/es2019/ui/copy-link.js +1 -2
- package/dist/es2019/ui/delete-button.js +2 -3
- package/dist/es2019/ui/format-menu-nested.js +1 -2
- package/dist/es2019/ui/move-down.js +1 -2
- package/dist/es2019/ui/move-up.js +1 -2
- package/dist/es2019/ui/utils/isNestedNode.js +5 -0
- package/dist/esm/editor-commands/formatNode.js +6 -6
- package/dist/esm/ui/block-menu.js +2 -2
- package/dist/esm/ui/copy-block.js +1 -2
- package/dist/esm/ui/copy-link.js +1 -2
- package/dist/esm/ui/delete-button.js +2 -3
- package/dist/esm/ui/format-menu-nested.js +1 -2
- package/dist/esm/ui/move-down.js +1 -2
- package/dist/esm/ui/move-up.js +1 -2
- package/dist/esm/ui/utils/isNestedNode.js +5 -0
- package/dist/types/editor-commands/transforms/types.d.ts +2 -2
- package/dist/types-ts4.5/editor-commands/transforms/types.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 4.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dc211dc1927b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc211dc1927b5) -
|
|
8
|
+
[ux] ED-29232: Fixed issues with block menu for file
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 4.0.16
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`26917199e153a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/26917199e153a) -
|
|
16
|
+
ED-29473 Add inputMethod attribute for block menu opened and switch inputMethod and triggeredFrom
|
|
17
|
+
attributes for element converted event
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 4.0.15
|
|
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
|
-
|
|
141
|
-
|
|
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
|
-
|
|
182
|
-
|
|
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
|
-
|
|
239
|
-
|
|
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
|
package/dist/cjs/ui/copy-link.js
CHANGED
|
@@ -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
|
package/dist/cjs/ui/move-down.js
CHANGED
|
@@ -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
|
package/dist/cjs/ui/move-up.js
CHANGED
|
@@ -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
|
|
@@ -24,6 +24,11 @@ var isNestedNode = exports.isNestedNode = function isNestedNode(selection, menuT
|
|
|
24
24
|
}
|
|
25
25
|
var $from = selection.$from;
|
|
26
26
|
var depth = $from.depth;
|
|
27
|
+
|
|
28
|
+
// When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
|
|
29
|
+
if ($from.depth === 1 && selection instanceof _state.NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
27
32
|
if ($from.depth > 0 && selection instanceof _state.NodeSelection) {
|
|
28
33
|
return true;
|
|
29
34
|
}
|
|
@@ -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
|
-
|
|
146
|
-
|
|
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
|
-
|
|
187
|
-
|
|
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
|
-
|
|
244
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -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
|
|
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
|
|
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
|
|
@@ -21,6 +21,11 @@ export const isNestedNode = (selection, menuTriggerBy) => {
|
|
|
21
21
|
$from
|
|
22
22
|
} = selection;
|
|
23
23
|
const depth = $from.depth;
|
|
24
|
+
|
|
25
|
+
// When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
|
|
26
|
+
if ($from.depth === 1 && selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
24
29
|
if ($from.depth > 0 && selection instanceof NodeSelection) {
|
|
25
30
|
return true;
|
|
26
31
|
}
|
|
@@ -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
|
-
|
|
136
|
-
|
|
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
|
-
|
|
177
|
-
|
|
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
|
-
|
|
234
|
-
|
|
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
|
|
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
|
package/dist/esm/ui/copy-link.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
package/dist/esm/ui/move-down.js
CHANGED
|
@@ -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
|
|
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
|
package/dist/esm/ui/move-up.js
CHANGED
|
@@ -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
|
|
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
|
|
@@ -19,6 +19,11 @@ export var isNestedNode = function isNestedNode(selection, menuTriggerBy) {
|
|
|
19
19
|
}
|
|
20
20
|
var $from = selection.$from;
|
|
21
21
|
var depth = $from.depth;
|
|
22
|
+
|
|
23
|
+
// When a file is in card view, selection.$from has a depth of 1, but it is not a nested node, should return false
|
|
24
|
+
if ($from.depth === 1 && selection instanceof NodeSelection && selection.node.type.name === 'media' && selection.node.attrs.type === 'file') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
22
27
|
if ($from.depth > 0 && selection instanceof NodeSelection) {
|
|
23
28
|
return true;
|
|
24
29
|
}
|
|
@@ -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.
|
|
7
|
-
triggeredFrom: INPUT_METHOD.
|
|
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.
|
|
7
|
-
triggeredFrom: INPUT_METHOD.
|
|
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.
|
|
3
|
+
"version": "4.0.17",
|
|
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.
|
|
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.
|
|
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
|
},
|