@atlaskit/editor-plugin-selection-extension 9.0.8 → 10.0.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.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/ui/extension/SelectionExtensionComponentWrapper.js +2 -2
- package/dist/cjs/ui/menu/SelectionExtensionDropdownItem.js +5 -6
- package/dist/cjs/ui/menu/SelectionExtensionNestedDropdownMenu.js +3 -2
- package/dist/es2019/ui/extension/SelectionExtensionComponentWrapper.js +2 -2
- package/dist/es2019/ui/menu/SelectionExtensionDropdownItem.js +5 -6
- package/dist/es2019/ui/menu/SelectionExtensionNestedDropdownMenu.js +3 -2
- package/dist/esm/ui/extension/SelectionExtensionComponentWrapper.js +2 -2
- package/dist/esm/ui/menu/SelectionExtensionDropdownItem.js +5 -6
- package/dist/esm/ui/menu/SelectionExtensionNestedDropdownMenu.js +3 -2
- package/dist/types/ui/SelectionExtensionComponentContext.d.ts +2 -1
- package/dist/types-ts4.5/ui/SelectionExtensionComponentContext.d.ts +2 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-extension
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.0.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`6c9c4e73b1c39`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6c9c4e73b1c39) -
|
|
14
|
+
EDITOR-4037 Block menu selection extension tests
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 9.0.8
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -53,7 +53,7 @@ var SelectionExtensionComponentWrapper = exports.SelectionExtensionComponentWrap
|
|
|
53
53
|
if (!extension) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
|
-
if (isToolbarAIFCEnabled) {
|
|
56
|
+
if (isToolbarAIFCEnabled || (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
57
57
|
var currentComponent;
|
|
58
58
|
if ('contentComponent' in extension && extension.contentComponent !== undefined) {
|
|
59
59
|
currentComponent = extension.contentComponent;
|
|
@@ -92,7 +92,7 @@ var SelectionExtensionComponentWrapper = exports.SelectionExtensionComponentWrap
|
|
|
92
92
|
if (!extension) {
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
|
-
if (isToolbarAIFCEnabled) {
|
|
95
|
+
if (isToolbarAIFCEnabled || (0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
96
96
|
var hasContentComponent = function hasContentComponent(ext) {
|
|
97
97
|
return 'contentComponent' in ext && ext.contentComponent !== undefined;
|
|
98
98
|
};
|
|
@@ -22,11 +22,10 @@ var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = fu
|
|
|
22
22
|
extensionSource = _useSelectionExtensio.extensionSource,
|
|
23
23
|
extensionLocation = _useSelectionExtensio.extensionLocation;
|
|
24
24
|
var handleClick = function handleClick() {
|
|
25
|
-
var _api$analytics;
|
|
25
|
+
var _api$blockControls, _dropdownItem$onClick, _api$analytics;
|
|
26
|
+
var preservedSelection = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection;
|
|
27
|
+
var selection = preservedSelection || editorView.state.selection;
|
|
26
28
|
if (dropdownItem.contentComponent) {
|
|
27
|
-
var _api$blockControls;
|
|
28
|
-
var preservedSelection = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection;
|
|
29
|
-
var selection = preservedSelection || editorView.state.selection;
|
|
30
29
|
var selectionInfo = (0, _utils.getSelectionTextInfoNew)(selection, editorView, api);
|
|
31
30
|
api.core.actions.execute(api.selectionExtension.commands.setActiveExtension({
|
|
32
31
|
extension: dropdownItem,
|
|
@@ -35,7 +34,7 @@ var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = fu
|
|
|
35
34
|
}
|
|
36
35
|
api.core.actions.execute(function (_ref2) {
|
|
37
36
|
var tr = _ref2.tr;
|
|
38
|
-
var _getSelectionAdfInfoN = (0, _utils.getSelectionAdfInfoNew)(
|
|
37
|
+
var _getSelectionAdfInfoN = (0, _utils.getSelectionAdfInfoNew)(selection),
|
|
39
38
|
selectedNode = _getSelectionAdfInfoN.selectedNode,
|
|
40
39
|
nodePos = _getSelectionAdfInfoN.nodePos;
|
|
41
40
|
tr.setMeta(_main.selectionExtensionPluginKey, {
|
|
@@ -45,7 +44,7 @@ var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = fu
|
|
|
45
44
|
});
|
|
46
45
|
return tr;
|
|
47
46
|
});
|
|
48
|
-
dropdownItem.onClick
|
|
47
|
+
(_dropdownItem$onClick = dropdownItem.onClick) === null || _dropdownItem$onClick === void 0 || _dropdownItem$onClick.call(dropdownItem);
|
|
49
48
|
(_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
50
49
|
action: _analytics.ACTION.CLICKED,
|
|
51
50
|
actionSubject: _analytics.ACTION_SUBJECT.BUTTON,
|
|
@@ -51,9 +51,10 @@ var SelectionExtensionNestedDropdownMenu = exports.SelectionExtensionNestedDropd
|
|
|
51
51
|
label: ""
|
|
52
52
|
}) : undefined,
|
|
53
53
|
elemAfter: /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
|
|
54
|
-
label:
|
|
54
|
+
label: ""
|
|
55
55
|
}),
|
|
56
|
-
onClick: handleClick
|
|
56
|
+
onClick: handleClick,
|
|
57
|
+
dropdownTestId: "editor-selection-extension-menu"
|
|
57
58
|
}, /*#__PURE__*/_react.default.createElement(ChildItems, {
|
|
58
59
|
nestedDropdownMenu: nestedDropdownMenu
|
|
59
60
|
}));
|
|
@@ -47,7 +47,7 @@ export const SelectionExtensionComponentWrapper = ({
|
|
|
47
47
|
if (!extension) {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
if (isToolbarAIFCEnabled) {
|
|
50
|
+
if (isToolbarAIFCEnabled || expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
51
51
|
let currentComponent;
|
|
52
52
|
if ('contentComponent' in extension && extension.contentComponent !== undefined) {
|
|
53
53
|
currentComponent = extension.contentComponent;
|
|
@@ -86,7 +86,7 @@ export const SelectionExtensionComponentWrapper = ({
|
|
|
86
86
|
if (!extension) {
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
|
-
if (isToolbarAIFCEnabled) {
|
|
89
|
+
if (isToolbarAIFCEnabled || expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
90
90
|
const hasContentComponent = ext => {
|
|
91
91
|
return 'contentComponent' in ext && ext.contentComponent !== undefined;
|
|
92
92
|
};
|
|
@@ -17,11 +17,10 @@ export const SelectionExtensionDropdownItem = ({
|
|
|
17
17
|
extensionLocation
|
|
18
18
|
} = useSelectionExtensionComponentContext();
|
|
19
19
|
const handleClick = () => {
|
|
20
|
-
var _api$analytics;
|
|
20
|
+
var _api$blockControls, _api$blockControls$sh, _dropdownItem$onClick, _api$analytics;
|
|
21
|
+
const preservedSelection = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
22
|
+
const selection = preservedSelection || editorView.state.selection;
|
|
21
23
|
if (dropdownItem.contentComponent) {
|
|
22
|
-
var _api$blockControls, _api$blockControls$sh;
|
|
23
|
-
const preservedSelection = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : (_api$blockControls$sh = _api$blockControls.sharedState.currentState()) === null || _api$blockControls$sh === void 0 ? void 0 : _api$blockControls$sh.preservedSelection;
|
|
24
|
-
const selection = preservedSelection || editorView.state.selection;
|
|
25
24
|
const selectionInfo = getSelectionTextInfoNew(selection, editorView, api);
|
|
26
25
|
api.core.actions.execute(api.selectionExtension.commands.setActiveExtension({
|
|
27
26
|
extension: dropdownItem,
|
|
@@ -34,7 +33,7 @@ export const SelectionExtensionDropdownItem = ({
|
|
|
34
33
|
const {
|
|
35
34
|
selectedNode,
|
|
36
35
|
nodePos
|
|
37
|
-
} = getSelectionAdfInfoNew(
|
|
36
|
+
} = getSelectionAdfInfoNew(selection);
|
|
38
37
|
tr.setMeta(selectionExtensionPluginKey, {
|
|
39
38
|
type: SelectionExtensionActionTypes.SET_SELECTED_NODE,
|
|
40
39
|
selectedNode,
|
|
@@ -42,7 +41,7 @@ export const SelectionExtensionDropdownItem = ({
|
|
|
42
41
|
});
|
|
43
42
|
return tr;
|
|
44
43
|
});
|
|
45
|
-
dropdownItem.onClick
|
|
44
|
+
(_dropdownItem$onClick = dropdownItem.onClick) === null || _dropdownItem$onClick === void 0 ? void 0 : _dropdownItem$onClick.call(dropdownItem);
|
|
46
45
|
(_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions.fireAnalyticsEvent({
|
|
47
46
|
action: ACTION.CLICKED,
|
|
48
47
|
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
@@ -45,9 +45,10 @@ export const SelectionExtensionNestedDropdownMenu = ({
|
|
|
45
45
|
label: ""
|
|
46
46
|
}) : undefined,
|
|
47
47
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
48
|
-
label:
|
|
48
|
+
label: ""
|
|
49
49
|
}),
|
|
50
|
-
onClick: handleClick
|
|
50
|
+
onClick: handleClick,
|
|
51
|
+
dropdownTestId: "editor-selection-extension-menu"
|
|
51
52
|
}, /*#__PURE__*/React.createElement(ChildItems, {
|
|
52
53
|
nestedDropdownMenu: nestedDropdownMenu
|
|
53
54
|
}));
|
|
@@ -45,7 +45,7 @@ export var SelectionExtensionComponentWrapper = function SelectionExtensionCompo
|
|
|
45
45
|
if (!extension) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
if (isToolbarAIFCEnabled) {
|
|
48
|
+
if (isToolbarAIFCEnabled || expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
49
49
|
var currentComponent;
|
|
50
50
|
if ('contentComponent' in extension && extension.contentComponent !== undefined) {
|
|
51
51
|
currentComponent = extension.contentComponent;
|
|
@@ -84,7 +84,7 @@ export var SelectionExtensionComponentWrapper = function SelectionExtensionCompo
|
|
|
84
84
|
if (!extension) {
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
|
-
if (isToolbarAIFCEnabled) {
|
|
87
|
+
if (isToolbarAIFCEnabled || expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
88
88
|
var hasContentComponent = function hasContentComponent(ext) {
|
|
89
89
|
return 'contentComponent' in ext && ext.contentComponent !== undefined;
|
|
90
90
|
};
|
|
@@ -15,11 +15,10 @@ export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownI
|
|
|
15
15
|
extensionSource = _useSelectionExtensio.extensionSource,
|
|
16
16
|
extensionLocation = _useSelectionExtensio.extensionLocation;
|
|
17
17
|
var handleClick = function handleClick() {
|
|
18
|
-
var _api$analytics;
|
|
18
|
+
var _api$blockControls, _dropdownItem$onClick, _api$analytics;
|
|
19
|
+
var preservedSelection = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection;
|
|
20
|
+
var selection = preservedSelection || editorView.state.selection;
|
|
19
21
|
if (dropdownItem.contentComponent) {
|
|
20
|
-
var _api$blockControls;
|
|
21
|
-
var preservedSelection = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 || (_api$blockControls = _api$blockControls.sharedState.currentState()) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.preservedSelection;
|
|
22
|
-
var selection = preservedSelection || editorView.state.selection;
|
|
23
22
|
var selectionInfo = getSelectionTextInfoNew(selection, editorView, api);
|
|
24
23
|
api.core.actions.execute(api.selectionExtension.commands.setActiveExtension({
|
|
25
24
|
extension: dropdownItem,
|
|
@@ -28,7 +27,7 @@ export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownI
|
|
|
28
27
|
}
|
|
29
28
|
api.core.actions.execute(function (_ref2) {
|
|
30
29
|
var tr = _ref2.tr;
|
|
31
|
-
var _getSelectionAdfInfoN = getSelectionAdfInfoNew(
|
|
30
|
+
var _getSelectionAdfInfoN = getSelectionAdfInfoNew(selection),
|
|
32
31
|
selectedNode = _getSelectionAdfInfoN.selectedNode,
|
|
33
32
|
nodePos = _getSelectionAdfInfoN.nodePos;
|
|
34
33
|
tr.setMeta(selectionExtensionPluginKey, {
|
|
@@ -38,7 +37,7 @@ export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownI
|
|
|
38
37
|
});
|
|
39
38
|
return tr;
|
|
40
39
|
});
|
|
41
|
-
dropdownItem.onClick
|
|
40
|
+
(_dropdownItem$onClick = dropdownItem.onClick) === null || _dropdownItem$onClick === void 0 || _dropdownItem$onClick.call(dropdownItem);
|
|
42
41
|
(_api$analytics = api.analytics) === null || _api$analytics === void 0 || _api$analytics.actions.fireAnalyticsEvent({
|
|
43
42
|
action: ACTION.CLICKED,
|
|
44
43
|
actionSubject: ACTION_SUBJECT.BUTTON,
|
|
@@ -44,9 +44,10 @@ export var SelectionExtensionNestedDropdownMenu = function SelectionExtensionNes
|
|
|
44
44
|
label: ""
|
|
45
45
|
}) : undefined,
|
|
46
46
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
47
|
-
label:
|
|
47
|
+
label: ""
|
|
48
48
|
}),
|
|
49
|
-
onClick: handleClick
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
dropdownTestId: "editor-selection-extension-menu"
|
|
50
51
|
}, /*#__PURE__*/React.createElement(ChildItems, {
|
|
51
52
|
nestedDropdownMenu: nestedDropdownMenu
|
|
52
53
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { SelectionExtensionPlugin } from '../selectionExtensionPluginType';
|
|
4
|
-
|
|
4
|
+
type SelectionExtensionComponentContextValue = {
|
|
5
5
|
api: ExtractInjectionAPI<SelectionExtensionPlugin>;
|
|
6
6
|
editorView: EditorView;
|
|
7
7
|
extensionKey: string;
|
|
@@ -10,3 +10,4 @@ export type SelectionExtensionComponentContextValue = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const SelectionExtensionComponentContextProvider: import("react").Provider<SelectionExtensionComponentContextValue | undefined>;
|
|
12
12
|
export declare const useSelectionExtensionComponentContext: () => SelectionExtensionComponentContextValue;
|
|
13
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import type { SelectionExtensionPlugin } from '../selectionExtensionPluginType';
|
|
4
|
-
|
|
4
|
+
type SelectionExtensionComponentContextValue = {
|
|
5
5
|
api: ExtractInjectionAPI<SelectionExtensionPlugin>;
|
|
6
6
|
editorView: EditorView;
|
|
7
7
|
extensionKey: string;
|
|
@@ -10,3 +10,4 @@ export type SelectionExtensionComponentContextValue = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare const SelectionExtensionComponentContextProvider: import("react").Provider<SelectionExtensionComponentContextValue | undefined>;
|
|
12
12
|
export declare const useSelectionExtensionComponentContext: () => SelectionExtensionComponentContextValue;
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-utils": "^19.26.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.31.0",
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
38
|
-
"@atlaskit/editor-plugin-block-controls": "^
|
|
39
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
40
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
41
|
-
"@atlaskit/editor-plugin-editor-viewmode-effects": "^
|
|
42
|
-
"@atlaskit/editor-plugin-primary-toolbar": "^
|
|
43
|
-
"@atlaskit/editor-plugin-selection-toolbar": "^
|
|
44
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
45
|
-
"@atlaskit/editor-plugin-user-preferences": "^
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^7.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-block-controls": "^8.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-block-menu": "^6.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-editor-viewmode-effects": "^7.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^8.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-selection-toolbar": "^8.0.0",
|
|
44
|
+
"@atlaskit/editor-plugin-toolbar": "^4.0.0",
|
|
45
|
+
"@atlaskit/editor-plugin-user-preferences": "^5.0.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
47
47
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
48
48
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
54
54
|
"@atlaskit/primitives": "^17.0.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^16.3.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
57
57
|
"lodash": "^4.17.21",
|
|
58
58
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
59
59
|
"uuid": "^3.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@atlaskit/editor-common": "^
|
|
62
|
+
"@atlaskit/editor-common": "^111.0.0",
|
|
63
63
|
"react": "^18.2.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|