@atlaskit/editor-plugin-quick-insert 13.0.1 → 13.1.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/pm-plugins/commands/index.js +35 -3
  3. package/dist/cjs/quickInsertPlugin.js +56 -33
  4. package/dist/cjs/ui/ModalElementBrowser/ModalElementBrowser.js +2 -1
  5. package/dist/cjs/ui/ModalElementBrowser/index.js +24 -15
  6. package/dist/cjs/ui/QuickInsertMenuFooterItem.js +37 -0
  7. package/dist/cjs/ui/QuickInsertSectionOverflowMenuItem.js +38 -0
  8. package/dist/cjs/ui/getQuickInsertComponents.js +103 -11
  9. package/dist/es2019/pm-plugins/commands/index.js +27 -0
  10. package/dist/es2019/quickInsertPlugin.js +27 -5
  11. package/dist/es2019/ui/ModalElementBrowser/ModalElementBrowser.js +2 -1
  12. package/dist/es2019/ui/ModalElementBrowser/index.js +25 -16
  13. package/dist/es2019/ui/QuickInsertMenuFooterItem.js +31 -0
  14. package/dist/es2019/ui/QuickInsertSectionOverflowMenuItem.js +32 -0
  15. package/dist/es2019/ui/getQuickInsertComponents.js +100 -7
  16. package/dist/esm/pm-plugins/commands/index.js +34 -2
  17. package/dist/esm/quickInsertPlugin.js +57 -34
  18. package/dist/esm/ui/ModalElementBrowser/ModalElementBrowser.js +2 -1
  19. package/dist/esm/ui/ModalElementBrowser/index.js +25 -16
  20. package/dist/esm/ui/QuickInsertMenuFooterItem.js +28 -0
  21. package/dist/esm/ui/QuickInsertSectionOverflowMenuItem.js +29 -0
  22. package/dist/esm/ui/getQuickInsertComponents.js +105 -13
  23. package/dist/types/pm-plugins/commands/index.d.ts +11 -0
  24. package/dist/types/pm-plugins/plugin-key.d.ts +5 -1
  25. package/dist/types/quickInsertPluginType.d.ts +5 -0
  26. package/dist/types/ui/ModalElementBrowser/ModalElementBrowser.d.ts +1 -0
  27. package/dist/types/ui/QuickInsertMenuFooterItem.d.ts +8 -0
  28. package/dist/types/ui/QuickInsertSectionOverflowMenuItem.d.ts +9 -0
  29. package/dist/types/ui/getQuickInsertComponents.d.ts +8 -1
  30. package/package.json +4 -4
@@ -5,8 +5,10 @@ import React, { useCallback } from 'react';
5
5
  import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
7
  import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { closeElementBrowserModal } from '../../pm-plugins/commands';
10
+ import { closeElementBrowser, closeElementBrowserModal } from '../../pm-plugins/commands';
11
+ import { pluginKey } from '../../pm-plugins/plugin-key';
10
12
  import ModalElementBrowser from './ModalElementBrowser';
