@atlaskit/editor-plugin-card 38.0.0 → 39.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/cjs/nodeviews/datasource.js +15 -2
- package/dist/cjs/pm-plugins/doc.js +7 -0
- package/dist/cjs/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/cjs/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/cjs/ui/EditToolbarButton/index.js +12 -24
- package/dist/cjs/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/cjs/ui/LinkToolbarAppearanceDropdown.js +39 -13
- package/dist/cjs/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/cjs/ui/OpenPreviewButton/index.js +3 -26
- package/dist/cjs/ui/toolbar.js +127 -364
- package/dist/es2019/nodeviews/datasource.js +14 -3
- package/dist/es2019/pm-plugins/doc.js +7 -0
- package/dist/es2019/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/es2019/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/es2019/ui/EditToolbarButton/index.js +12 -24
- package/dist/es2019/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/es2019/ui/LinkToolbarAppearanceDropdown.js +36 -10
- package/dist/es2019/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/es2019/ui/OpenPreviewButton/index.js +3 -26
- package/dist/es2019/ui/toolbar.js +125 -352
- package/dist/esm/nodeviews/datasource.js +15 -2
- package/dist/esm/pm-plugins/doc.js +7 -0
- package/dist/esm/ui/DatasourceAppearanceButton.js +4 -8
- package/dist/esm/ui/EditToolbarButton/EditToolbarButtonPresentation.js +11 -26
- package/dist/esm/ui/EditToolbarButton/index.js +12 -24
- package/dist/esm/ui/HyperlinkToolbarAppearanceDropdown.js +6 -13
- package/dist/esm/ui/LinkToolbarAppearanceDropdown.js +36 -10
- package/dist/esm/ui/OpenLinkToolbarButton/index.js +1 -3
- package/dist/esm/ui/OpenPreviewButton/index.js +3 -26
- package/dist/esm/ui/toolbar.js +126 -361
- package/dist/types/ui/DatasourceAppearanceButton.d.ts +1 -2
- package/dist/types/ui/EditToolbarButton/EditToolbarButtonPresentation.d.ts +1 -1
- package/dist/types/ui/EditToolbarButton/types.d.ts +0 -1
- package/dist/types/ui/HyperlinkToolbarAppearanceDropdown.d.ts +16 -1
- package/dist/types/ui/LinkToolbarAppearanceDropdown.d.ts +24 -2
- package/dist/types/ui/OpenLinkToolbarButton/index.d.ts +1 -2
- package/dist/types/ui/OpenPreviewButton/index.d.ts +1 -2
- package/dist/types/ui/toolbar.d.ts +1 -2
- package/package.json +19 -19
- package/dist/cjs/ui/HyperlinkToolbarAppearance.js +0 -162
- package/dist/cjs/ui/LinkToolbarAppearance.js +0 -174
- package/dist/es2019/ui/HyperlinkToolbarAppearance.js +0 -86
- package/dist/es2019/ui/LinkToolbarAppearance.js +0 -145
- package/dist/esm/ui/HyperlinkToolbarAppearance.js +0 -153
- package/dist/esm/ui/LinkToolbarAppearance.js +0 -167
- package/dist/types/ui/HyperlinkToolbarAppearance.d.ts +0 -18
- package/dist/types/ui/LinkToolbarAppearance.d.ts +0 -25
|
@@ -19,6 +19,7 @@ import React from 'react';
|
|
|
19
19
|
|
|
20
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
21
21
|
import { jsx } from '@emotion/react';
|
|
22
|
+
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
22
23
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
23
24
|
import { DATASOURCE_INNER_CONTAINER_CLASSNAME, SmartCardSharedCssClassName } from '@atlaskit/editor-common/styles/smart-card';
|
|
24
25
|
import UnsupportedInline from '@atlaskit/editor-common/UnsupportedInline';
|
|
@@ -27,6 +28,7 @@ import { DatasourceTableViewWithWrappers as DatasourceTableView } from '@atlaski
|
|
|
27
28
|
import { EditorSmartCardProvider } from '@atlaskit/link-provider/editor-smart-card-provider';
|
|
28
29
|
import { EditorSmartCardProviderValueGuard } from '@atlaskit/link-provider/editor-smart-card-provider-value-guard';
|
|
29
30
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common/constants';
|
|
31
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
30
32
|
import { DatasourceErrorBoundary } from '../ui/datasourceErrorBoundary';
|
|
31
33
|
import { EditorAnalyticsContext } from '../ui/EditorAnalyticsContext';
|
|
32
34
|
var getPosSafely = function getPosSafely(pos) {
|
|
@@ -59,8 +61,13 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
59
61
|
_this$getColumnsInfo$ = _this$getColumnsInfo.wrappedColumnKeys,
|
|
60
62
|
wrappedColumnKeys = _this$getColumnsInfo$ === void 0 ? [] : _this$getColumnsInfo$,
|
|
61
63
|
_this$getColumnsInfo$2 = _this$getColumnsInfo.columnCustomSizes,
|
|
62
|
-
columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2
|
|
63
|
-
|
|
64
|
+
columnCustomSizes = _this$getColumnsInfo$2 === void 0 ? {} : _this$getColumnsInfo$2,
|
|
65
|
+
_this$getColumnsInfo$3 = _this$getColumnsInfo.visibleColumnKeys,
|
|
66
|
+
visibleColumnKeys = _this$getColumnsInfo$3 === void 0 ? [] : _this$getColumnsInfo$3;
|
|
67
|
+
// With no saved columns, the table view calls this itself to save its default columns once
|
|
68
|
+
// they load. The experiment is checked last so only that automatic update is exposed.
|
|
69
|
+
var isDefaultColumnsUpdate = visibleColumnKeys.length === 0 && isExperimentEnabled('platform_editor_phantom_edit_fix');
|
|
70
|
+
_this.updateTableProperties(columnKeys, columnCustomSizes, wrappedColumnKeys, isDefaultColumnsUpdate);
|
|
64
71
|
});
|
|
65
72
|
_defineProperty(_this, "handleColumnResize", function (key, width) {
|
|
66
73
|
var _this$getColumnsInfo2 = _this.getColumnsInfo(),
|
|
@@ -109,6 +116,7 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
109
116
|
return _createClass(DatasourceComponent, [{
|
|
110
117
|
key: "updateTableProperties",
|
|
111
118
|
value: function updateTableProperties(columnKeysArg, columnCustomSizes, wrappedColumnKeys) {
|
|
119
|
+
var tintDirtyTr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
112
120
|
var _this$props$view = this.props.view,
|
|
113
121
|
state = _this$props$view.state,
|
|
114
122
|
dispatch = _this$props$view.dispatch;
|
|
@@ -149,6 +157,11 @@ export var DatasourceComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
149
157
|
// Ensures dispatch does not contribute to undo history (otherwise user requires three undo's to revert table)
|
|
150
158
|
tr.setMeta('addToHistory', false);
|
|
151
159
|
tr.setMeta('scrollIntoView', false);
|
|
160
|
+
if (tintDirtyTr) {
|
|
161
|
+
// Tint as dirty: saving the table's default columns isn't a user edit. Hosts autosave
|
|
162
|
+
// local organic changes, so a viewer would create a new version of a live doc.
|
|
163
|
+
tintDirtyTransaction(tr);
|
|
164
|
+
}
|
|
152
165
|
dispatch(tr);
|
|
153
166
|
}
|
|
154
167
|
}, {
|
|
@@ -9,12 +9,14 @@ import { unlinkPayload } from '@atlaskit/editor-common/analytics/linking-utils';
|
|
|
9
9
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/enums';
|
|
10
10
|
import { SMART_LINK_TYPE } from '@atlaskit/editor-common/analytics/types/node-events';
|
|
11
11
|
import { addLinkMetadata } from '@atlaskit/editor-common/card';
|
|
12
|
+
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
12
13
|
import { getActiveLinkMark } from '@atlaskit/editor-common/link/utils';
|
|
13
14
|
import { processRawValue } from '@atlaskit/editor-common/process-raw-value';
|
|
14
15
|
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils/annotation';
|
|
15
16
|
import { nodesBetweenChanged } from '@atlaskit/editor-common/utils/document';
|
|
16
17
|
import { getLinkCreationAnalyticsEvent, isFromCurrentDomain } from '@atlaskit/editor-common/utils/hyperlink';
|
|
17
18
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
19
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
18
20
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
21
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|
|
20
22
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
@@ -414,6 +416,11 @@ export var changeSelectedCardToLinkFallback = function changeSelectedCardToLinkF
|
|
|
414
416
|
})(tr);
|
|
415
417
|
}
|
|
416
418
|
if (dispatch) {
|
|
419
|
+
if (isExperimentEnabled('platform_editor_phantom_edit_fix')) {
|
|
420
|
+
// Tint as dirty: falling back to a link after a resolve error isn't a user edit. Hosts
|
|
421
|
+
// autosave local organic changes, so a viewer would create a new version of a live doc.
|
|
422
|
+
tintDirtyTransaction(tr);
|
|
423
|
+
}
|
|
417
424
|
dispatch(tr.setMeta('addToHistory', false));
|
|
418
425
|
}
|
|
419
426
|
return true;
|
|
@@ -27,8 +27,7 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
27
27
|
editorView = _ref.editorView,
|
|
28
28
|
editorState = _ref.editorState,
|
|
29
29
|
selected = _ref.selected,
|
|
30
|
-
inputMethod = _ref.inputMethod
|
|
31
|
-
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
30
|
+
inputMethod = _ref.inputMethod;
|
|
32
31
|
var _useFetchDatasourceIn = useFetchDatasourceInfo({
|
|
33
32
|
isRegularCardNode: true,
|
|
34
33
|
url: url,
|
|
@@ -95,8 +94,7 @@ var DatasourceAppearanceButtonWithCardContext = function DatasourceAppearanceBut
|
|
|
95
94
|
}),
|
|
96
95
|
selected: selected,
|
|
97
96
|
onClick: onChangeAppearance,
|
|
98
|
-
testId: 'card-datasource-appearance-button'
|
|
99
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
97
|
+
testId: 'card-datasource-appearance-button'
|
|
100
98
|
}));
|
|
101
99
|
};
|
|
102
100
|
export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref2) {
|
|
@@ -106,8 +104,7 @@ export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref
|
|
|
106
104
|
editorView = _ref2.editorView,
|
|
107
105
|
editorState = _ref2.editorState,
|
|
108
106
|
selected = _ref2.selected,
|
|
109
|
-
inputMethod = _ref2.inputMethod
|
|
110
|
-
areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
|
|
107
|
+
inputMethod = _ref2.inputMethod;
|
|
111
108
|
var cardContext = useSmartLinkContext();
|
|
112
109
|
return jsx(DatasourceAppearanceButtonWithCardContext, {
|
|
113
110
|
url: url,
|
|
@@ -117,7 +114,6 @@ export var DatasourceAppearanceButton = function DatasourceAppearanceButton(_ref
|
|
|
117
114
|
editorState: editorState,
|
|
118
115
|
cardContext: cardContext,
|
|
119
116
|
selected: selected,
|
|
120
|
-
inputMethod: inputMethod
|
|
121
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
117
|
+
inputMethod: inputMethod
|
|
122
118
|
});
|
|
123
119
|
};
|
|
@@ -9,7 +9,6 @@ import { useCallback, useRef, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { FormattedMessage } from 'react-intl';
|
|
11
11
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
12
|
-
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
13
12
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
14
13
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
15
14
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
@@ -31,8 +30,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
31
30
|
editorView = _ref.editorView,
|
|
32
31
|
extensionKey = _ref.extensionKey,
|
|
33
32
|
onLinkEditClick = _ref.onLinkEditClick,
|
|
34
|
-
intl = _ref.intl
|
|
35
|
-
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled;
|
|
33
|
+
intl = _ref.intl;
|
|
36
34
|
var _useState = useState(false),
|
|
37
35
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
36
|
isOpen = _useState2[0],
|
|
@@ -58,10 +56,7 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
58
56
|
focusEditorView(editorView);
|
|
59
57
|
}
|
|
60
58
|
}, [currentAppearance, datasourceId, editorAnalyticsApi, editorView, extensionKey]);
|
|
61
|
-
var
|
|
62
|
-
label: ""
|
|
63
|
-
}) : undefined;
|
|
64
|
-
var tooltipContent = areAnyNewToolbarFlagsEnabled ? intl.formatMessage(linkToolbarMessages.editLink) : undefined;
|
|
59
|
+
var editLinkLabel = intl.formatMessage(linkToolbarMessages.editLink);
|
|
65
60
|
switch (editVariant) {
|
|
66
61
|
case 'edit-link':
|
|
67
62
|
{
|
|
@@ -70,15 +65,11 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
70
65
|
}, jsx(Button, {
|
|
71
66
|
testId: "edit-link",
|
|
72
67
|
onClick: onEditLink,
|
|
73
|
-
icon:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// Ignored via go/ees005
|
|
79
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
80
|
-
, linkToolbarMessages.editLink)), !areAnyNewToolbarFlagsEnabled && jsx(Separator, {
|
|
81
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
68
|
+
icon: jsx(EditIcon, {
|
|
69
|
+
label: ""
|
|
70
|
+
}),
|
|
71
|
+
ariaLabel: editLinkLabel,
|
|
72
|
+
tooltipContent: editLinkLabel
|
|
82
73
|
}));
|
|
83
74
|
}
|
|
84
75
|
case 'edit-datasource':
|
|
@@ -88,14 +79,11 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
88
79
|
}, jsx(Button, {
|
|
89
80
|
testId: "edit-datasource",
|
|
90
81
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
91
|
-
onClick: onEditDatasource
|
|
92
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
82
|
+
onClick: onEditDatasource
|
|
93
83
|
}, jsx(FormattedMessage
|
|
94
84
|
// Ignored via go/ees005
|
|
95
85
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
96
|
-
, linkToolbarMessages.editDatasourceStandalone))
|
|
97
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
98
|
-
}));
|
|
86
|
+
, linkToolbarMessages.editDatasourceStandalone)));
|
|
99
87
|
}
|
|
100
88
|
case 'edit-dropdown':
|
|
101
89
|
{
|
|
@@ -112,14 +100,11 @@ var EditToolbarButtonPresentation = function EditToolbarButtonPresentation(_ref)
|
|
|
112
100
|
onClick: toggleOpen,
|
|
113
101
|
selected: isOpen,
|
|
114
102
|
disabled: false,
|
|
115
|
-
ariaHasPopup: true
|
|
116
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
103
|
+
ariaHasPopup: true
|
|
117
104
|
}, jsx(FormattedMessage
|
|
118
105
|
// Ignored via go/ees005
|
|
119
106
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
120
|
-
, messages.editDropdownTriggerTitle))
|
|
121
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
122
|
-
}));
|
|
107
|
+
, messages.editDropdownTriggerTitle)));
|
|
123
108
|
return jsx(Flex, {
|
|
124
109
|
ref: containerRef
|
|
125
110
|
}, jsx(UiDropdown, {
|
|
@@ -35,8 +35,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
35
35
|
editorView = props.editorView,
|
|
36
36
|
intl = props.intl,
|
|
37
37
|
onLinkEditClick = props.onLinkEditClick,
|
|
38
|
-
url = props.url
|
|
39
|
-
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
38
|
+
url = props.url;
|
|
40
39
|
var _useFetchDatasourceIn = useFetchDatasourceInfo({
|
|
41
40
|
isRegularCardNode: true,
|
|
42
41
|
url: url,
|
|
@@ -96,8 +95,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
96
95
|
gap: "space.050"
|
|
97
96
|
}, jsx(Button, {
|
|
98
97
|
testId: "edit-link",
|
|
99
|
-
onClick: onEditLink
|
|
100
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
98
|
+
onClick: onEditLink
|
|
101
99
|
}, jsx(FormattedMessage
|
|
102
100
|
// Ignored via go/ees005
|
|
103
101
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -110,8 +108,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
110
108
|
}, jsx(Button, {
|
|
111
109
|
testId: "edit-datasource",
|
|
112
110
|
tooltipContent: intl.formatMessage(linkToolbarMessages.editDatasourceStandaloneTooltip),
|
|
113
|
-
onClick: onEditDatasource
|
|
114
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
111
|
+
onClick: onEditDatasource
|
|
115
112
|
}, jsx(FormattedMessage
|
|
116
113
|
// Ignored via go/ees005
|
|
117
114
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -132,8 +129,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
132
129
|
onClick: toggleOpen,
|
|
133
130
|
selected: isOpen,
|
|
134
131
|
disabled: false,
|
|
135
|
-
ariaHasPopup: true
|
|
136
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
132
|
+
ariaHasPopup: true
|
|
137
133
|
}, jsx(FormattedMessage
|
|
138
134
|
// Ignored via go/ees005
|
|
139
135
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -181,8 +177,7 @@ var EditToolbarButtonWithUrl = function EditToolbarButtonWithUrl(props) {
|
|
|
181
177
|
editorView = props.editorView,
|
|
182
178
|
intl = props.intl,
|
|
183
179
|
onLinkEditClick = props.onLinkEditClick,
|
|
184
|
-
url = props.url
|
|
185
|
-
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
180
|
+
url = props.url;
|
|
186
181
|
var _useFetchDatasourceIn2 = useFetchDatasourceInfo({
|
|
187
182
|
isRegularCardNode: true,
|
|
188
183
|
url: url,
|
|
@@ -210,8 +205,7 @@ var EditToolbarButtonWithUrl = function EditToolbarButtonWithUrl(props) {
|
|
|
210
205
|
editorView: editorView,
|
|
211
206
|
extensionKey: extensionKey,
|
|
212
207
|
onLinkEditClick: onLinkEditClick,
|
|
213
|
-
intl: intl
|
|
214
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
208
|
+
intl: intl
|
|
215
209
|
});
|
|
216
210
|
};
|
|
217
211
|
var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasourceId(props) {
|
|
@@ -221,8 +215,7 @@ var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasource
|
|
|
221
215
|
intl = props.intl,
|
|
222
216
|
onLinkEditClick = props.onLinkEditClick,
|
|
223
217
|
datasourceId = props.datasourceId,
|
|
224
|
-
node = props.node
|
|
225
|
-
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
218
|
+
node = props.node;
|
|
226
219
|
var fetchData = useMemo(function () {
|
|
227
220
|
try {
|
|
228
221
|
var _attrs$datasource$vie;
|
|
@@ -260,8 +253,7 @@ var EditToolbarButtonWithDatasourceId = function EditToolbarButtonWithDatasource
|
|
|
260
253
|
editorView: editorView,
|
|
261
254
|
extensionKey: extensionKey,
|
|
262
255
|
onLinkEditClick: onLinkEditClick,
|
|
263
|
-
intl: intl
|
|
264
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
256
|
+
intl: intl
|
|
265
257
|
});
|
|
266
258
|
};
|
|
267
259
|
export var EditToolbarButton = function EditToolbarButton(props) {
|
|
@@ -271,8 +263,7 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
271
263
|
editorView = props.editorView,
|
|
272
264
|
intl = props.intl,
|
|
273
265
|
onLinkEditClick = props.onLinkEditClick,
|
|
274
|
-
url = props.url
|
|
275
|
-
areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
|
|
266
|
+
url = props.url;
|
|
276
267
|
var cardContext = useSmartLinkContext();
|
|
277
268
|
if (props.url) {
|
|
278
269
|
return jsx(EditToolbarButtonWithUrl, {
|
|
@@ -283,8 +274,7 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
283
274
|
editorView: editorView,
|
|
284
275
|
cardContext: cardContext,
|
|
285
276
|
onLinkEditClick: onLinkEditClick,
|
|
286
|
-
currentAppearance: currentAppearance
|
|
287
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
277
|
+
currentAppearance: currentAppearance
|
|
288
278
|
});
|
|
289
279
|
}
|
|
290
280
|
if (props.datasourceId && props.node) {
|
|
@@ -295,8 +285,7 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
295
285
|
editorAnalyticsApi: editorAnalyticsApi,
|
|
296
286
|
editorView: editorView,
|
|
297
287
|
onLinkEditClick: onLinkEditClick,
|
|
298
|
-
currentAppearance: currentAppearance
|
|
299
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
288
|
+
currentAppearance: currentAppearance
|
|
300
289
|
});
|
|
301
290
|
}
|
|
302
291
|
return jsx(EditToolbarButtonWithCardContext, {
|
|
@@ -307,7 +296,6 @@ export var EditToolbarButton = function EditToolbarButton(props) {
|
|
|
307
296
|
editorView: editorView,
|
|
308
297
|
cardContext: cardContext,
|
|
309
298
|
onLinkEditClick: onLinkEditClick,
|
|
310
|
-
currentAppearance: currentAppearance
|
|
311
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
299
|
+
currentAppearance: currentAppearance
|
|
312
300
|
});
|
|
313
301
|
};
|
|
@@ -4,15 +4,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
6
6
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
7
|
-
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
8
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
9
7
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
10
8
|
import { DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu/DropdownContainer';
|
|
11
9
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
12
10
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
13
11
|
import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
|
|
14
12
|
var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
15
|
-
var _props$
|
|
13
|
+
var _props$cardOptions3;
|
|
16
14
|
var _useState = useState(new Map()),
|
|
17
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
16
|
supportedUrlsMap = _useState2[0],
|
|
@@ -23,7 +21,6 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
23
21
|
setIsOpen = _useState4[1];
|
|
24
22
|
var cardProvider = useRef(undefined);
|
|
25
23
|
var containerRef = useRef(undefined);
|
|
26
|
-
var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean((_props$editorPluginAp = props.editorPluginApi) === null || _props$editorPluginAp === void 0 ? void 0 : _props$editorPluginAp.toolbar));
|
|
27
24
|
var url = props.url,
|
|
28
25
|
intl = props.intl,
|
|
29
26
|
editorView = props.editorView,
|
|
@@ -54,8 +51,8 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
54
51
|
return _context.abrupt("return", cardProvider.current);
|
|
55
52
|
case 2:
|
|
56
53
|
return _context.abrupt("return", new Promise(function (resolve) {
|
|
57
|
-
var _props$
|
|
58
|
-
var cardProvider = (_props$
|
|
54
|
+
var _props$editorPluginAp;
|
|
55
|
+
var cardProvider = (_props$editorPluginAp = props.editorPluginApi) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.card) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.sharedState) === null || _props$editorPluginAp === void 0 || (_props$editorPluginAp = _props$editorPluginAp.currentState()) === null || _props$editorPluginAp === void 0 ? void 0 : _props$editorPluginAp.provider;
|
|
59
56
|
if (cardProvider) {
|
|
60
57
|
resolve(cardProvider);
|
|
61
58
|
}
|
|
@@ -173,8 +170,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
173
170
|
label: "",
|
|
174
171
|
spacing: "compact",
|
|
175
172
|
size: "small"
|
|
176
|
-
})
|
|
177
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
173
|
+
})
|
|
178
174
|
}, title);
|
|
179
175
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
180
176
|
ref: containerRef,
|
|
@@ -204,11 +200,8 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
|
|
|
204
200
|
isDatasourceView: isDatasourceView,
|
|
205
201
|
allowDatasource: allowDatasource,
|
|
206
202
|
dispatchCommand: dispatchCommand,
|
|
207
|
-
settingsConfig: settingsConfig
|
|
208
|
-
|
|
209
|
-
})), !areToolbarFlagsEnabled(Boolean((_props$editorPluginAp3 = props.editorPluginApi) === null || _props$editorPluginAp3 === void 0 ? void 0 : _props$editorPluginAp3.toolbar)) && /*#__PURE__*/React.createElement(Separator, {
|
|
210
|
-
areAnyNewToolbarFlagsEnabled: areToolbarFlagsEnabled(Boolean((_props$editorPluginAp4 = props.editorPluginApi) === null || _props$editorPluginAp4 === void 0 ? void 0 : _props$editorPluginAp4.toolbar))
|
|
211
|
-
}));
|
|
203
|
+
settingsConfig: settingsConfig
|
|
204
|
+
})));
|
|
212
205
|
};
|
|
213
206
|
export var getCustomHyperlinkAppearanceDropdown = function getCustomHyperlinkAppearanceDropdown(_ref3) {
|
|
214
207
|
var url = _ref3.url,
|
|
@@ -6,6 +6,7 @@ import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics/types/en
|
|
|
6
6
|
import { appearancePropsMap } from '@atlaskit/editor-common/card';
|
|
7
7
|
import { getDropdownOption } from '@atlaskit/editor-common/card/link-toolbar-dropdown-options';
|
|
8
8
|
import { commandWithMetadata } from '@atlaskit/editor-common/card/utils';
|
|
9
|
+
import nodeNames from '@atlaskit/editor-common/messages';
|
|
9
10
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
10
11
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
11
12
|
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
@@ -15,11 +16,38 @@ import ButtonItem from '@atlaskit/menu/button-item';
|
|
|
15
16
|
import LinkItem from '@atlaskit/menu/link-item';
|
|
16
17
|
import MenuGroup from '@atlaskit/menu/menu-group';
|
|
17
18
|
import Section from '@atlaskit/menu/section';
|
|
19
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
18
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
19
21
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
20
22
|
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
23
|
+
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
21
24
|
import { DatasourceDropdownOption, datasourceDisplayInformation } from './DatasourceDropdownOption';
|
|
22
|
-
|
|
25
|
+
export var getUnavailableMessage = function getUnavailableMessage(state, intl) {
|
|
26
|
+
try {
|
|
27
|
+
var parentNode = state.selection.$from.node(1);
|
|
28
|
+
var parentName = intl.formatMessage(nodeNames[parentNode.type.name]);
|
|
29
|
+
var tooltip = intl.formatMessage(messages.displayOptionUnavailableInParentNode, {
|
|
30
|
+
node: parentName
|
|
31
|
+
});
|
|
32
|
+
return tooltip;
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// eslint-disable-line no-unused-vars
|
|
35
|
+
return intl.formatMessage(messages.displayOptionUnavailableInParentNode, {
|
|
36
|
+
node: intl.formatMessage(nodeNames.defaultBlockNode)
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether the node a registered embed transformer (for example native embeds) would insert for the
|
|
43
|
+
* selected card is allowed in its parent. That node can be allowed where `embedCard` is not.
|
|
44
|
+
*/
|
|
45
|
+
export var isTransformedEmbedSupportedInParent = function isTransformedEmbedSupportedInParent(editorState, currentAppearance) {
|
|
46
|
+
var _cardState$embedCardT, _cardState$embedCardT2;
|
|
47
|
+
var cardState = pluginKey.getState(editorState);
|
|
48
|
+
var transformedNode = cardState === null || cardState === void 0 || (_cardState$embedCardT = cardState.embedCardTransformers) === null || _cardState$embedCardT === void 0 || (_cardState$embedCardT2 = _cardState$embedCardT.getEmbedCardTransformNode) === null || _cardState$embedCardT2 === void 0 ? void 0 : _cardState$embedCardT2.call(_cardState$embedCardT, editorState);
|
|
49
|
+
return transformedNode ? isSupportedInParent(editorState, Fragment.from(transformedNode), currentAppearance) : false;
|
|
50
|
+
};
|
|
23
51
|
export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
24
52
|
var _cardContext$value, _setSelectedCardAppea, _setSelectedCardAppea2, _changeSelectedCardTo, _setSelectedCardAppea3;
|
|
25
53
|
var url = _ref.url,
|
|
@@ -46,8 +74,9 @@ export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
|
46
74
|
return null;
|
|
47
75
|
}
|
|
48
76
|
}
|
|
77
|
+
var showUnsupportedOptionsDisabled = fg('platform_editor_link_appearance_disabled_options');
|
|
49
78
|
var isBlockCardLinkSupportedInParent = allowBlockCards ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.blockCard.createChecked({})), currentAppearance) : false;
|
|
50
|
-
var isEmbedCardLinkSupportedInParent = allowEmbeds ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance) : false;
|
|
79
|
+
var isEmbedCardLinkSupportedInParent = allowEmbeds ? isSupportedInParent(editorState, Fragment.from(editorState.schema.nodes.embedCard.createChecked({})), currentAppearance) || showUnsupportedOptionsDisabled && isTransformedEmbedSupportedInParent(editorState, currentAppearance) : false;
|
|
51
80
|
var embedOption = allowEmbeds && preview && {
|
|
52
81
|
appearance: 'embed',
|
|
53
82
|
title: intl.formatMessage(messages.embed),
|
|
@@ -102,8 +131,7 @@ export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
|
102
131
|
Icon = settingsConfig.icon;
|
|
103
132
|
}
|
|
104
133
|
|
|
105
|
-
// TODO: ED-26961 -
|
|
106
|
-
// this implementation doesn't
|
|
134
|
+
// TODO: ED-26961 - this implementation does not support change boarding via pulse
|
|
107
135
|
return /*#__PURE__*/React.createElement(MenuGroup, null, /*#__PURE__*/React.createElement(Section, null, finalOptions.map(function (option) {
|
|
108
136
|
var item = /*#__PURE__*/React.createElement(ButtonItem, {
|
|
109
137
|
key: option.title,
|
|
@@ -114,11 +142,11 @@ export var LinkAppearanceMenu = function LinkAppearanceMenu(_ref) {
|
|
|
114
142
|
return option.onClick();
|
|
115
143
|
},
|
|
116
144
|
isSelected: option.selected,
|
|
117
|
-
isDisabled: option.disabled,
|
|
145
|
+
isDisabled: showUnsupportedOptionsDisabled && option.disabled,
|
|
118
146
|
description: option.description,
|
|
119
147
|
shouldDescriptionWrap: true
|
|
120
148
|
}, option.title);
|
|
121
|
-
return option.tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
149
|
+
return showUnsupportedOptionsDisabled && option.tooltip ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
122
150
|
key: option.title,
|
|
123
151
|
content: option.tooltip
|
|
124
152
|
}, item) : item;
|
|
@@ -152,8 +180,7 @@ export var getLinkAppearanceDropdown = function getLinkAppearanceDropdown(_ref2)
|
|
|
152
180
|
_ref2$showUpgradeDisc = _ref2.showUpgradeDiscoverability,
|
|
153
181
|
showUpgradeDiscoverability = _ref2$showUpgradeDisc === void 0 ? true : _ref2$showUpgradeDisc,
|
|
154
182
|
isDatasourceView = _ref2.isDatasourceView,
|
|
155
|
-
settingsConfig = _ref2.settingsConfig
|
|
156
|
-
areAnyNewToolbarFlagsEnabled = _ref2.areAnyNewToolbarFlagsEnabled;
|
|
183
|
+
settingsConfig = _ref2.settingsConfig;
|
|
157
184
|
var alignmentItemOptions = {
|
|
158
185
|
render: function render(props) {
|
|
159
186
|
return /*#__PURE__*/React.createElement(LinkAppearanceMenu, {
|
|
@@ -168,8 +195,7 @@ export var getLinkAppearanceDropdown = function getLinkAppearanceDropdown(_ref2)
|
|
|
168
195
|
isDatasourceView: isDatasourceView,
|
|
169
196
|
allowDatasource: allowDatasource,
|
|
170
197
|
dispatchCommand: props.dispatchCommand,
|
|
171
|
-
settingsConfig: settingsConfig
|
|
172
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
198
|
+
settingsConfig: settingsConfig
|
|
173
199
|
});
|
|
174
200
|
},
|
|
175
201
|
width: 200,
|
|
@@ -11,7 +11,6 @@ import { useSmartLinkDestinationUrl } from '@atlaskit/smart-card/hook/use-smart-
|
|
|
11
11
|
*/
|
|
12
12
|
export var OpenLinkToolbarButton = function OpenLinkToolbarButton(_ref) {
|
|
13
13
|
var url = _ref.url,
|
|
14
|
-
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled,
|
|
15
14
|
editorView = _ref.editorView,
|
|
16
15
|
onClick = _ref.onClick,
|
|
17
16
|
title = _ref.title;
|
|
@@ -29,7 +28,6 @@ export var OpenLinkToolbarButton = function OpenLinkToolbarButton(_ref) {
|
|
|
29
28
|
}),
|
|
30
29
|
href: destinationUrl,
|
|
31
30
|
target: "_blank",
|
|
32
|
-
onClick: handleClick
|
|
33
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
31
|
+
onClick: handleClick
|
|
34
32
|
});
|
|
35
33
|
};
|
|
@@ -8,9 +8,7 @@ import { linkMessages } from '@atlaskit/editor-common/messages/link';
|
|
|
8
8
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
9
9
|
import { extractSmartLinkEmbed } from '@atlaskit/link-extractors/extract-smart-link-embed';
|
|
10
10
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
11
|
-
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
12
11
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
13
|
-
import { Inline } from '@atlaskit/primitives/compiled/inline';
|
|
14
12
|
import { getObjectAri, getObjectIconUrl, getObjectName } from '@atlaskit/smart-card';
|
|
15
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
14
|
import { getResolvedAttributesFromStore } from '../../pm-plugins/utils';
|
|
@@ -18,7 +16,6 @@ import { appearanceForLink } from '../analytics/utils';
|
|
|
18
16
|
export var OpenPreviewPanelToolbarButton = function OpenPreviewPanelToolbarButton(_ref) {
|
|
19
17
|
var node = _ref.node,
|
|
20
18
|
intl = _ref.intl,
|
|
21
|
-
areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled,
|
|
22
19
|
editorAnalyticsApi = _ref.editorAnalyticsApi,
|
|
23
20
|
editorView = _ref.editorView;
|
|
24
21
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
@@ -59,29 +56,10 @@ export var OpenPreviewPanelToolbarButton = function OpenPreviewPanelToolbarButto
|
|
|
59
56
|
});
|
|
60
57
|
};
|
|
61
58
|
var title = intl.formatMessage(linkMessages.openPreviewPanel);
|
|
62
|
-
var icon =
|
|
59
|
+
var icon = /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
63
60
|
label: "",
|
|
64
61
|
spacing: "spacious"
|
|
65
|
-
})
|
|
66
|
-
/*#__PURE__*/
|
|
67
|
-
// This is a hack required for Jira until areToolbarFlagsEnabled are enabled to ensure the icon has padding
|
|
68
|
-
// Padding is removed when areToolbarFlagsEnabled for a button with icon only in platform/packages/editor/editor-common/src/ui/FloatingToolbar/Button.tsx
|
|
69
|
-
React.createElement(Inline, {
|
|
70
|
-
as: "span",
|
|
71
|
-
space: "space.050",
|
|
72
|
-
alignBlock: "center"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
74
|
-
as: "span",
|
|
75
|
-
"aria-hidden": true,
|
|
76
|
-
role: "presentation"
|
|
77
|
-
}), /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
78
|
-
label: "",
|
|
79
|
-
spacing: "spacious"
|
|
80
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
81
|
-
as: "span",
|
|
82
|
-
"aria-hidden": true,
|
|
83
|
-
role: "presentation"
|
|
84
|
-
}));
|
|
62
|
+
});
|
|
85
63
|
if (openPreviewPanel && isPanelAvailable) {
|
|
86
64
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
87
65
|
gap: "space.050"
|
|
@@ -89,8 +67,7 @@ export var OpenPreviewPanelToolbarButton = function OpenPreviewPanelToolbarButto
|
|
|
89
67
|
testId: "open-preview-panel-floating-toolbar-button",
|
|
90
68
|
onClick: handleOpenGlancePanelClick,
|
|
91
69
|
icon: icon,
|
|
92
|
-
title: title
|
|
93
|
-
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
70
|
+
title: title
|
|
94
71
|
}));
|
|
95
72
|
}
|
|
96
73
|
}
|