@atlaskit/editor-plugin-selection-extension 3.6.0 → 3.6.1

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,13 @@
1
1
  # @atlaskit/editor-plugin-selection-extension
2
2
 
3
+ ## 3.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`de1880647c70f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de1880647c70f) -
8
+ Support block menu config in selection extension
9
+ - Updated dependencies
10
+
3
11
  ## 3.6.0
4
12
 
5
13
  ### Minor Changes
@@ -113,7 +113,7 @@ function getSelectionAdfInfo(state) {
113
113
  var selection = state.selection;
114
114
  var selectionInfo = {
115
115
  selectedNode: selection.$from.node(),
116
- nodePos: selection.$from.before() // default to the position before the selection
116
+ nodePos: selection.$from.depth > 0 ? selection.$from.before() : selection.from
117
117
  };
118
118
  if (selection instanceof _state.TextSelection) {
119
119
  var $from = selection.$from,
@@ -9,7 +9,9 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _messages = require("@atlaskit/editor-common/messages");
11
11
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
+ var _usePluginStateEffect = require("@atlaskit/editor-common/use-plugin-state-effect");
12
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
13
15
  var _insertAdfAtEndOfDoc2 = require("./pm-plugins/actions/insertAdfAtEndOfDoc");
14
16
  var _replaceWithAdf2 = require("./pm-plugins/actions/replaceWithAdf");
15
17
  var _main = require("./pm-plugins/main");
@@ -19,6 +21,7 @@ var _SelectionExtensionComponentWrapper = require("./ui/extension/SelectionExten
19
21
  var _extensions = require("./ui/extensions");
20
22
  var _LegacyToolbarComponent = require("./ui/LegacyToolbarComponent");
21
23
  var _selectionToolbar2 = require("./ui/selectionToolbar");
24
+ var _registerBlockMenuItems = require("./ui/utils/registerBlockMenuItems");
22
25
  var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
23
26
  var api = _ref.api,
24
27
  config = _ref.config;
@@ -126,9 +129,17 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
126
129
  };
127
130
  }
128
131
  },
