@atlaskit/editor-core 244.0.0 → 245.0.1
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/ui/quick-insert/QuickInsertSkillMenuItem.js +62 -26
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/ui/quick-insert/QuickInsertSkillMenuItem.js +62 -27
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/ui/quick-insert/QuickInsertSkillMenuItem.js +64 -27
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/ui/quick-insert/QuickInsertSkillMenuItem.d.ts +10 -1
- package/package.json +48 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 245.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9a4b8cfc2a3c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9a4b8cfc2a3c5) -
|
|
8
|
+
Expose the optional product credit check through the AI plugin API. Check skill eligibility before
|
|
9
|
+
query removal in the registered menus using `quickInsert-skill` and `elementBrowser-skill`, with
|
|
10
|
+
product-owned recovery content. Respect the existing `confluence_ubp_quick_insert_menu` and
|
|
11
|
+
`jira_ai_ubp_enforcement_messaging` rollouts under `platform_editor_slash_command`.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 245.0.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 244.0.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -6,14 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.QuickInsertSkillMenuItem = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _popup = require("@atlaskit/editor-common/credit-guard/popup");
|
|
10
|
+
var _useAiCreditGuard = require("@atlaskit/editor-common/credit-guard/use-ai-credit-guard");
|
|
9
11
|
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
10
12
|
var _skillTag = require("@atlaskit/editor-common/quick-insert/skill-tag");
|
|
11
13
|
var _useQuickInsertContext = require("@atlaskit/editor-common/quick-insert/use-quick-insert-context");
|
|
14
|
+
var _surfaceContext = require("@atlaskit/editor-common/registered-menu/surface-context");
|
|
12
15
|
var _executeExtensionQuickInsertItem = require("./executeExtensionQuickInsertItem");
|
|
13
16
|
var _ExtensionQuickInsertIcon = require("./ExtensionQuickInsertIcon");
|
|
14
17
|
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); }
|
|
18
|
+
// Core reads the credit action without depending on the internal AI plugin package.
|
|
19
|
+
|
|
15
20
|
var QuickInsertSkillMenuItem = exports.QuickInsertSkillMenuItem = function QuickInsertSkillMenuItem(_ref) {
|
|
16
|
-
var
|
|
21
|
+
var _surfaceContext$get;
|
|
17
22
|
var apiRef = _ref.apiRef,
|
|
18
23
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
19
24
|
editorActions = _ref.editorActions,
|
|
@@ -21,7 +26,26 @@ var QuickInsertSkillMenuItem = exports.QuickInsertSkillMenuItem = function Quick
|
|
|
21
26
|
onInsert = _ref.onInsert;
|
|
22
27
|
var _useQuickInsertContex = (0, _useQuickInsertContext.useQuickInsertContext)(),
|
|
23
28
|
editorView = _useQuickInsertContex.editorView,
|
|
24
|
-
isOffline = _useQuickInsertContex.isOffline
|
|
29
|
+
isOffline = _useQuickInsertContex.isOffline,
|
|
30
|
+
quickInsertItem = _useQuickInsertContex.item,
|
|
31
|
+
surfaceContext = _useQuickInsertContex.surfaceContext;
|
|
32
|
+
var surface = surfaceContext === null || surfaceContext === void 0 || (_surfaceContext$get = surfaceContext.get(_surfaceContext.REGISTERED_MENU_SURFACE_CONTEXT)) === null || _surfaceContext$get === void 0 ? void 0 : _surfaceContext$get.surface;
|
|
33
|
+
var getAICreditStatus = (0, _react.useCallback)(function (context) {
|
|
34
|
+
var _apiRef$current, _apiRef$current$actio, _apiRef$current$actio2;
|
|
35
|
+
return (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.aiExperience) === null || _apiRef$current === void 0 || (_apiRef$current$actio = (_apiRef$current$actio2 = _apiRef$current.actions).getAICreditStatus) === null || _apiRef$current$actio === void 0 ? void 0 : _apiRef$current$actio.call(_apiRef$current$actio2, context);
|
|
36
|
+
}, [apiRef]);
|
|
37
|
+
var guard = (0, _useAiCreditGuard.useAICreditGuard)(getAICreditStatus);
|
|
38
|
+
var creditFeatureName = surface === 'element-browser' ? 'elementBrowser-skill' : 'quickInsert-skill';
|
|
39
|
+
var onBeforeSelect = (0, _react.useCallback)(function () {
|
|
40
|
+
return guard.check({
|
|
41
|
+
featureName: creditFeatureName
|
|
42
|
+
});
|
|
43
|
+
}, [creditFeatureName, guard.check]);
|
|
44
|
+
(0, _react.useEffect)(function () {
|
|
45
|
+
if (!(quickInsertItem !== null && quickInsertItem !== void 0 && quickInsertItem.isSelected)) {
|
|
46
|
+
guard.close();
|
|
47
|
+
}
|
|
48
|
+
}, [quickInsertItem === null || quickInsertItem === void 0 ? void 0 : quickInsertItem.isSelected, guard.close]);
|
|
25
49
|
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
26
50
|
var insert = _ref2.insert,
|
|
27
51
|
source = _ref2.source;
|
|
@@ -39,30 +63,42 @@ var QuickInsertSkillMenuItem = exports.QuickInsertSkillMenuItem = function Quick
|
|
|
39
63
|
}
|
|
40
64
|
return result;
|
|
41
65
|
}, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
previewIcon: /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertIcon.ExtensionQuickInsertIcon, {
|
|
55
|
-
getIcon: item.icon,
|
|
56
|
-
itemKey: item.key,
|
|
57
|
-
label: "",
|
|
58
|
-
size: "small"
|
|
59
|
-
}),
|
|
60
|
-
shouldClampPreview: false,
|
|
61
|
-
title: item.title,
|
|
62
|
-
titleContent: item.moduleKey ? /*#__PURE__*/_react.default.createElement(_skillTag.SkillTag, {
|
|
63
|
-
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
66
|
+
var renderItem = (0, _react.useCallback)(function (triggerProps) {
|
|
67
|
+
var _item$parameters;
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
69
|
+
"aria-controls": triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps['aria-controls'],
|
|
70
|
+
ariaLabel: item.title,
|
|
71
|
+
description: item.description,
|
|
72
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertIcon.ExtensionQuickInsertIcon, {
|
|
73
|
+
getIcon: item.icon,
|
|
74
|
+
itemKey: item.key,
|
|
75
|
+
label: ""
|
|
76
|
+
}),
|
|
77
|
+
itemRef: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.ref,
|
|
64
78
|
isDisabled: isOffline,
|
|
65
|
-
|
|
66
|
-
|
|
79
|
+
lozenge: item.lozenge,
|
|
80
|
+
onBeforeSelect: onBeforeSelect,
|
|
81
|
+
onSelect: onSelect,
|
|
82
|
+
preview: item.preview,
|
|
83
|
+
previewIcon: /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertIcon.ExtensionQuickInsertIcon, {
|
|
84
|
+
getIcon: item.icon,
|
|
85
|
+
itemKey: item.key,
|
|
86
|
+
label: "",
|
|
87
|
+
size: "small"
|
|
88
|
+
}),
|
|
89
|
+
shouldShowPreview: !guard.feedback,
|
|
90
|
+
shouldClampPreview: false,
|
|
91
|
+
title: item.title,
|
|
92
|
+
titleContent: item.moduleKey ? /*#__PURE__*/_react.default.createElement(_skillTag.SkillTag, {
|
|
93
|
+
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
94
|
+
isDisabled: isOffline,
|
|
95
|
+
slug: item.moduleKey
|
|
96
|
+
}) : undefined
|
|
97
|
+
});
|
|
98
|
+
}, [guard.feedback, isOffline, item, onBeforeSelect, onSelect]);
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_popup.CreditCheckedPopup, {
|
|
100
|
+
guard: guard,
|
|
101
|
+
isNestedMenu: surface !== 'element-browser',
|
|
102
|
+
renderTrigger: renderItem
|
|
67
103
|
});
|
|
68
104
|
};
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
8
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
|
-
var version = exports.version = "
|
|
9
|
+
var version = exports.version = "245.0.0";
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
import { CreditCheckedPopup } from '@atlaskit/editor-common/credit-guard/popup';
|
|
3
|
+
import { useAICreditGuard } from '@atlaskit/editor-common/credit-guard/use-ai-credit-guard';
|
|
2
4
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
3
5
|
import { SkillTag } from '@atlaskit/editor-common/quick-insert/skill-tag';
|
|
4
6
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
7
|
+
import { REGISTERED_MENU_SURFACE_CONTEXT } from '@atlaskit/editor-common/registered-menu/surface-context';
|
|
5
8
|
import { executeExtensionQuickInsertItem } from './executeExtensionQuickInsertItem';
|
|
6
9
|
import { ExtensionQuickInsertIcon } from './ExtensionQuickInsertIcon';
|
|
10
|
+
|
|
11
|
+
// Core reads the credit action without depending on the internal AI plugin package.
|
|
12
|
+
|
|
7
13
|
export const QuickInsertSkillMenuItem = ({
|
|
8
14
|
apiRef,
|
|
9
15
|
createAnalyticsEvent,
|
|
@@ -11,11 +17,28 @@ export const QuickInsertSkillMenuItem = ({
|
|
|
11
17
|
item,
|
|
12
18
|
onInsert
|
|
13
19
|
}) => {
|
|
14
|
-
var
|
|
20
|
+
var _surfaceContext$get;
|
|
15
21
|
const {
|
|
16
22
|
editorView,
|
|
17
|
-
isOffline
|
|
23
|
+
isOffline,
|
|
24
|
+
item: quickInsertItem,
|
|
25
|
+
surfaceContext
|
|
18
26
|
} = useQuickInsertContext();
|
|
27
|
+
const surface = surfaceContext === null || surfaceContext === void 0 ? void 0 : (_surfaceContext$get = surfaceContext.get(REGISTERED_MENU_SURFACE_CONTEXT)) === null || _surfaceContext$get === void 0 ? void 0 : _surfaceContext$get.surface;
|
|
28
|
+
const getAICreditStatus = useCallback(context => {
|
|
29
|
+
var _apiRef$current, _apiRef$current$aiExp, _apiRef$current$aiExp2, _apiRef$current$aiExp3;
|
|
30
|
+
return (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 ? void 0 : (_apiRef$current$aiExp = _apiRef$current.aiExperience) === null || _apiRef$current$aiExp === void 0 ? void 0 : (_apiRef$current$aiExp2 = (_apiRef$current$aiExp3 = _apiRef$current$aiExp.actions).getAICreditStatus) === null || _apiRef$current$aiExp2 === void 0 ? void 0 : _apiRef$current$aiExp2.call(_apiRef$current$aiExp3, context);
|
|
31
|
+
}, [apiRef]);
|
|
32
|
+
const guard = useAICreditGuard(getAICreditStatus);
|
|
33
|
+
const creditFeatureName = surface === 'element-browser' ? 'elementBrowser-skill' : 'quickInsert-skill';
|
|
34
|
+
const onBeforeSelect = useCallback(() => guard.check({
|
|
35
|
+
featureName: creditFeatureName
|
|
36
|
+
}), [creditFeatureName, guard.check]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!(quickInsertItem !== null && quickInsertItem !== void 0 && quickInsertItem.isSelected)) {
|
|
39
|
+
guard.close();
|
|
40
|
+
}
|
|
41
|
+
}, [quickInsertItem === null || quickInsertItem === void 0 ? void 0 : quickInsertItem.isSelected, guard.close]);
|
|
19
42
|
const onSelect = useCallback(({
|
|
20
43
|
insert,
|
|
21
44
|
source
|
|
@@ -34,30 +57,42 @@ export const QuickInsertSkillMenuItem = ({
|
|
|
34
57
|
}
|
|
35
58
|
return result;
|
|
36
59
|
}, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
previewIcon: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
50
|
-
getIcon: item.icon,
|
|
51
|
-
itemKey: item.key,
|
|
52
|
-
label: "",
|
|
53
|
-
size: "small"
|
|
54
|
-
}),
|
|
55
|
-
shouldClampPreview: false,
|
|
56
|
-
title: item.title,
|
|
57
|
-
titleContent: item.moduleKey ? /*#__PURE__*/React.createElement(SkillTag, {
|
|
58
|
-
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
60
|
+
const renderItem = useCallback(triggerProps => {
|
|
61
|
+
var _item$parameters;
|
|
62
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
63
|
+
"aria-controls": triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps['aria-controls'],
|
|
64
|
+
ariaLabel: item.title,
|
|
65
|
+
description: item.description,
|
|
66
|
+
iconBefore: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
67
|
+
getIcon: item.icon,
|
|
68
|
+
itemKey: item.key,
|
|
69
|
+
label: ""
|
|
70
|
+
}),
|
|
71
|
+
itemRef: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.ref,
|
|
59
72
|
isDisabled: isOffline,
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
lozenge: item.lozenge,
|
|
74
|
+
onBeforeSelect: onBeforeSelect,
|
|
75
|
+
onSelect: onSelect,
|
|
76
|
+
preview: item.preview,
|
|
77
|
+
previewIcon: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
78
|
+
getIcon: item.icon,
|
|
79
|
+
itemKey: item.key,
|
|
80
|
+
label: "",
|
|
81
|
+
size: "small"
|
|
82
|
+
}),
|
|
83
|
+
shouldShowPreview: !guard.feedback,
|
|
84
|
+
shouldClampPreview: false,
|
|
85
|
+
title: item.title,
|
|
86
|
+
titleContent: item.moduleKey ? /*#__PURE__*/React.createElement(SkillTag, {
|
|
87
|
+
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
88
|
+
isDisabled: isOffline,
|
|
89
|
+
slug: item.moduleKey
|
|
90
|
+
}) : undefined
|
|
91
|
+
});
|
|
92
|
+
}, [guard.feedback, isOffline, item, onBeforeSelect, onSelect]);
|
|
93
|
+
return /*#__PURE__*/React.createElement(CreditCheckedPopup, {
|
|
94
|
+
guard: guard,
|
|
95
|
+
isNestedMenu: surface !== 'element-browser',
|
|
96
|
+
renderTrigger: renderItem
|
|
62
97
|
});
|
|
63
98
|
};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
import { CreditCheckedPopup } from '@atlaskit/editor-common/credit-guard/popup';
|
|
3
|
+
import { useAICreditGuard } from '@atlaskit/editor-common/credit-guard/use-ai-credit-guard';
|
|
2
4
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
3
5
|
import { SkillTag } from '@atlaskit/editor-common/quick-insert/skill-tag';
|
|
4
6
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
7
|
+
import { REGISTERED_MENU_SURFACE_CONTEXT } from '@atlaskit/editor-common/registered-menu/surface-context';
|
|
5
8
|
import { executeExtensionQuickInsertItem } from './executeExtensionQuickInsertItem';
|
|
6
9
|
import { ExtensionQuickInsertIcon } from './ExtensionQuickInsertIcon';
|
|
10
|
+
|
|
11
|
+
// Core reads the credit action without depending on the internal AI plugin package.
|
|
12
|
+
|
|
7
13
|
export var QuickInsertSkillMenuItem = function QuickInsertSkillMenuItem(_ref) {
|
|
8
|
-
var
|
|
14
|
+
var _surfaceContext$get;
|
|
9
15
|
var apiRef = _ref.apiRef,
|
|
10
16
|
createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
11
17
|
editorActions = _ref.editorActions,
|
|
@@ -13,7 +19,26 @@ export var QuickInsertSkillMenuItem = function QuickInsertSkillMenuItem(_ref) {
|
|
|
13
19
|
onInsert = _ref.onInsert;
|
|
14
20
|
var _useQuickInsertContex = useQuickInsertContext(),
|
|
15
21
|
editorView = _useQuickInsertContex.editorView,
|
|
16
|
-
isOffline = _useQuickInsertContex.isOffline
|
|
22
|
+
isOffline = _useQuickInsertContex.isOffline,
|
|
23
|
+
quickInsertItem = _useQuickInsertContex.item,
|
|
24
|
+
surfaceContext = _useQuickInsertContex.surfaceContext;
|
|
25
|
+
var surface = surfaceContext === null || surfaceContext === void 0 || (_surfaceContext$get = surfaceContext.get(REGISTERED_MENU_SURFACE_CONTEXT)) === null || _surfaceContext$get === void 0 ? void 0 : _surfaceContext$get.surface;
|
|
26
|
+
var getAICreditStatus = useCallback(function (context) {
|
|
27
|
+
var _apiRef$current, _apiRef$current$actio, _apiRef$current$actio2;
|
|
28
|
+
return (_apiRef$current = apiRef.current) === null || _apiRef$current === void 0 || (_apiRef$current = _apiRef$current.aiExperience) === null || _apiRef$current === void 0 || (_apiRef$current$actio = (_apiRef$current$actio2 = _apiRef$current.actions).getAICreditStatus) === null || _apiRef$current$actio === void 0 ? void 0 : _apiRef$current$actio.call(_apiRef$current$actio2, context);
|
|
29
|
+
}, [apiRef]);
|
|
30
|
+
var guard = useAICreditGuard(getAICreditStatus);
|
|
31
|
+
var creditFeatureName = surface === 'element-browser' ? 'elementBrowser-skill' : 'quickInsert-skill';
|
|
32
|
+
var onBeforeSelect = useCallback(function () {
|
|
33
|
+
return guard.check({
|
|
34
|
+
featureName: creditFeatureName
|
|
35
|
+
});
|
|
36
|
+
}, [creditFeatureName, guard.check]);
|
|
37
|
+
useEffect(function () {
|
|
38
|
+
if (!(quickInsertItem !== null && quickInsertItem !== void 0 && quickInsertItem.isSelected)) {
|
|
39
|
+
guard.close();
|
|
40
|
+
}
|
|
41
|
+
}, [quickInsertItem === null || quickInsertItem === void 0 ? void 0 : quickInsertItem.isSelected, guard.close]);
|
|
17
42
|
var onSelect = useCallback(function (_ref2) {
|
|
18
43
|
var insert = _ref2.insert,
|
|
19
44
|
source = _ref2.source;
|
|
@@ -31,30 +56,42 @@ export var QuickInsertSkillMenuItem = function QuickInsertSkillMenuItem(_ref) {
|
|
|
31
56
|
}
|
|
32
57
|
return result;
|
|
33
58
|
}, [apiRef, createAnalyticsEvent, editorActions, editorView.state, item, onInsert]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
previewIcon: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
47
|
-
getIcon: item.icon,
|
|
48
|
-
itemKey: item.key,
|
|
49
|
-
label: "",
|
|
50
|
-
size: "small"
|
|
51
|
-
}),
|
|
52
|
-
shouldClampPreview: false,
|
|
53
|
-
title: item.title,
|
|
54
|
-
titleContent: item.moduleKey ? /*#__PURE__*/React.createElement(SkillTag, {
|
|
55
|
-
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
59
|
+
var renderItem = useCallback(function (triggerProps) {
|
|
60
|
+
var _item$parameters;
|
|
61
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
62
|
+
"aria-controls": triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps['aria-controls'],
|
|
63
|
+
ariaLabel: item.title,
|
|
64
|
+
description: item.description,
|
|
65
|
+
iconBefore: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
66
|
+
getIcon: item.icon,
|
|
67
|
+
itemKey: item.key,
|
|
68
|
+
label: ""
|
|
69
|
+
}),
|
|
70
|
+
itemRef: triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.ref,
|
|
56
71
|
isDisabled: isOffline,
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
lozenge: item.lozenge,
|
|
73
|
+
onBeforeSelect: onBeforeSelect,
|
|
74
|
+
onSelect: onSelect,
|
|
75
|
+
preview: item.preview,
|
|
76
|
+
previewIcon: /*#__PURE__*/React.createElement(ExtensionQuickInsertIcon, {
|
|
77
|
+
getIcon: item.icon,
|
|
78
|
+
itemKey: item.key,
|
|
79
|
+
label: "",
|
|
80
|
+
size: "small"
|
|
81
|
+
}),
|
|
82
|
+
shouldShowPreview: !guard.feedback,
|
|
83
|
+
shouldClampPreview: false,
|
|
84
|
+
title: item.title,
|
|
85
|
+
titleContent: item.moduleKey ? /*#__PURE__*/React.createElement(SkillTag, {
|
|
86
|
+
color: (_item$parameters = item.parameters) === null || _item$parameters === void 0 ? void 0 : _item$parameters.color,
|
|
87
|
+
isDisabled: isOffline,
|
|
88
|
+
slug: item.moduleKey
|
|
89
|
+
}) : undefined
|
|
90
|
+
});
|
|
91
|
+
}, [guard.feedback, isOffline, item, onBeforeSelect, onSelect]);
|
|
92
|
+
return /*#__PURE__*/React.createElement(CreditCheckedPopup, {
|
|
93
|
+
guard: guard,
|
|
94
|
+
isNestedMenu: surface !== 'element-browser',
|
|
95
|
+
renderTrigger: renderItem
|
|
59
96
|
});
|
|
60
97
|
};
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
|
+
import type { GetAICreditStatus } from '@atlaskit/editor-common/credit-guard/types';
|
|
3
4
|
import type { MenuItem } from '@atlaskit/editor-common/extensions/types/utils';
|
|
4
5
|
import type { PublicPluginAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
5
6
|
import type { ExtensionPlugin } from '@atlaskit/editor-plugins/extension';
|
|
6
7
|
import type EditorActions from '../../actions';
|
|
8
|
+
type SkillMenuPluginAPI = PublicPluginAPI<[ExtensionPlugin]> & {
|
|
9
|
+
aiExperience?: {
|
|
10
|
+
actions: {
|
|
11
|
+
getAICreditStatus?: GetAICreditStatus;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
7
15
|
export declare const QuickInsertSkillMenuItem: ({ apiRef, createAnalyticsEvent, editorActions, item, onInsert, }: {
|
|
8
|
-
apiRef: React.MutableRefObject<
|
|
16
|
+
apiRef: React.MutableRefObject<SkillMenuPluginAPI | undefined>;
|
|
9
17
|
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
10
18
|
editorActions: EditorActions;
|
|
11
19
|
item: MenuItem;
|
|
12
20
|
onInsert?: () => void;
|
|
13
21
|
}) => React.JSX.Element;
|
|
22
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "245.0.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -50,15 +50,15 @@
|
|
|
50
50
|
"@atlaskit/button": "^25.8.0",
|
|
51
51
|
"@atlaskit/css": "^1.1.0",
|
|
52
52
|
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
53
|
-
"@atlaskit/editor-plugin-block-menu": "^
|
|
54
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
55
|
-
"@atlaskit/editor-plugin-quick-insert": "^
|
|
56
|
-
"@atlaskit/editor-plugin-selection-extension": "^
|
|
57
|
-
"@atlaskit/editor-plugin-user-preferences": "^
|
|
53
|
+
"@atlaskit/editor-plugin-block-menu": "^32.0.0",
|
|
54
|
+
"@atlaskit/editor-plugin-connectivity": "^33.0.0",
|
|
55
|
+
"@atlaskit/editor-plugin-quick-insert": "^33.0.0",
|
|
56
|
+
"@atlaskit/editor-plugin-selection-extension": "^36.0.0",
|
|
57
|
+
"@atlaskit/editor-plugin-user-preferences": "^31.0.0",
|
|
58
58
|
"@atlaskit/editor-plugins": "^17.0.0",
|
|
59
59
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
60
60
|
"@atlaskit/editor-shared-styles": "^5.2.0",
|
|
61
|
-
"@atlaskit/editor-ssr-renderer": "^
|
|
61
|
+
"@atlaskit/editor-ssr-renderer": "^28.0.0",
|
|
62
62
|
"@atlaskit/editor-toolbar": "^2.11.0",
|
|
63
63
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
64
64
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@atlaskit/react-ufo": "^8.5.0",
|
|
78
78
|
"@atlaskit/task-decision": "^21.16.0",
|
|
79
79
|
"@atlaskit/tmp-editor-statsig": "^264.0.0",
|
|
80
|
-
"@atlaskit/tokens": "^20.
|
|
80
|
+
"@atlaskit/tokens": "^20.13.0",
|
|
81
81
|
"@atlaskit/tooltip": "^24.4.0",
|
|
82
82
|
"@atlaskit/width-detector": "^7.2.0",
|
|
83
83
|
"@babel/runtime": "^7.0.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"uuid": "^11.1.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@atlaskit/editor-common": "^
|
|
95
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
96
96
|
"@atlaskit/link-provider": "^6.2.0",
|
|
97
97
|
"@atlaskit/media-core": "^39.0.0",
|
|
98
98
|
"react": "^18.2.0 || ^19.2.0",
|
|
@@ -109,41 +109,41 @@
|
|
|
109
109
|
"@atlaskit/analytics-gas-types": "^6.2.0",
|
|
110
110
|
"@atlaskit/analytics-listeners": "^11.4.0",
|
|
111
111
|
"@atlaskit/code": "^20.0.0",
|
|
112
|
-
"@atlaskit/collab-provider": "^
|
|
112
|
+
"@atlaskit/collab-provider": "^42.0.0",
|
|
113
113
|
"@atlaskit/docs": "^12.3.0",
|
|
114
114
|
"@atlaskit/drawer": "^14.3.0",
|
|
115
|
-
"@atlaskit/editor-common": "^
|
|
116
|
-
"@atlaskit/editor-plugin-alignment": "^
|
|
117
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
118
|
-
"@atlaskit/editor-plugin-base": "^
|
|
119
|
-
"@atlaskit/editor-plugin-card": "^
|
|
120
|
-
"@atlaskit/editor-plugin-code-block-advanced": "^
|
|
121
|
-
"@atlaskit/editor-plugin-collab-edit": "^
|
|
122
|
-
"@atlaskit/editor-plugin-content-insertion": "^
|
|
123
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
124
|
-
"@atlaskit/editor-plugin-extension": "^
|
|
125
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
126
|
-
"@atlaskit/editor-plugin-guideline": "^
|
|
127
|
-
"@atlaskit/editor-plugin-highlight": "^
|
|
128
|
-
"@atlaskit/editor-plugin-hyperlink": "^
|
|
129
|
-
"@atlaskit/editor-plugin-insert-block": "^
|
|
130
|
-
"@atlaskit/editor-plugin-layout": "^
|
|
131
|
-
"@atlaskit/editor-plugin-list": "^
|
|
132
|
-
"@atlaskit/editor-plugin-media": "^
|
|
133
|
-
"@atlaskit/editor-plugin-media-insert": "^
|
|
134
|
-
"@atlaskit/editor-plugin-paste": "^
|
|
135
|
-
"@atlaskit/editor-plugin-selection-marker": "^
|
|
136
|
-
"@atlaskit/editor-plugin-show-diff": "^
|
|
137
|
-
"@atlaskit/editor-plugin-synced-block": "^
|
|
138
|
-
"@atlaskit/editor-plugin-table": "^
|
|
139
|
-
"@atlaskit/editor-plugin-tasks-and-decisions": "^
|
|
140
|
-
"@atlaskit/editor-plugin-text-color": "^
|
|
141
|
-
"@atlaskit/editor-plugin-text-formatting": "^
|
|
142
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
143
|
-
"@atlaskit/editor-plugin-toolbar-lists-indentation": "^
|
|
144
|
-
"@atlaskit/editor-plugin-track-changes": "^
|
|
145
|
-
"@atlaskit/editor-synced-block-provider": "^
|
|
146
|
-
"@atlaskit/editor-synced-block-renderer": "^
|
|
115
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
116
|
+
"@atlaskit/editor-plugin-alignment": "^34.0.0",
|
|
117
|
+
"@atlaskit/editor-plugin-annotation": "^33.0.0",
|
|
118
|
+
"@atlaskit/editor-plugin-base": "^34.0.0",
|
|
119
|
+
"@atlaskit/editor-plugin-card": "^39.0.0",
|
|
120
|
+
"@atlaskit/editor-plugin-code-block-advanced": "^33.0.0",
|
|
121
|
+
"@atlaskit/editor-plugin-collab-edit": "^35.0.0",
|
|
122
|
+
"@atlaskit/editor-plugin-content-insertion": "^33.0.0",
|
|
123
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^35.0.0",
|
|
124
|
+
"@atlaskit/editor-plugin-extension": "^36.0.0",
|
|
125
|
+
"@atlaskit/editor-plugin-grid": "^33.0.0",
|
|
126
|
+
"@atlaskit/editor-plugin-guideline": "^33.0.0",
|
|
127
|
+
"@atlaskit/editor-plugin-highlight": "^33.0.0",
|
|
128
|
+
"@atlaskit/editor-plugin-hyperlink": "^35.0.0",
|
|
129
|
+
"@atlaskit/editor-plugin-insert-block": "^34.0.0",
|
|
130
|
+
"@atlaskit/editor-plugin-layout": "^34.0.0",
|
|
131
|
+
"@atlaskit/editor-plugin-list": "^35.0.0",
|
|
132
|
+
"@atlaskit/editor-plugin-media": "^35.0.0",
|
|
133
|
+
"@atlaskit/editor-plugin-media-insert": "^51.0.0",
|
|
134
|
+
"@atlaskit/editor-plugin-paste": "^34.0.0",
|
|
135
|
+
"@atlaskit/editor-plugin-selection-marker": "^33.0.0",
|
|
136
|
+
"@atlaskit/editor-plugin-show-diff": "^33.0.0",
|
|
137
|
+
"@atlaskit/editor-plugin-synced-block": "^31.0.0",
|
|
138
|
+
"@atlaskit/editor-plugin-table": "^45.0.0",
|
|
139
|
+
"@atlaskit/editor-plugin-tasks-and-decisions": "^36.0.0",
|
|
140
|
+
"@atlaskit/editor-plugin-text-color": "^33.0.0",
|
|
141
|
+
"@atlaskit/editor-plugin-text-formatting": "^34.0.0",
|
|
142
|
+
"@atlaskit/editor-plugin-toolbar": "^30.0.0",
|
|
143
|
+
"@atlaskit/editor-plugin-toolbar-lists-indentation": "^34.0.0",
|
|
144
|
+
"@atlaskit/editor-plugin-track-changes": "^32.0.0",
|
|
145
|
+
"@atlaskit/editor-synced-block-provider": "^29.0.0",
|
|
146
|
+
"@atlaskit/editor-synced-block-renderer": "^31.0.0",
|
|
147
147
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
148
148
|
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
149
149
|
"@atlaskit/form": "^18.3.0",
|
|
@@ -156,27 +156,27 @@
|
|
|
156
156
|
"@atlaskit/media-test-helpers": "^43.0.0",
|
|
157
157
|
"@atlaskit/media-ui": "^31.10.0",
|
|
158
158
|
"@atlaskit/modal-dialog": "^17.2.0",
|
|
159
|
-
"@atlaskit/navigation-system": "^11.
|
|
159
|
+
"@atlaskit/navigation-system": "^11.8.0",
|
|
160
160
|
"@atlaskit/popper": "^9.4.0",
|
|
161
161
|
"@atlaskit/portal": "^7.1.0",
|
|
162
162
|
"@atlaskit/profilecard": "^27.10.0",
|
|
163
|
-
"@atlaskit/renderer": "^
|
|
163
|
+
"@atlaskit/renderer": "^156.0.0",
|
|
164
164
|
"@atlaskit/section-message": "^10.3.0",
|
|
165
165
|
"@atlaskit/spinner": "^20.4.0",
|
|
166
166
|
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
167
167
|
"@atlaskit/textarea": "^10.3.0",
|
|
168
|
-
"@atlaskit/textfield": "^
|
|
168
|
+
"@atlaskit/textfield": "^11.0.0",
|
|
169
169
|
"@atlaskit/toggle": "^17.3.0",
|
|
170
170
|
"@atlaskit/util-data-test": "^19.1.0",
|
|
171
171
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
172
172
|
"@atlassian/a11y-playwright-testing": "^0.13.0",
|
|
173
173
|
"@atlassian/adf-schema-json": "^1.35.0",
|
|
174
|
-
"@atlassian/editor-rovo-bridge": "^
|
|
174
|
+
"@atlassian/editor-rovo-bridge": "^32.0.0",
|
|
175
175
|
"@atlassian/experiment-test-utils": "^0.2.0",
|
|
176
176
|
"@atlassian/feature-flags-storybook-utils": "^0.5.0",
|
|
177
|
-
"@atlassian/feature-flags-test-utils": "^
|
|
177
|
+
"@atlassian/feature-flags-test-utils": "^2.0.0",
|
|
178
178
|
"@atlassian/search-client": "^3.15.0",
|
|
179
|
-
"@atlassian/search-provider": "^
|
|
179
|
+
"@atlassian/search-provider": "^34.0.0",
|
|
180
180
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
181
181
|
"@atlassian/testing-library": "^0.12.0",
|
|
182
182
|
"@atlassian/user-profile-card": "^1.56.0",
|