11
13
  var Modal = function Modal(_ref) {
12
14
  var quickInsertState = _ref.quickInsertState,
@@ -15,7 +17,8 @@ var Modal = function Modal(_ref) {
15
17
  helpUrl = _ref.helpUrl,
16
18
  insertItem = _ref.insertItem,
17
19
  getSuggestions = _ref.getSuggestions,
18
- api = _ref.api;
20
+ api = _ref.api,
21
+ defaultCategory = _ref.defaultCategory;
19
22
  var getItems = useCallback(function (query, category) {
20
23
  var _getSuggestions$map, _getSuggestions;
21
24
  return (_getSuggestions$map = getSuggestions === null || getSuggestions === void 0 || (_getSuggestions = getSuggestions({
@@ -40,22 +43,26 @@ var Modal = function Modal(_ref) {
40
43
  // Instead of adding the item immediately on insert item
41
44
  // We wait until modal close is complete, refocus the editor and then add the item
42
45
  var insertableItem = React.useRef(null);
46
+ var closeBrowser = useCallback(function () {
47
+ var closeCommand = isExperimentEnabled('platform_editor_slash_command') ? closeElementBrowser : closeElementBrowserModal;
48
+ closeCommand()(editorView.state, editorView.dispatch);
49
+ }, [editorView]);
43
50
  var onInsertItem = useCallback(function (item) {
44
- closeElementBrowserModal()(editorView.state, editorView.dispatch);
51
+ closeBrowser();
45
52
  if (fg('platform_editor_ease_of_use_metrics')) {
46
53
  var _api$metrics;
47
54
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer());
48
55
  }
49
56
  insertableItem.current = item;
50
- }, [editorView, api]);
57
+ }, [closeBrowser, api]);
51
58
  var onClose = useCallback(function () {
52
- closeElementBrowserModal()(editorView.state, editorView.dispatch);
59
+ closeBrowser();
53
60
  if (fg('platform_editor_ease_of_use_metrics')) {
54
61
  var _api$metrics2;
55
62
  api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 ? void 0 : _api$metrics2.commands.startActiveSessionTimer());
56
63
  }
57
64
  focusInEditor();
58
- }, [editorView, focusInEditor, api]);
65
+ }, [closeBrowser, focusInEditor, api]);
59
66
  var onCloseComplete = useCallback(function () {
60
67
  if (!insertableItem.current) {
61
68
  focusInEditor();
@@ -67,10 +74,11 @@ var Modal = function Modal(_ref) {
67
74
  insertItem === null || insertItem === void 0 || insertItem(item, INPUT_METHOD.ELEMENT_BROWSER)(editorView.state, editorView.dispatch);
68
75
  }, [editorView, focusInEditor, insertItem]);
69
76
  return /*#__PURE__*/React.createElement(ModalElementBrowser, {
77
+ defaultCategory: defaultCategory,
70
78
  getItems: getItems,
71
79
  onInsertItem: onInsertItem,
72
80
  helpUrl: helpUrl,
73
- isOpen: quickInsertState.isElementBrowserModalOpen || false,
81
+ isOpen: quickInsertState.isElementBrowserOpen || false,
74
82
  emptyStateHandler: quickInsertState.emptyStateHandler,
75
83
  onClose: onClose,
76
84
  onCloseComplete: onCloseComplete,
@@ -78,32 +86,33 @@ var Modal = function Modal(_ref) {
78
86
  });
79
87
  };
80
88
  export default (function (_ref2) {
81
- var _pluginInjectionAPI$q, _pluginInjectionAPI$q2;
89
+ var _pluginKey$getState, _pluginInjectionAPI$q, _pluginInjectionAPI$q2;
82
90
  var editorView = _ref2.editorView,
83
91
  helpUrl = _ref2.helpUrl,
84
92
  pluginInjectionAPI = _ref2.pluginInjectionAPI;
85
93
  var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionAPI, ['quickInsert', 'connectivity'], function (state) {
86
- var _state$quickInsertSta, _state$quickInsertSta2, _state$quickInsertSta3, _state$quickInsertSta4, _state$connectivitySt;
94
+ var _state$quickInsertSta, _state$quickInsertSta2, _state$quickInsertSta3, _state$quickInsertSta4, _state$quickInsertSta5, _state$connectivitySt;
87
95
  return {
88
96
  lazyDefaultItems: (_state$quickInsertSta = state.quickInsertState) === null || _state$quickInsertSta === void 0 ? void 0 : _state$quickInsertSta.lazyDefaultItems,
89
97
  providedItems: (_state$quickInsertSta2 = state.quickInsertState) === null || _state$quickInsertSta2 === void 0 ? void 0 : _state$quickInsertSta2.providedItems,
90
- isElementBrowserModalOpen: (_state$quickInsertSta3 = state.quickInsertState) === null || _state$quickInsertSta3 === void 0 ? void 0 : _state$quickInsertSta3.isElementBrowserModalOpen,
91
- emptyStateHandler: (_state$quickInsertSta4 = state.quickInsertState) === null || _state$quickInsertSta4 === void 0 ? void 0 : _state$quickInsertSta4.emptyStateHandler,
98
+ isElementBrowserOpen: isExperimentEnabled('platform_editor_slash_command') ? (_state$quickInsertSta3 = state.quickInsertState) === null || _state$quickInsertSta3 === void 0 ? void 0 : _state$quickInsertSta3.isElementBrowserOpen : (_state$quickInsertSta4 = state.quickInsertState) === null || _state$quickInsertSta4 === void 0 ? void 0 : _state$quickInsertSta4.isElementBrowserModalOpen,
99
+ emptyStateHandler: (_state$quickInsertSta5 = state.quickInsertState) === null || _state$quickInsertSta5 === void 0 ? void 0 : _state$quickInsertSta5.emptyStateHandler,
92
100
  mode: (_state$connectivitySt = state.connectivityState) === null || _state$connectivitySt === void 0 ? void 0 : _state$connectivitySt.mode
93
101
  };
94
102
  }),
95
103
  lazyDefaultItems = _useSharedPluginState.lazyDefaultItems,
96
104
  providedItems = _useSharedPluginState.providedItems,
97
- isElementBrowserModalOpen = _useSharedPluginState.isElementBrowserModalOpen,
105
+ isElementBrowserOpen = _useSharedPluginState.isElementBrowserOpen,
98
106
  emptyStateHandler = _useSharedPluginState.emptyStateHandler,
99
107
  mode = _useSharedPluginState.mode;
100
- return /*#__PURE__*/React.createElement(Modal
101
- // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
102
- , {
108
+ return /*#__PURE__*/React.createElement(Modal, {
109
+ defaultCategory: (_pluginKey$getState = pluginKey.getState(editorView.state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.elementBrowserInitialCategory
110
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
111
+ ,
103
112
  quickInsertState: {
104
113
  lazyDefaultItems: lazyDefaultItems,
105
114
  providedItems: providedItems,
106
- isElementBrowserModalOpen: isElementBrowserModalOpen,
115
+ isElementBrowserOpen: isElementBrowserOpen,
107
116
  emptyStateHandler: emptyStateHandler
108
117
  },
109
118
  editorView: editorView,
@@ -0,0 +1,28 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
4
+ import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
5
+ import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
6
+ export var QuickInsertMenuFooterItem = function QuickInsertMenuFooterItem(_ref) {
7
+ var api = _ref.api;
8
+ var _useIntl = useIntl(),
9
+ formatMessage = _useIntl.formatMessage;
10
+ var onSelect = useCallback(function (_ref2) {
11
+ var _api$quickInsert$comm, _api$quickInsert;
12
+ var insert = _ref2.insert;
13
+ var tr = insert(undefined);
14
+ return (_api$quickInsert$comm = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.commands.openElementBrowser()({
15
+ tr: tr
16
+ })) !== null && _api$quickInsert$comm !== void 0 ? _api$quickInsert$comm : tr;
17
+ }, [api]);
18
+ return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
19
+ ariaLabel: formatMessage(toolbarInsertBlockMessages.viewMoreAriaLabel),
20
+ iconBefore: /*#__PURE__*/React.createElement(ShowMoreHorizontalIcon, {
21
+ label: ""
22
+ }),
23
+ isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
24
+ onSelect: onSelect,
25
+ shouldWrapIcon: false,
26
+ title: formatMessage(toolbarInsertBlockMessages.viewMore)
27
+ });
28
+ };
@@ -0,0 +1,29 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl';
3
+ import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
4
+ import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
5
+ import AddIcon from '@atlaskit/icon/core/add';
6
+ export var QuickInsertSectionOverflowMenuItem = function QuickInsertSectionOverflowMenuItem(_ref) {
7
+ var api = _ref.api,
8
+ category = _ref.category;
9
+ var _useIntl = useIntl(),
10
+ formatMessage = _useIntl.formatMessage;
11
+ var onSelect = useCallback(function (_ref2) {
12
+ var _api$quickInsert$comm, _api$quickInsert;
13
+ var insert = _ref2.insert;
14
+ var tr = insert(undefined);
15
+ return (_api$quickInsert$comm = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.commands.openElementBrowser({
16
+ category: category
17
+ })({
18
+ tr: tr
19
+ })) !== null && _api$quickInsert$comm !== void 0 ? _api$quickInsert$comm : tr;
20
+ }, [api, category]);
21
+ return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
22
+ iconBefore: /*#__PURE__*/React.createElement(AddIcon, {
23
+ label: ""
24
+ }),
25
+ isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
26
+ onSelect: onSelect,
27
+ title: formatMessage(toolbarInsertBlockMessages.viewMore)
28
+ });
29
+ };
@@ -1,16 +1,108 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- 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; }
5
- import { BLOCK_TEMPLATES_SECTION, DATA_AND_CHARTS_SECTION, EMBED_SECTION, MEDIA_SECTION, MENU, OTHER_SECTION, RECOMMENDED_SECTION, ROVO_SECTION, STRUCTURE_SECTION, TEXT_FORMATTING_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
6
- import { QUICK_INSERT_MENU_RANK } from '@atlaskit/editor-common/quick-insert/rank';
7
- var sections = [RECOMMENDED_SECTION, STRUCTURE_SECTION, MEDIA_SECTION, EMBED_SECTION, TEXT_FORMATTING_SECTION, ROVO_SECTION, DATA_AND_CHARTS_SECTION, BLOCK_TEMPLATES_SECTION, OTHER_SECTION];
8
- export var getQuickInsertComponents = function getQuickInsertComponents() {
9
- return [MENU].concat(_toConsumableArray(sections.map(function (section) {
10
- return _objectSpread(_objectSpread({}, section), {}, {
11
- parents: [_objectSpread(_objectSpread({}, MENU), {}, {
2
+ import React from 'react';
3
+ import { useIntl } from 'react-intl';
4
+ import { BLOCK_TEMPLATES_SECTION, DATA_AND_CHARTS_SECTION, EMBED_SECTION, MEDIA_SECTION, MENU, OTHER_SECTION, RECOMMENDED_SECTION, ROVO_SECTION, STRUCTURE_SECTION, TEXT_FORMATTING_SECTION, VIEW_ALL_ELEMENTS_MENU_ITEM } from '@atlaskit/editor-common/quick-insert/keys';
5
+ import { QuickInsertMenuRoot } from '@atlaskit/editor-common/quick-insert/menu-root';
6
+ import { QuickInsertMenuSection } from '@atlaskit/editor-common/quick-insert/menu-section';
7
+ import { messages } from '@atlaskit/editor-common/quick-insert/messages';
8
+ import { CATEGORY_VIEW_MORE_RANK, QUICK_INSERT_MENU_RANK } from '@atlaskit/editor-common/quick-insert/rank';
9
+ import { getMenuFooterSectionKey } from '@atlaskit/editor-common/type-ahead-get-menu-footer-section-key';
10
+ import { getSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-get-section-overflow-item-key';
11
+ import { QuickInsertMenuFooterItem } from './QuickInsertMenuFooterItem';
12
+ import { QuickInsertSectionOverflowMenuItem } from './QuickInsertSectionOverflowMenuItem';
13
+ var categories = [{
14
+ message: messages.categoryRecommended,
15
+ section: RECOMMENDED_SECTION
16
+ }, {
17
+ message: messages.categoryStructure,
18
+ section: STRUCTURE_SECTION
19
+ }, {
20
+ message: messages.categoryMedia,
21
+ section: MEDIA_SECTION
22
+ }, {
23
+ message: messages.categoryEmbed,
24
+ section: EMBED_SECTION
25
+ }, {
26
+ message: messages.categoryTextFormatting,
27
+ section: TEXT_FORMATTING_SECTION
28
+ }, {
29
+ message: messages.categoryRovo,
30
+ section: ROVO_SECTION
31
+ }, {
32
+ message: messages.categoryDataAndCharts,
33
+ section: DATA_AND_CHARTS_SECTION
34
+ }, {
35
+ message: messages.categoryBlockTemplates,
36
+ section: BLOCK_TEMPLATES_SECTION
37
+ }, {
38
+ message: messages.categoryOther,
39
+ section: OTHER_SECTION
40
+ }];
41
+ var createSectionComponent = function createSectionComponent(message) {
42
+ var SectionComponent = function SectionComponent(_ref) {
43
+ var children = _ref.children;
44
+ var _useIntl = useIntl(),
45
+ formatMessage = _useIntl.formatMessage;
46
+ return /*#__PURE__*/React.createElement(QuickInsertMenuSection, {
47
+ title: formatMessage(message)
48
+ }, children);
49
+ };
50
+ return SectionComponent;
51
+ };
52
+ export var getQuickInsertComponents = function getQuickInsertComponents(_ref2) {
53
+ var api = _ref2.api,
54
+ includeElementBrowserItems = _ref2.includeElementBrowserItems;
55
+ return [{
56
+ key: MENU.key,
57
+ type: MENU.type,
58
+ component: QuickInsertMenuRoot
59
+ }].concat(_toConsumableArray(categories.flatMap(function (_ref3) {
60
+ var message = _ref3.message,
61
+ section = _ref3.section;
62
+ return [{
63
+ key: section.key,
64
+ type: section.type,
65
+ parents: [{
66
+ key: MENU.key,
67
+ type: MENU.type,
12
68
  rank: QUICK_INSERT_MENU_RANK[section.key]
13
- })]
14
- });
15
- })));
69
+ }],
70
+ component: createSectionComponent(message)
71
+ }].concat(_toConsumableArray(includeElementBrowserItems ? [{
72
+ key: getSectionOverflowItemKey(section.key),
73
+ type: 'menu-item',
74
+ parents: [{
75
+ key: section.key,
76
+ type: section.type,
77
+ rank: CATEGORY_VIEW_MORE_RANK
78
+ }],
79
+ component: function component() {
80
+ return /*#__PURE__*/React.createElement(QuickInsertSectionOverflowMenuItem, {
81
+ api: api,
82
+ category: section.key
83
+ });
84
+ }
85
+ }] : []));
86
+ })), _toConsumableArray(includeElementBrowserItems ? [{
87
+ key: getMenuFooterSectionKey(MENU.key),
88
+ type: 'menu-section',
89
+ parents: [{
90
+ key: MENU.key,
91
+ type: MENU.type,
92
+ rank: Number.MAX_SAFE_INTEGER
93
+ }]
94
+ }, {
95
+ key: VIEW_ALL_ELEMENTS_MENU_ITEM.key,
96
+ type: VIEW_ALL_ELEMENTS_MENU_ITEM.type,
97
+ parents: [{
98
+ key: getMenuFooterSectionKey(MENU.key),
99
+ type: 'menu-section',
100
+ rank: 100
101
+ }],
102
+ component: function component() {
103
+ return /*#__PURE__*/React.createElement(QuickInsertMenuFooterItem, {
104
+ api: api
105
+ });
106
+ }
107
+ }] : []));
16
108
  };
@@ -1,6 +1,17 @@
1
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
3
3
  import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
4
+ import type { OpenElementBrowserOptions } from '../../quickInsertPluginType';
5
+ export declare const openElementBrowser: ({ category }?: OpenElementBrowserOptions) => EditorCommand;
6
+ export declare const closeElementBrowser: () => Command;
7
+ /**
8
+ * @private
9
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-62138 Internal documentation for deprecation (no external access)} Tracked by EDITOR-8422. Use `openElementBrowser` instead.
10
+ */
4
11
  export declare const openElementBrowserModal: EditorCommand;
12
+ /**
13
+ * @private
14
+ * @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-62138 Internal documentation for deprecation (no external access)} Tracked by EDITOR-8422. Use `closeElementBrowser` instead.
15
+ */
5
16
  export declare const closeElementBrowserModal: () => Command;
6
17
  export declare const createInsertItem: (onInsert?: (item: QuickInsertItem) => void) => ((item: QuickInsertItem, source?: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.ELEMENT_BROWSER) => Command);
@@ -1,3 +1,7 @@
1
- import type { QuickInsertPluginState } from '@atlaskit/editor-common/types';
1
+ import type { QuickInsertPluginState as CommonQuickInsertPluginState } from '@atlaskit/editor-common/types';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ export type QuickInsertPluginState = CommonQuickInsertPluginState & {
4
+ elementBrowserInitialCategory?: string;
5
+ };
6
+ export type QuickInsertPluginStateKeys = keyof QuickInsertPluginState;
3
7
  export declare const pluginKey: PluginKey<QuickInsertPluginState>;
@@ -10,6 +10,9 @@ export type QuickInsertSharedState = CommonQuickInsertSharedState & {
10
10
  typeAheadHandler: TypeAheadHandler;
11
11
  };
12
12
  export type QuickInsertPluginOptions = CommonQuickInsertPluginOptions;
13
+ export type OpenElementBrowserOptions = {
14
+ category?: string;
15
+ };
13
16
  export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
14
17
  actions: {
15
18
  getSuggestions: (searchOptions: QuickInsertSearchOptions) => QuickInsertItem[];
@@ -18,6 +21,8 @@ export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
18
21
  };
19
22
  commands: {
20
23
  addQuickInsertItem: (item: QuickInsertHandler) => EditorCommand;
24
+ openElementBrowser: (options?: OpenElementBrowserOptions) => EditorCommand;
25
+ /** @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-62138 Internal documentation for deprecation (no external access)} Tracked by EDITOR-8422. Use `openElementBrowser` instead. */
21
26
  openElementBrowserModal: EditorCommand;
22
27
  removeQuickInsertItem: (key: string) => EditorCommand;
23
28
  updateQuickInsertItem: (key: string, item: QuickInsertHandler) => EditorCommand;
@@ -8,6 +8,7 @@ import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
8
8
  import type { EmptyStateHandler } from '@atlaskit/editor-common/types';
9
9
  export declare const MODAL_WRAPPER_PADDING = 16;
10
10
  export interface Props {
11
+ defaultCategory?: string;
11
12
  emptyStateHandler?: EmptyStateHandler;
12
13
  getItems: (query?: string, category?: string) => QuickInsertItem[];
13
14
  helpUrl?: string | undefined;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { QuickInsertPlugin } from '../quickInsertPluginType';
4
+ type Props = {
5
+ api: ExtractInjectionAPI<QuickInsertPlugin> | undefined;
6
+ };
7
+ export declare const QuickInsertMenuFooterItem: ({ api }: Props) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
+ import type { QuickInsertPlugin } from '../quickInsertPluginType';
4
+ type Props = {
5
+ api: ExtractInjectionAPI<QuickInsertPlugin> | undefined;
6
+ category: string;
7
+ };
8
+ export declare const QuickInsertSectionOverflowMenuItem: ({ api, category }: Props) => React.JSX.Element;
9
+ export {};
@@ -1,2 +1,9 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
2
  import type { RegisterComponent } from '@atlaskit/editor-ui-control-model/types';
2
- export declare const getQuickInsertComponents: () => RegisterComponent[];
3
+ import type { QuickInsertPlugin } from '../quickInsertPluginType';
4
+ type Params = {
5
+ api: ExtractInjectionAPI<QuickInsertPlugin> | undefined;
6
+ includeElementBrowserItems: boolean;
7
+ };
8
+ export declare const getQuickInsertComponents: ({ api, includeElementBrowserItems, }: Params) => RegisterComponent[];
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "13.0.1",
3
+ "version": "13.1.1",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,17 +29,17 @@
29
29
  "@atlaskit/editor-plugin-ui-control-registry": "^7.0.0",
30
30
  "@atlaskit/editor-prosemirror": "^8.0.0",
31
31
  "@atlaskit/editor-ui-control-model": "^2.4.0",
32
- "@atlaskit/icon": "^37.2.0",
32
+ "@atlaskit/icon": "^37.3.0",
33
33
  "@atlaskit/modal-dialog": "^16.2.0",
34
34
  "@atlaskit/platform-feature-experiments": "^0.3.0",
35
35
  "@atlaskit/platform-feature-flags": "^2.1.0",
36
- "@atlaskit/tmp-editor-statsig": "^139.0.0",
36
+ "@atlaskit/tmp-editor-statsig": "^140.0.0",
37
37
  "@atlaskit/tokens": "^16.3.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@emotion/react": "^11.7.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "@atlaskit/editor-common": "^117.0.0",
42
+ "@atlaskit/editor-common": "^117.2.0",
43
43
  "react": "^18.2.0 || ^19.2.0",
44
44
  "react-dom": "^18.2.0 || ^19.2.0",
45
45
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"