129
- contentComponent: function contentComponent(_ref6) {
132
+ usePluginHook: function usePluginHook() {
133
+ (0, _usePluginStateEffect.usePluginStateEffect)(api, ['userIntent', 'selection'], function (_ref6) {
134
+ var userIntentState = _ref6.userIntentState;
135
+ if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true)) {
136
+ (0, _registerBlockMenuItems.registerBlockMenuItems)(extensionList, api);
137
+ }
138
+ });
139
+ },
140
+ contentComponent: function contentComponent(_ref7) {
130
141
  var _api$analytics;
131
- var editorView = _ref6.editorView;
142
+ var editorView = _ref7.editorView;
132
143
  return /*#__PURE__*/_react.default.createElement(_SelectionExtensionComponentWrapper.SelectionExtensionComponentWrapper, {
133
144
  editorView: editorView,
134
145
  api: api,
@@ -198,8 +209,8 @@ var selectionExtensionPlugin = exports.selectionExtensionPlugin = function selec
198
209
  selectionRanges: selectionRanges
199
210
  };
200
211
  (_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
201
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
202
- var tr = _ref7.tr;
212
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref8) {
213
+ var tr = _ref8.tr;
203
214
  tr.setMeta(_main.selectionExtensionPluginKey, {
204
215
  type: _types.SelectionExtensionActionTypes.SET_SELECTED_NODE,
205
216
  selectedNode: selectedNode,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getToolbarItemExtensions = exports.getMenuItemExtensions = void 0;
6
+ exports.getToolbarItemExtensions = exports.getMenuItemExtensions = exports.getBlockMenuItemExtensions = void 0;
7
7
  /**
8
8
  * From the full list of extensions, extract only those that have a toolbar item configuration
9
9
  * for the specified type (either 'primaryToolbar' or 'inlineToolbar').
@@ -60,4 +60,20 @@ var getMenuItemExtensions = exports.getMenuItemExtensions = function getMenuItem
60
60
  }
61
61
  return acc;
62
62
  }, []);
63
+ };
64
+ var getBlockMenuItemExtensions = exports.getBlockMenuItemExtensions = function getBlockMenuItemExtensions(extensionList, targetSource) {
65
+ return extensionList.reduce(function (acc, extension) {
66
+ var source = extension.source,
67
+ blockMenu = extension.blockMenu;
68
+ if (source === targetSource && blockMenu !== null && blockMenu !== void 0 && blockMenu.getMenuItem) {
69
+ var _blockMenu$getNestedM;
70
+ var menuItem = blockMenu.getMenuItem();
71
+ var nestedMenuItems = (_blockMenu$getNestedM = blockMenu.getNestedMenuItems) === null || _blockMenu$getNestedM === void 0 ? void 0 : _blockMenu$getNestedM.call(blockMenu);
72
+ acc.push({
73
+ menuItem: menuItem,
74
+ nestedMenuItems: nestedMenuItems
75
+ });
76
+ }
77
+ return acc;
78
+ }, []);
63
79
  };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.registerBlockMenuItems = registerBlockMenuItems;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
10
+ var _extensions = require("../extensions");
11
+ function registerBlockMenuItems(extensionList, api) {
12
+ var blockMenuExtensions = (0, _extensions.getBlockMenuItemExtensions)(extensionList, 'first-party');
13
+ if (!(blockMenuExtensions !== null && blockMenuExtensions !== void 0 && blockMenuExtensions.length)) {
14
+ return;
15
+ }
16
+ blockMenuExtensions.forEach(function (extension, index) {
17
+ var _api$blockMenu;
18
+ var menuItem = extension.menuItem;
19
+ var blockMenuItemKey = "selection-extension-".concat(index);
20
+ var blockMenuComponent = [{
21
+ type: 'block-menu-item',
22
+ key: blockMenuItemKey,
23
+ parent: {
24
+ type: 'block-menu-section',
25
+ key: 'block-menu-section-primary',
26
+ rank: 200
27
+ },
28
+ component: function component() {
29
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
30
+ elemBefore: menuItem.icon ? /*#__PURE__*/_react.default.createElement(menuItem.icon) : undefined
31
+ }, menuItem.label);
32
+ }
33
+ }];
34
+ api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(blockMenuComponent);
35
+ });
36
+ }
@@ -113,7 +113,7 @@ export function getSelectionAdfInfo(state) {
113
113
  const selection = state.selection;
114
114
  let selectionInfo = {
115
115
  selectedNode: selection.$from.node(),
116
- nodePos: selection.$from.before() // default to the position before the selection
116
+ nodePos: selection.$from.depth > 0 ? selection.$from.before() : selection.from
117
117
  };
118
118
  if (selection instanceof TextSelection) {
119
119
  const {
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
4
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
7
  import { insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
6
8
  import { replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
7
9
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
@@ -11,6 +13,7 @@ import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExte
11
13
  import { getMenuItemExtensions, getToolbarItemExtensions } from './ui/extensions';
12
14
  import { LegacyPrimaryToolbarComponent } from './ui/LegacyToolbarComponent';
13
15
  import { selectionToolbar } from './ui/selectionToolbar';
16
+ import { registerBlockMenuItems } from './ui/utils/registerBlockMenuItems';
14
17
  export const selectionExtensionPlugin = ({
15
18
  api,
16
19
  config
@@ -121,6 +124,15 @@ export const selectionExtensionPlugin = ({
121
124
  };
122
125
  }
123
126
  },
127
+ usePluginHook: () => {
128
+ usePluginStateEffect(api, ['userIntent', 'selection'], ({
129
+ userIntentState
130
+ }) => {
131
+ if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
132
+ registerBlockMenuItems(extensionList, api);
133
+ }
134
+ });
135
+ },
124
136
  contentComponent: ({
125
137
  editorView
126
138
  }) => {
@@ -54,4 +54,22 @@ export const getMenuItemExtensions = (extensionList, targetSource) => {
54
54
  }
55
55
  return acc;
56
56
  }, []);
57
+ };
58
+ export const getBlockMenuItemExtensions = (extensionList, targetSource) => {
59
+ return extensionList.reduce((acc, extension) => {
60
+ const {
61
+ source,
62
+ blockMenu
63
+ } = extension;
64
+ if (source === targetSource && blockMenu !== null && blockMenu !== void 0 && blockMenu.getMenuItem) {
65
+ var _blockMenu$getNestedM;
66
+ const menuItem = blockMenu.getMenuItem();
67
+ const nestedMenuItems = (_blockMenu$getNestedM = blockMenu.getNestedMenuItems) === null || _blockMenu$getNestedM === void 0 ? void 0 : _blockMenu$getNestedM.call(blockMenu);
68
+ acc.push({
69
+ menuItem,
70
+ nestedMenuItems
71
+ });
72
+ }
73
+ return acc;
74
+ }, []);
57
75
  };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
3
+ import { getBlockMenuItemExtensions } from '../extensions';
4
+ export function registerBlockMenuItems(extensionList, api) {
5
+ const blockMenuExtensions = getBlockMenuItemExtensions(extensionList, 'first-party');
6
+ if (!(blockMenuExtensions !== null && blockMenuExtensions !== void 0 && blockMenuExtensions.length)) {
7
+ return;
8
+ }
9
+ blockMenuExtensions.forEach((extension, index) => {
10
+ var _api$blockMenu;
11
+ const menuItem = extension.menuItem;
12
+ const blockMenuItemKey = `selection-extension-${index}`;
13
+ const blockMenuComponent = [{
14
+ type: 'block-menu-item',
15
+ key: blockMenuItemKey,
16
+ parent: {
17
+ type: 'block-menu-section',
18
+ key: 'block-menu-section-primary',
19
+ rank: 200
20
+ },
21
+ component: () => {
22
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
23
+ elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon) : undefined
24
+ }, menuItem.label);
25
+ }
26
+ }];
27
+ api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(blockMenuComponent);
28
+ });
29
+ }
@@ -104,7 +104,7 @@ export function getSelectionAdfInfo(state) {
104
104
  var selection = state.selection;
105
105
  var selectionInfo = {
106
106
  selectedNode: selection.$from.node(),
107
- nodePos: selection.$from.before() // default to the position before the selection
107
+ nodePos: selection.$from.depth > 0 ? selection.$from.before() : selection.from
108
108
  };
109
109
  if (selection instanceof TextSelection) {
110
110
  var $from = selection.$from,
@@ -2,7 +2,9 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import React from 'react';
3
3
  import { selectionExtensionMessages } from '@atlaskit/editor-common/messages';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
+ import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
8
  import { insertAdfAtEndOfDoc as _insertAdfAtEndOfDoc } from './pm-plugins/actions/insertAdfAtEndOfDoc';
7
9
  import { replaceWithAdf as _replaceWithAdf } from './pm-plugins/actions/replaceWithAdf';
8
10
  import { createPlugin, selectionExtensionPluginKey } from './pm-plugins/main';
@@ -12,6 +14,7 @@ import { SelectionExtensionComponentWrapper } from './ui/extension/SelectionExte
12
14
  import { getMenuItemExtensions, getToolbarItemExtensions } from './ui/extensions';
13
15
  import { LegacyPrimaryToolbarComponent } from './ui/LegacyToolbarComponent';
14
16
  import { selectionToolbar as _selectionToolbar } from './ui/selectionToolbar';
17
+ import { registerBlockMenuItems } from './ui/utils/registerBlockMenuItems';
15
18
  export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
16
19
  var api = _ref.api,
17
20
  config = _ref.config;
@@ -119,9 +122,17 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
119
122
  };
120
123
  }
