@atlaskit/editor-plugin-card 27.0.3 → 27.1.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 +50 -0
- package/dist/cjs/cardPlugin.js +1 -0
- package/dist/cjs/ui/PreAuthValuePropositionModal.js +29 -3
- package/dist/cjs/ui/quick-insert/DatasourceQuickInsertMenuItem.js +19 -1
- package/dist/cjs/ui/quick-insert/getCardQuickInsertComponents.js +6 -6
- package/dist/es2019/cardPlugin.js +1 -0
- package/dist/es2019/ui/PreAuthValuePropositionModal.js +27 -2
- package/dist/es2019/ui/quick-insert/DatasourceQuickInsertMenuItem.js +16 -2
- package/dist/es2019/ui/quick-insert/getCardQuickInsertComponents.js +6 -6
- package/dist/esm/cardPlugin.js +1 -0
- package/dist/esm/ui/PreAuthValuePropositionModal.js +29 -3
- package/dist/esm/ui/quick-insert/DatasourceQuickInsertMenuItem.js +20 -2
- package/dist/esm/ui/quick-insert/getCardQuickInsertComponents.js +6 -6
- package/dist/types/cardPluginType.d.ts +3 -1
- package/dist/types/ui/PreAuthValuePropositionModal.d.ts +3 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 27.1.1
|
|
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
|
+
- Updated dependencies
|
|
29
|
+
|
|
30
|
+
## 27.1.0
|
|
31
|
+
|
|
32
|
+
### Minor Changes
|
|
33
|
+
|
|
34
|
+
- [`067939baaaeb9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/067939baaaeb9) -
|
|
35
|
+
Fix the pre-auth value proposition modal in the `platform_sl_3p_preauth_value_modal` experiment
|
|
36
|
+
treatments behind `platform_sl_3p_preauth_value_modal_killswitch`:
|
|
37
|
+
- Allow titles to wrap in both treatment variants. Preserve the image variant's default height
|
|
38
|
+
while allowing taller text to reveal more of the centered illustration, keeping provider icons
|
|
39
|
+
aligned.
|
|
40
|
+
- Truncate long provider names in the Connect button so the Close button remains fully visible.
|
|
41
|
+
- Prevent editor floating toolbars from appearing above the modal using the existing `overlayOpen`
|
|
42
|
+
user intent, without layout effects that warn during server rendering.
|
|
43
|
+
|
|
44
|
+
In `@atlaskit/smart-card/pre-auth-value-proposition-modal`, `PreAuthValuePropositionModalProps`
|
|
45
|
+
adds optional `onOpenChange` to notify hosts when the modal opens, closes, or unmounts.
|
|
46
|
+
`@atlaskit/editor-plugin-card` adds an optional `UserIntentPlugin` integration and declares its
|
|
47
|
+
package dependency.
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies
|
|
52
|
+
|
|
3
53
|
## 27.0.3
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
package/dist/cjs/cardPlugin.js
CHANGED
|
@@ -177,6 +177,7 @@ var cardPlugin = exports.cardPlugin = function cardPlugin(_ref2) {
|
|
|
177
177
|
editorViewForPasteMenu = editorView;
|
|
178
178
|
var breakoutEnabled = options.editorAppearance === 'full-page';
|
|
179
179
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _fg.fg)('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/_react.default.createElement(_PreAuthValuePropositionModal.PreAuthValuePropositionModalListener, {
|
|
180
|
+
api: api,
|
|
180
181
|
cardPluginEvents: cardPluginEvents
|
|
181
182
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/_react.default.createElement(PasteMenuSmartCardClientSync, {
|
|
182
183
|
clientRef: pasteMenuSmartCardClientRef
|
|
@@ -29,11 +29,35 @@ var getNewSmartLinkUrl = function getNewSmartLinkUrl(event) {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
var ModalListener = function ModalListener(_ref) {
|
|
32
|
-
var
|
|
32
|
+
var api = _ref.api,
|
|
33
|
+
cardPluginEvents = _ref.cardPluginEvents;
|
|
33
34
|
var _useState = (0, _react.useState)(),
|
|
34
35
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
35
36
|
url = _useState2[0],
|
|
36
37
|
setUrl = _useState2[1];
|
|
38
|
+
var _useState3 = (0, _react.useState)(false),
|
|
39
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
40
|
+
isOpen = _useState4[0],
|
|
41
|
+
setIsOpen = _useState4[1];
|
|
42
|
+
|
|
43
|
+
// While the pre-auth modal is visible, use 'overlayOpen' to suppress the floating toolbar.
|
|
44
|
+
// Jira portals editor popups above its issue dialog, so the toolbar would otherwise appear
|
|
45
|
+
// above the modal blanket. Keep it available while link eligibility is still being checked.
|
|
46
|
+
// On close or unmount, restore the previous intent unless another interaction has changed it.
|
|
47
|
+
(0, _react.useEffect)(function () {
|
|
48
|
+
var _api$userIntent$share, _api$userIntent$share2;
|
|
49
|
+
if (!isOpen || !(api !== null && api !== void 0 && api.userIntent)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
var previousIntent = (_api$userIntent$share = (_api$userIntent$share2 = api.userIntent.sharedState.currentState()) === null || _api$userIntent$share2 === void 0 ? void 0 : _api$userIntent$share2.currentUserIntent) !== null && _api$userIntent$share !== void 0 ? _api$userIntent$share : 'default';
|
|
53
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent('overlayOpen'));
|
|
54
|
+
return function () {
|
|
55
|
+
var _api$userIntent;
|
|
56
|
+
if (((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'overlayOpen') {
|
|
57
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent(previousIntent));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, [api, isOpen]);
|
|
37
61
|
(0, _react.useEffect)(function () {
|
|
38
62
|
return cardPluginEvents.subscribe(function (event) {
|
|
39
63
|
var newSmartLinkUrl = getNewSmartLinkUrl(event);
|
|
@@ -45,14 +69,16 @@ var ModalListener = function ModalListener(_ref) {
|
|
|
45
69
|
});
|
|
46
70
|
}, [cardPluginEvents]);
|
|
47
71
|
var onFinished = (0, _react.useCallback)(function () {
|
|
48
|
-
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
setUrl(undefined);
|
|
49
74
|
}, []);
|
|
50
75
|
return url ? /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
51
76
|
fallback: null
|
|
52
77
|
}, /*#__PURE__*/_react.default.createElement(PreAuthValuePropositionModal, {
|
|
53
78
|
key: url,
|
|
54
79
|
url: url,
|
|
55
|
-
onFinished: onFinished
|
|
80
|
+
onFinished: onFinished,
|
|
81
|
+
onOpenChange: setIsOpen
|
|
56
82
|
})) : null;
|
|
57
83
|
};
|
|
58
84
|
var PreAuthValuePropositionModalListener = exports.PreAuthValuePropositionModalListener = /*#__PURE__*/_react.default.memo(ModalListener);
|
|
@@ -6,10 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.DatasourceQuickInsertMenuItem = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _reactIntl = require("react-intl");
|
|
11
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
|
+
var _confluenceAttributionIcon = require("@atlaskit/editor-common/quick-insert/confluence-attribution-icon");
|
|
14
|
+
var _jiraAttributionIcon = require("@atlaskit/editor-common/quick-insert/jira-attribution-icon");
|
|
12
15
|
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
16
|
+
var _messages2 = require("@atlaskit/editor-common/quick-insert/messages");
|
|
13
17
|
var _useQuickInsertContext = require("@atlaskit/editor-common/quick-insert/use-quick-insert-context");
|
|
14
18
|
var _assets = _interopRequireDefault(require("@atlaskit/icon/core/assets"));
|
|
15
19
|
var _pages = _interopRequireDefault(require("@atlaskit/icon/core/pages"));
|
|
@@ -17,6 +21,8 @@ var _workItems = _interopRequireDefault(require("@atlaskit/icon/core/work-items"
|
|
|
17
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
18
22
|
var _actions = require("../../pm-plugins/actions");
|
|
19
23
|
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); }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
20
26
|
var DatasourceQuickInsertMenuItem = exports.DatasourceQuickInsertMenuItem = function DatasourceQuickInsertMenuItem(_ref) {
|
|
21
27
|
var previewImageUrls = _ref.previewImageUrls,
|
|
22
28
|
type = _ref.type;
|
|
@@ -26,6 +32,17 @@ var DatasourceQuickInsertMenuItem = exports.DatasourceQuickInsertMenuItem = func
|
|
|
26
32
|
isOffline = _useQuickInsertContex.isOffline;
|
|
27
33
|
var isJira = type === 'jira';
|
|
28
34
|
var isConfluenceSearch = type === 'confluence-search';
|
|
35
|
+
var description = formatMessage(isJira ? (0, _fg.fg)('confluence-issue-terminology-refresh') ? _messages.cardMessages.datasourceJiraIssueDescriptionIssueTermRefresh : _messages.cardMessages.datasourceJiraIssueDescription : isConfluenceSearch ? _messages.cardMessages.datasourceConfluenceSearchDescription : _messages.cardMessages.datasourceAssetsObjectsDescription);
|
|
36
|
+
var preview = (0, _react.useMemo)(function () {
|
|
37
|
+
return previewImageUrls ? {
|
|
38
|
+
image: previewImageUrls,
|
|
39
|
+
attribution: _objectSpread({
|
|
40
|
+
name: formatMessage(isJira ? _messages2.messages.previewAttributionJira : isConfluenceSearch ? _messages2.messages.previewAttributionConfluence : _messages2.messages.previewAttributionAssets)
|
|
41
|
+
}, (isJira || isConfluenceSearch) && {
|
|
42
|
+
icon: isJira ? _jiraAttributionIcon.JiraAttributionIcon : _confluenceAttributionIcon.ConfluenceAttributionIcon
|
|
43
|
+
})
|
|
44
|
+
} : undefined;
|
|
45
|
+
}, [formatMessage, isConfluenceSearch, isJira, previewImageUrls]);
|
|
29
46
|
var onSelect = (0, _react.useCallback)(function (_ref2) {
|
|
30
47
|
var insert = _ref2.insert;
|
|
31
48
|
var tr = insert(undefined);
|
|
@@ -33,6 +50,7 @@ var DatasourceQuickInsertMenuItem = exports.DatasourceQuickInsertMenuItem = func
|
|
|
33
50
|
return tr;
|
|
34
51
|
}, [type]);
|
|
35
52
|
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
53
|
+
description: description,
|
|
36
54
|
iconBefore: isJira ? /*#__PURE__*/_react.default.createElement(_workItems.default, {
|
|
37
55
|
label: ""
|
|
38
56
|
}) : isConfluenceSearch ? /*#__PURE__*/_react.default.createElement(_pages.default, {
|
|
@@ -42,7 +60,7 @@ var DatasourceQuickInsertMenuItem = exports.DatasourceQuickInsertMenuItem = func
|
|
|
42
60
|
}),
|
|
43
61
|
isDisabled: isOffline,
|
|
44
62
|
onSelect: onSelect,
|
|
45
|
-
|
|
63
|
+
preview: preview,
|
|
46
64
|
title: formatMessage(isJira ? (0, _fg.fg)('confluence-issue-terminology-refresh') ? _messages.cardMessages.datasourceJiraIssueIssueTermRefresh : _messages.cardMessages.datasourceJiraIssue : isConfluenceSearch ? _messages.cardMessages.datasourceConfluenceSearch : _messages.cardMessages.datasourceAssetsObjectsGeneralAvailability)
|
|
47
65
|
});
|
|
48
66
|
};
|
|
@@ -18,14 +18,14 @@ var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
|
18
18
|
var _utils2 = require("../../pm-plugins/utils");
|
|
19
19
|
var _DatasourceQuickInsertMenuItem = require("./DatasourceQuickInsertMenuItem");
|
|
20
20
|
var datasourcePreviewImageUrlsByKey = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.JIRA_WORK_ITEMS_MENU_ITEM.key, {
|
|
21
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
22
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
21
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIM.png',
|
|
22
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLA.png'
|
|
23
23
|
}), _keys.CONFLUENCE_LIST_MENU_ITEM.key, {
|
|
24
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
25
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
24
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIK.png',
|
|
25
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVMD.png'
|
|
26
26
|
}), _keys.ASSETS_MENU_ITEM.key, {
|
|
27
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
28
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
27
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVJ2.png',
|
|
28
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVM6.png'
|
|
29
29
|
});
|
|
30
30
|
var getCardQuickInsertComponents = exports.getCardQuickInsertComponents = function getCardQuickInsertComponents(_ref) {
|
|
31
31
|
var api = _ref.api,
|
|
@@ -172,6 +172,7 @@ export const cardPlugin = ({
|
|
|
172
172
|
editorViewForPasteMenu = editorView;
|
|
173
173
|
const breakoutEnabled = options.editorAppearance === 'full-page';
|
|
174
174
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
|
|
175
|
+
api: api,
|
|
175
176
|
cardPluginEvents: cardPluginEvents
|
|
176
177
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
|
|
177
178
|
clientRef: pasteMenuSmartCardClientRef
|
|
@@ -13,22 +13,47 @@ const getNewSmartLinkUrl = event => {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
const ModalListener = ({
|
|
16
|
+
api,
|
|
16
17
|
cardPluginEvents
|
|
17
18
|
}) => {
|
|
18
19
|
const [url, setUrl] = useState();
|
|
20
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
21
|
+
|
|
22
|
+
// While the pre-auth modal is visible, use 'overlayOpen' to suppress the floating toolbar.
|
|
23
|
+
// Jira portals editor popups above its issue dialog, so the toolbar would otherwise appear
|
|
24
|
+
// above the modal blanket. Keep it available while link eligibility is still being checked.
|
|
25
|
+
// On close or unmount, restore the previous intent unless another interaction has changed it.
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
var _api$userIntent$share, _api$userIntent$share2;
|
|
28
|
+
if (!isOpen || !(api !== null && api !== void 0 && api.userIntent)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const previousIntent = (_api$userIntent$share = (_api$userIntent$share2 = api.userIntent.sharedState.currentState()) === null || _api$userIntent$share2 === void 0 ? void 0 : _api$userIntent$share2.currentUserIntent) !== null && _api$userIntent$share !== void 0 ? _api$userIntent$share : 'default';
|
|
32
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent('overlayOpen'));
|
|
33
|
+
return () => {
|
|
34
|
+
var _api$userIntent, _api$userIntent$share3;
|
|
35
|
+
if (((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : (_api$userIntent$share3 = _api$userIntent.sharedState.currentState()) === null || _api$userIntent$share3 === void 0 ? void 0 : _api$userIntent$share3.currentUserIntent) === 'overlayOpen') {
|
|
36
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent(previousIntent));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, [api, isOpen]);
|
|
19
40
|
useEffect(() => cardPluginEvents.subscribe(event => {
|
|
20
41
|
const newSmartLinkUrl = getNewSmartLinkUrl(event);
|
|
21
42
|
if (newSmartLinkUrl) {
|
|
22
43
|
setUrl(currentUrl => currentUrl !== null && currentUrl !== void 0 ? currentUrl : newSmartLinkUrl);
|
|
23
44
|
}
|
|
24
45
|
}), [cardPluginEvents]);
|
|
25
|
-
const onFinished = useCallback(() =>
|
|
46
|
+
const onFinished = useCallback(() => {
|
|
47
|
+
setIsOpen(false);
|
|
48
|
+
setUrl(undefined);
|
|
49
|
+
}, []);
|
|
26
50
|
return url ? /*#__PURE__*/React.createElement(Suspense, {
|
|
27
51
|
fallback: null
|
|
28
52
|
}, /*#__PURE__*/React.createElement(PreAuthValuePropositionModal, {
|
|
29
53
|
key: url,
|
|
30
54
|
url: url,
|
|
31
|
-
onFinished: onFinished
|
|
55
|
+
onFinished: onFinished,
|
|
56
|
+
onOpenChange: setIsOpen
|
|
32
57
|
})) : null;
|
|
33
58
|
};
|
|
34
59
|
export const PreAuthValuePropositionModalListener = /*#__PURE__*/React.memo(ModalListener);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { ConfluenceAttributionIcon } from '@atlaskit/editor-common/quick-insert/confluence-attribution-icon';
|
|
5
|
+
import { JiraAttributionIcon } from '@atlaskit/editor-common/quick-insert/jira-attribution-icon';
|
|
4
6
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
7
|
+
import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
|
|
5
8
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
6
9
|
import AssetsIcon from '@atlaskit/icon/core/assets';
|
|
7
10
|
import PagesIcon from '@atlaskit/icon/core/pages';
|
|
@@ -20,6 +23,16 @@ export const DatasourceQuickInsertMenuItem = ({
|
|
|
20
23
|
} = useQuickInsertContext();
|
|
21
24
|
const isJira = type === 'jira';
|
|
22
25
|
const isConfluenceSearch = type === 'confluence-search';
|
|
26
|
+
const description = formatMessage(isJira ? fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueDescriptionIssueTermRefresh : messages.datasourceJiraIssueDescription : isConfluenceSearch ? messages.datasourceConfluenceSearchDescription : messages.datasourceAssetsObjectsDescription);
|
|
27
|
+
const preview = useMemo(() => previewImageUrls ? {
|
|
28
|
+
image: previewImageUrls,
|
|
29
|
+
attribution: {
|
|
30
|
+
name: formatMessage(isJira ? quickInsertMessages.previewAttributionJira : isConfluenceSearch ? quickInsertMessages.previewAttributionConfluence : quickInsertMessages.previewAttributionAssets),
|
|
31
|
+
...((isJira || isConfluenceSearch) && {
|
|
32
|
+
icon: isJira ? JiraAttributionIcon : ConfluenceAttributionIcon
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
} : undefined, [formatMessage, isConfluenceSearch, isJira, previewImageUrls]);
|
|
23
36
|
const onSelect = useCallback(({
|
|
24
37
|
insert
|
|
25
38
|
}) => {
|
|
@@ -28,6 +41,7 @@ export const DatasourceQuickInsertMenuItem = ({
|
|
|
28
41
|
return tr;
|
|
29
42
|
}, [type]);
|
|
30
43
|
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
44
|
+
description: description,
|
|
31
45
|
iconBefore: isJira ? /*#__PURE__*/React.createElement(WorkItemsIcon, {
|
|
32
46
|
label: ""
|
|
33
47
|
}) : isConfluenceSearch ? /*#__PURE__*/React.createElement(PagesIcon, {
|
|
@@ -37,7 +51,7 @@ export const DatasourceQuickInsertMenuItem = ({
|
|
|
37
51
|
}),
|
|
38
52
|
isDisabled: isOffline,
|
|
39
53
|
onSelect: onSelect,
|
|
40
|
-
|
|
54
|
+
preview: preview,
|
|
41
55
|
title: formatMessage(isJira ? fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueIssueTermRefresh : messages.datasourceJiraIssue : isConfluenceSearch ? messages.datasourceConfluenceSearch : messages.datasourceAssetsObjectsGeneralAvailability)
|
|
42
56
|
});
|
|
43
57
|
};
|
|
@@ -11,16 +11,16 @@ import { isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
|
11
11
|
import { DatasourceQuickInsertMenuItem } from './DatasourceQuickInsertMenuItem';
|
|
12
12
|
const datasourcePreviewImageUrlsByKey = {
|
|
13
13
|
[JIRA_WORK_ITEMS_MENU_ITEM.key]: {
|
|
14
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
15
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
14
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIM.png',
|
|
15
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLA.png'
|
|
16
16
|
},
|
|
17
17
|
[CONFLUENCE_LIST_MENU_ITEM.key]: {
|
|
18
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
19
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
18
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIK.png',
|
|
19
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVMD.png'
|
|
20
20
|
},
|
|
21
21
|
[ASSETS_MENU_ITEM.key]: {
|
|
22
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
23
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
22
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVJ2.png',
|
|
23
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVM6.png'
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
export const getCardQuickInsertComponents = ({
|
package/dist/esm/cardPlugin.js
CHANGED
|
@@ -169,6 +169,7 @@ export var cardPlugin = function cardPlugin(_ref2) {
|
|
|
169
169
|
editorViewForPasteMenu = editorView;
|
|
170
170
|
var breakoutEnabled = options.editorAppearance === 'full-page';
|
|
171
171
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fg('platform_sl_3p_preauth_value_modal_killswitch') ? /*#__PURE__*/React.createElement(PreAuthValuePropositionModalListener, {
|
|
172
|
+
api: api,
|
|
172
173
|
cardPluginEvents: cardPluginEvents
|
|
173
174
|
}) : null, shouldRegisterPasteDisplayAsMenu && /*#__PURE__*/React.createElement(PasteMenuSmartCardClientSync, {
|
|
174
175
|
clientRef: pasteMenuSmartCardClientRef
|
|
@@ -18,11 +18,35 @@ var getNewSmartLinkUrl = function getNewSmartLinkUrl(event) {
|
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
var ModalListener = function ModalListener(_ref) {
|
|
21
|
-
var
|
|
21
|
+
var api = _ref.api,
|
|
22
|
+
cardPluginEvents = _ref.cardPluginEvents;
|
|
22
23
|
var _useState = useState(),
|
|
23
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
25
|
url = _useState2[0],
|
|
25
26
|
setUrl = _useState2[1];
|
|
27
|
+
var _useState3 = useState(false),
|
|
28
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
29
|
+
isOpen = _useState4[0],
|
|
30
|
+
setIsOpen = _useState4[1];
|
|
31
|
+
|
|
32
|
+
// While the pre-auth modal is visible, use 'overlayOpen' to suppress the floating toolbar.
|
|
33
|
+
// Jira portals editor popups above its issue dialog, so the toolbar would otherwise appear
|
|
34
|
+
// above the modal blanket. Keep it available while link eligibility is still being checked.
|
|
35
|
+
// On close or unmount, restore the previous intent unless another interaction has changed it.
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
var _api$userIntent$share, _api$userIntent$share2;
|
|
38
|
+
if (!isOpen || !(api !== null && api !== void 0 && api.userIntent)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
var previousIntent = (_api$userIntent$share = (_api$userIntent$share2 = api.userIntent.sharedState.currentState()) === null || _api$userIntent$share2 === void 0 ? void 0 : _api$userIntent$share2.currentUserIntent) !== null && _api$userIntent$share !== void 0 ? _api$userIntent$share : 'default';
|
|
42
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent('overlayOpen'));
|
|
43
|
+
return function () {
|
|
44
|
+
var _api$userIntent;
|
|
45
|
+
if (((_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || (_api$userIntent = _api$userIntent.sharedState.currentState()) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.currentUserIntent) === 'overlayOpen') {
|
|
46
|
+
api.core.actions.execute(api.userIntent.commands.setCurrentUserIntent(previousIntent));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}, [api, isOpen]);
|
|
26
50
|
useEffect(function () {
|
|
27
51
|
return cardPluginEvents.subscribe(function (event) {
|
|
28
52
|
var newSmartLinkUrl = getNewSmartLinkUrl(event);
|
|
@@ -34,14 +58,16 @@ var ModalListener = function ModalListener(_ref) {
|
|
|
34
58
|
});
|
|
35
59
|
}, [cardPluginEvents]);
|
|
36
60
|
var onFinished = useCallback(function () {
|
|
37
|
-
|
|
61
|
+
setIsOpen(false);
|
|
62
|
+
setUrl(undefined);
|
|
38
63
|
}, []);
|
|
39
64
|
return url ? /*#__PURE__*/React.createElement(Suspense, {
|
|
40
65
|
fallback: null
|
|
41
66
|
}, /*#__PURE__*/React.createElement(PreAuthValuePropositionModal, {
|
|
42
67
|
key: url,
|
|
43
68
|
url: url,
|
|
44
|
-
onFinished: onFinished
|
|
69
|
+
onFinished: onFinished,
|
|
70
|
+
onOpenChange: setIsOpen
|
|
45
71
|
})) : null;
|
|
46
72
|
};
|
|
47
73
|
export var PreAuthValuePropositionModalListener = /*#__PURE__*/React.memo(ModalListener);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
5
|
import { useIntl } from 'react-intl';
|
|
3
6
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { ConfluenceAttributionIcon } from '@atlaskit/editor-common/quick-insert/confluence-attribution-icon';
|
|
8
|
+
import { JiraAttributionIcon } from '@atlaskit/editor-common/quick-insert/jira-attribution-icon';
|
|
4
9
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
10
|
+
import { messages as quickInsertMessages } from '@atlaskit/editor-common/quick-insert/messages';
|
|
5
11
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
6
12
|
import AssetsIcon from '@atlaskit/icon/core/assets';
|
|
7
13
|
import PagesIcon from '@atlaskit/icon/core/pages';
|
|
@@ -17,6 +23,17 @@ export var DatasourceQuickInsertMenuItem = function DatasourceQuickInsertMenuIte
|
|
|
17
23
|
isOffline = _useQuickInsertContex.isOffline;
|
|
18
24
|
var isJira = type === 'jira';
|
|
19
25
|
var isConfluenceSearch = type === 'confluence-search';
|
|
26
|
+
var description = formatMessage(isJira ? fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueDescriptionIssueTermRefresh : messages.datasourceJiraIssueDescription : isConfluenceSearch ? messages.datasourceConfluenceSearchDescription : messages.datasourceAssetsObjectsDescription);
|
|
27
|
+
var preview = useMemo(function () {
|
|
28
|
+
return previewImageUrls ? {
|
|
29
|
+
image: previewImageUrls,
|
|
30
|
+
attribution: _objectSpread({
|
|
31
|
+
name: formatMessage(isJira ? quickInsertMessages.previewAttributionJira : isConfluenceSearch ? quickInsertMessages.previewAttributionConfluence : quickInsertMessages.previewAttributionAssets)
|
|
32
|
+
}, (isJira || isConfluenceSearch) && {
|
|
33
|
+
icon: isJira ? JiraAttributionIcon : ConfluenceAttributionIcon
|
|
34
|
+
})
|
|
35
|
+
} : undefined;
|
|
36
|
+
}, [formatMessage, isConfluenceSearch, isJira, previewImageUrls]);
|
|
20
37
|
var onSelect = useCallback(function (_ref2) {
|
|
21
38
|
var insert = _ref2.insert;
|
|
22
39
|
var tr = insert(undefined);
|
|
@@ -24,6 +41,7 @@ export var DatasourceQuickInsertMenuItem = function DatasourceQuickInsertMenuIte
|
|
|
24
41
|
return tr;
|
|
25
42
|
}, [type]);
|
|
26
43
|
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
44
|
+
description: description,
|
|
27
45
|
iconBefore: isJira ? /*#__PURE__*/React.createElement(WorkItemsIcon, {
|
|
28
46
|
label: ""
|
|
29
47
|
}) : isConfluenceSearch ? /*#__PURE__*/React.createElement(PagesIcon, {
|
|
@@ -33,7 +51,7 @@ export var DatasourceQuickInsertMenuItem = function DatasourceQuickInsertMenuIte
|
|
|
33
51
|
}),
|
|
34
52
|
isDisabled: isOffline,
|
|
35
53
|
onSelect: onSelect,
|
|
36
|
-
|
|
54
|
+
preview: preview,
|
|
37
55
|
title: formatMessage(isJira ? fg('confluence-issue-terminology-refresh') ? messages.datasourceJiraIssueIssueTermRefresh : messages.datasourceJiraIssue : isConfluenceSearch ? messages.datasourceConfluenceSearch : messages.datasourceAssetsObjectsGeneralAvailability)
|
|
38
56
|
});
|
|
39
57
|
};
|
|
@@ -11,14 +11,14 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
11
11
|
import { isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
12
12
|
import { DatasourceQuickInsertMenuItem } from './DatasourceQuickInsertMenuItem';
|
|
13
13
|
var datasourcePreviewImageUrlsByKey = _defineProperty(_defineProperty(_defineProperty({}, JIRA_WORK_ITEMS_MENU_ITEM.key, {
|
|
14
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
15
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
14
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIM.png',
|
|
15
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVLA.png'
|
|
16
16
|
}), CONFLUENCE_LIST_MENU_ITEM.key, {
|
|
17
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
18
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
17
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVIK.png',
|
|
18
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVMD.png'
|
|
19
19
|
}), ASSETS_MENU_ITEM.key, {
|
|
20
|
-
dark: 'https://dam-cdn.atl.orangelogic.com/
|
|
21
|
-
light: 'https://dam-cdn.atl.orangelogic.com/
|
|
20
|
+
dark: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVJ2.png',
|
|
21
|
+
light: 'https://dam-cdn.atl.orangelogic.com/CDNLink/AT12OVM6.png'
|
|
22
22
|
});
|
|
23
23
|
export var getCardQuickInsertComponents = function getCardQuickInsertComponents(_ref) {
|
|
24
24
|
var api = _ref.api,
|
|
@@ -16,6 +16,7 @@ import type { GridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
|
16
16
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
17
17
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
18
18
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
19
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent/user-intent-plugin-type';
|
|
19
20
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
20
21
|
import type { CardPluginOptions, CardPluginState } from './types';
|
|
21
22
|
type DummyAnnotationPlugin = NextEditorPlugin<'annotation', {
|
|
@@ -38,7 +39,8 @@ export type CardPluginDependencies = [
|
|
|
38
39
|
OptionalPlugin<ConnectivityPlugin>,
|
|
39
40
|
OptionalPlugin<BasePlugin>,
|
|
40
41
|
OptionalPlugin<ToolbarPlugin>,
|
|
41
|
-
OptionalPlugin<UiControlRegistryPlugin
|
|
42
|
+
OptionalPlugin<UiControlRegistryPlugin>,
|
|
43
|
+
OptionalPlugin<UserIntentPlugin>
|
|
42
44
|
];
|
|
43
45
|
export type CardPlugin = NextEditorPlugin<'card', {
|
|
44
46
|
actions: CardPluginActions;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { CardPlugin } from '../cardPluginType';
|
|
2
4
|
import type { EditorCardPluginEvents } from './analytics/create-events-queue';
|
|
3
5
|
import type { CardPluginEvent } from './analytics/types';
|
|
4
6
|
type PreAuthValuePropositionModalListenerProps = {
|
|
7
|
+
api?: ExtractInjectionAPI<CardPlugin>;
|
|
5
8
|
cardPluginEvents: EditorCardPluginEvents<CardPluginEvent>;
|
|
6
9
|
};
|
|
7
10
|
export declare const PreAuthValuePropositionModalListener: React.MemoExoticComponent<(props: PreAuthValuePropositionModalListenerProps) => React.JSX.Element | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.1.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^21.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-toolbar": "^18.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-ui-control-registry": "^15.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-user-intent": "^19.0.0",
|
|
43
44
|
"@atlaskit/editor-plugin-width": "^22.0.0",
|
|
44
45
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
45
46
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
46
47
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
47
|
-
"@atlaskit/editor-toolbar": "^2.
|
|
48
|
+
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
48
49
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
49
50
|
"@atlaskit/frontend-utilities": "^5.0.0",
|
|
50
51
|
"@atlaskit/icon": "^38.0.0",
|
|
@@ -62,8 +63,8 @@
|
|
|
62
63
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
63
64
|
"@atlaskit/primitives": "^22.5.0",
|
|
64
65
|
"@atlaskit/prosemirror-history": "^1.2.0",
|
|
65
|
-
"@atlaskit/smart-card": "^46.
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
66
|
+
"@atlaskit/smart-card": "^46.1.0",
|
|
67
|
+
"@atlaskit/tmp-editor-statsig": "^209.0.0",
|
|
67
68
|
"@atlaskit/tokens": "^20.0.0",
|
|
68
69
|
"@babel/runtime": "^7.0.0",
|
|
69
70
|
"@emotion/react": "^11.7.1",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"uuid": "^11.1.1"
|
|
74
75
|
},
|
|
75
76
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^125.
|
|
77
|
+
"@atlaskit/editor-common": "^125.4.0",
|
|
77
78
|
"@atlaskit/link-provider": "^6.0.0",
|
|
78
79
|
"react": "^18.2.0 || ^19.2.0",
|
|
79
80
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|