@atlaskit/editor-plugin-quick-insert 0.1.2 → 0.2.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 +10 -0
- package/dist/cjs/plugin.js +30 -21
- package/dist/es2019/plugin.js +82 -71
- package/dist/esm/plugin.js +30 -21
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugin.d.ts +7 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugin.d.ts +9 -1
- package/package.json +3 -2
- package/report.api.md +11 -1
- package/tmp/api-report-tmp.d.ts +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-quick-insert
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#41143](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41143) [`7d6dfe2befa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d6dfe2befa) - [ED-20003] Replace TyepAhead API for Editor Plugin Injection API
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 0.1.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -21,38 +21,39 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
21
21
|
var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
22
22
|
var options = _ref.config,
|
|
23
23
|
api = _ref.api;
|
|
24
|
+
var typeAhead = {
|
|
25
|
+
id: _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT,
|
|
26
|
+
trigger: '/',
|
|
27
|
+
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
28
|
+
getItems: function getItems(_ref2) {
|
|
29
|
+
var query = _ref2.query,
|
|
30
|
+
editorState = _ref2.editorState;
|
|
31
|
+
var quickInsertState = _pluginKey.pluginKey.getState(editorState);
|
|
32
|
+
return Promise.resolve((0, _search.getQuickInsertSuggestions)({
|
|
33
|
+
query: query,
|
|
34
|
+
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
35
|
+
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
36
|
+
},
|
|
37
|
+
selectItem: function selectItem(state, item, insert) {
|
|
38
|
+
return item.action(insert, state);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
24
41
|
return {
|
|
25
42
|
name: 'quickInsert',
|
|
26
43
|
pmPlugins: function pmPlugins(defaultItems) {
|
|
27
44
|
return [{
|
|
28
45
|
name: 'quickInsert',
|
|
29
46
|
// It's important that this plugin is above TypeAheadPlugin
|
|
30
|
-
plugin: function plugin(
|
|
31
|
-
var providerFactory =
|
|
32
|
-
getIntl =
|
|
33
|
-
dispatch =
|
|
47
|
+
plugin: function plugin(_ref3) {
|
|
48
|
+
var providerFactory = _ref3.providerFactory,
|
|
49
|
+
getIntl = _ref3.getIntl,
|
|
50
|
+
dispatch = _ref3.dispatch;
|
|
34
51
|
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
35
52
|
}
|
|
36
53
|
}];
|
|
37
54
|
},
|
|
38
55
|
pluginsOptions: {
|
|
39
|
-
typeAhead:
|
|
40
|
-
id: _typeAhead.TypeAheadAvailableNodes.QUICK_INSERT,
|
|
41
|
-
trigger: '/',
|
|
42
|
-
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
43
|
-
getItems: function getItems(_ref3) {
|
|
44
|
-
var query = _ref3.query,
|
|
45
|
-
editorState = _ref3.editorState;
|
|
46
|
-
var quickInsertState = _pluginKey.pluginKey.getState(editorState);
|
|
47
|
-
return Promise.resolve((0, _search.getQuickInsertSuggestions)({
|
|
48
|
-
query: query,
|
|
49
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
50
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
51
|
-
},
|
|
52
|
-
selectItem: function selectItem(state, item, insert) {
|
|
53
|
-
return item.action(insert, state);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
+
typeAhead: typeAhead
|
|
56
57
|
},
|
|
57
58
|
contentComponent: function contentComponent(_ref4) {
|
|
58
59
|
var editorView = _ref4.editorView;
|
|
@@ -74,6 +75,7 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
74
75
|
return null;
|
|
75
76
|
}
|
|
76
77
|
return {
|
|
78
|
+
typeAheadHandler: typeAhead,
|
|
77
79
|
lazyDefaultItems: quickInsertState.lazyDefaultItems,
|
|
78
80
|
emptyStateHandler: quickInsertState.emptyStateHandler,
|
|
79
81
|
providedItems: quickInsertState.providedItems,
|
|
@@ -82,6 +84,13 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
82
84
|
},
|
|
83
85
|
actions: {
|
|
84
86
|
insertItem: _commands.insertItem,
|
|
87
|
+
openTypeAhead: function openTypeAhead(inputMethod) {
|
|
88
|
+
var _api$typeAhead;
|
|
89
|
+
return Boolean(api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.actions.open({
|
|
90
|
+
triggerHandler: typeAhead,
|
|
91
|
+
inputMethod: inputMethod
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
85
94
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
86
95
|
var _api$quickInsert$shar;
|
|
87
96
|
var _ref5 = (_api$quickInsert$shar = api === null || api === void 0 ? void 0 : api.quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -9,81 +9,92 @@ import ModalElementBrowser from './ui/ModalElementBrowser';
|
|
|
9
9
|
export const quickInsertPlugin = ({
|
|
10
10
|
config: options,
|
|
11
11
|
api
|
|
12
|
-
}) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}];
|
|
24
|
-
},
|
|
25
|
-
pluginsOptions: {
|
|
26
|
-
typeAhead: {
|
|
27
|
-
id: TypeAheadAvailableNodes.QUICK_INSERT,
|
|
28
|
-
trigger: '/',
|
|
29
|
-
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
30
|
-
getItems({
|
|
12
|
+
}) => {
|
|
13
|
+
const typeAhead = {
|
|
14
|
+
id: TypeAheadAvailableNodes.QUICK_INSERT,
|
|
15
|
+
trigger: '/',
|
|
16
|
+
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
17
|
+
getItems({
|
|
18
|
+
query,
|
|
19
|
+
editorState
|
|
20
|
+
}) {
|
|
21
|
+
const quickInsertState = pluginKey.getState(editorState);
|
|
22
|
+
return Promise.resolve(getQuickInsertSuggestions({
|
|
31
23
|
query,
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
38
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
39
|
-
},
|
|
40
|
-
selectItem: (state, item, insert) => {
|
|
41
|
-
return item.action(insert, state);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
contentComponent({
|
|
46
|
-
editorView
|
|
47
|
-
}) {
|
|
48
|
-
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
49
|
-
return /*#__PURE__*/React.createElement(ModalElementBrowser, {
|
|
50
|
-
editorView: editorView,
|
|
51
|
-
helpUrl: options === null || options === void 0 ? void 0 : options.elementBrowserHelpUrl,
|
|
52
|
-
pluginInjectionAPI: api
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
},
|
|
57
|
-
getSharedState(editorState) {
|
|
58
|
-
if (!editorState) {
|
|
59
|
-
return null;
|
|
24
|
+
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
25
|
+
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
26
|
+
},
|
|
27
|
+
selectItem: (state, item, insert) => {
|
|
28
|
+
return item.action(insert, state);
|
|
60
29
|
}
|
|
61
|
-
|
|
62
|
-
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
name: 'quickInsert',
|
|
33
|
+
pmPlugins(defaultItems) {
|
|
34
|
+
return [{
|
|
35
|
+
name: 'quickInsert',
|
|
36
|
+
// It's important that this plugin is above TypeAheadPlugin
|
|
37
|
+
plugin: ({
|
|
38
|
+
providerFactory,
|
|
39
|
+
getIntl,
|
|
40
|
+
dispatch
|
|
41
|
+
}) => quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler)
|
|
42
|
+
}];
|
|
43
|
+
},
|
|
44
|
+
pluginsOptions: {
|
|
45
|
+
typeAhead
|
|
46
|
+
},
|
|
47
|
+
contentComponent({
|
|
48
|
+
editorView
|
|
49
|
+
}) {
|
|
50
|
+
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(ModalElementBrowser, {
|
|
52
|
+
editorView: editorView,
|
|
53
|
+
helpUrl: options === null || options === void 0 ? void 0 : options.elementBrowserHelpUrl,
|
|
54
|
+
pluginInjectionAPI: api
|
|
55
|
+
});
|
|
56
|
+
}
|
|
63
57
|
return null;
|
|
58
|
+
},
|
|
59
|
+
getSharedState(editorState) {
|
|
60
|
+
if (!editorState) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
const quickInsertState = pluginKey.getState(editorState);
|
|
64
|
+
if (!quickInsertState) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
typeAheadHandler: typeAhead,
|
|
69
|
+
lazyDefaultItems: quickInsertState.lazyDefaultItems,
|
|
70
|
+
emptyStateHandler: quickInsertState.emptyStateHandler,
|
|
71
|
+
providedItems: quickInsertState.providedItems,
|
|
72
|
+
isElementBrowserModalOpen: quickInsertState.isElementBrowserModalOpen
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
actions: {
|
|
76
|
+
insertItem,
|
|
77
|
+
openTypeAhead(inputMethod) {
|
|
78
|
+
var _api$typeAhead;
|
|
79
|
+
return Boolean(api === null || api === void 0 ? void 0 : (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.actions.open({
|
|
80
|
+
triggerHandler: typeAhead,
|
|
81
|
+
inputMethod
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
getSuggestions: searchOptions => {
|
|
85
|
+
var _api$quickInsert$shar;
|
|
86
|
+
const {
|
|
87
|
+
lazyDefaultItems,
|
|
88
|
+
providedItems
|
|
89
|
+
} = (_api$quickInsert$shar = api === null || api === void 0 ? void 0 : api.quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {};
|
|
90
|
+
return getQuickInsertSuggestions(searchOptions, lazyDefaultItems, providedItems);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
commands: {
|
|
94
|
+
openElementBrowserModal
|
|
64
95
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
emptyStateHandler: quickInsertState.emptyStateHandler,
|
|
68
|
-
providedItems: quickInsertState.providedItems,
|
|
69
|
-
isElementBrowserModalOpen: quickInsertState.isElementBrowserModalOpen
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
actions: {
|
|
73
|
-
insertItem,
|
|
74
|
-
getSuggestions: searchOptions => {
|
|
75
|
-
var _api$quickInsert$shar;
|
|
76
|
-
const {
|
|
77
|
-
lazyDefaultItems,
|
|
78
|
-
providedItems
|
|
79
|
-
} = (_api$quickInsert$shar = api === null || api === void 0 ? void 0 : api.quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {};
|
|
80
|
-
return getQuickInsertSuggestions(searchOptions, lazyDefaultItems, providedItems);
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
commands: {
|
|
84
|
-
openElementBrowserModal
|
|
85
|
-
}
|
|
86
|
-
});
|
|
96
|
+
};
|
|
97
|
+
};
|
|
87
98
|
const setProviderState = providerState => (state, dispatch) => {
|
|
88
99
|
if (dispatch) {
|
|
89
100
|
dispatch(state.tr.setMeta(pluginKey, providerState));
|
package/dist/esm/plugin.js
CHANGED
|
@@ -14,38 +14,39 @@ import ModalElementBrowser from './ui/ModalElementBrowser';
|
|
|
14
14
|
export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
15
15
|
var options = _ref.config,
|
|
16
16
|
api = _ref.api;
|
|
17
|
+
var typeAhead = {
|
|
18
|
+
id: TypeAheadAvailableNodes.QUICK_INSERT,
|
|
19
|
+
trigger: '/',
|
|
20
|
+
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
21
|
+
getItems: function getItems(_ref2) {
|
|
22
|
+
var query = _ref2.query,
|
|
23
|
+
editorState = _ref2.editorState;
|
|
24
|
+
var quickInsertState = pluginKey.getState(editorState);
|
|
25
|
+
return Promise.resolve(getQuickInsertSuggestions({
|
|
26
|
+
query: query,
|
|
27
|
+
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
28
|
+
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
29
|
+
},
|
|
30
|
+
selectItem: function selectItem(state, item, insert) {
|
|
31
|
+
return item.action(insert, state);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
17
34
|
return {
|
|
18
35
|
name: 'quickInsert',
|
|
19
36
|
pmPlugins: function pmPlugins(defaultItems) {
|
|
20
37
|
return [{
|
|
21
38
|
name: 'quickInsert',
|
|
22
39
|
// It's important that this plugin is above TypeAheadPlugin
|
|
23
|
-
plugin: function plugin(
|
|
24
|
-
var providerFactory =
|
|
25
|
-
getIntl =
|
|
26
|
-
dispatch =
|
|
40
|
+
plugin: function plugin(_ref3) {
|
|
41
|
+
var providerFactory = _ref3.providerFactory,
|
|
42
|
+
getIntl = _ref3.getIntl,
|
|
43
|
+
dispatch = _ref3.dispatch;
|
|
27
44
|
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
28
45
|
}
|
|
29
46
|
}];
|
|
30
47
|
},
|
|
31
48
|
pluginsOptions: {
|
|
32
|
-
typeAhead:
|
|
33
|
-
id: TypeAheadAvailableNodes.QUICK_INSERT,
|
|
34
|
-
trigger: '/',
|
|
35
|
-
headless: options === null || options === void 0 ? void 0 : options.headless,
|
|
36
|
-
getItems: function getItems(_ref3) {
|
|
37
|
-
var query = _ref3.query,
|
|
38
|
-
editorState = _ref3.editorState;
|
|
39
|
-
var quickInsertState = pluginKey.getState(editorState);
|
|
40
|
-
return Promise.resolve(getQuickInsertSuggestions({
|
|
41
|
-
query: query,
|
|
42
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems
|
|
43
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems));
|
|
44
|
-
},
|
|
45
|
-
selectItem: function selectItem(state, item, insert) {
|
|
46
|
-
return item.action(insert, state);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
+
typeAhead: typeAhead
|
|
49
50
|
},
|
|
50
51
|
contentComponent: function contentComponent(_ref4) {
|
|
51
52
|
var editorView = _ref4.editorView;
|
|
@@ -67,6 +68,7 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
67
68
|
return null;
|
|
68
69
|
}
|
|
69
70
|
return {
|
|
71
|
+
typeAheadHandler: typeAhead,
|
|
70
72
|
lazyDefaultItems: quickInsertState.lazyDefaultItems,
|
|
71
73
|
emptyStateHandler: quickInsertState.emptyStateHandler,
|
|
72
74
|
providedItems: quickInsertState.providedItems,
|
|
@@ -75,6 +77,13 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
75
77
|
},
|
|
76
78
|
actions: {
|
|
77
79
|
insertItem: insertItem,
|
|
80
|
+
openTypeAhead: function openTypeAhead(inputMethod) {
|
|
81
|
+
var _api$typeAhead;
|
|
82
|
+
return Boolean(api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.actions.open({
|
|
83
|
+
triggerHandler: typeAhead,
|
|
84
|
+
inputMethod: inputMethod
|
|
85
|
+
}));
|
|
86
|
+
},
|
|
78
87
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
79
88
|
var _api$quickInsert$shar;
|
|
80
89
|
var _ref5 = (_api$quickInsert$shar = api === null || api === void 0 ? void 0 : api.quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { quickInsertPlugin } from './plugin';
|
|
2
|
-
export type { QuickInsertPlugin } from './plugin';
|
|
2
|
+
export type { QuickInsertPlugin, QuickInsertSharedState } from './plugin';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { Command, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions,
|
|
2
|
+
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
4
|
export type { QuickInsertPluginOptions };
|
|
5
|
+
export type QuickInsertSharedState = CommonQuickInsertSharedState & {
|
|
6
|
+
typeAheadHandler: TypeAheadHandler;
|
|
7
|
+
};
|
|
4
8
|
export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
5
9
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
10
|
+
dependencies: [TypeAheadPlugin];
|
|
6
11
|
sharedState: QuickInsertSharedState | null;
|
|
7
12
|
actions: {
|
|
13
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
8
14
|
insertItem: (item: QuickInsertItem) => Command;
|
|
9
15
|
getSuggestions: (searchOptions: QuickInsertSearchOptions) => QuickInsertItem[];
|
|
10
16
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { quickInsertPlugin } from './plugin';
|
|
2
|
-
export type { QuickInsertPlugin } from './plugin';
|
|
2
|
+
export type { QuickInsertPlugin, QuickInsertSharedState } from './plugin';
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
-
import type { Command, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions,
|
|
2
|
+
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
4
|
export type { QuickInsertPluginOptions };
|
|
5
|
+
export type QuickInsertSharedState = CommonQuickInsertSharedState & {
|
|
6
|
+
typeAheadHandler: TypeAheadHandler;
|
|
7
|
+
};
|
|
4
8
|
export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
5
9
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
10
|
+
dependencies: [
|
|
11
|
+
TypeAheadPlugin
|
|
12
|
+
];
|
|
6
13
|
sharedState: QuickInsertSharedState | null;
|
|
7
14
|
actions: {
|
|
15
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
8
16
|
insertItem: (item: QuickInsertItem) => Command;
|
|
9
17
|
getSuggestions: (searchOptions: QuickInsertSearchOptions) => QuickInsertItem[];
|
|
10
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-quick-insert",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Quick insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/button": "^16.10.0",
|
|
39
|
-
"@atlaskit/editor-common": "^76.
|
|
39
|
+
"@atlaskit/editor-common": "^76.6.0",
|
|
40
|
+
"@atlaskit/editor-plugin-type-ahead": "^0.5.0",
|
|
40
41
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
41
42
|
"@atlaskit/icon": "^21.12.0",
|
|
42
43
|
"@atlaskit/modal-dialog": "^12.8.0",
|
package/report.api.md
CHANGED
|
@@ -21,15 +21,20 @@ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
|
21
21
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
22
22
|
import type { QuickInsertPluginOptions } from '@atlaskit/editor-common/types';
|
|
23
23
|
import type { QuickInsertSearchOptions } from '@atlaskit/editor-common/types';
|
|
24
|
-
import type { QuickInsertSharedState } from '@atlaskit/editor-common/types';
|
|
24
|
+
import type { QuickInsertSharedState as QuickInsertSharedState_2 } from '@atlaskit/editor-common/types';
|
|
25
|
+
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
26
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
27
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
25
28
|
|
|
26
29
|
// @public (undocumented)
|
|
27
30
|
export type QuickInsertPlugin = NextEditorPlugin<
|
|
28
31
|
'quickInsert',
|
|
29
32
|
{
|
|
30
33
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
34
|
+
dependencies: [TypeAheadPlugin];
|
|
31
35
|
sharedState: QuickInsertSharedState | null;
|
|
32
36
|
actions: {
|
|
37
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
33
38
|
insertItem: (item: QuickInsertItem) => Command;
|
|
34
39
|
getSuggestions: (
|
|
35
40
|
searchOptions: QuickInsertSearchOptions,
|
|
@@ -44,6 +49,11 @@ export type QuickInsertPlugin = NextEditorPlugin<
|
|
|
44
49
|
// @public (undocumented)
|
|
45
50
|
export const quickInsertPlugin: QuickInsertPlugin;
|
|
46
51
|
|
|
52
|
+
// @public (undocumented)
|
|
53
|
+
export type QuickInsertSharedState = QuickInsertSharedState_2 & {
|
|
54
|
+
typeAheadHandler: TypeAheadHandler;
|
|
55
|
+
};
|
|
56
|
+
|
|
47
57
|
// (No @packageDocumentation comment for this package)
|
|
48
58
|
```
|
|
49
59
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -10,13 +10,18 @@ import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
|
10
10
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
11
11
|
import type { QuickInsertPluginOptions } from '@atlaskit/editor-common/types';
|
|
12
12
|
import type { QuickInsertSearchOptions } from '@atlaskit/editor-common/types';
|
|
13
|
-
import type { QuickInsertSharedState } from '@atlaskit/editor-common/types';
|
|
13
|
+
import type { QuickInsertSharedState as QuickInsertSharedState_2 } from '@atlaskit/editor-common/types';
|
|
14
|
+
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
15
|
+
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
16
|
+
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
14
17
|
|
|
15
18
|
// @public (undocumented)
|
|
16
19
|
export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
17
20
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
21
|
+
dependencies: [TypeAheadPlugin];
|
|
18
22
|
sharedState: QuickInsertSharedState | null;
|
|
19
23
|
actions: {
|
|
24
|
+
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
20
25
|
insertItem: (item: QuickInsertItem) => Command;
|
|
21
26
|
getSuggestions: (searchOptions: QuickInsertSearchOptions) => QuickInsertItem[];
|
|
22
27
|
};
|
|
@@ -28,6 +33,11 @@ export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
|
28
33
|
// @public (undocumented)
|
|
29
34
|
export const quickInsertPlugin: QuickInsertPlugin;
|
|
30
35
|
|
|
36
|
+
// @public (undocumented)
|
|
37
|
+
export type QuickInsertSharedState = QuickInsertSharedState_2 & {
|
|
38
|
+
typeAheadHandler: TypeAheadHandler;
|
|
39
|
+
};
|
|
40
|
+
|
|
31
41
|
// (No @packageDocumentation comment for this package)
|
|
32
42
|
|
|
33
43
|
```
|