121
124
  },
122
- contentComponent: function contentComponent(_ref6) {
125
+ usePluginHook: function usePluginHook() {
126
+ usePluginStateEffect(api, ['userIntent', 'selection'], function (_ref6) {
127
+ var userIntentState = _ref6.userIntentState;
128
+ if ((userIntentState === null || userIntentState === void 0 ? void 0 : userIntentState.currentUserIntent) === 'blockMenuOpen' && expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true)) {
129
+ registerBlockMenuItems(extensionList, api);
130
+ }
131
+ });
132
+ },
133
+ contentComponent: function contentComponent(_ref7) {
123
134
  var _api$analytics;
124
- var editorView = _ref6.editorView;
135
+ var editorView = _ref7.editorView;
125
136
  return /*#__PURE__*/React.createElement(SelectionExtensionComponentWrapper, {
126
137
  editorView: editorView,
127
138
  api: api,
@@ -191,8 +202,8 @@ export var selectionExtensionPlugin = function selectionExtensionPlugin(_ref) {
191
202
  selectionRanges: selectionRanges
192
203
  };
193
204
  (_extension$onClick = extension.onClick) === null || _extension$onClick === void 0 || _extension$onClick.call(extension, onClickCallbackOptions);
194
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref7) {
195
- var tr = _ref7.tr;
205
+ api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref8) {
206
+ var tr = _ref8.tr;
196
207
  tr.setMeta(selectionExtensionPluginKey, {
197
208
  type: SelectionExtensionActionTypes.SET_SELECTED_NODE,
198
209
  selectedNode: selectedNode,
@@ -54,4 +54,20 @@ export var getMenuItemExtensions = function getMenuItemExtensions(extensionList,
54
54
  }
55
55
  return acc;
56
56
  }, []);
57
+ };
58
+ export var getBlockMenuItemExtensions = function getBlockMenuItemExtensions(extensionList, targetSource) {
59
+ return extensionList.reduce(function (acc, extension) {
60
+ var source = extension.source,
61
+ blockMenu = extension.blockMenu;
62
+ if (source === targetSource && blockMenu !== null && blockMenu !== void 0 && blockMenu.getMenuItem) {
63
+ var _blockMenu$getNestedM;
64
+ var menuItem = blockMenu.getMenuItem();
65
+ var nestedMenuItems = (_blockMenu$getNestedM = blockMenu.getNestedMenuItems) === null || _blockMenu$getNestedM === void 0 ? void 0 : _blockMenu$getNestedM.call(blockMenu);
66
+ acc.push({
67
+ menuItem: menuItem,
68
+ nestedMenuItems: nestedMenuItems
69
+ });
70
+ }
71
+ return acc;
72
+ }, []);
57
73
  };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
3
+ import { getBlockMenuItemExtensions } from '../extensions';
4
+ export function registerBlockMenuItems(extensionList, api) {
5
+ var blockMenuExtensions = getBlockMenuItemExtensions(extensionList, 'first-party');
6
+ if (!(blockMenuExtensions !== null && blockMenuExtensions !== void 0 && blockMenuExtensions.length)) {
7
+ return;
8
+ }
9
+ blockMenuExtensions.forEach(function (extension, index) {
10
+ var _api$blockMenu;
11
+ var menuItem = extension.menuItem;
12
+ var blockMenuItemKey = "selection-extension-".concat(index);
13
+ var blockMenuComponent = [{
14
+ type: 'block-menu-item',
15
+ key: blockMenuItemKey,
16
+ parent: {
17
+ type: 'block-menu-section',
18
+ key: 'block-menu-section-primary',
19
+ rank: 200
20
+ },
21
+ component: function component() {
22
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
23
+ elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon) : undefined
24
+ }, menuItem.label);
25
+ }
26
+ }];
27
+ api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(blockMenuComponent);
28
+ });
29
+ }
@@ -1,9 +1,12 @@
1
1
  import { type ADFEntity } from '@atlaskit/adf-utils/types';
