@atlaskit/editor-plugin-quick-insert 21.1.2 → 21.1.3
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 +30 -0
- package/dist/cjs/ui/QuickInsertMenuFooterItem.js +1 -0
- package/dist/cjs/ui/QuickInsertSectionOverflowMenuItem.js +1 -0
- package/dist/cjs/ui/RegistryElementBrowser/RegistryElementBrowser.js +3 -12
- package/dist/cjs/ui/RegistryElementBrowser/RegistryElementBrowserFooter.js +2 -4
- package/dist/cjs/ui/getLegacyCompatibleComponents.js +19 -4
- package/dist/es2019/ui/QuickInsertMenuFooterItem.js +1 -0
- package/dist/es2019/ui/QuickInsertSectionOverflowMenuItem.js +1 -0
- package/dist/es2019/ui/RegistryElementBrowser/RegistryElementBrowser.js +3 -12
- package/dist/es2019/ui/RegistryElementBrowser/RegistryElementBrowserFooter.js +2 -4
- package/dist/es2019/ui/getLegacyCompatibleComponents.js +18 -4
- package/dist/esm/ui/QuickInsertMenuFooterItem.js +1 -0
- package/dist/esm/ui/QuickInsertSectionOverflowMenuItem.js +1 -0
- package/dist/esm/ui/RegistryElementBrowser/RegistryElementBrowser.js +3 -12
- package/dist/esm/ui/RegistryElementBrowser/RegistryElementBrowserFooter.js +2 -4
- package/dist/esm/ui/getLegacyCompatibleComponents.js +17 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-quick-insert
|
|
2
2
|
|
|
3
|
+
## 21.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`a034f535638cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a034f535638cc) -
|
|
8
|
+
Add structured Quick Insert previews with localised title, description and attribution under
|
|
9
|
+
platform_editor_slash_command.
|
|
10
|
+
|
|
11
|
+
Exclude footer and category navigation actions from previews. Left-align attribution, use subtle
|
|
12
|
+
title and attribution text, and default description text.
|
|
13
|
+
|
|
14
|
+
Show text previews even without preview metadata, and reserve a fixed image area while images load
|
|
15
|
+
or when they fail. Keep previews within the viewport, flipping left when needed, with compact
|
|
16
|
+
panel dimensions and typography.
|
|
17
|
+
|
|
18
|
+
Replace baked panel screenshots with image-only assets. Remove image fields from text-only legacy
|
|
19
|
+
previews while preserving their attribution.
|
|
20
|
+
|
|
21
|
+
Let extension providers own their preview images and attribution. Pass preview metadata through
|
|
22
|
+
the Company Hub manifest factory and remove Editor's fallback preview registry.
|
|
23
|
+
|
|
24
|
+
Localize provider attribution names and display Confluence and Jira product icons instead of the
|
|
25
|
+
attribution prefix when an icon is present. Allow the Dropbox manifest to receive the host's
|
|
26
|
+
message formatter.
|
|
27
|
+
|
|
28
|
+
- [`7306003a7565b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7306003a7565b) -
|
|
29
|
+
Fix modal dismissal, category spacing, measured list height, and viewport-aware menu placement
|
|
30
|
+
under platform_editor_slash_command.
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 21.1.2
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -31,6 +31,7 @@ var QuickInsertMenuFooterItem = exports.QuickInsertMenuFooterItem = function Qui
|
|
|
31
31
|
}),
|
|
32
32
|
isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
|
|
33
33
|
onSelect: onSelect,
|
|
34
|
+
shouldShowPreview: false,
|
|
34
35
|
shouldWrapIcon: false,
|
|
35
36
|
title: formatMessage(_messages.toolbarInsertBlockMessages.viewMore)
|
|
36
37
|
});
|
|
@@ -33,6 +33,7 @@ var QuickInsertSectionOverflowMenuItem = exports.QuickInsertSectionOverflowMenuI
|
|
|
33
33
|
}),
|
|
34
34
|
isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
|
|
35
35
|
onSelect: onSelect,
|
|
36
|
+
shouldShowPreview: false,
|
|
36
37
|
title: formatMessage(_messages.toolbarInsertBlockMessages.viewMore)
|
|
37
38
|
});
|
|
38
39
|
};
|
|
@@ -13,6 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactIntl = require("react-intl");
|
|
15
15
|
var _button = _interopRequireDefault(require("@atlaskit/button/icon/button"));
|
|
16
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
16
17
|
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
17
18
|
var _typeAheadGetMenuFooterSectionKey = require("@atlaskit/editor-common/type-ahead-get-menu-footer-section-key");
|
|
18
19
|
var _typeAheadGetSectionOverflowItemKey = require("@atlaskit/editor-common/type-ahead-get-section-overflow-item-key");
|
|
@@ -123,13 +124,6 @@ var RegistryElementBrowser = exports.RegistryElementBrowser = function RegistryE
|
|
|
123
124
|
setSelectedKey(undefined);
|
|
124
125
|
onClearSelection();
|
|
125
126
|
}, [onClearSelection]);
|
|
126
|
-
var onClearSearch = (0, _react.useCallback)(function () {
|
|
127
|
-
var _searchInputRef$curre;
|
|
128
|
-
setQuery('');
|
|
129
|
-
setSelectedKey(undefined);
|
|
130
|
-
onClearSelection();
|
|
131
|
-
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 || _searchInputRef$curre.focus();
|
|
132
|
-
}, [onClearSelection]);
|
|
133
127
|
var onRegistrySelect = (0, _react.useCallback)(function (key, handler) {
|
|
134
128
|
setSelectedKey(key);
|
|
135
129
|
onSelect(handler);
|
|
@@ -209,11 +203,8 @@ var RegistryElementBrowser = exports.RegistryElementBrowser = function RegistryE
|
|
|
209
203
|
}), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
210
204
|
appearance: "subtle",
|
|
211
205
|
icon: _cross.default,
|
|
212
|
-
label: formatMessage(
|
|
213
|
-
|
|
214
|
-
id: 'editor.quick-insert.clear-search'
|
|
215
|
-
}),
|
|
216
|
-
onClick: onClearSearch,
|
|
206
|
+
label: formatMessage(_quickInsert.messages.close),
|
|
207
|
+
onClick: onClose,
|
|
217
208
|
spacing: "compact"
|
|
218
209
|
})))), /*#__PURE__*/_react.default.createElement(_modalBody.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
219
210
|
className: (0, _runtime.ax)(["_zulp1fka _1e0c11p5 _yv0e1xuv _lk4ji47z"])
|
|
@@ -9,6 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactIntl = require("react-intl");
|
|
10
10
|
var _button = _interopRequireDefault(require("@atlaskit/button/default/button"));
|
|
11
11
|
var _link = _interopRequireDefault(require("@atlaskit/button/link"));
|
|
12
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
12
13
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
14
|
var RegistryElementBrowserFooter = exports.RegistryElementBrowserFooter = function RegistryElementBrowserFooter(_ref) {
|
|
14
15
|
var helpUrl = _ref.helpUrl,
|
|
@@ -51,8 +52,5 @@ var RegistryElementBrowserFooter = exports.RegistryElementBrowserFooter = functi
|
|
|
51
52
|
})), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
52
53
|
appearance: "subtle",
|
|
53
54
|
onClick: onClose
|
|
54
|
-
}, formatMessage(
|
|
55
|
-
defaultMessage: 'Close',
|
|
56
|
-
id: 'editor.quick-insert.close'
|
|
57
|
-
}))));
|
|
55
|
+
}, formatMessage(_quickInsert.messages.close))));
|
|
58
56
|
};
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.getLegacyCompatibleComponents = void 0;
|
|
8
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _reactIntl = require("react-intl");
|
|
11
13
|
var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
|
|
12
14
|
var _getMenuItemParents = require("@atlaskit/editor-common/quick-insert/get-menu-item-parents");
|
|
13
15
|
var _getProviderMenuItemKey = require("@atlaskit/editor-common/quick-insert/get-provider-menu-item-key");
|
|
14
16
|
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
17
|
+
var _messages = require("@atlaskit/editor-common/quick-insert/messages");
|
|
15
18
|
var _snippetPreviewImageUrls = require("@atlaskit/editor-common/quick-insert/snippet-preview-image-urls");
|
|
16
19
|
var _useQuickInsertContext = require("@atlaskit/editor-common/quick-insert/use-quick-insert-context");
|
|
17
20
|
var _apps = _interopRequireDefault(require("@atlaskit/icon/core/apps"));
|
|
18
|
-
var
|
|
21
|
+
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); }
|
|
19
22
|
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; }
|
|
20
23
|
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) { (0, _defineProperty2.default)(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; }
|
|
21
24
|
var LegacyQuickInsertProviderMenuItem = function LegacyQuickInsertProviderMenuItem(_ref) {
|
|
22
25
|
var item = _ref.item,
|
|
23
26
|
onInsert = _ref.onInsert;
|
|
27
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
28
|
+
formatMessage = _useIntl.formatMessage;
|
|
24
29
|
var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
|
|
25
30
|
editorView = _useQuickInsertContex.editorView,
|
|
26
31
|
isOffline = _useQuickInsertContex.isOffline;
|
|
@@ -38,14 +43,24 @@ var LegacyQuickInsertProviderMenuItem = function LegacyQuickInsertProviderMenuIt
|
|
|
38
43
|
var itemKey = item.key === undefined ? undefined : String(item.key);
|
|
39
44
|
var snippetKeyPrefix = 'snippet-extension:snippet-';
|
|
40
45
|
var previewKey = itemKey !== null && itemKey !== void 0 && itemKey.startsWith(snippetKeyPrefix) ? itemKey.slice(snippetKeyPrefix.length) : undefined;
|
|
41
|
-
var
|
|
46
|
+
var fallbackPreviewImage = previewKey ? (0, _snippetPreviewImageUrls.getSnippetPreviewImageUrls)(previewKey) : undefined;
|
|
47
|
+
var preview = (0, _react.useMemo)(function () {
|
|
48
|
+
var _item$preview;
|
|
49
|
+
return (_item$preview = item.preview) !== null && _item$preview !== void 0 ? _item$preview : fallbackPreviewImage ? {
|
|
50
|
+
image: fallbackPreviewImage,
|
|
51
|
+
attribution: {
|
|
52
|
+
name: formatMessage(_messages.messages.previewAttributionAtlassian)
|
|
53
|
+
}
|
|
54
|
+
} : undefined;
|
|
55
|
+
}, [formatMessage, fallbackPreviewImage, item.preview]);
|
|
42
56
|
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
57
|
+
description: item.description,
|
|
43
58
|
iconBefore: Icon ? /*#__PURE__*/_react.default.createElement(Icon, null) : /*#__PURE__*/_react.default.createElement(_apps.default, {
|
|
44
59
|
label: ""
|
|
45
60
|
}),
|
|
46
61
|
isDisabled: isDisabled,
|
|
47
62
|
onSelect: onSelect,
|
|
48
|
-
|
|
63
|
+
preview: preview,
|
|
49
64
|
shortcut: item.keyshortcut,
|
|
50
65
|
title: item.title
|
|
51
66
|
});
|
|
@@ -25,6 +25,7 @@ export const QuickInsertMenuFooterItem = ({
|
|
|
25
25
|
}),
|
|
26
26
|
isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
|
|
27
27
|
onSelect: onSelect,
|
|
28
|
+
shouldShowPreview: false,
|
|
28
29
|
shouldWrapIcon: false,
|
|
29
30
|
title: formatMessage(toolbarInsertBlockMessages.viewMore)
|
|
30
31
|
});
|
|
@@ -4,6 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
import IconButton from '@atlaskit/button/icon/button';
|
|
7
|
+
import { messages } from '@atlaskit/editor-common/quick-insert';
|
|
7
8
|
import { MENU, RECOMMENDED_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
8
9
|
import { getMenuFooterSectionKey } from '@atlaskit/editor-common/type-ahead-get-menu-footer-section-key';
|
|
9
10
|
import { getSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-get-section-overflow-item-key';
|
|
@@ -95,13 +96,6 @@ export const RegistryElementBrowser = ({
|
|
|
95
96
|
setSelectedKey(undefined);
|
|
96
97
|
onClearSelection();
|
|
97
98
|
}, [onClearSelection]);
|
|
98
|
-
const onClearSearch = useCallback(() => {
|
|
99
|
-
var _searchInputRef$curre;
|
|
100
|
-
setQuery('');
|
|
101
|
-
setSelectedKey(undefined);
|
|
102
|
-
onClearSelection();
|
|
103
|
-
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
|
|
104
|
-
}, [onClearSelection]);
|
|
105
99
|
const onRegistrySelect = useCallback((key, handler) => {
|
|
106
100
|
setSelectedKey(key);
|
|
107
101
|
onSelect(handler);
|
|
@@ -179,11 +173,8 @@ export const RegistryElementBrowser = ({
|
|
|
179
173
|
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
180
174
|
appearance: "subtle",
|
|
181
175
|
icon: CrossIcon,
|
|
182
|
-
label: formatMessage(
|
|
183
|
-
|
|
184
|
-
id: 'editor.quick-insert.clear-search'
|
|
185
|
-
}),
|
|
186
|
-
onClick: onClearSearch,
|
|
176
|
+
label: formatMessage(messages.close),
|
|
177
|
+
onClick: onClose,
|
|
187
178
|
spacing: "compact"
|
|
188
179
|
})))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("div", {
|
|
189
180
|
className: ax(["_zulp1fka _1e0c11p5 _yv0e1xuv _lk4ji47z"])
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import Button from '@atlaskit/button/default/button';
|
|
4
4
|
import LinkButton from '@atlaskit/button/link';
|
|
5
|
+
import { messages } from '@atlaskit/editor-common/quick-insert';
|
|
5
6
|
import { Inline, Text } from '@atlaskit/primitives/compiled';
|
|
6
7
|
export const RegistryElementBrowserFooter = ({
|
|
7
8
|
helpUrl,
|
|
@@ -46,8 +47,5 @@ export const RegistryElementBrowserFooter = ({
|
|
|
46
47
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
47
48
|
appearance: "subtle",
|
|
48
49
|
onClick: onClose
|
|
49
|
-
}, formatMessage(
|
|
50
|
-
defaultMessage: 'Close',
|
|
51
|
-
id: 'editor.quick-insert.close'
|
|
52
|
-
}))));
|
|
50
|
+
}, formatMessage(messages.close))));
|
|
53
51
|
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
3
4
|
import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
|
|
4
5
|
import { getQuickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
|
|
5
6
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
7
|
+
import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
|
|
6
8
|
import { getSnippetPreviewImageUrls } from '@atlaskit/editor-common/quick-insert/snippet-preview-image-urls';
|
|
7
9
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
8
10
|
import AppsIcon from '@atlaskit/icon/core/apps';
|
|
9
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
10
11
|
const LegacyQuickInsertProviderMenuItem = ({
|
|
11
12
|
item,
|
|
12
13
|
onInsert
|
|
13
14
|
}) => {
|
|
15
|
+
const {
|
|
16
|
+
formatMessage
|
|
17
|
+
} = useIntl();
|
|
14
18
|
const {
|
|
15
19
|
editorView,
|
|
16
20
|
isOffline
|
|
@@ -30,14 +34,24 @@ const LegacyQuickInsertProviderMenuItem = ({
|
|
|
30
34
|
const itemKey = item.key === undefined ? undefined : String(item.key);
|
|
31
35
|
const snippetKeyPrefix = 'snippet-extension:snippet-';
|
|
32
36
|
const previewKey = itemKey !== null && itemKey !== void 0 && itemKey.startsWith(snippetKeyPrefix) ? itemKey.slice(snippetKeyPrefix.length) : undefined;
|
|
33
|
-
const
|
|
37
|
+
const fallbackPreviewImage = previewKey ? getSnippetPreviewImageUrls(previewKey) : undefined;
|
|
38
|
+
const preview = useMemo(() => {
|
|
39
|
+
var _item$preview;
|
|
40
|
+
return (_item$preview = item.preview) !== null && _item$preview !== void 0 ? _item$preview : fallbackPreviewImage ? {
|
|
41
|
+
image: fallbackPreviewImage,
|
|
42
|
+
attribution: {
|
|
43
|
+
name: formatMessage(quickInsertMessages.previewAttributionAtlassian)
|
|
44
|
+
}
|
|
45
|
+
} : undefined;
|
|
46
|
+
}, [formatMessage, fallbackPreviewImage, item.preview]);
|
|
34
47
|
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
48
|
+
description: item.description,
|
|
35
49
|
iconBefore: Icon ? /*#__PURE__*/React.createElement(Icon, null) : /*#__PURE__*/React.createElement(AppsIcon, {
|
|
36
50
|
label: ""
|
|
37
51
|
}),
|
|
38
52
|
isDisabled: isDisabled,
|
|
39
53
|
onSelect: onSelect,
|
|
40
|
-
|
|
54
|
+
preview: preview,
|
|
41
55
|
shortcut: item.keyshortcut,
|
|
42
56
|
title: item.title
|
|
43
57
|
});
|
|
@@ -22,6 +22,7 @@ export var QuickInsertMenuFooterItem = function QuickInsertMenuFooterItem(_ref)
|
|
|
22
22
|
}),
|
|
23
23
|
isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
|
|
24
24
|
onSelect: onSelect,
|
|
25
|
+
shouldShowPreview: false,
|
|
25
26
|
shouldWrapIcon: false,
|
|
26
27
|
title: formatMessage(toolbarInsertBlockMessages.viewMore)
|
|
27
28
|
});
|
|
@@ -24,6 +24,7 @@ export var QuickInsertSectionOverflowMenuItem = function QuickInsertSectionOverf
|
|
|
24
24
|
}),
|
|
25
25
|
isDisabled: !(api !== null && api !== void 0 && api.quickInsert),
|
|
26
26
|
onSelect: onSelect,
|
|
27
|
+
shouldShowPreview: false,
|
|
27
28
|
title: formatMessage(toolbarInsertBlockMessages.viewMore)
|
|
28
29
|
});
|
|
29
30
|
};
|
|
@@ -5,6 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { useIntl } from 'react-intl';
|
|
7
7
|
import IconButton from '@atlaskit/button/icon/button';
|
|
8
|
+
import { messages } from '@atlaskit/editor-common/quick-insert';
|
|
8
9
|
import { MENU, RECOMMENDED_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
9
10
|
import { getMenuFooterSectionKey } from '@atlaskit/editor-common/type-ahead-get-menu-footer-section-key';
|
|
10
11
|
import { getSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-get-section-overflow-item-key';
|
|
@@ -114,13 +115,6 @@ export var RegistryElementBrowser = function RegistryElementBrowser(_ref) {
|
|
|
114
115
|
setSelectedKey(undefined);
|
|
115
116
|
onClearSelection();
|
|
116
117
|
}, [onClearSelection]);
|
|
117
|
-
var onClearSearch = useCallback(function () {
|
|
118
|
-
var _searchInputRef$curre;
|
|
119
|
-
setQuery('');
|
|
120
|
-
setSelectedKey(undefined);
|
|
121
|
-
onClearSelection();
|
|
122
|
-
(_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 || _searchInputRef$curre.focus();
|
|
123
|
-
}, [onClearSelection]);
|
|
124
118
|
var onRegistrySelect = useCallback(function (key, handler) {
|
|
125
119
|
setSelectedKey(key);
|
|
126
120
|
onSelect(handler);
|
|
@@ -200,11 +194,8 @@ export var RegistryElementBrowser = function RegistryElementBrowser(_ref) {
|
|
|
200
194
|
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
201
195
|
appearance: "subtle",
|
|
202
196
|
icon: CrossIcon,
|
|
203
|
-
label: formatMessage(
|
|
204
|
-
|
|
205
|
-
id: 'editor.quick-insert.clear-search'
|
|
206
|
-
}),
|
|
207
|
-
onClick: onClearSearch,
|
|
197
|
+
label: formatMessage(messages.close),
|
|
198
|
+
onClick: onClose,
|
|
208
199
|
spacing: "compact"
|
|
209
200
|
})))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement("div", {
|
|
210
201
|
className: ax(["_zulp1fka _1e0c11p5 _yv0e1xuv _lk4ji47z"])
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import Button from '@atlaskit/button/default/button';
|
|
4
4
|
import LinkButton from '@atlaskit/button/link';
|
|
5
|
+
import { messages } from '@atlaskit/editor-common/quick-insert';
|
|
5
6
|
import { Inline, Text } from '@atlaskit/primitives/compiled';
|
|
6
7
|
export var RegistryElementBrowserFooter = function RegistryElementBrowserFooter(_ref) {
|
|
7
8
|
var helpUrl = _ref.helpUrl,
|
|
@@ -44,8 +45,5 @@ export var RegistryElementBrowserFooter = function RegistryElementBrowserFooter(
|
|
|
44
45
|
})), /*#__PURE__*/React.createElement(Button, {
|
|
45
46
|
appearance: "subtle",
|
|
46
47
|
onClick: onClose
|
|
47
|
-
}, formatMessage(
|
|
48
|
-
defaultMessage: 'Close',
|
|
49
|
-
id: 'editor.quick-insert.close'
|
|
50
|
-
}))));
|
|
48
|
+
}, formatMessage(messages.close))));
|
|
51
49
|
};
|
|
@@ -2,18 +2,21 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
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
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 React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { useIntl } from 'react-intl';
|
|
6
7
|
import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
|
|
7
8
|
import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
|
|
8
9
|
import { getQuickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
|
|
9
10
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
11
|
+
import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
|
|
10
12
|
import { getSnippetPreviewImageUrls } from '@atlaskit/editor-common/quick-insert/snippet-preview-image-urls';
|
|
11
13
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
12
14
|
import AppsIcon from '@atlaskit/icon/core/apps';
|
|
13
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
14
15
|
var LegacyQuickInsertProviderMenuItem = function LegacyQuickInsertProviderMenuItem(_ref) {
|
|
15
16
|
var item = _ref.item,
|
|
16
17
|
onInsert = _ref.onInsert;
|
|
18
|
+
var _useIntl = useIntl(),
|
|
19
|
+
formatMessage = _useIntl.formatMessage;
|
|
17
20
|
var _useQuickInsertContex = useQuickInsertContext(),
|
|
18
21
|
editorView = _useQuickInsertContex.editorView,
|
|
19
22
|
isOffline = _useQuickInsertContex.isOffline;
|
|
@@ -31,14 +34,24 @@ var LegacyQuickInsertProviderMenuItem = function LegacyQuickInsertProviderMenuIt
|
|
|
31
34
|
var itemKey = item.key === undefined ? undefined : String(item.key);
|
|
32
35
|
var snippetKeyPrefix = 'snippet-extension:snippet-';
|
|
33
36
|
var previewKey = itemKey !== null && itemKey !== void 0 && itemKey.startsWith(snippetKeyPrefix) ? itemKey.slice(snippetKeyPrefix.length) : undefined;
|
|
34
|
-
var
|
|
37
|
+
var fallbackPreviewImage = previewKey ? getSnippetPreviewImageUrls(previewKey) : undefined;
|
|
38
|
+
var preview = useMemo(function () {
|
|
39
|
+
var _item$preview;
|
|
40
|
+
return (_item$preview = item.preview) !== null && _item$preview !== void 0 ? _item$preview : fallbackPreviewImage ? {
|
|
41
|
+
image: fallbackPreviewImage,
|
|
42
|
+
attribution: {
|
|
43
|
+
name: formatMessage(quickInsertMessages.previewAttributionAtlassian)
|
|
44
|
+
}
|
|
45
|
+
} : undefined;
|
|
46
|
+
}, [formatMessage, fallbackPreviewImage, item.preview]);
|
|
35
47
|
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
48
|
+
description: item.description,
|
|
36
49
|
iconBefore: Icon ? /*#__PURE__*/React.createElement(Icon, null) : /*#__PURE__*/React.createElement(AppsIcon, {
|
|
37
50
|
label: ""
|
|
38
51
|
}),
|
|
39
52
|
isDisabled: isDisabled,
|
|
40
53
|
onSelect: onSelect,
|
|
41
|
-
|
|
54
|
+
preview: preview,
|
|
42
55
|
shortcut: item.keyshortcut,
|
|
43
56
|
title: item.title
|
|
44
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-quick-insert",
|
|
3
|
-
"version": "21.1.
|
|
3
|
+
"version": "21.1.3",
|
|
4
4
|
"description": "Quick insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/editor-plugin-connectivity": "^21.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-editor-viewmode": "^23.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-metrics": "^22.0.0",
|
|
35
|
-
"@atlaskit/editor-plugin-type-ahead": "^22.
|
|
35
|
+
"@atlaskit/editor-plugin-type-ahead": "^22.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-ui-control-registry": "^15.0.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
38
38
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
45
45
|
"@atlaskit/primitives": "^22.5.0",
|
|
46
46
|
"@atlaskit/textfield": "^10.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^209.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^20.0.0",
|
|
49
49
|
"@atlaskit/tooltip": "^24.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@emotion/react": "^11.7.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^125.
|
|
55
|
+
"@atlaskit/editor-common": "^125.4.0",
|
|
56
56
|
"react": "^18.2.0 || ^19.2.0",
|
|
57
57
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
58
58
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|