@atlaskit/editor-plugin-selection-extension 9.0.3 → 9.0.5
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 +16 -0
- package/dist/cjs/selectionExtensionPlugin.js +8 -10
- package/dist/cjs/ui/menu/SelectionExtensionDropdownItem.js +5 -5
- package/dist/cjs/ui/menu/SelectionExtensionMenuItems.js +2 -2
- package/dist/cjs/ui/menu/{SelectionExtensionDropdownMenu.js → SelectionExtensionNestedDropdownMenu.js} +5 -6
- package/dist/es2019/selectionExtensionPlugin.js +4 -7
- package/dist/es2019/ui/menu/SelectionExtensionDropdownItem.js +4 -3
- package/dist/es2019/ui/menu/SelectionExtensionMenuItems.js +1 -1
- package/dist/es2019/ui/menu/{SelectionExtensionDropdownMenu.js → SelectionExtensionNestedDropdownMenu.js} +6 -5
- package/dist/esm/selectionExtensionPlugin.js +8 -10
- package/dist/esm/ui/menu/SelectionExtensionDropdownItem.js +4 -3
- package/dist/esm/ui/menu/SelectionExtensionMenuItems.js +1 -1
- package/dist/esm/ui/menu/{SelectionExtensionDropdownMenu.js → SelectionExtensionNestedDropdownMenu.js} +6 -5
- package/package.json +3 -3
- /package/dist/types/ui/menu/{SelectionExtensionDropdownMenu.d.ts → SelectionExtensionNestedDropdownMenu.d.ts} +0 -0
- /package/dist/types-ts4.5/ui/menu/{SelectionExtensionDropdownMenu.d.ts → SelectionExtensionNestedDropdownMenu.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-extension
|
|
2
2
|
|
|
3
|
+
## 9.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b3c4249a34e4b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b3c4249a34e4b) -
|
|
8
|
+
EDITOR-3880 Improve block menu rendering to support infinite nesting
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 9.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`b831109342cdf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b831109342cdf) -
|
|
16
|
+
EDITOR-3880 Register block menu selection extensions statically
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 9.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -12,7 +12,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
12
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
13
13
|
var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
|
|
14
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
16
15
|
var _insertAdfAtEndOfDoc2 = require("./pm-plugins/actions/insertAdfAtEndOfDoc");
|
|
17
16
|
var _replaceWithAdf2 = require("./pm-plugins/actions/replaceWithAdf");
|
|
18
17
|
var _main = require("./pm-plugins/main");
|
|
@@ -57,6 +56,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
}
|
|
59
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
60
|
+
(0, _registerBlockMenuItems.registerBlockMenuItems)(extensionList, api);
|
|
61
|
+
}
|
|
60
62
|
return {
|
|
61
63
|
name: 'selectionExtension',
|
|
62
64
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -143,14 +145,10 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
143
145
|
}
|
|
144
146
|
},
|
|
145
147
|
usePluginHook: function usePluginHook() {
|
|
146
|
-
(0, _usePluginStateEffect.usePluginStateEffect)(api, ['
|
|
147
|
-
var userIntentState = _ref6.userIntentState;
|
|
148
|
+
(0, _usePluginStateEffect.usePluginStateEffect)(api, ['selection'], function () {
|
|
148
149
|
if ((0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && (0, _coreUtils.isSSR)()) {
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
|
-
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
152
|
-
(0, _registerBlockMenuItems.registerBlockMenuItems)(extensionList, api);
|
|
153
|
-
}
|
|
154
152
|
if (isToolbarAIFCEnabled && (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
|
|
155
153
|
var _api$toolbar;
|
|
156
154
|
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)({
|
|
@@ -160,9 +158,9 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
160
|
},
|
|
163
|
-
contentComponent: function contentComponent(
|
|
161
|
+
contentComponent: function contentComponent(_ref6) {
|
|
164
162
|
var _api$analytics;
|
|
165
|
-
var editorView =
|
|
163
|
+
var editorView = _ref6.editorView;
|
|
166
164
|
if (!editorView || (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) && (0, _coreUtils.isSSR)()) {
|
|
167
165
|
return null;
|
|
168
166
|
}
|
|
@@ -231,8 +229,8 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
|
|
|
231
229
|
selectionRanges: selectionRanges
|
|
232
230
|
};
|
|
233
231
|
(_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
|
|
234
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (
|
|
235
|
-
var tr =
|
|
232
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
|
|
233
|
+
var tr = _ref7.tr;
|
|
236
234
|
tr.setMeta(_main.selectionExtensionPluginKey, {
|
|
237
235
|
type: _types.SelectionExtensionActionTypes.SET_SELECTED_NODE,
|
|
238
236
|
selectedNode: selectedNode,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.SelectionExtensionDropdownItem = void 0;
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
10
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
10
|
var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = function SelectionExtensionDropdownItem(_ref) {
|
|
12
11
|
var dropdownItem = _ref.dropdownItem;
|
|
12
|
+
var IconComponent = dropdownItem.icon;
|
|
13
13
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
14
|
-
elemBefore:
|
|
15
|
-
label:
|
|
14
|
+
elemBefore: IconComponent ? /*#__PURE__*/_react.default.createElement(IconComponent, {
|
|
15
|
+
label: ""
|
|
16
16
|
}) : undefined,
|
|
17
17
|
onClick: dropdownItem.onClick,
|
|
18
18
|
isDisabled: dropdownItem.isDisabled
|
|
@@ -8,7 +8,7 @@ exports.SelectionExtensionMenuItems = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _menuItems = require("../utils/menu-items");
|
|
10
10
|
var _SelectionExtensionDropdownItem = require("./SelectionExtensionDropdownItem");
|
|
11
|
-
var
|
|
11
|
+
var _SelectionExtensionNestedDropdownMenu = require("./SelectionExtensionNestedDropdownMenu");
|
|
12
12
|
var SelectionExtensionMenuItems = exports.SelectionExtensionMenuItems = function SelectionExtensionMenuItems(_ref) {
|
|
13
13
|
var getMenuItems = _ref.getMenuItems;
|
|
14
14
|
var extensionMenuItems = getMenuItems();
|
|
@@ -17,7 +17,7 @@ var SelectionExtensionMenuItems = exports.SelectionExtensionMenuItems = function
|
|
|
17
17
|
}
|
|
18
18
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, extensionMenuItems.map(function (item) {
|
|
19
19
|
if ((0, _menuItems.isNestedDropdownMenuConfiguration)(item)) {
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_SelectionExtensionNestedDropdownMenu.SelectionExtensionNestedDropdownMenu, {
|
|
21
21
|
key: item.label,
|
|
22
22
|
nestedDropdownMenu: item
|
|
23
23
|
});
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.SelectionExtensionNestedDropdownMenu = void 0;
|
|
9
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
10
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
12
11
|
var _SelectionExtensionDropdownItem = require("./SelectionExtensionDropdownItem");
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
12
|
var ChildItems = function ChildItems(_ref) {
|
|
15
13
|
var nestedDropdownMenu = _ref.nestedDropdownMenu;
|
|
16
14
|
var childItems = nestedDropdownMenu.getMenuItems();
|
|
17
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, childItems.map(function (dropdownItem) {
|
|
18
16
|
return /*#__PURE__*/_react.default.createElement(_SelectionExtensionDropdownItem.SelectionExtensionDropdownItem, {
|
|
19
17
|
key: dropdownItem.label,
|
|
20
18
|
dropdownItem: dropdownItem
|
|
@@ -23,10 +21,11 @@ var ChildItems = function ChildItems(_ref) {
|
|
|
23
21
|
};
|
|
24
22
|
var SelectionExtensionNestedDropdownMenu = exports.SelectionExtensionNestedDropdownMenu = function SelectionExtensionNestedDropdownMenu(_ref2) {
|
|
25
23
|
var nestedDropdownMenu = _ref2.nestedDropdownMenu;
|
|
24
|
+
var IconComponent = nestedDropdownMenu.icon;
|
|
26
25
|
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarNestedDropdownMenu, {
|
|
27
26
|
text: nestedDropdownMenu.label,
|
|
28
|
-
elemBefore:
|
|
29
|
-
label:
|
|
27
|
+
elemBefore: IconComponent ? /*#__PURE__*/_react.default.createElement(IconComponent, {
|
|
28
|
+
label: ""
|
|
30
29
|
}) : undefined,
|
|
31
30
|
elemAfter: /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
|
|
32
31
|
label: 'nested menu'
|
|
@@ -4,7 +4,6 @@ import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
|
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
6
6
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
8
7
|
import { insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
|
|
9
8
|
import { replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
|
|
10
9
|
import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
|
|
@@ -46,6 +45,9 @@ export const selectionExtensionPlugin = ({
|
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
}
|
|
48
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
49
|
+
registerBlockMenuItems(extensionList, api);
|
|
50
|
+
}
|
|
49
51
|
return {
|
|
50
52
|
name: 'selectionExtension',
|
|
51
53
|
getSharedState(editorState) {
|
|
@@ -138,15 +140,10 @@ export const selectionExtensionPlugin = ({
|
|
|
138
140
|
}
|
|
139
141
|
},
|
|
140
142
|
usePluginHook: () => {
|
|
141
|
-
usePluginStateEffect(api, ['
|
|
142
|
-
userIntentState
|
|
143
|
-
}) => {
|
|
143
|
+
usePluginStateEffect(api, ['selection'], () => {
|
|
144
144
|
if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
148
|
-
registerBlockMenuItems(extensionList, api);
|
|
149
|
-
}
|
|
150
147
|
if (isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
|
|
151
148
|
var _api$toolbar;
|
|
152
149
|
api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents({
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
3
3
|
export const SelectionExtensionDropdownItem = ({
|
|
4
4
|
dropdownItem
|
|
5
5
|
}) => {
|
|
6
|
+
const IconComponent = dropdownItem.icon;
|
|
6
7
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
7
|
-
elemBefore:
|
|
8
|
-
label:
|
|
8
|
+
elemBefore: IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
9
|
+
label: ""
|
|
9
10
|
}) : undefined,
|
|
10
11
|
onClick: dropdownItem.onClick,
|
|
11
12
|
isDisabled: dropdownItem.isDisabled
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { isNestedDropdownMenuConfiguration } from '../utils/menu-items';
|
|
3
3
|
import { SelectionExtensionDropdownItem } from './SelectionExtensionDropdownItem';
|
|
4
|
-
import { SelectionExtensionNestedDropdownMenu } from './
|
|
4
|
+
import { SelectionExtensionNestedDropdownMenu } from './SelectionExtensionNestedDropdownMenu';
|
|
5
5
|
export const SelectionExtensionMenuItems = ({
|
|
6
6
|
getMenuItems
|
|
7
7
|
}) => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
3
3
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
4
4
|
import { SelectionExtensionDropdownItem } from './SelectionExtensionDropdownItem';
|
|
5
5
|
const ChildItems = ({
|
|
6
6
|
nestedDropdownMenu
|
|
7
7
|
}) => {
|
|
8
8
|
const childItems = nestedDropdownMenu.getMenuItems();
|
|
9
|
-
return /*#__PURE__*/React.createElement(
|
|
9
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, childItems.map(dropdownItem => /*#__PURE__*/React.createElement(SelectionExtensionDropdownItem, {
|
|
10
10
|
key: dropdownItem.label,
|
|
11
11
|
dropdownItem: dropdownItem
|
|
12
12
|
})));
|
|
@@ -14,10 +14,11 @@ const ChildItems = ({
|
|
|
14
14
|
export const SelectionExtensionNestedDropdownMenu = ({
|
|
15
15
|
nestedDropdownMenu
|
|
16
16
|
}) => {
|
|
17
|
+
const IconComponent = nestedDropdownMenu.icon;
|
|
17
18
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
18
19
|
text: nestedDropdownMenu.label,
|
|
19
|
-
elemBefore:
|
|
20
|
-
label:
|
|
20
|
+
elemBefore: IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
21
|
+
label: ""
|
|
21
22
|
}) : undefined,
|
|
22
23
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
23
24
|
label: 'nested menu'
|
|
@@ -5,7 +5,6 @@ import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
|
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
6
|
import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
8
|
import { insertAdfAtEndOfDoc as _insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
|
|
10
9
|
import { replaceWithAdf as _replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
|
|
11
10
|
import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
|
|
@@ -50,6 +49,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
50
49
|
});
|
|
51
50
|
}
|
|
52
51
|
}
|
|
52
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
53
|
+
registerBlockMenuItems(extensionList, api);
|
|
54
|
+
}
|
|
53
55
|
return {
|
|
54
56
|
name: 'selectionExtension',
|
|
55
57
|
getSharedState: function getSharedState(editorState) {
|
|
@@ -136,14 +138,10 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
136
138
|
}
|
|
137
139
|
},
|
|
138
140
|
usePluginHook: function usePluginHook() {
|
|
139
|
-
usePluginStateEffect(api, ['
|
|
140
|
-
var userIntentState = _ref6.userIntentState;
|
|
141
|
+
usePluginStateEffect(api, ['selection'], function () {
|
|
141
142
|
if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
|
|
142
143
|
return;
|
|
143
144
|
}
|
|
144
|
-
if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
|
|
145
|
-
registerBlockMenuItems(extensionList, api);
|
|
146
|
-
}
|
|
147
145
|
if (isToolbarAIFCEnabled && expValEquals('platform_editor_toolbar_aifc_selection_extension', 'isEnabled', true)) {
|
|
148
146
|
var _api$toolbar;
|
|
149
147
|
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents({
|
|
@@ -153,9 +151,9 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
153
151
|
}
|
|
154
152
|
});
|
|
155
153
|
},
|
|
156
|
-
contentComponent: function contentComponent(
|
|
154
|
+
contentComponent: function contentComponent(_ref6) {
|
|
157
155
|
var _api$analytics;
|
|
158
|
-
var editorView =
|
|
156
|
+
var editorView = _ref6.editorView;
|
|
159
157
|
if (!editorView || expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && isSSR()) {
|
|
160
158
|
return null;
|
|
161
159
|
}
|
|
@@ -224,8 +222,8 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
|
|
|
224
222
|
selectionRanges: selectionRanges
|
|
225
223
|
};
|
|
226
224
|
(_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
|
|
227
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (
|
|
228
|
-
var tr =
|
|
225
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
|
|
226
|
+
var tr = _ref7.tr;
|
|
229
227
|
tr.setMeta(selectionExtensionPluginKey, {
|
|
230
228
|
type: SelectionExtensionActionTypes.SET_SELECTED_NODE,
|
|
231
229
|
selectedNode: selectedNode,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
3
3
|
export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownItem(_ref) {
|
|
4
4
|
var dropdownItem = _ref.dropdownItem;
|
|
5
|
+
var IconComponent = dropdownItem.icon;
|
|
5
6
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
6
|
-
elemBefore:
|
|
7
|
-
label:
|
|
7
|
+
elemBefore: IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
8
|
+
label: ""
|
|
8
9
|
}) : undefined,
|
|
9
10
|
onClick: dropdownItem.onClick,
|
|
10
11
|
isDisabled: dropdownItem.isDisabled
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { isNestedDropdownMenuConfiguration } from '../utils/menu-items';
|
|
3
3
|
import { SelectionExtensionDropdownItem } from './SelectionExtensionDropdownItem';
|
|
4
|
-
import { SelectionExtensionNestedDropdownMenu } from './
|
|
4
|
+
import { SelectionExtensionNestedDropdownMenu } from './SelectionExtensionNestedDropdownMenu';
|
|
5
5
|
export var SelectionExtensionMenuItems = function SelectionExtensionMenuItems(_ref) {
|
|
6
6
|
var getMenuItems = _ref.getMenuItems;
|
|
7
7
|
var extensionMenuItems = getMenuItems();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
3
3
|
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
4
4
|
import { SelectionExtensionDropdownItem } from './SelectionExtensionDropdownItem';
|
|
5
5
|
var ChildItems = function ChildItems(_ref) {
|
|
6
6
|
var nestedDropdownMenu = _ref.nestedDropdownMenu;
|
|
7
7
|
var childItems = nestedDropdownMenu.getMenuItems();
|
|
8
|
-
return /*#__PURE__*/React.createElement(
|
|
8
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, childItems.map(function (dropdownItem) {
|
|
9
9
|
return /*#__PURE__*/React.createElement(SelectionExtensionDropdownItem, {
|
|
10
10
|
key: dropdownItem.label,
|
|
11
11
|
dropdownItem: dropdownItem
|
|
@@ -14,10 +14,11 @@ var ChildItems = function ChildItems(_ref) {
|
|
|
14
14
|
};
|
|
15
15
|
export var SelectionExtensionNestedDropdownMenu = function SelectionExtensionNestedDropdownMenu(_ref2) {
|
|
16
16
|
var nestedDropdownMenu = _ref2.nestedDropdownMenu;
|
|
17
|
+
var IconComponent = nestedDropdownMenu.icon;
|
|
17
18
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
18
19
|
text: nestedDropdownMenu.label,
|
|
19
|
-
elemBefore:
|
|
20
|
-
label:
|
|
20
|
+
elemBefore: IconComponent ? /*#__PURE__*/React.createElement(IconComponent, {
|
|
21
|
+
label: ""
|
|
21
22
|
}) : undefined,
|
|
22
23
|
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
23
24
|
label: 'nested menu'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.5",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.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": "^16.4.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^15.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^15.11.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": "^110.
|
|
62
|
+
"@atlaskit/editor-common": "^110.44.0",
|
|
63
63
|
"react": "^18.2.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
File without changes
|
|
File without changes
|