@atlaskit/editor-plugin-quick-insert 1.3.3 → 1.4.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 +17 -0
- package/dist/cjs/plugin.js +24 -3
- package/dist/es2019/plugin.js +19 -1
- package/dist/esm/plugin.js +24 -3
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types-ts4.5/plugin.d.ts +2 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-quick-insert
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#141244](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141244)
|
|
8
|
+
[`972ec7421443c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/972ec7421443c) -
|
|
9
|
+
[ED-24939] Add addQuickInsertItem command to support adding new quick insert items
|
|
10
|
+
|
|
11
|
+
## 1.3.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#139334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139334)
|
|
16
|
+
[`30793649657c0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30793649657c0) -
|
|
17
|
+
[HOT-111629] We had an incident where the last character disappears when hitting the enter key on
|
|
18
|
+
windows OS for Korean characters. Bumping to prosemirror-view@1.34.2 for the fix.
|
|
19
|
+
|
|
3
20
|
## 1.3.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -8,7 +8,9 @@ exports.quickInsertPlugin = void 0;
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
12
14
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
13
15
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
14
16
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
@@ -38,6 +40,7 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
38
40
|
return item.action(insert, state);
|
|
39
41
|
}
|
|
40
42
|
};
|
|
43
|
+
var intl;
|
|
41
44
|
return {
|
|
42
45
|
name: 'quickInsert',
|
|
43
46
|
pmPlugins: function pmPlugins(defaultItems) {
|
|
@@ -100,7 +103,25 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
100
103
|
}
|
|
101
104
|
},
|
|
102
105
|
commands: {
|
|
103
|
-
openElementBrowserModal: _commands.openElementBrowserModal
|
|
106
|
+
openElementBrowserModal: _commands.openElementBrowserModal,
|
|
107
|
+
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
108
|
+
return function (_ref6) {
|
|
109
|
+
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
110
|
+
var tr = _ref6.tr;
|
|
111
|
+
var _ref7 = (_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 : {},
|
|
112
|
+
lazyDefaultItems = _ref7.lazyDefaultItems;
|
|
113
|
+
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
114
|
+
var memoisedNewItems = (0, _quickInsert.memoProcessQuickInsertItems)([item], intl);
|
|
115
|
+
return tr.setMeta(_pluginKey.pluginKey, {
|
|
116
|
+
lazyDefaultItems: function lazyDefaultItems() {
|
|
117
|
+
return [].concat((0, _toConsumableArray2.default)(defaultItems), (0, _toConsumableArray2.default)(memoisedNewItems));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
usePluginHook: function usePluginHook() {
|
|
124
|
+
intl = (0, _reactIntlNext.useIntl)();
|
|
104
125
|
}
|
|
105
126
|
};
|
|
106
127
|
};
|
|
@@ -146,7 +167,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
146
167
|
},
|
|
147
168
|
view: function view(editorView) {
|
|
148
169
|
var providerHandler = /*#__PURE__*/function () {
|
|
149
|
-
var
|
|
170
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_name, providerPromise) {
|
|
150
171
|
var provider, providedItems;
|
|
151
172
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
152
173
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -182,7 +203,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
182
203
|
}, _callee, null, [[1, 11]]);
|
|
183
204
|
}));
|
|
184
205
|
return function providerHandler(_x, _x2) {
|
|
185
|
-
return
|
|
206
|
+
return _ref8.apply(this, arguments);
|
|
186
207
|
};
|
|
187
208
|
}();
|
|
188
209
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
2
3
|
import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
5
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
@@ -28,6 +29,7 @@ export const quickInsertPlugin = ({
|
|
|
28
29
|
return item.action(insert, state);
|
|
29
30
|
}
|
|
30
31
|
};
|
|
32
|
+
let intl;
|
|
31
33
|
return {
|
|
32
34
|
name: 'quickInsert',
|
|
33
35
|
pmPlugins(defaultItems) {
|
|
@@ -91,7 +93,23 @@ export const quickInsertPlugin = ({
|
|
|
91
93
|
}
|
|
92
94
|
},
|
|
93
95
|
commands: {
|
|
94
|
-
openElementBrowserModal
|
|
96
|
+
openElementBrowserModal,
|
|
97
|
+
addQuickInsertItem: item => ({
|
|
98
|
+
tr
|
|
99
|
+
}) => {
|
|
100
|
+
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
101
|
+
const {
|
|
102
|
+
lazyDefaultItems
|
|
103
|
+
} = (_api$quickInsert$shar2 = api === null || api === void 0 ? 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 : {};
|
|
104
|
+
const defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
105
|
+
const memoisedNewItems = memoProcessQuickInsertItems([item], intl);
|
|
106
|
+
return tr.setMeta(pluginKey, {
|
|
107
|
+
lazyDefaultItems: () => [...defaultItems, ...memoisedNewItems]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
usePluginHook: () => {
|
|
112
|
+
intl = useIntl();
|
|
95
113
|
}
|
|
96
114
|
};
|
|
97
115
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
5
|
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; }
|
|
5
6
|
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; }
|
|
6
7
|
import React from 'react';
|
|
8
|
+
import { useIntl } from 'react-intl-next';
|
|
7
9
|
import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
|
|
8
10
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
11
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
@@ -31,6 +33,7 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
31
33
|
return item.action(insert, state);
|
|
32
34
|
}
|
|
33
35
|
};
|
|
36
|
+
var intl;
|
|
34
37
|
return {
|
|
35
38
|
name: 'quickInsert',
|
|
36
39
|
pmPlugins: function pmPlugins(defaultItems) {
|
|
@@ -93,7 +96,25 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
93
96
|
}
|
|
94
97
|
},
|
|
95
98
|
commands: {
|
|
96
|
-
openElementBrowserModal: openElementBrowserModal
|
|
99
|
+
openElementBrowserModal: openElementBrowserModal,
|
|
100
|
+
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
101
|
+
return function (_ref6) {
|
|
102
|
+
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
103
|
+
var tr = _ref6.tr;
|
|
104
|
+
var _ref7 = (_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 : {},
|
|
105
|
+
lazyDefaultItems = _ref7.lazyDefaultItems;
|
|
106
|
+
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
107
|
+
var memoisedNewItems = memoProcessQuickInsertItems([item], intl);
|
|
108
|
+
return tr.setMeta(pluginKey, {
|
|
109
|
+
lazyDefaultItems: function lazyDefaultItems() {
|
|
110
|
+
return [].concat(_toConsumableArray(defaultItems), _toConsumableArray(memoisedNewItems));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
usePluginHook: function usePluginHook() {
|
|
117
|
+
intl = useIntl();
|
|
97
118
|
}
|
|
98
119
|
};
|
|
99
120
|
};
|
|
@@ -139,7 +160,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
139
160
|
},
|
|
140
161
|
view: function view(editorView) {
|
|
141
162
|
var providerHandler = /*#__PURE__*/function () {
|
|
142
|
-
var
|
|
163
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
|
|
143
164
|
var provider, providedItems;
|
|
144
165
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
145
166
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -175,7 +196,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
175
196
|
}, _callee, null, [[1, 11]]);
|
|
176
197
|
}));
|
|
177
198
|
return function providerHandler(_x, _x2) {
|
|
178
|
-
return
|
|
199
|
+
return _ref8.apply(this, arguments);
|
|
179
200
|
};
|
|
180
201
|
}();
|
|
181
202
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertHandler, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
5
|
export type { QuickInsertPluginOptions };
|
|
6
6
|
export type QuickInsertSharedState = CommonQuickInsertSharedState & {
|
|
@@ -17,6 +17,7 @@ export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
|
17
17
|
};
|
|
18
18
|
commands: {
|
|
19
19
|
openElementBrowserModal: EditorCommand;
|
|
20
|
+
addQuickInsertItem: (item: QuickInsertHandler) => EditorCommand;
|
|
20
21
|
};
|
|
21
22
|
}>;
|
|
22
23
|
export declare const quickInsertPlugin: QuickInsertPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Command, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, QuickInsertHandler, QuickInsertPluginOptions, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
5
|
export type { QuickInsertPluginOptions };
|
|
6
6
|
export type QuickInsertSharedState = CommonQuickInsertSharedState & {
|
|
@@ -19,6 +19,7 @@ export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
|
|
|
19
19
|
};
|
|
20
20
|
commands: {
|
|
21
21
|
openElementBrowserModal: EditorCommand;
|
|
22
|
+
addQuickInsertItem: (item: QuickInsertHandler) => EditorCommand;
|
|
22
23
|
};
|
|
23
24
|
}>;
|
|
24
25
|
export declare const quickInsertPlugin: QuickInsertPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-quick-insert",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Quick insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^89.
|
|
35
|
+
"@atlaskit/editor-common": "^89.3.0",
|
|
36
36
|
"@atlaskit/editor-plugin-type-ahead": "^1.8.0",
|
|
37
|
-
"@atlaskit/editor-prosemirror": "
|
|
38
|
-
"@atlaskit/icon": "^22.
|
|
39
|
-
"@atlaskit/modal-dialog": "^12.
|
|
37
|
+
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
38
|
+
"@atlaskit/icon": "^22.18.0",
|
|
39
|
+
"@atlaskit/modal-dialog": "^12.16.0",
|
|
40
40
|
"@atlaskit/theme": "^13.0.0",
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
41
|
+
"@atlaskit/tokens": "^1.60.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"@emotion/react": "^11.7.1"
|
|
44
44
|
},
|