@atlaskit/editor-plugin-quick-insert 2.0.2 → 2.0.4
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/quickInsertPlugin.js +29 -16
- package/dist/es2019/quickInsertPlugin.js +15 -1
- package/dist/esm/quickInsertPlugin.js +29 -16
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-quick-insert
|
|
2
2
|
|
|
3
|
+
## 2.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#121073](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121073)
|
|
14
|
+
[`9c197731fcbf8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9c197731fcbf8) -
|
|
15
|
+
[ux] [ED-26824] When platform_editor_controls is enabled, add 'View more' button to quick
|
|
16
|
+
insertpopup to open element browser modal
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 2.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -50,7 +50,20 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
50
50
|
onInsert(quickInsertItem);
|
|
51
51
|
}
|
|
52
52
|
return result;
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
// This is used by typeahead plugin to trigger element browser modal without introducing circular dependency.
|
|
56
|
+
// Given it's only temporarily needed to roll out toolbar&menus separate to quick insert/right rail change
|
|
57
|
+
// skip updating `TypeAheadHandler` to avoid unnecessary breaking change.
|
|
58
|
+
openElementBrowserModal: options !== null && options !== void 0 && options.enableElementBrowser ? function () {
|
|
59
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
60
|
+
var tr = _ref3.tr;
|
|
61
|
+
(0, _commands.openElementBrowserModal)({
|
|
62
|
+
tr: tr
|
|
63
|
+
});
|
|
64
|
+
return tr;
|
|
65
|
+
});
|
|
66
|
+
} : undefined
|
|
54
67
|
};
|
|
55
68
|
var intl;
|
|
56
69
|
return {
|
|
@@ -59,10 +72,10 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
59
72
|
return [{
|
|
60
73
|
name: 'quickInsert',
|
|
61
74
|
// It's important that this plugin is above TypeAheadPlugin
|
|
62
|
-
plugin: function plugin(
|
|
63
|
-
var providerFactory =
|
|
64
|
-
getIntl =
|
|
65
|
-
dispatch =
|
|
75
|
+
plugin: function plugin(_ref4) {
|
|
76
|
+
var providerFactory = _ref4.providerFactory,
|
|
77
|
+
getIntl = _ref4.getIntl,
|
|
78
|
+
dispatch = _ref4.dispatch;
|
|
66
79
|
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
67
80
|
}
|
|
68
81
|
}];
|
|
@@ -70,8 +83,8 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
70
83
|
pluginsOptions: {
|
|
71
84
|
typeAhead: typeAhead
|
|
72
85
|
},
|
|
73
|
-
contentComponent: function contentComponent(
|
|
74
|
-
var editorView =
|
|
86
|
+
contentComponent: function contentComponent(_ref5) {
|
|
87
|
+
var editorView = _ref5.editorView;
|
|
75
88
|
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
76
89
|
return /*#__PURE__*/_react.default.createElement(_ModalElementBrowser.default, {
|
|
77
90
|
editorView: editorView,
|
|
@@ -108,9 +121,9 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
108
121
|
},
|
|
109
122
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
110
123
|
var _api$quickInsert$shar, _api$quickInsert;
|
|
111
|
-
var
|
|
112
|
-
lazyDefaultItems =
|
|
113
|
-
providedItems =
|
|
124
|
+
var _ref6 = (_api$quickInsert$shar = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
|
125
|
+
lazyDefaultItems = _ref6.lazyDefaultItems,
|
|
126
|
+
providedItems = _ref6.providedItems;
|
|
114
127
|
if (options !== null && options !== void 0 && options.prioritySortingFn) {
|
|
115
128
|
searchOptions = _objectSpread(_objectSpread({}, searchOptions), {}, {
|
|
116
129
|
prioritySortingFn: options.prioritySortingFn
|
|
@@ -122,11 +135,11 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
122
135
|
commands: {
|
|
123
136
|
openElementBrowserModal: _commands.openElementBrowserModal,
|
|
124
137
|
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
125
|
-
return function (
|
|
138
|
+
return function (_ref7) {
|
|
126
139
|
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
127
|
-
var tr =
|
|
128
|
-
var
|
|
129
|
-
lazyDefaultItems =
|
|
140
|
+
var tr = _ref7.tr;
|
|
141
|
+
var _ref8 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
|
|
142
|
+
lazyDefaultItems = _ref8.lazyDefaultItems;
|
|
130
143
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
131
144
|
var memoisedNewItems = (0, _quickInsert.memoProcessQuickInsertItems)([item], intl);
|
|
132
145
|
return tr.setMeta(_pluginKey.pluginKey, {
|
|
@@ -184,7 +197,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
184
197
|
},
|
|
185
198
|
view: function view(editorView) {
|
|
186
199
|
var providerHandler = /*#__PURE__*/function () {
|
|
187
|
-
var
|
|
200
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_name, providerPromise) {
|
|
188
201
|
var provider, providedItems;
|
|
189
202
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
190
203
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -220,7 +233,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
220
233
|
}, _callee, null, [[1, 11]]);
|
|
221
234
|
}));
|
|
222
235
|
return function providerHandler(_x, _x2) {
|
|
223
|
-
return
|
|
236
|
+
return _ref9.apply(this, arguments);
|
|
224
237
|
};
|
|
225
238
|
}();
|
|
226
239
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
|
@@ -39,7 +39,21 @@ export const quickInsertPlugin = ({
|
|
|
39
39
|
onInsert(quickInsertItem);
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
// This is used by typeahead plugin to trigger element browser modal without introducing circular dependency.
|
|
45
|
+
// Given it's only temporarily needed to roll out toolbar&menus separate to quick insert/right rail change
|
|
46
|
+
// skip updating `TypeAheadHandler` to avoid unnecessary breaking change.
|
|
47
|
+
openElementBrowserModal: options !== null && options !== void 0 && options.enableElementBrowser ? () => {
|
|
48
|
+
api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
49
|
+
tr
|
|
50
|
+
}) => {
|
|
51
|
+
openElementBrowserModal({
|
|
52
|
+
tr
|
|
53
|
+
});
|
|
54
|
+
return tr;
|
|
55
|
+
});
|
|
56
|
+
} : undefined
|
|
43
57
|
};
|
|
44
58
|
let intl;
|
|
45
59
|
return {
|
|
@@ -43,7 +43,20 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
43
43
|
onInsert(quickInsertItem);
|
|
44
44
|
}
|
|
45
45
|
return result;
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
// This is used by typeahead plugin to trigger element browser modal without introducing circular dependency.
|
|
49
|
+
// Given it's only temporarily needed to roll out toolbar&menus separate to quick insert/right rail change
|
|
50
|
+
// skip updating `TypeAheadHandler` to avoid unnecessary breaking change.
|
|
51
|
+
openElementBrowserModal: options !== null && options !== void 0 && options.enableElementBrowser ? function () {
|
|
52
|
+
api === null || api === void 0 || api.core.actions.execute(function (_ref3) {
|
|
53
|
+
var tr = _ref3.tr;
|
|
54
|
+
openElementBrowserModal({
|
|
55
|
+
tr: tr
|
|
56
|
+
});
|
|
57
|
+
return tr;
|
|
58
|
+
});
|
|
59
|
+
} : undefined
|
|
47
60
|
};
|
|
48
61
|
var intl;
|
|
49
62
|
return {
|
|
@@ -52,10 +65,10 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
52
65
|
return [{
|
|
53
66
|
name: 'quickInsert',
|
|
54
67
|
// It's important that this plugin is above TypeAheadPlugin
|
|
55
|
-
plugin: function plugin(
|
|
56
|
-
var providerFactory =
|
|
57
|
-
getIntl =
|
|
58
|
-
dispatch =
|
|
68
|
+
plugin: function plugin(_ref4) {
|
|
69
|
+
var providerFactory = _ref4.providerFactory,
|
|
70
|
+
getIntl = _ref4.getIntl,
|
|
71
|
+
dispatch = _ref4.dispatch;
|
|
59
72
|
return quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, options === null || options === void 0 ? void 0 : options.emptyStateHandler);
|
|
60
73
|
}
|
|
61
74
|
}];
|
|
@@ -63,8 +76,8 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
63
76
|
pluginsOptions: {
|
|
64
77
|
typeAhead: typeAhead
|
|
65
78
|
},
|
|
66
|
-
contentComponent: function contentComponent(
|
|
67
|
-
var editorView =
|
|
79
|
+
contentComponent: function contentComponent(_ref5) {
|
|
80
|
+
var editorView = _ref5.editorView;
|
|
68
81
|
if (options !== null && options !== void 0 && options.enableElementBrowser) {
|
|
69
82
|
return /*#__PURE__*/React.createElement(ModalElementBrowser, {
|
|
70
83
|
editorView: editorView,
|
|
@@ -101,9 +114,9 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
101
114
|
},
|
|
102
115
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
103
116
|
var _api$quickInsert$shar, _api$quickInsert;
|
|
104
|
-
var
|
|
105
|
-
lazyDefaultItems =
|
|
106
|
-
providedItems =
|
|
117
|
+
var _ref6 = (_api$quickInsert$shar = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
|
118
|
+
lazyDefaultItems = _ref6.lazyDefaultItems,
|
|
119
|
+
providedItems = _ref6.providedItems;
|
|
107
120
|
if (options !== null && options !== void 0 && options.prioritySortingFn) {
|
|
108
121
|
searchOptions = _objectSpread(_objectSpread({}, searchOptions), {}, {
|
|
109
122
|
prioritySortingFn: options.prioritySortingFn
|
|
@@ -115,11 +128,11 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
115
128
|
commands: {
|
|
116
129
|
openElementBrowserModal: openElementBrowserModal,
|
|
117
130
|
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
118
|
-
return function (
|
|
131
|
+
return function (_ref7) {
|
|
119
132
|
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
120
|
-
var tr =
|
|
121
|
-
var
|
|
122
|
-
lazyDefaultItems =
|
|
133
|
+
var tr = _ref7.tr;
|
|
134
|
+
var _ref8 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
|
|
135
|
+
lazyDefaultItems = _ref8.lazyDefaultItems;
|
|
123
136
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
124
137
|
var memoisedNewItems = memoProcessQuickInsertItems([item], intl);
|
|
125
138
|
return tr.setMeta(pluginKey, {
|
|
@@ -177,7 +190,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
177
190
|
},
|
|
178
191
|
view: function view(editorView) {
|
|
179
192
|
var providerHandler = /*#__PURE__*/function () {
|
|
180
|
-
var
|
|
193
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
|
|
181
194
|
var provider, providedItems;
|
|
182
195
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
183
196
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -213,7 +226,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
213
226
|
}, _callee, null, [[1, 11]]);
|
|
214
227
|
}));
|
|
215
228
|
return function providerHandler(_x, _x2) {
|
|
216
|
-
return
|
|
229
|
+
return _ref9.apply(this, arguments);
|
|
217
230
|
};
|
|
218
231
|
}();
|
|
219
232
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-quick-insert",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Quick insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/button": "^21.1.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^101.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-type-ahead": "^2.
|
|
39
|
+
"@atlaskit/editor-plugin-type-ahead": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
41
41
|
"@atlaskit/icon": "^24.1.0",
|
|
42
42
|
"@atlaskit/modal-dialog": "^13.0.0",
|
|
43
43
|
"@atlaskit/theme": "^17.0.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
45
|
-
"@atlaskit/tokens": "^4.
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^3.4.0",
|
|
45
|
+
"@atlaskit/tokens": "^4.3.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0",
|
|
47
47
|
"@emotion/react": "^11.7.1"
|
|
48
48
|
},
|