2
2
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
4
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
6
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
8
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
9
+ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
7
10
  import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
8
11
  import type { DynamicSelectionExtension, SelectionAdfResult, InsertAdfAtEndOfDocResult, ReplaceWithAdfResult, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
9
12
  export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
@@ -27,6 +30,9 @@ export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
27
30
  OptionalPlugin<EditorViewModePlugin>,
28
31
  OptionalPlugin<PrimaryToolbarPlugin>,
29
32
  OptionalPlugin<UserPreferencesPlugin>,
33
+ OptionalPlugin<UserIntentPlugin>,
34
+ OptionalPlugin<SelectionPlugin>,
35
+ OptionalPlugin<BlockMenuPlugin>,
30
36
  SelectionToolbarPlugin
31
37
  ];
32
38
  pluginConfiguration: SelectionExtensionPluginOptions | undefined;
@@ -1,4 +1,4 @@
1
- import type { ExtensionConfiguration, ExtensionSource, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
1
+ import type { ExtensionConfiguration, ExtensionSource, GetMenuItemFn, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
2
2
  export type ToolbarItemExtension = {
3
3
  getMenuItems?: GetMenuItemsFn;
4
4
  getToolbarItem: GetToolbarItemFn;
@@ -25,3 +25,9 @@ export declare const getToolbarItemExtensions: (extensionList: ExtensionConfigur
25
25
  * @example
26
26
  */
27
27
  export declare const getMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => SelectionExtensionConfig[];
28
+ type BlockMenuItems = {
29
+ menuItem: ReturnType<GetMenuItemFn>;
30
+ nestedMenuItems?: ReturnType<GetMenuItemsFn>;
31
+ };
32
+ export declare const getBlockMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => BlockMenuItems[];
33
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { SelectionExtensionPlugin } from '../../selectionExtensionPluginType';
3
+ import type { ExtensionConfiguration } from '../../types';
4
+ export declare function registerBlockMenuItems(extensionList: ExtensionConfiguration[], api: ExtractInjectionAPI<SelectionExtensionPlugin> | undefined): void;
@@ -1,9 +1,12 @@
1
1
  import { type ADFEntity } from '@atlaskit/adf-utils/types';
2
2
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
+ import type { BlockMenuPlugin } from '@atlaskit/editor-plugin-block-menu';
4
5
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
6
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
+ import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
6
8
  import type { SelectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
9
+ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
7
10
  import type { UserPreferencesPlugin } from '@atlaskit/editor-plugin-user-preferences';
8
11
  import type { DynamicSelectionExtension, SelectionAdfResult, InsertAdfAtEndOfDocResult, ReplaceWithAdfResult, SelectionExtension, SelectionExtensionPluginOptions, SelectionExtensionPluginState, SelectionExtensionSelectionInfo } from './types';
9
12
  export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
@@ -27,6 +30,9 @@ export type SelectionExtensionPlugin = NextEditorPlugin<'selectionExtension', {
27
30
  OptionalPlugin<EditorViewModePlugin>,
28
31
  OptionalPlugin<PrimaryToolbarPlugin>,
29
32
  OptionalPlugin<UserPreferencesPlugin>,
33
+ OptionalPlugin<UserIntentPlugin>,
34
+ OptionalPlugin<SelectionPlugin>,
35
+ OptionalPlugin<BlockMenuPlugin>,
30
36
  SelectionToolbarPlugin
31
37
  ];
32
38
  pluginConfiguration: SelectionExtensionPluginOptions | undefined;
@@ -1,4 +1,4 @@
1
- import type { ExtensionConfiguration, ExtensionSource, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
1
+ import type { ExtensionConfiguration, ExtensionSource, GetMenuItemFn, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
2
2
  export type ToolbarItemExtension = {
3
3
  getMenuItems?: GetMenuItemsFn;
4
4
  getToolbarItem: GetToolbarItemFn;
@@ -25,3 +25,9 @@ export declare const getToolbarItemExtensions: (extensionList: ExtensionConfigur
25
25
  * @example
26
26
  */
27
27
  export declare const getMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => SelectionExtensionConfig[];
28
+ type BlockMenuItems = {
29
+ menuItem: ReturnType<GetMenuItemFn>;
30
+ nestedMenuItems?: ReturnType<GetMenuItemsFn>;
31
+ };
32
+ export declare const getBlockMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => BlockMenuItems[];
33
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { SelectionExtensionPlugin } from '../../selectionExtensionPluginType';
3
+ import type { ExtensionConfiguration } from '../../types';
4
+ export declare function registerBlockMenuItems(extensionList: ExtensionConfiguration[], api: ExtractInjectionAPI<SelectionExtensionPlugin> | undefined): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,13 +31,11 @@
31
31
  "*.compiled.css"
32
32
  ],
33
33
  "atlaskit:src": "src/index.ts",
34
- "af:exports": {
35
- ".": "./src/index.ts"
36
- },
37
34
  "dependencies": {
38
35
  "@atlaskit/adf-utils": "^19.21.0",
39
36
  "@atlaskit/editor-json-transformer": "^8.27.0",
40
37
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
38
+ "@atlaskit/editor-plugin-block-menu": "^0.0.15",
41
39
  "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
42
40
  "@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
43
41
  "@atlaskit/editor-plugin-selection-toolbar": "^4.3.0",
@@ -45,17 +43,18 @@
45
43
  "@atlaskit/editor-prosemirror": "7.0.0",
46
44
  "@atlaskit/editor-shared-styles": "^3.6.0",
47
45
  "@atlaskit/editor-tables": "^2.9.0",
48
- "@atlaskit/icon": "^28.0.0",
46
+ "@atlaskit/editor-toolbar": "^0.5.0",
47
+ "@atlaskit/icon": "^28.1.0",
49
48
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
- "@atlaskit/primitives": "^14.11.0",
51
- "@atlaskit/tmp-editor-statsig": "^11.7.0",
49
+ "@atlaskit/primitives": "^14.12.0",
50
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
52
51
  "@babel/runtime": "^7.0.0",
53
52
  "lodash": "^4.17.21",
54
53
  "react-intl-next": "npm:react-intl@^5.18.1",
55
54
  "uuid": "^3.1.0"
56
55
  },
57
56
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^107.31.0",
57
+ "@atlaskit/editor-common": "^107.33.0",
59
58
  "react": "^18.2.0"
60
59
  },
61
60
  "devDependencies": {