@atlaskit/editor-plugin-card 1.14.5 → 1.15.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/.eslintrc.js +12 -12
- package/CHANGELOG.md +693 -684
- package/LICENSE.md +6 -8
- package/dist/cjs/pm-plugins/doc.js +21 -1
- package/dist/cjs/toolbar.js +36 -6
- package/dist/cjs/ui/EditDatasourceButton.js +5 -26
- package/dist/cjs/ui/EditToolbarButton.js +139 -0
- package/dist/cjs/utils.js +4 -1
- package/dist/es2019/pm-plugins/doc.js +22 -2
- package/dist/es2019/toolbar.js +33 -7
- package/dist/es2019/ui/EditDatasourceButton.js +1 -22
- package/dist/es2019/ui/EditToolbarButton.js +123 -0
- package/dist/es2019/utils.js +3 -0
- package/dist/esm/pm-plugins/doc.js +22 -2
- package/dist/esm/toolbar.js +38 -8
- package/dist/esm/ui/EditDatasourceButton.js +1 -22
- package/dist/esm/ui/EditToolbarButton.js +131 -0
- package/dist/esm/utils.js +3 -0
- package/dist/types/pm-plugins/doc.d.ts +1 -0
- package/dist/types/ui/EditDatasourceButton.d.ts +0 -2
- package/dist/types/ui/EditToolbarButton.d.ts +15 -0
- package/dist/types/ui/EditorAnalyticsContext.d.ts +1 -1
- package/dist/types/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
- package/dist/types/ui/EditorLinkingPlatformAnalytics/LinkEvents.d.ts +1 -1
- package/dist/types/ui/EditorSmartCardEvents.d.ts +1 -1
- package/dist/types/utils.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +1 -0
- package/dist/types-ts4.5/ui/EditDatasourceButton.d.ts +0 -2
- package/dist/types-ts4.5/ui/EditToolbarButton.d.ts +15 -0
- package/dist/types-ts4.5/ui/EditorAnalyticsContext.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/DatasourceEvents.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditorLinkingPlatformAnalytics/LinkEvents.d.ts +1 -1
- package/dist/types-ts4.5/ui/EditorSmartCardEvents.d.ts +1 -1
- package/dist/types-ts4.5/utils.d.ts +2 -0
- package/package.json +8 -6
- package/report.api.md +94 -96
|
@@ -6,12 +6,12 @@ import isEqual from 'lodash/isEqual';
|
|
|
6
6
|
import { isSafeUrl } from '@atlaskit/adf-schema';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, SMART_LINK_TYPE, unlinkPayload } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
9
|
-
import { getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { getDatasourceType, getLinkCreationAnalyticsEvent, isFromCurrentDomain, nodesBetweenChanged, processRawValue } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
11
11
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
12
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { appearanceForNodeType, isDatasourceConfigEditable, isDatasourceNode, selectedCardAppearance } from '../utils';
|
|
14
|
-
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
14
|
+
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash, showDatasourceModal } from './actions';
|
|
15
15
|
import { pluginKey } from './plugin-key';
|
|
16
16
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
17
17
|
/**
|
|
@@ -560,4 +560,24 @@ var updateDatasourceStash = function updateDatasourceStash(tr, selectedNode) {
|
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
+
};
|
|
564
|
+
export var editDatasource = function editDatasource(datasourceId, _editorAnalyticsApi) {
|
|
565
|
+
return function (state, dispatch) {
|
|
566
|
+
var datasourceType = getDatasourceType(datasourceId);
|
|
567
|
+
if (dispatch && datasourceType) {
|
|
568
|
+
var tr = state.tr;
|
|
569
|
+
showDatasourceModal(datasourceType)(tr);
|
|
570
|
+
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
571
|
+
// buildEditLinkPayload(
|
|
572
|
+
// type as
|
|
573
|
+
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
574
|
+
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
575
|
+
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
576
|
+
// ),
|
|
577
|
+
// )(tr);
|
|
578
|
+
dispatch(tr);
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
return false;
|
|
582
|
+
};
|
|
563
583
|
};
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -18,14 +18,15 @@ import CogIcon from '@atlaskit/icon/glyph/editor/settings';
|
|
|
18
18
|
import UnlinkIcon from '@atlaskit/icon/glyph/editor/unlink';
|
|
19
19
|
import OpenIcon from '@atlaskit/icon/glyph/shortcut';
|
|
20
20
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
|
-
import { changeSelectedCardToText } from './pm-plugins/doc';
|
|
21
|
+
import { changeSelectedCardToText, editDatasource } from './pm-plugins/doc';
|
|
22
22
|
import { pluginKey } from './pm-plugins/main';
|
|
23
23
|
import { DatasourceAppearanceButton } from './ui/DatasourceAppearanceButton';
|
|
24
|
-
import {
|
|
24
|
+
import { EditDatasourceButton } from './ui/EditDatasourceButton';
|
|
25
25
|
import { buildEditLinkToolbar, editLink, editLinkToolbarConfig } from './ui/EditLinkToolbar';
|
|
26
|
+
import { EditToolbarButton } from './ui/EditToolbarButton';
|
|
26
27
|
import { LinkToolbarAppearance } from './ui/LinkToolbarAppearance';
|
|
27
28
|
import { ToolbarViewedEvent } from './ui/ToolbarViewedEvent';
|
|
28
|
-
import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceConfigEditable, isDatasourceNode, titleUrlPairFromNode } from './utils';
|
|
29
|
+
import { appearanceForNodeType, displayInfoForCard, findCardInfo, isDatasourceConfigEditable, isDatasourceNode, isEditDropdownEnabled, titleUrlPairFromNode } from './utils';
|
|
29
30
|
export var removeCard = function removeCard(editorAnalyticsApi) {
|
|
30
31
|
return commandWithMetadata(function (state, dispatch) {
|
|
31
32
|
if (!(state.selection instanceof NodeSelection)) {
|
|
@@ -215,7 +216,20 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
215
216
|
return getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, node.attrs.datasource.id, state, cardOptions, currentAppearance, platform, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c = pluginInjectionApi.card) === null || _pluginInjectionApi$c === void 0 ? void 0 : _pluginInjectionApi$c.actions);
|
|
216
217
|
} else {
|
|
217
218
|
var inlineCard = state.schema.nodes.inlineCard;
|
|
218
|
-
var toolbarItems = [{
|
|
219
|
+
var toolbarItems = [isEditDropdownEnabled(platform) && cardOptions.allowDatasource ? {
|
|
220
|
+
type: 'custom',
|
|
221
|
+
fallback: [],
|
|
222
|
+
render: function render(editorView) {
|
|
223
|
+
return /*#__PURE__*/React.createElement(EditToolbarButton, {
|
|
224
|
+
key: "edit-toolbar-item",
|
|
225
|
+
url: url,
|
|
226
|
+
intl: intl,
|
|
227
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
228
|
+
editorView: editorView,
|
|
229
|
+
onLinkEditClick: editLink(editorAnalyticsApi)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
} : {
|
|
219
233
|
id: 'editor.link.edit',
|
|
220
234
|
type: 'button',
|
|
221
235
|
selected: false,
|
|
@@ -314,7 +328,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
314
328
|
type: 'separator'
|
|
315
329
|
}]));
|
|
316
330
|
}
|
|
317
|
-
var shouldShowDatasourceEditButton = platform !== 'mobile' && allowDatasource;
|
|
331
|
+
var shouldShowDatasourceEditButton = platform !== 'mobile' && allowDatasource && !getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar');
|
|
318
332
|
if (shouldShowDatasourceEditButton) {
|
|
319
333
|
toolbarItems.unshift({
|
|
320
334
|
type: 'custom',
|
|
@@ -374,7 +388,7 @@ export var getSettingsButtonGroup = function getSettingsButtonGroup(intl, editor
|
|
|
374
388
|
var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl, editorAnalyticsApi, node, hoverDecoration, datasourceId, state, cardOptions, currentAppearance, platform, cardActions) {
|
|
375
389
|
var _node$attrs3;
|
|
376
390
|
var toolbarItems = [];
|
|
377
|
-
if (isDatasourceConfigEditable(datasourceId)) {
|
|
391
|
+
if (isDatasourceConfigEditable(datasourceId) && !getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar')) {
|
|
378
392
|
toolbarItems.push({
|
|
379
393
|
id: 'editor.edit.datasource',
|
|
380
394
|
type: 'button',
|
|
@@ -388,6 +402,22 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
388
402
|
type: 'separator'
|
|
389
403
|
});
|
|
390
404
|
}
|
|
405
|
+
var editDropdownWithSeparator = [{
|
|
406
|
+
type: 'custom',
|
|
407
|
+
fallback: [],
|
|
408
|
+
render: function render(editorView) {
|
|
409
|
+
return /*#__PURE__*/React.createElement(EditToolbarButton, {
|
|
410
|
+
key: "edit-toolbar-item",
|
|
411
|
+
url: metadata.url,
|
|
412
|
+
intl: intl,
|
|
413
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
414
|
+
editorView: editorView,
|
|
415
|
+
onLinkEditClick: editLink(editorAnalyticsApi)
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}, {
|
|
419
|
+
type: 'separator'
|
|
420
|
+
}];
|
|
391
421
|
var canShowMainToolbar = function canShowMainToolbar() {
|
|
392
422
|
// we do not show smart-link or the datasource icons when the node does not have a url to resolve
|
|
393
423
|
if (!metadata.url) {
|
|
@@ -407,7 +437,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
407
437
|
allowEmbeds = cardOptions.allowEmbeds,
|
|
408
438
|
showUpgradeDiscoverability = cardOptions.showUpgradeDiscoverability;
|
|
409
439
|
var url = metadata.url;
|
|
410
|
-
toolbarItems.push({
|
|
440
|
+
toolbarItems.push.apply(toolbarItems, [{
|
|
411
441
|
type: 'custom',
|
|
412
442
|
fallback: [],
|
|
413
443
|
render: function render(editorView) {
|
|
@@ -443,7 +473,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
443
473
|
}
|
|
444
474
|
}, {
|
|
445
475
|
type: 'separator'
|
|
446
|
-
});
|
|
476
|
+
}].concat(_toConsumableArray(getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') ? [].concat(editDropdownWithSeparator) : [])));
|
|
447
477
|
}
|
|
448
478
|
if (node !== null && node !== void 0 && (_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.url) {
|
|
449
479
|
toolbarItems.push({
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
4
|
import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator, SmallerEditIcon } from '@atlaskit/editor-common/ui';
|
|
5
|
-
import { getDatasourceType } from '@atlaskit/editor-common/utils';
|
|
6
5
|
import { Flex } from '@atlaskit/primitives';
|
|
7
|
-
import {
|
|
6
|
+
import { editDatasource } from '../pm-plugins/doc';
|
|
8
7
|
import { isDatasourceConfigEditable } from '../utils';
|
|
9
8
|
import { CardContextProvider } from './CardContextProvider';
|
|
10
9
|
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
@@ -71,24 +70,4 @@ export var EditDatasourceButton = function EditDatasourceButton(_ref2) {
|
|
|
71
70
|
cardContext: cardContext
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
|
-
};
|
|
75
|
-
export var editDatasource = function editDatasource(datasourceId, editorAnalyticsApi) {
|
|
76
|
-
return function (state, dispatch) {
|
|
77
|
-
var datasourceType = getDatasourceType(datasourceId);
|
|
78
|
-
if (dispatch && datasourceType) {
|
|
79
|
-
var tr = state.tr;
|
|
80
|
-
showDatasourceModal(datasourceType)(tr);
|
|
81
|
-
// editorAnalyticsApi?.attachAnalyticsEvent(
|
|
82
|
-
// buildEditLinkPayload(
|
|
83
|
-
// type as
|
|
84
|
-
// | ACTION_SUBJECT_ID.CARD_INLINE
|
|
85
|
-
// | ACTION_SUBJECT_ID.CARD_BLOCK
|
|
86
|
-
// | ACTION_SUBJECT_ID.EMBEDS,
|
|
87
|
-
// ),
|
|
88
|
-
// )(tr);
|
|
89
|
-
dispatch(tr);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
};
|
|
94
73
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { css, jsx } from '@emotion/react';
|
|
5
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
+
import { linkToolbarMessages, cardMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
|
+
import { FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
8
|
+
import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
|
|
9
|
+
import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
10
|
+
import { ButtonItem } from '@atlaskit/menu';
|
|
11
|
+
import { Flex } from '@atlaskit/primitives';
|
|
12
|
+
import { editDatasource } from '../pm-plugins/doc';
|
|
13
|
+
import { isDatasourceConfigEditable } from '../utils';
|
|
14
|
+
import { CardContextProvider } from './CardContextProvider';
|
|
15
|
+
import { useFetchDatasourceInfo } from './useFetchDatasourceInfo';
|
|
16
|
+
var dropdownExpandContainer = css({
|
|
17
|
+
margin: "0px ".concat("var(--ds-space-negative-050, -4px)")
|
|
18
|
+
});
|
|
19
|
+
var EditButtonWithCardContext = function EditButtonWithCardContext(_ref) {
|
|
20
|
+
var cardContext = _ref.cardContext,
|
|
21
|
+
intl = _ref.intl,
|
|
22
|
+
editorAnalyticsApi = _ref.editorAnalyticsApi,
|
|
23
|
+
url = _ref.url,
|
|
24
|
+
editorView = _ref.editorView,
|
|
25
|
+
onLinkEditClick = _ref.onLinkEditClick;
|
|
26
|
+
var _useFetchDatasourceIn = useFetchDatasourceInfo({
|
|
27
|
+
isRegularCardNode: true,
|
|
28
|
+
url: url,
|
|
29
|
+
cardContext: cardContext
|
|
30
|
+
}),
|
|
31
|
+
datasourceId = _useFetchDatasourceIn.datasourceId;
|
|
32
|
+
var _useState = useState(false),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
isOpen = _useState2[0],
|
|
35
|
+
setIsOpen = _useState2[1];
|
|
36
|
+
var containerRef = useRef();
|
|
37
|
+
var toggleOpen = function toggleOpen() {
|
|
38
|
+
return setIsOpen(function (open) {
|
|
39
|
+
return !open;
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var onClose = function onClose() {
|
|
43
|
+
return setIsOpen(false);
|
|
44
|
+
};
|
|
45
|
+
var dispatchCommand = useCallback(function (fn) {
|
|
46
|
+
if (editorView) {
|
|
47
|
+
fn === null || fn === void 0 || fn(editorView.state, editorView.dispatch);
|
|
48
|
+
if (!editorView.hasFocus()) {
|
|
49
|
+
editorView.focus();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, [editorView]);
|
|
53
|
+
var onEditLink = useCallback(function () {
|
|
54
|
+
dispatchCommand(onLinkEditClick);
|
|
55
|
+
}, [dispatchCommand, onLinkEditClick]);
|
|
56
|
+
var shouldFallbackToEditButton = useMemo(function () {
|
|
57
|
+
if (!datasourceId || !isDatasourceConfigEditable(datasourceId)) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
if (url) {
|
|
61
|
+
var _cardContext$store, _urlState$error;
|
|
62
|
+
var urlState = cardContext === null || cardContext === void 0 || (_cardContext$store = cardContext.store) === null || _cardContext$store === void 0 ? void 0 : _cardContext$store.getState()[url];
|
|
63
|
+
if ((urlState === null || urlState === void 0 || (_urlState$error = urlState.error) === null || _urlState$error === void 0 ? void 0 : _urlState$error.kind) === 'fatal') {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}, [cardContext === null || cardContext === void 0 ? void 0 : cardContext.store, datasourceId, url]);
|
|
69
|
+
var onEditDatasource = useCallback(function () {
|
|
70
|
+
if (datasourceId) {
|
|
71
|
+
dispatchCommand(editDatasource(datasourceId, editorAnalyticsApi));
|
|
72
|
+
}
|
|
73
|
+
}, [dispatchCommand, datasourceId, editorAnalyticsApi]);
|
|
74
|
+
if (shouldFallbackToEditButton) {
|
|
75
|
+
return jsx(Button, {
|
|
76
|
+
testId: "edit-link",
|
|
77
|
+
onClick: onEditLink
|
|
78
|
+
}, jsx(FormattedMessage, linkToolbarMessages.editLink));
|
|
79
|
+
}
|
|
80
|
+
var trigger = jsx(Button, {
|
|
81
|
+
testId: "edit-dropdown-trigger",
|
|
82
|
+
iconAfter: jsx("span", {
|
|
83
|
+
css: dropdownExpandContainer
|
|
84
|
+
}, jsx(ExpandIcon, {
|
|
85
|
+
label: intl.formatMessage(messages.editDropdownTriggerTitle)
|
|
86
|
+
})),
|
|
87
|
+
onClick: toggleOpen,
|
|
88
|
+
selected: isOpen,
|
|
89
|
+
disabled: false,
|
|
90
|
+
ariaHasPopup: true
|
|
91
|
+
}, jsx(FormattedMessage, messages.editDropdownTriggerTitle));
|
|
92
|
+
return jsx(Flex, {
|
|
93
|
+
ref: containerRef
|
|
94
|
+
}, jsx(UiDropdown, {
|
|
95
|
+
mountTo: containerRef.current,
|
|
96
|
+
isOpen: isOpen,
|
|
97
|
+
handleClickOutside: onClose,
|
|
98
|
+
handleEscapeKeydown: onClose,
|
|
99
|
+
trigger: trigger,
|
|
100
|
+
scrollableElement: containerRef.current,
|
|
101
|
+
arrowKeyNavigationProviderOptions: {
|
|
102
|
+
type: ArrowKeyNavigationType.MENU
|
|
103
|
+
}
|
|
104
|
+
}, jsx(ButtonItem, {
|
|
105
|
+
key: "edit.link",
|
|
106
|
+
onClick: onEditLink,
|
|
107
|
+
testId: "edit-dropdown-edit-link-item"
|
|
108
|
+
}, jsx(FormattedMessage, messages.editDropdownEditLinkTitle)), jsx(ButtonItem, {
|
|
109
|
+
key: "edit.datasource",
|
|
110
|
+
onClick: onEditDatasource,
|
|
111
|
+
testId: "edit-dropdown-edit-datasource-item"
|
|
112
|
+
}, jsx(FormattedMessage, messages.editDropdownEditDatasourceTitle))));
|
|
113
|
+
};
|
|
114
|
+
export var EditToolbarButton = function EditToolbarButton(_ref2) {
|
|
115
|
+
var intl = _ref2.intl,
|
|
116
|
+
editorAnalyticsApi = _ref2.editorAnalyticsApi,
|
|
117
|
+
url = _ref2.url,
|
|
118
|
+
editorView = _ref2.editorView,
|
|
119
|
+
onLinkEditClick = _ref2.onLinkEditClick;
|
|
120
|
+
return jsx(CardContextProvider, null, function (_ref3) {
|
|
121
|
+
var cardContext = _ref3.cardContext;
|
|
122
|
+
return jsx(EditButtonWithCardContext, {
|
|
123
|
+
url: url,
|
|
124
|
+
intl: intl,
|
|
125
|
+
editorAnalyticsApi: editorAnalyticsApi,
|
|
126
|
+
editorView: editorView,
|
|
127
|
+
cardContext: cardContext,
|
|
128
|
+
onLinkEditClick: onLinkEditClick
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
package/dist/esm/utils.js
CHANGED
|
@@ -80,6 +80,9 @@ export var isDatasourceConfigEditable = function isDatasourceConfigEditable(data
|
|
|
80
80
|
}
|
|
81
81
|
return datasourcesWithConfigModal.includes(datasourceId);
|
|
82
82
|
};
|
|
83
|
+
export var isEditDropdownEnabled = function isEditDropdownEnabled(platform) {
|
|
84
|
+
return getBooleanFF('platform.linking-platform.enable-datasource-edit-dropdown-toolbar') && platform !== 'mobile';
|
|
85
|
+
};
|
|
83
86
|
|
|
84
87
|
/**
|
|
85
88
|
* Typeguard that checks node attributes are datasource node attributes
|
|
@@ -38,4 +38,5 @@ export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf |
|
|
|
38
38
|
* Get attributes for new Card Appearance
|
|
39
39
|
*/
|
|
40
40
|
export declare const getAttrsForAppearance: (appearance: CardAppearance, selectedNode: Node) => import("prosemirror-model").Attrs;
|
|
41
|
+
export declare const editDatasource: (datasourceId: string, _editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
41
42
|
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { IntlShape } from 'react-intl-next';
|
|
4
4
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
5
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
7
|
import type { CardContext } from '@atlaskit/link-provider';
|
|
@@ -15,4 +14,3 @@ export interface EditDatasourceButtonProps {
|
|
|
15
14
|
cardContext?: CardContext;
|
|
16
15
|
}
|
|
17
16
|
export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, }: EditDatasourceButtonProps) => jsx.JSX.Element;
|
|
18
|
-
export declare const editDatasource: (datasourceId: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export interface EditToolbarButtonProps {
|
|
8
|
+
intl: IntlShape;
|
|
9
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
10
|
+
url?: string;
|
|
11
|
+
editorView?: EditorView;
|
|
12
|
+
cardContext?: CardContext;
|
|
13
|
+
onLinkEditClick: Command;
|
|
14
|
+
}
|
|
15
|
+
export declare const EditToolbarButton: ({ intl, editorAnalyticsApi, url, editorView, onLinkEditClick, }: EditToolbarButtonProps) => jsx.JSX.Element;
|
|
@@ -7,4 +7,4 @@ export type EditorAnalyticsContextProps = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Provides location attribute to child events
|
|
9
9
|
*/
|
|
10
|
-
export declare const EditorAnalyticsContext: ({ editorView, children
|
|
10
|
+
export declare const EditorAnalyticsContext: ({ editorView, children }: EditorAnalyticsContextProps) => JSX.Element;
|
|
@@ -3,4 +3,4 @@ import type { AnalyticsBindingsProps } from './common';
|
|
|
3
3
|
* Subscribes to the events occuring in the card
|
|
4
4
|
* plugin and fires analytics events accordingly
|
|
5
5
|
*/
|
|
6
|
-
export declare const DatasourceEventsBinding: ({ cardPluginEvents
|
|
6
|
+
export declare const DatasourceEventsBinding: ({ cardPluginEvents }: AnalyticsBindingsProps) => null;
|
|
@@ -3,4 +3,4 @@ import type { AnalyticsBindingsProps } from './common';
|
|
|
3
3
|
* Subscribes to the events occuring in the card
|
|
4
4
|
* plugin and fires analytics events accordingly
|
|
5
5
|
*/
|
|
6
|
-
export declare const LinkEventsBinding: ({ cardPluginEvents
|
|
6
|
+
export declare const LinkEventsBinding: ({ cardPluginEvents }: AnalyticsBindingsProps) => null;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
|
2
2
|
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { CardContext } from '@atlaskit/link-provider';
|
|
5
|
+
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
5
6
|
import type { CardInfo, DatasourceNode } from './types';
|
|
6
7
|
export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
|
|
7
8
|
export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
|
|
@@ -22,6 +23,7 @@ export declare const isEmbedSupportedAtPosition: (currentNodePosition: number, e
|
|
|
22
23
|
export declare const isBlockSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
|
|
23
24
|
export declare const getResolvedAttributesFromStore: (url: string, display: string | null, store?: CardContext['store']) => {};
|
|
24
25
|
export declare const isDatasourceConfigEditable: (datasourceId: string) => boolean;
|
|
26
|
+
export declare const isEditDropdownEnabled: (platform?: CardPlatform) => boolean;
|
|
25
27
|
/**
|
|
26
28
|
* Typeguard that checks node attributes are datasource node attributes
|
|
27
29
|
* ** WARNING ** Typeguards are not a guarantee, if the asserted type changes
|
|
@@ -38,4 +38,5 @@ export declare const insertDatasource: (state: EditorState, adf: DatasourceAdf |
|
|
|
38
38
|
* Get attributes for new Card Appearance
|
|
39
39
|
*/
|
|
40
40
|
export declare const getAttrsForAppearance: (appearance: CardAppearance, selectedNode: Node) => import("prosemirror-model").Attrs;
|
|
41
|
+
export declare const editDatasource: (datasourceId: string, _editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
41
42
|
export {};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import type { IntlShape } from 'react-intl-next';
|
|
4
4
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
6
5
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
6
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
7
|
import type { CardContext } from '@atlaskit/link-provider';
|
|
@@ -15,4 +14,3 @@ export interface EditDatasourceButtonProps {
|
|
|
15
14
|
cardContext?: CardContext;
|
|
16
15
|
}
|
|
17
16
|
export declare const EditDatasourceButton: ({ intl, editorAnalyticsApi, url, editorView, editorState, }: EditDatasourceButtonProps) => jsx.JSX.Element;
|
|
18
|
-
export declare const editDatasource: (datasourceId: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export interface EditToolbarButtonProps {
|
|
8
|
+
intl: IntlShape;
|
|
9
|
+
editorAnalyticsApi?: EditorAnalyticsAPI;
|
|
10
|
+
url?: string;
|
|
11
|
+
editorView?: EditorView;
|
|
12
|
+
cardContext?: CardContext;
|
|
13
|
+
onLinkEditClick: Command;
|
|
14
|
+
}
|
|
15
|
+
export declare const EditToolbarButton: ({ intl, editorAnalyticsApi, url, editorView, onLinkEditClick, }: EditToolbarButtonProps) => jsx.JSX.Element;
|
|
@@ -7,4 +7,4 @@ export type EditorAnalyticsContextProps = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Provides location attribute to child events
|
|
9
9
|
*/
|
|
10
|
-
export declare const EditorAnalyticsContext: ({ editorView, children
|
|
10
|
+
export declare const EditorAnalyticsContext: ({ editorView, children }: EditorAnalyticsContextProps) => JSX.Element;
|
|
@@ -3,4 +3,4 @@ import type { AnalyticsBindingsProps } from './common';
|
|
|
3
3
|
* Subscribes to the events occuring in the card
|
|
4
4
|
* plugin and fires analytics events accordingly
|
|
5
5
|
*/
|
|
6
|
-
export declare const DatasourceEventsBinding: ({ cardPluginEvents
|
|
6
|
+
export declare const DatasourceEventsBinding: ({ cardPluginEvents }: AnalyticsBindingsProps) => null;
|
|
@@ -3,4 +3,4 @@ import type { AnalyticsBindingsProps } from './common';
|
|
|
3
3
|
* Subscribes to the events occuring in the card
|
|
4
4
|
* plugin and fires analytics events accordingly
|
|
5
5
|
*/
|
|
6
|
-
export declare const LinkEventsBinding: ({ cardPluginEvents
|
|
6
|
+
export declare const LinkEventsBinding: ({ cardPluginEvents }: AnalyticsBindingsProps) => null;
|
|
@@ -2,6 +2,7 @@ import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
|
2
2
|
import type { Node, NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { CardContext } from '@atlaskit/link-provider';
|
|
5
|
+
import type { CardPlatform } from '@atlaskit/smart-card';
|
|
5
6
|
import type { CardInfo, DatasourceNode } from './types';
|
|
6
7
|
export declare const appearanceForNodeType: (spec: NodeType) => CardAppearance | undefined;
|
|
7
8
|
export declare const selectedCardAppearance: (state: EditorState) => CardAppearance | undefined;
|
|
@@ -22,6 +23,7 @@ export declare const isEmbedSupportedAtPosition: (currentNodePosition: number, e
|
|
|
22
23
|
export declare const isBlockSupportedAtPosition: (currentNodePosition: number, editorState: EditorState, currentAppearance?: CardAppearance) => boolean;
|
|
23
24
|
export declare const getResolvedAttributesFromStore: (url: string, display: string | null, store?: CardContext['store']) => {};
|
|
24
25
|
export declare const isDatasourceConfigEditable: (datasourceId: string) => boolean;
|
|
26
|
+
export declare const isEditDropdownEnabled: (platform?: CardPlatform) => boolean;
|
|
25
27
|
/**
|
|
26
28
|
* Typeguard that checks node attributes are datasource node attributes
|
|
27
29
|
* ** WARNING ** Typeguards are not a guarantee, if the asserted type changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.1",
|
|
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": "^36.10.7",
|
|
36
36
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
37
37
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
38
|
-
"@atlaskit/editor-common": "^81.
|
|
38
|
+
"@atlaskit/editor-common": "^81.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-decorations": "^1.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
"@atlaskit/link-datasource": "^2.3.0",
|
|
54
54
|
"@atlaskit/linking-common": "^5.7.0",
|
|
55
55
|
"@atlaskit/linking-types": "^8.9.0",
|
|
56
|
+
"@atlaskit/menu": "2.3.1",
|
|
56
57
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
57
|
-
"@atlaskit/primitives": "^6.
|
|
58
|
-
"@atlaskit/smart-card": "^27.
|
|
58
|
+
"@atlaskit/primitives": "^6.4.0",
|
|
59
|
+
"@atlaskit/smart-card": "^27.4.0",
|
|
59
60
|
"@atlaskit/theme": "^12.8.0",
|
|
60
61
|
"@atlaskit/tokens": "^1.49.0",
|
|
61
62
|
"@atlaskit/tooltip": "^18.4.0",
|
|
@@ -71,7 +72,6 @@
|
|
|
71
72
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
|
|
75
75
|
"typescript": "~5.4.2"
|
|
76
76
|
},
|
|
77
77
|
"techstack": {
|
|
@@ -104,8 +104,10 @@
|
|
|
104
104
|
]
|
|
105
105
|
}
|
|
106
106
|
},
|
|
107
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
108
107
|
"platform-feature-flags": {
|
|
108
|
+
"platform.linking-platform.enable-datasource-edit-dropdown-toolbar": {
|
|
109
|
+
"type": "boolean"
|
|
110
|
+
},
|
|
109
111
|
"platform.linking-platform.smart-links-in-live-pages": {
|
|
110
112
|
"type": "boolean"
|
|
111
113
|
},
|