@atlaskit/editor-plugin-card 2.6.2 → 2.6.4
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 +16 -0
- package/dist/cjs/nodeviews/genericCard.js +5 -3
- package/dist/cjs/nodeviews/inlineCard.js +15 -10
- package/dist/cjs/pm-plugins/main.js +9 -6
- package/dist/cjs/toolbar.js +1 -0
- package/dist/cjs/ui/{EditToolbarButton.js → EditToolbarButton/EditToolbarButtonPresentation.js} +15 -65
- package/dist/cjs/ui/EditToolbarButton/index.js +286 -0
- package/dist/cjs/ui/EditToolbarButton/types.js +5 -0
- package/dist/cjs/ui/useFetchDatasourceDataInfo.js +75 -0
- package/dist/es2019/nodeviews/genericCard.js +5 -3
- package/dist/es2019/nodeviews/inlineCard.js +16 -10
- package/dist/es2019/pm-plugins/main.js +10 -5
- package/dist/es2019/toolbar.js +1 -0
- package/dist/es2019/ui/{EditToolbarButton.js → EditToolbarButton/EditToolbarButtonPresentation.js} +14 -67
- package/dist/es2019/ui/EditToolbarButton/index.js +278 -0
- package/dist/es2019/ui/EditToolbarButton/types.js +1 -0
- package/dist/es2019/ui/useFetchDatasourceDataInfo.js +41 -0
- package/dist/esm/nodeviews/genericCard.js +5 -3
- package/dist/esm/nodeviews/inlineCard.js +15 -10
- package/dist/esm/pm-plugins/main.js +9 -6
- package/dist/esm/toolbar.js +1 -0
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +116 -0
- package/dist/esm/ui/{EditToolbarButton.js → EditToolbarButton/index.js} +116 -4
- package/dist/esm/ui/EditToolbarButton/types.js +1 -0
- package/dist/esm/ui/useFetchDatasourceDataInfo.js +67 -0
- package/dist/types/nodeviews/genericCard.d.ts +1 -0
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +9 -0
- package/dist/types/ui/EditToolbarButton/index.d.ts +3 -0
- package/dist/types/ui/EditToolbarButton/types.d.ts +29 -0
- package/dist/types/ui/useFetchDatasourceDataInfo.d.ts +10 -0
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +9 -0
- package/dist/types-ts4.5/ui/EditToolbarButton/index.d.ts +3 -0
- package/dist/types-ts4.5/ui/EditToolbarButton/types.d.ts +29 -0
- package/dist/types-ts4.5/ui/useFetchDatasourceDataInfo.d.ts +10 -0
- package/package.json +5 -2
- package/dist/types/ui/EditToolbarButton.d.ts +0 -18
- package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +0 -18
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { css, jsx } from '@emotion/react';
|
|
7
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
8
|
+
import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
|
+
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
|
|
10
|
+
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
11
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
12
|
+
import { ButtonItem } from '@atlaskit/menu';
|
|
13
|
+
import { Flex } from '@atlaskit/primitives';
|
|
14
|
+
import { focusEditorView } from '../../utils';
|
|
15
|
+
import { editDatasource } from '../EditDatasourceButton';
|
|
16
|
+
var dropdownExpandContainer = css({
|
|
17
|
+
margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
|
|
18
|
+
});
|
|
19
|
+
var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref) {
|
|
20
|
+
var datasourceId = _ref.datasourceId,
|
|
21
|
+
currentAppearance = _ref.currentAppearance,
|
|
22
|
+
editorAnalyticsApi = _ref.editorAnalyticsApi,
|
|
23
|
+
editVariant = _ref.editVariant,
|
|
24
|
+
editorView = _ref.editorView,
|
|
25
|
+
extensionKey = _ref.extensionKey,
|
|
26
|
+
onLinkEditClick = _ref.onLinkEditClick,
|
|
27
|
+
intl = _ref.intl;
|
|
28
|
+
var _useState = useState(false),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
isOpen = _useState2[0],
|
|
31
|
+
setIsOpen = _useState2[1];
|
|
32
|
+
var containerRef = useRef();
|
|
33
|
+
var toggleOpen = function toggleOpen() {
|
|
34
|
+
return setIsOpen(function (open) {
|
|
35
|
+
return !open;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var onClose = function onClose() {
|
|
39
|
+
return setIsOpen(false);
|
|
40
|
+
};
|
|
41
|
+
var onEditLink = useCallback(function () {
|
|
42
|
+
if (editorView) {
|
|
43
|
+
onLinkEditClick(editorView.state, editorView.dispatch);
|
|
44
|
+
focusEditorView(editorView);
|
|
45
|
+
}
|
|
46
|
+
}, [editorView, onLinkEditClick]);
|
|
47
|
+
var onEditDatasource = useCallback(function () {
|
|
48
|
+
if (editorView && datasourceId) {
|
|
49
|
+
editDatasource(datasourceId, editorAnalyticsApi, currentAppearance, extensionKey)(editorView.state, editorView.dispatch);
|
|
50
|
+
focusEditorView(editorView);
|
|
51
|
+
}
|
|
52
|
+
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
53
|
+
switch (editVariant) {
|
|
54
|
+
case 'edit-link':
|
|
55
|
+
{
|
|
56
|
+
return jsx(Flex, {
|
|
57
|
+
gap: "space.050"
|
|
58
|
+
}, jsx(Button, {
|
|
59
|
+
testId: "edit-link",
|
|
60
|
+
onClick: onEditLink
|
|
61
|
+
}, jsx(FormattedMessage, linkToolbarMessages.editLink)), jsx(Separator, null));
|
|
62
|
+
}
|
|
63
|
+
case 'edit-datasource':
|
|
64
|
+
{
|
|
65
|
+
return jsx(Flex, {
|
|
66
|
+
gap: "space.050"
|
|
67
|
+
}, jsx(Button, {
|
|
68
|
+
testId: "edit-datasource",
|
|
69
|
+
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
70
|
+
onClick: onEditDatasource
|
|
71
|
+
}, jsx(FormattedMessage, linkToolbarMessages.editDatasourceStandalone)), jsx(Separator, null));
|
|
72
|
+
}
|
|
73
|
+
case 'edit-dropdown':
|
|
74
|
+
{
|
|
75
|
+
var trigger = jsx(Flex, {
|
|
76
|
+
gap: "space.050"
|
|
77
|
+
}, jsx(Button, {
|
|
78
|
+
testId: "edit-dropdown-trigger",
|
|
79
|
+
iconAfter: jsx("span", {
|
|
80
|
+
css: dropdownExpandContainer
|
|
81
|
+
}, jsx(ExpandIcon, {
|
|
82
|
+
label: intl.formatMessage(messages.editDropdownTriggerTitle)
|
|
83
|
+
})),
|
|
84
|
+
onClick: toggleOpen,
|
|
85
|
+
selected: isOpen,
|
|
86
|
+
disabled: false,
|
|
87
|
+
ariaHasPopup: true
|
|
88
|
+
}, jsx(FormattedMessage, messages.editDropdownTriggerTitle)), jsx(Separator, null));
|
|
89
|
+
return jsx(Flex, {
|
|
90
|
+
ref: containerRef
|
|
91
|
+
}, jsx(UiDropdown, {
|
|
92
|
+
mountTo: containerRef.current,
|
|
93
|
+
isOpen: isOpen,
|
|
94
|
+
handleClickOutside: onClose,
|
|
95
|
+
handleEscapeKeydown: onClose,
|
|
96
|
+
trigger: trigger,
|
|
97
|
+
scrollableElement: containerRef.current,
|
|
98
|
+
arrowKeyNavigationProviderOptions: {
|
|
99
|
+
type: ArrowKeyNavigationType.MENU
|
|
100
|
+
}
|
|
101
|
+
}, jsx(ButtonItem, {
|
|
102
|
+
key: "edit.link",
|
|
103
|
+
onClick: onEditLink,
|
|
104
|
+
testId: "edit-dropdown-edit-link-item"
|
|
105
|
+
}, jsx(FormattedMessage, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
106
|
+
key: "edit.datasource",
|
|
107
|
+
onClick: onEditDatasource,
|
|
108
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
109
|
+
}, jsx(FormattedMessage, messages.editDropdownEditDatasourceTitle))));
|
|
110
|
+
}
|
|
111
|
+
case 'none':
|
|
112
|
+
default:
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
export default EditToolbarButtonPresentation;
|
|
@@ -12,11 +12,14 @@ import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator
|
|
|
12
12
|
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
13
13
|
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
14
14
|
import { ButtonItem } from '@atlaskit/menu';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { Flex } from '@atlaskit/primitives';
|
|
16
|
-
import { editDatasource } from '
|
|
17
|
-
import { focusEditorView, isDatasourceConfigEditable } from '
|
|
18
|
-
import { CardContextProvider } from '
|
|
19
|
-
import {
|
|
17
|
+
import { editDatasource } from '../../ui/EditDatasourceButton';
|
|
18
|
+
import { focusEditorView, isDatasourceConfigEditable } from '../../utils';
|
|
19
|
+
import { CardContextProvider } from '../CardContextProvider';
|
|
20
|
+
import { useFetchDatasourceDataInfo } from '../useFetchDatasourceDataInfo';
|
|
21
|
+
import { useFetchDatasourceInfo } from '../useFetchDatasourceInfo';
|
|
22
|
+
import EditToolbarButtonPresentation from './EditToolbarButtonPresentation';
|
|
20
23
|
var dropdownExpandContainer = css({
|
|
21
24
|
margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
|
|
22
25
|
});
|
|
@@ -144,6 +147,91 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
144
147
|
return null;
|
|
145
148
|
}
|
|
146
149
|
};
|
|
150
|
+
var EditToolbarButtonWithUrl = function EditToolbarButtonWithUrl(props) {
|
|
151
|
+
var cardContext = props.cardContext,
|
|
152
|
+
currentAppearance = props.currentAppearance,
|
|
153
|
+
editorAnalyticsApi = props.editorAnalyticsApi,
|
|
154
|
+
editorView = props.editorView,
|
|
155
|
+
intl = props.intl,
|
|
156
|
+
onLinkEditClick = props.onLinkEditClick,
|
|
157
|
+
url = props.url;
|
|
158
|
+
var _useFetchDatasourceIn2 = useFetchDatasourceInfo({
|
|
159
|
+
isRegularCardNode: true,
|
|
160
|
+
url: url,
|
|
161
|
+
cardContext: cardContext
|
|
162
|
+
}),
|
|
163
|
+
extensionKey = _useFetchDatasourceIn2.extensionKey,
|
|
164
|
+
datasourceId = _useFetchDatasourceIn2.datasourceId;
|
|
165
|
+
var editVariant = useMemo(function () {
|
|
166
|
+
var _cardContext$store2, _urlState$error2;
|
|
167
|
+
if (!datasourceId || !isDatasourceConfigEditable(datasourceId)) {
|
|
168
|
+
return 'edit-link';
|
|
169
|
+
}
|
|
170
|
+
var urlState = cardContext === null || cardContext === void 0 || (_cardContext$store2 = cardContext.store) === null || _cardContext$store2 === void 0 ? void 0 : _cardContext$store2.getState()[url];
|
|
171
|
+
if ((urlState === null || urlState === void 0 || (_urlState$error2 = urlState.error) === null || _urlState$error2 === void 0 ? void 0 : _urlState$error2.kind) === 'fatal') {
|
|
172
|
+
return 'edit-link';
|
|
173
|
+
}
|
|
174
|
+
return 'edit-dropdown';
|
|
175
|
+
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, datasourceId, url]);
|
|
176
|
+
return jsx(EditToolbarButtonPresentation, {
|
|
177
|
+
datasourceId: datasourceId,
|
|
178
|
+
currentAppearance: currentAppearance,
|
|
179
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
180
|
+
editVariant: editVariant,
|
|
181
|
+
editorView: editorView,
|
|
182
|
+
extensionKey: extensionKey,
|
|
183
|
+
onLinkEditClick: onLinkEditClick,
|
|
184
|
+
intl: intl
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasourceId(props) {
|
|
188
|
+
var currentAppearance = props.currentAppearance,
|
|
189
|
+
editorAnalyticsApi = props.editorAnalyticsApi,
|
|
190
|
+
editorView = props.editorView,
|
|
191
|
+
intl = props.intl,
|
|
192
|
+
onLinkEditClick = props.onLinkEditClick,
|
|
193
|
+
datasourceId = props.datasourceId,
|
|
194
|
+
node = props.node;
|
|
195
|
+
var fetchData = useMemo(function () {
|
|
196
|
+
try {
|
|
197
|
+
var _attrs$datasource$vie;
|
|
198
|
+
var attrs = node.attrs;
|
|
199
|
+
var parameters = attrs.datasource.parameters;
|
|
200
|
+
var visibleColumnKeys = (_attrs$datasource$vie = attrs.datasource.views[0]) === null || _attrs$datasource$vie === void 0 || (_attrs$datasource$vie = _attrs$datasource$vie.properties) === null || _attrs$datasource$vie === void 0 ? void 0 : _attrs$datasource$vie.columns.map(function (c) {
|
|
201
|
+
return c.key;
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
parameters: parameters,
|
|
205
|
+
visibleColumnKeys: visibleColumnKeys
|
|
206
|
+
};
|
|
207
|
+
} catch (e) {
|
|
208
|
+
// eslint-disable-next-line no-console
|
|
209
|
+
console.error(e);
|
|
210
|
+
}
|
|
211
|
+
}, [node.attrs]);
|
|
212
|
+
var _useFetchDatasourceDa = useFetchDatasourceDataInfo({
|
|
213
|
+
datasourceId: datasourceId,
|
|
214
|
+
parameters: fetchData === null || fetchData === void 0 ? void 0 : fetchData.parameters,
|
|
215
|
+
visibleColumnKeys: fetchData === null || fetchData === void 0 ? void 0 : fetchData.visibleColumnKeys
|
|
216
|
+
}),
|
|
217
|
+
extensionKey = _useFetchDatasourceDa.extensionKey;
|
|
218
|
+
var editVariant = useMemo(function () {
|
|
219
|
+
if (!datasourceId || !isDatasourceConfigEditable(datasourceId)) {
|
|
220
|
+
return 'none';
|
|
221
|
+
}
|
|
222
|
+
return 'edit-datasource';
|
|
223
|
+
}, [datasourceId]);
|
|
224
|
+
return jsx(EditToolbarButtonPresentation, {
|
|
225
|
+
datasourceId: datasourceId,
|
|
226
|
+
currentAppearance: currentAppearance,
|
|
227
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
228
|
+
editVariant: editVariant,
|
|
229
|
+
editorView: editorView,
|
|
230
|
+
extensionKey: extensionKey,
|
|
231
|
+
onLinkEditClick: onLinkEditClick,
|
|
232
|
+
intl: intl
|
|
233
|
+
});
|
|
234
|
+
};
|
|
147
235
|
export var EditToolbarButton = function EditToolbarButton(props) {
|
|
148
236
|
var currentAppearance = props.currentAppearance,
|
|
149
237
|
datasourceId = props.datasourceId,
|
|
@@ -154,6 +242,30 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
154
242
|
url = props.url;
|
|
155
243
|
return jsx(CardContextProvider, null, function (_ref) {
|
|
156
244
|
var cardContext = _ref.cardContext;
|
|
245
|
+
if (fg('enable_datasource_nourl_edit_dropdown_datafetch')) {
|
|
246
|
+
if (props.url) {
|
|
247
|
+
return jsx(EditToolbarButtonWithUrl, {
|
|
248
|
+
url: props.url,
|
|
249
|
+
intl: intl,
|
|
250
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
251
|
+
editorView: editorView,
|
|
252
|
+
cardContext: cardContext,
|
|
253
|
+
onLinkEditClick: onLinkEditClick,
|
|
254
|
+
currentAppearance: currentAppearance
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (props.datasourceId && props.node) {
|
|
258
|
+
return jsx(EditToolbarButtonWithDatasourceId, {
|
|
259
|
+
datasourceId: props.datasourceId,
|
|
260
|
+
node: props.node,
|
|
261
|
+
intl: intl,
|
|
262
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
263
|
+
editorView: editorView,
|
|
264
|
+
onLinkEditClick: onLinkEditClick,
|
|
265
|
+
currentAppearance: currentAppearance
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
157
269
|
return jsx(EditToolbarButtonWithCardContext, {
|
|
158
270
|
datasourceId: datasourceId,
|
|
159
271
|
url: url,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension';
|
|
7
|
+
export var useFetchDatasourceDataInfo = function useFetchDatasourceDataInfo(_ref) {
|
|
8
|
+
var datasourceId = _ref.datasourceId,
|
|
9
|
+
parameters = _ref.parameters,
|
|
10
|
+
visibleColumnKeys = _ref.visibleColumnKeys;
|
|
11
|
+
var _useState = useState(undefined),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
extensionKey = _useState2[0],
|
|
14
|
+
setExtensionKey = _useState2[1];
|
|
15
|
+
var _useDatasourceClientE = useDatasourceClientExtension(),
|
|
16
|
+
getDatasourceData = _useDatasourceClientE.getDatasourceData;
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var fetchDatasource = /*#__PURE__*/function () {
|
|
19
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
20
|
+
var datasourceDataRequest, _yield$getDatasourceD, meta;
|
|
21
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
_context.prev = 0;
|
|
25
|
+
if (!(!datasourceId || !parameters || !visibleColumnKeys)) {
|
|
26
|
+
_context.next = 3;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return _context.abrupt("return");
|
|
30
|
+
case 3:
|
|
31
|
+
datasourceDataRequest = {
|
|
32
|
+
parameters: parameters,
|
|
33
|
+
pageSize: DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE,
|
|
34
|
+
pageCursor: undefined,
|
|
35
|
+
fields: visibleColumnKeys,
|
|
36
|
+
includeSchema: true
|
|
37
|
+
};
|
|
38
|
+
_context.next = 6;
|
|
39
|
+
return getDatasourceData(datasourceId, datasourceDataRequest, false);
|
|
40
|
+
case 6:
|
|
41
|
+
_yield$getDatasourceD = _context.sent;
|
|
42
|
+
meta = _yield$getDatasourceD.meta;
|
|
43
|
+
setExtensionKey(meta.extensionKey);
|
|
44
|
+
_context.next = 15;
|
|
45
|
+
break;
|
|
46
|
+
case 11:
|
|
47
|
+
_context.prev = 11;
|
|
48
|
+
_context.t0 = _context["catch"](0);
|
|
49
|
+
// eslint-disable-next-line no-console
|
|
50
|
+
console.error(_context.t0);
|
|
51
|
+
setExtensionKey(undefined);
|
|
52
|
+
case 15:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}, _callee, null, [[0, 11]]);
|
|
57
|
+
}));
|
|
58
|
+
return function fetchDatasource() {
|
|
59
|
+
return _ref2.apply(this, arguments);
|
|
60
|
+
};
|
|
61
|
+
}();
|
|
62
|
+
void fetchDatasource();
|
|
63
|
+
}, [getDatasourceData, visibleColumnKeys, parameters, datasourceId]);
|
|
64
|
+
return {
|
|
65
|
+
extensionKey: extensionKey
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -42,6 +42,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
42
42
|
onClickCallback?: OnClickCallback;
|
|
43
43
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
44
44
|
hoverPreviewOptions?: BaseCardProps['hoverPreviewOptions'];
|
|
45
|
+
__livePage?: boolean;
|
|
45
46
|
}
|
|
46
47
|
export interface SmartCardProps extends CardProps {
|
|
47
48
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
@@ -3,5 +3,5 @@ import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react
|
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
4
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
5
5
|
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, }: SmartCardProps) => JSX.Element | null>;
|
|
6
|
-
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
6
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage'>;
|
|
7
7
|
export declare function InlineCardNodeView(props: InlineNodeViewComponentProps & InlineCardNodeViewProps & InlineCardWithAwarenessProps): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { EditDatasourceToolbarButtonWithCommonProps, EditVariant } from './types';
|
|
3
|
+
interface EditToolbarPresentationProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
4
|
+
extensionKey?: string;
|
|
5
|
+
datasourceId?: string;
|
|
6
|
+
editVariant: EditVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const EditToolbarButtonPresentation: ({ datasourceId, currentAppearance, editorAnalyticsApi, editVariant, editorView, extensionKey, onLinkEditClick, intl, }: EditToolbarPresentationProps) => jsx.JSX.Element | null;
|
|
9
|
+
export default EditToolbarButtonPresentation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { type CardType } from '../../types';
|
|
8
|
+
export type EditVariant = 'none' | 'edit-link' | 'edit-datasource' | 'edit-dropdown';
|
|
9
|
+
export interface EditDatasourceToolbarButtonWithCommonProps {
|
|
10
|
+
intl: IntlShape;
|
|
11
|
+
onLinkEditClick: Command;
|
|
12
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
13
|
+
editorView?: EditorView;
|
|
14
|
+
currentAppearance?: CardType;
|
|
15
|
+
}
|
|
16
|
+
export interface EditDatasourceToolbarButtonWithUrlProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
17
|
+
cardContext?: CardContext;
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EditDatasourceToolbarButtonWithDatasourceIdProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
21
|
+
datasourceId: string;
|
|
22
|
+
node: Node;
|
|
23
|
+
}
|
|
24
|
+
export type EditDatasourceToolbarButtonProps = EditDatasourceToolbarButtonWithCommonProps & {
|
|
25
|
+
cardContext?: CardContext;
|
|
26
|
+
url?: string;
|
|
27
|
+
datasourceId?: string;
|
|
28
|
+
node?: Node;
|
|
29
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JiraIssueDatasourceParameters } from '@atlaskit/link-datasource';
|
|
2
|
+
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
3
|
+
export interface useFetchDatasourceDataInfoProps {
|
|
4
|
+
datasourceId: string;
|
|
5
|
+
parameters?: DatasourceParameters | JiraIssueDatasourceParameters;
|
|
6
|
+
visibleColumnKeys?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const useFetchDatasourceDataInfo: ({ datasourceId, parameters, visibleColumnKeys, }: useFetchDatasourceDataInfoProps) => {
|
|
9
|
+
extensionKey: string | undefined;
|
|
10
|
+
};
|
|
@@ -42,6 +42,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
42
42
|
onClickCallback?: OnClickCallback;
|
|
43
43
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
44
44
|
hoverPreviewOptions?: BaseCardProps['hoverPreviewOptions'];
|
|
45
|
+
__livePage?: boolean;
|
|
45
46
|
}
|
|
46
47
|
export interface SmartCardProps extends CardProps {
|
|
47
48
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
@@ -3,5 +3,5 @@ import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react
|
|
|
3
3
|
import type { SmartCardProps } from './genericCard';
|
|
4
4
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
5
5
|
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, showServerActions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, }: SmartCardProps) => JSX.Element | null>;
|
|
6
|
-
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
6
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'showServerActions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage'>;
|
|
7
7
|
export declare function InlineCardNodeView(props: InlineNodeViewComponentProps & InlineCardNodeViewProps & InlineCardWithAwarenessProps): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import type { EditDatasourceToolbarButtonWithCommonProps, EditVariant } from './types';
|
|
3
|
+
interface EditToolbarPresentationProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
4
|
+
extensionKey?: string;
|
|
5
|
+
datasourceId?: string;
|
|
6
|
+
editVariant: EditVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const EditToolbarButtonPresentation: ({ datasourceId, currentAppearance, editorAnalyticsApi, editVariant, editorView, extensionKey, onLinkEditClick, intl, }: EditToolbarPresentationProps) => jsx.JSX.Element | null;
|
|
9
|
+
export default EditToolbarButtonPresentation;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
|
+
import { type CardType } from '../../types';
|
|
8
|
+
export type EditVariant = 'none' | 'edit-link' | 'edit-datasource' | 'edit-dropdown';
|
|
9
|
+
export interface EditDatasourceToolbarButtonWithCommonProps {
|
|
10
|
+
intl: IntlShape;
|
|
11
|
+
onLinkEditClick: Command;
|
|
12
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
13
|
+
editorView?: EditorView;
|
|
14
|
+
currentAppearance?: CardType;
|
|
15
|
+
}
|
|
16
|
+
export interface EditDatasourceToolbarButtonWithUrlProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
17
|
+
cardContext?: CardContext;
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EditDatasourceToolbarButtonWithDatasourceIdProps extends EditDatasourceToolbarButtonWithCommonProps {
|
|
21
|
+
datasourceId: string;
|
|
22
|
+
node: Node;
|
|
23
|
+
}
|
|
24
|
+
export type EditDatasourceToolbarButtonProps = EditDatasourceToolbarButtonWithCommonProps & {
|
|
25
|
+
cardContext?: CardContext;
|
|
26
|
+
url?: string;
|
|
27
|
+
datasourceId?: string;
|
|
28
|
+
node?: Node;
|
|
29
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JiraIssueDatasourceParameters } from '@atlaskit/link-datasource';
|
|
2
|
+
import type { DatasourceParameters } from '@atlaskit/linking-types';
|
|
3
|
+
export interface useFetchDatasourceDataInfoProps {
|
|
4
|
+
datasourceId: string;
|
|
5
|
+
parameters?: DatasourceParameters | JiraIssueDatasourceParameters;
|
|
6
|
+
visibleColumnKeys?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const useFetchDatasourceDataInfo: ({ datasourceId, parameters, visibleColumnKeys, }: useFetchDatasourceDataInfoProps) => {
|
|
9
|
+
extensionKey: string | undefined;
|
|
10
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/adf-schema": "^39.0.3",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.4.0",
|
|
38
|
-
"@atlaskit/editor-common": "^86.
|
|
38
|
+
"@atlaskit/editor-common": "^86.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.4.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-disabled": "^1.1.0",
|
|
@@ -104,6 +104,9 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"platform-feature-flags": {
|
|
107
|
+
"enable_datasource_nourl_edit_dropdown_datafetch": {
|
|
108
|
+
"type": "boolean"
|
|
109
|
+
},
|
|
107
110
|
"platform.linking-platform.enable-datasource-edit-dropdown-toolbar": {
|
|
108
111
|
"type": "boolean"
|
|
109
112
|
},
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type IntlShape } from 'react-intl-next';
|
|
3
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
|
-
import { type CardType } from '../types';
|
|
8
|
-
export interface EditDatasourceToolbarButtonProps {
|
|
9
|
-
datasourceId?: string;
|
|
10
|
-
intl: IntlShape;
|
|
11
|
-
onLinkEditClick: Command;
|
|
12
|
-
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
13
|
-
url?: string;
|
|
14
|
-
editorView?: EditorView;
|
|
15
|
-
cardContext?: CardContext;
|
|
16
|
-
currentAppearance?: CardType;
|
|
17
|
-
}
|
|
18
|
-
export declare const EditToolbarButton: (props: EditDatasourceToolbarButtonProps) => jsx.JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type IntlShape } from 'react-intl-next';
|
|
3
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
|
-
import { type CardType } from '../types';
|
|
8
|
-
export interface EditDatasourceToolbarButtonProps {
|
|
9
|
-
datasourceId?: string;
|
|
10
|
-
intl: IntlShape;
|
|
11
|
-
onLinkEditClick: Command;
|
|
12
|
-
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
13
|
-
url?: string;
|
|
14
|
-
editorView?: EditorView;
|
|
15
|
-
cardContext?: CardContext;
|
|
16
|
-
currentAppearance?: CardType;
|
|
17
|
-
}
|
|
18
|
-
export declare const EditToolbarButton: (props: EditDatasourceToolbarButtonProps) => jsx.JSX.Element;
|