@atlaskit/editor-plugin-media-insert 29.0.5 → 29.0.6
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/ui/quick-insert/MediaInsertQuickInsertMenuItem.js +7 -13
- package/dist/cjs/ui/quick-insert/getMediaInsertQuickInsertComponents.js +10 -0
- package/dist/es2019/ui/quick-insert/MediaInsertQuickInsertMenuItem.js +2 -7
- package/dist/es2019/ui/quick-insert/getMediaInsertQuickInsertComponents.js +9 -0
- package/dist/esm/ui/quick-insert/MediaInsertQuickInsertMenuItem.js +7 -13
- package/dist/esm/ui/quick-insert/getMediaInsertQuickInsertComponents.js +10 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media-insert
|
|
2
2
|
|
|
3
|
+
## 29.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3a4c286fdb8c1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a4c286fdb8c1) -
|
|
8
|
+
Add registry-backed Quick Insert search matching under the existing
|
|
9
|
+
`platform_editor_slash_command` experiment. Make native, provider, and extension registered Quick
|
|
10
|
+
Insert items searchable.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 29.0.5
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -8,27 +8,21 @@ exports.MediaInsertQuickInsertMenuItem = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
12
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
13
|
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
15
|
-
var
|
|
14
|
+
var _useQuickInsertContext = require("@atlaskit/editor-common/quick-insert/use-quick-insert-context");
|
|
16
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
16
|
var MediaInsertQuickInsertMenuItem = exports.MediaInsertQuickInsertMenuItem = function MediaInsertQuickInsertMenuItem(_ref) {
|
|
18
17
|
var api = _ref.api,
|
|
19
18
|
config = _ref.config;
|
|
20
19
|
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
21
20
|
formatMessage = _useIntl.formatMessage;
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
isOffline = _useSharedPluginState.isOffline;
|
|
29
|
-
var onSelect = (0, _react.useCallback)(function (_ref3) {
|
|
30
|
-
var _api$mediaInsert, _api$mediaInsert2, _api$analytics, _ref4;
|
|
31
|
-
var insert = _ref3.insert;
|
|
21
|
+
var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
|
|
22
|
+
isOffline = _useQuickInsertContex.isOffline;
|
|
23
|
+
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
24
|
+
var _api$mediaInsert, _api$mediaInsert2, _api$analytics, _ref3;
|
|
25
|
+
var insert = _ref2.insert;
|
|
32
26
|
var tr = insert('');
|
|
33
27
|
api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 || _api$mediaInsert.commands.showMediaInsertPopup()({
|
|
34
28
|
tr: tr
|
|
@@ -40,7 +34,7 @@ var MediaInsertQuickInsertMenuItem = exports.MediaInsertQuickInsertMenuItem = fu
|
|
|
40
34
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PICKER_MEDIA,
|
|
41
35
|
attributes: {
|
|
42
36
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
|
|
43
|
-
openedTab: (
|
|
37
|
+
openedTab: (_ref3 = firstRegisteredTab === null || firstRegisteredTab === void 0 ? void 0 : firstRegisteredTab.key) !== null && _ref3 !== void 0 ? _ref3 : config !== null && config !== void 0 && config.isOnlyExternalLinks ? _analytics.MEDIA_INSERT_TAB.LINK : _analytics.MEDIA_INSERT_TAB.UPLOAD
|
|
44
38
|
},
|
|
45
39
|
eventType: _analytics.EVENT_TYPE.UI
|
|
46
40
|
})(tr);
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getMediaInsertQuickInsertComponents = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
10
|
+
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
|
|
9
11
|
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
10
12
|
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
11
13
|
var _MediaInsertQuickInsertMenuItem = require("./MediaInsertQuickInsertMenuItem");
|
|
@@ -20,6 +22,14 @@ var getMediaInsertQuickInsertComponents = exports.getMediaInsertQuickInsertCompo
|
|
|
20
22
|
type: _keys.MEDIA_SECTION.type,
|
|
21
23
|
rank: _rank.MEDIA_SECTION_RANK[_keys.MEDIA_INSERT_MENU_ITEM.key]
|
|
22
24
|
}],
|
|
25
|
+
match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function (_ref2) {
|
|
26
|
+
var formatMessage = _ref2.formatMessage;
|
|
27
|
+
return {
|
|
28
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.mediaFilesDescription),
|
|
29
|
+
keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
|
|
30
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.mediaFiles)
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
23
33
|
component: function component() {
|
|
24
34
|
return /*#__PURE__*/_react.default.createElement(_MediaInsertQuickInsertMenuItem.MediaInsertQuickInsertMenuItem, {
|
|
25
35
|
api: api,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MEDIA_INSERT_TAB } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
7
6
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
-
import {
|
|
7
|
+
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
9
8
|
export const MediaInsertQuickInsertMenuItem = ({
|
|
10
9
|
api,
|
|
11
10
|
config
|
|
@@ -15,11 +14,7 @@ export const MediaInsertQuickInsertMenuItem = ({
|
|
|
15
14
|
} = useIntl();
|
|
16
15
|
const {
|
|
17
16
|
isOffline
|
|
18
|
-
} =
|
|
19
|
-
connectivityState
|
|
20
|
-
}) => ({
|
|
21
|
-
isOffline: isOfflineMode(connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode)
|
|
22
|
-
}));
|
|
17
|
+
} = useQuickInsertContext();
|
|
23
18
|
const onSelect = useCallback(({
|
|
24
19
|
insert
|
|
25
20
|
}) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
2
4
|
import { MEDIA_INSERT_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
5
|
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
6
|
import { MediaInsertQuickInsertMenuItem } from './MediaInsertQuickInsertMenuItem';
|
|
@@ -13,6 +15,13 @@ export const getMediaInsertQuickInsertComponents = ({
|
|
|
13
15
|
type: MEDIA_SECTION.type,
|
|
14
16
|
rank: MEDIA_SECTION_RANK[MEDIA_INSERT_MENU_ITEM.key]
|
|
15
17
|
}],
|
|
18
|
+
match: createQuickInsertMatcher(({
|
|
19
|
+
formatMessage
|
|
20
|
+
}) => ({
|
|
21
|
+
description: formatMessage(messages.mediaFilesDescription),
|
|
22
|
+
keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
|
|
23
|
+
title: formatMessage(messages.mediaFiles)
|
|
24
|
+
})),
|
|
16
25
|
component: () => /*#__PURE__*/React.createElement(MediaInsertQuickInsertMenuItem, {
|
|
17
26
|
api: api,
|
|
18
27
|
config: config
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MEDIA_INSERT_TAB } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
5
|
import { IconImages } from '@atlaskit/editor-common/quick-insert';
|
|
7
6
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
-
import {
|
|
7
|
+
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
9
8
|
export var MediaInsertQuickInsertMenuItem = function MediaInsertQuickInsertMenuItem(_ref) {
|
|
10
9
|
var api = _ref.api,
|
|
11
10
|
config = _ref.config;
|
|
12
11
|
var _useIntl = useIntl(),
|
|
13
12
|
formatMessage = _useIntl.formatMessage;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
isOffline = _useSharedPluginState.isOffline;
|
|
21
|
-
var onSelect = useCallback(function (_ref3) {
|
|
22
|
-
var _api$mediaInsert, _api$mediaInsert2, _api$analytics, _ref4;
|
|
23
|
-
var insert = _ref3.insert;
|
|
13
|
+
var _useQuickInsertContex = useQuickInsertContext(),
|
|
14
|
+
isOffline = _useQuickInsertContex.isOffline;
|
|
15
|
+
var onSelect = useCallback(function (_ref2) {
|
|
16
|
+
var _api$mediaInsert, _api$mediaInsert2, _api$analytics, _ref3;
|
|
17
|
+
var insert = _ref2.insert;
|
|
24
18
|
var tr = insert('');
|
|
25
19
|
api === null || api === void 0 || (_api$mediaInsert = api.mediaInsert) === null || _api$mediaInsert === void 0 || _api$mediaInsert.commands.showMediaInsertPopup()({
|
|
26
20
|
tr: tr
|
|
@@ -32,7 +26,7 @@ export var MediaInsertQuickInsertMenuItem = function MediaInsertQuickInsertMenuI
|
|
|
32
26
|
actionSubjectId: ACTION_SUBJECT_ID.PICKER_MEDIA,
|
|
33
27
|
attributes: {
|
|
34
28
|
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
35
|
-
openedTab: (
|
|
29
|
+
openedTab: (_ref3 = firstRegisteredTab === null || firstRegisteredTab === void 0 ? void 0 : firstRegisteredTab.key) !== null && _ref3 !== void 0 ? _ref3 : config !== null && config !== void 0 && config.isOnlyExternalLinks ? MEDIA_INSERT_TAB.LINK : MEDIA_INSERT_TAB.UPLOAD
|
|
36
30
|
},
|
|
37
31
|
eventType: EVENT_TYPE.UI
|
|
38
32
|
})(tr);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
|
+
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
2
4
|
import { MEDIA_INSERT_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
5
|
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
6
|
import { MediaInsertQuickInsertMenuItem } from './MediaInsertQuickInsertMenuItem';
|
|
@@ -13,6 +15,14 @@ export var getMediaInsertQuickInsertComponents = function getMediaInsertQuickIns
|
|
|
13
15
|
type: MEDIA_SECTION.type,
|
|
14
16
|
rank: MEDIA_SECTION_RANK[MEDIA_INSERT_MENU_ITEM.key]
|
|
15
17
|
}],
|
|
18
|
+
match: createQuickInsertMatcher(function (_ref2) {
|
|
19
|
+
var formatMessage = _ref2.formatMessage;
|
|
20
|
+
return {
|
|
21
|
+
description: formatMessage(messages.mediaFilesDescription),
|
|
22
|
+
keywords: ['attachment', 'gif', 'media', 'picture', 'image', 'video', 'file'],
|
|
23
|
+
title: formatMessage(messages.mediaFiles)
|
|
24
|
+
};
|
|
25
|
+
}),
|
|
16
26
|
component: function component() {
|
|
17
27
|
return /*#__PURE__*/React.createElement(MediaInsertQuickInsertMenuItem, {
|
|
18
28
|
api: api,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media-insert",
|
|
3
|
-
"version": "29.0.
|
|
3
|
+
"version": "29.0.6",
|
|
4
4
|
"description": "Media Insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"@atlaskit/editor-plugin-analytics": "^14.0.0",
|
|
27
27
|
"@atlaskit/editor-plugin-connectivity": "^14.0.0",
|
|
28
28
|
"@atlaskit/editor-plugin-media": "^16.0.0",
|
|
29
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^8.
|
|
29
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^8.1.0",
|
|
30
30
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
31
31
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
32
|
-
"@atlaskit/editor-ui-control-model": "^2.
|
|
32
|
+
"@atlaskit/editor-ui-control-model": "^2.6.0",
|
|
33
33
|
"@atlaskit/form": "^17.0.0",
|
|
34
34
|
"@atlaskit/icon": "^37.3.0",
|
|
35
35
|
"@atlaskit/media-card": "^81.6.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/runtime": "^7.0.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@atlaskit/editor-common": "^118.
|
|
48
|
+
"@atlaskit/editor-common": "^118.10.0",
|
|
49
49
|
"@atlaskit/tokens": "^16.6.0",
|
|
50
50
|
"react": "^18.2.0 || ^19.2.0",
|
|
51
51
|
"react-dom": "^18.2.0 || ^19.2.0",
|