@atlaskit/editor-plugin-card 36.0.26 → 37.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 +15 -0
- package/dist/cjs/nodeviews/inlineCardBase.js +3 -5
- package/dist/cjs/pm-plugins/doc.js +7 -19
- package/dist/cjs/ui/EditToolbarButton/index.js +3 -11
- package/dist/cjs/ui/toolbar.js +4 -4
- package/dist/es2019/nodeviews/inlineCardBase.js +3 -5
- package/dist/es2019/pm-plugins/doc.js +5 -15
- package/dist/es2019/ui/EditToolbarButton/index.js +3 -11
- package/dist/es2019/ui/toolbar.js +4 -4
- package/dist/esm/nodeviews/inlineCardBase.js +3 -5
- package/dist/esm/pm-plugins/doc.js +7 -19
- package/dist/esm/ui/EditToolbarButton/index.js +3 -11
- package/dist/esm/ui/toolbar.js +4 -4
- package/package.json +22 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 37.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`84f221954c9fb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/84f221954c9fb) -
|
|
8
|
+
Remove the `control` branches of experiment `platform_editor_controls`; the editor controls
|
|
9
|
+
(`variant1`) experience is now permanent.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 37.0.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 36.0.26
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -14,7 +14,6 @@ var _utils = require("@atlaskit/editor-common/Popup/utils");
|
|
|
14
14
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
15
15
|
var _lazy = require("@atlaskit/smart-card/card/lazy");
|
|
16
16
|
var _ssr = require("@atlaskit/smart-card/ssr");
|
|
17
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
18
17
|
var _actions = require("../pm-plugins/actions");
|
|
19
18
|
var _toolbar = require("../ui/toolbar");
|
|
20
19
|
var _isIntersectionObserverSupported = require("./isIntersectionObserverSupported");
|
|
@@ -148,14 +147,13 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
148
147
|
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
149
148
|
}
|
|
150
149
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
151
|
-
var onClick = (0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
152
150
|
var card = (0, _react.useMemo)(function () {
|
|
153
151
|
if ((isPageSSRed || cardState) && url) {
|
|
154
152
|
return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
155
153
|
key: url,
|
|
156
154
|
url: url,
|
|
157
155
|
appearance: "inline",
|
|
158
|
-
onClick:
|
|
156
|
+
onClick: handleOnClick,
|
|
159
157
|
container: scrollContainer,
|
|
160
158
|
onResolve: onResolve,
|
|
161
159
|
onError: onError,
|
|
@@ -172,7 +170,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
172
170
|
key: url,
|
|
173
171
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
174
172
|
appearance: "inline",
|
|
175
|
-
onClick:
|
|
173
|
+
onClick: handleOnClick,
|
|
176
174
|
container: scrollContainer,
|
|
177
175
|
onResolve: onResolve,
|
|
178
176
|
onError: onError,
|
|
@@ -183,7 +181,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
183
181
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
184
182
|
disablePreviewPanel: disablePreviewPanel
|
|
185
183
|
});
|
|
186
|
-
}, [url, data,
|
|
184
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel, cardState]);
|
|
187
185
|
|
|
188
186
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
189
187
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -22,7 +22,6 @@ var _hyperlink = require("@atlaskit/editor-common/utils/hyperlink");
|
|
|
22
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
23
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
24
24
|
var _closeHistory = require("@atlaskit/prosemirror-history/closeHistory");
|
|
25
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
26
25
|
var _actions = require("./actions");
|
|
27
26
|
var _pluginKey = require("./plugin-key");
|
|
28
27
|
var _shouldReplaceLink = require("./shouldReplaceLink");
|
|
@@ -359,25 +358,14 @@ var convertHyperlinkToSmartCard = exports.convertHyperlinkToSmartCard = function
|
|
|
359
358
|
shouldReplaceLink: true
|
|
360
359
|
};
|
|
361
360
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
return mark.type === link;
|
|
367
|
-
});
|
|
368
|
-
if (linkMark) {
|
|
369
|
-
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
374
|
-
var linkMark = node.marks.find(function (mark) {
|
|
375
|
-
return mark.type === link;
|
|
376
|
-
});
|
|
377
|
-
if (linkMark) {
|
|
378
|
-
requests.push(createRequest(linkMark, pos));
|
|
379
|
-
}
|
|
361
|
+
var activeLinkMark = (0, _utils.getActiveLinkMark)(state);
|
|
362
|
+
if (activeLinkMark) {
|
|
363
|
+
var linkMark = activeLinkMark.node.marks.find(function (mark) {
|
|
364
|
+
return mark.type === link;
|
|
380
365
|
});
|
|
366
|
+
if (linkMark) {
|
|
367
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
368
|
+
}
|
|
381
369
|
}
|
|
382
370
|
(0, _card.addLinkMetadata)(state.selection, state.tr, {
|
|
383
371
|
action: _enums.ACTION.CHANGED_TYPE
|
|
@@ -11,7 +11,6 @@ var _react = require("react");
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntl = require("react-intl");
|
|
13
13
|
var _Button = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Button"));
|
|
14
|
-
var _Separator = _interopRequireDefault(require("@atlaskit/editor-common/FloatingToolbar/Separator"));
|
|
15
14
|
var _card = require("@atlaskit/editor-common/messages/card");
|
|
16
15
|
var _linkToolbar = require("@atlaskit/editor-common/messages/link-toolbar");
|
|
17
16
|
var _types = require("@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types");
|
|
@@ -20,7 +19,6 @@ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-d
|
|
|
20
19
|
var _useSmartLinkContext = require("@atlaskit/link-provider/use-smart-link-context");
|
|
21
20
|
var _buttonItem = _interopRequireDefault(require("@atlaskit/menu/button-item"));
|
|
22
21
|
var _flex = require("@atlaskit/primitives/compiled/flex");
|
|
23
|
-
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
24
22
|
var _utils = require("../../pm-plugins/utils");
|
|
25
23
|
var _editDatasourceAction = require("../editDatasourceAction");
|
|
26
24
|
var _useFetchDatasourceDataInfo = require("../useFetchDatasourceDataInfo");
|
|
@@ -109,9 +107,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
109
107
|
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
110
108
|
// Ignored via go/ees005
|
|
111
109
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
112
|
-
, _linkToolbar.linkToolbarMessages.editLink))
|
|
113
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
114
|
-
}));
|
|
110
|
+
, _linkToolbar.linkToolbarMessages.editLink)));
|
|
115
111
|
}
|
|
116
112
|
case 'edit-datasource':
|
|
117
113
|
{
|
|
@@ -125,9 +121,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
125
121
|
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
126
122
|
// Ignored via go/ees005
|
|
127
123
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
128
|
-
, _linkToolbar.linkToolbarMessages.editDatasourceStandalone))
|
|
129
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
130
|
-
}));
|
|
124
|
+
, _linkToolbar.linkToolbarMessages.editDatasourceStandalone)));
|
|
131
125
|
}
|
|
132
126
|
case 'edit-dropdown':
|
|
133
127
|
{
|
|
@@ -149,9 +143,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
149
143
|
}, (0, _react2.jsx)(_reactIntl.FormattedMessage
|
|
150
144
|
// Ignored via go/ees005
|
|
151
145
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
152
|
-
, _card.messages.editDropdownTriggerTitle))
|
|
153
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
154
|
-
}));
|
|
146
|
+
, _card.messages.editDropdownTriggerTitle)));
|
|
155
147
|
return (0, _react2.jsx)(_flex.Flex, {
|
|
156
148
|
ref: containerRef
|
|
157
149
|
}, (0, _react2.jsx)(_DropdownContainer.DropdownContainer, {
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -343,7 +343,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
343
343
|
testId: 'inline-card-toolbar-comment-button',
|
|
344
344
|
iconFallback: _comment.default,
|
|
345
345
|
title: intl.formatMessage(_annotation.annotationMessages.createComment),
|
|
346
|
-
showTitle:
|
|
346
|
+
showTitle: true,
|
|
347
347
|
onClick: onCommentButtonClick,
|
|
348
348
|
disabled: (0, _isOfflineMode.isOfflineMode)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.sharedState) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.mode)
|
|
349
349
|
}, {
|
|
@@ -740,7 +740,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
740
740
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
741
741
|
var testId = 'datasource-overflow-dropdown-trigger';
|
|
742
742
|
|
|
743
|
-
// When canShowAppearanceSwitch is true,
|
|
743
|
+
// When canShowAppearanceSwitch is true, the link appearance dropdown shows, which includes a link preference button
|
|
744
744
|
// So only add the link appearance button when canShowAppearanceSwitch is false
|
|
745
745
|
if (!canShowAppearanceSwitch()) {
|
|
746
746
|
var linkPreferenceButton = getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink);
|
|
@@ -821,9 +821,9 @@ var getStartingToolbarItems = exports.getStartingToolbarItems = function getStar
|
|
|
821
821
|
type: 'button',
|
|
822
822
|
onClick: onEditLink,
|
|
823
823
|
title: intl.formatMessage(_linkToolbar.linkToolbarMessages.editLink),
|
|
824
|
-
showTitle:
|
|
824
|
+
showTitle: false,
|
|
825
825
|
metadata: metadata,
|
|
826
|
-
icon:
|
|
826
|
+
icon: _edit.default
|
|
827
827
|
}, {
|
|
828
828
|
type: 'separator'
|
|
829
829
|
}];
|
|
@@ -7,7 +7,6 @@ import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { Card as SmartCard } from '@atlaskit/smart-card/card/lazy';
|
|
9
9
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
10
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
12
11
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
13
12
|
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
@@ -146,14 +145,13 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
146
145
|
propsOnClick === null || propsOnClick === void 0 ? void 0 : propsOnClick(event);
|
|
147
146
|
}
|
|
148
147
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
149
|
-
const onClick = editorExperiment('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
150
148
|
const card = useMemo(() => {
|
|
151
149
|
if ((isPageSSRed || cardState) && url) {
|
|
152
150
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
153
151
|
key: url,
|
|
154
152
|
url: url,
|
|
155
153
|
appearance: "inline",
|
|
156
|
-
onClick:
|
|
154
|
+
onClick: handleOnClick,
|
|
157
155
|
container: scrollContainer,
|
|
158
156
|
onResolve: onResolve,
|
|
159
157
|
onError: onError,
|
|
@@ -170,7 +168,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
170
168
|
key: url,
|
|
171
169
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
172
170
|
appearance: "inline",
|
|
173
|
-
onClick:
|
|
171
|
+
onClick: handleOnClick,
|
|
174
172
|
container: scrollContainer,
|
|
175
173
|
onResolve: onResolve,
|
|
176
174
|
onError: onError,
|
|
@@ -181,7 +179,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
181
179
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
182
180
|
disablePreviewPanel: disablePreviewPanel
|
|
183
181
|
});
|
|
184
|
-
}, [url, data,
|
|
182
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel, cardState]);
|
|
185
183
|
|
|
186
184
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
187
185
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -12,7 +12,6 @@ import { getLinkCreationAnalyticsEvent, isFromCurrentDomain } from '@atlaskit/ed
|
|
|
12
12
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
14
14
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|
|
15
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
16
15
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
17
16
|
import { pluginKey } from './plugin-key';
|
|
18
17
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
@@ -332,21 +331,12 @@ export const convertHyperlinkToSmartCard = (state, source, appearance, normalize
|
|
|
332
331
|
analyticsAction: ACTION.CHANGED_TYPE,
|
|
333
332
|
shouldReplaceLink: true
|
|
334
333
|
});
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
341
|
-
}
|
|
334
|
+
const activeLinkMark = getActiveLinkMark(state);
|
|
335
|
+
if (activeLinkMark) {
|
|
336
|
+
const linkMark = activeLinkMark.node.marks.find(mark => mark.type === link);
|
|
337
|
+
if (linkMark) {
|
|
338
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
342
339
|
}
|
|
343
|
-
} else {
|
|
344
|
-
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
345
|
-
const linkMark = node.marks.find(mark => mark.type === link);
|
|
346
|
-
if (linkMark) {
|
|
347
|
-
requests.push(createRequest(linkMark, pos));
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
340
|
}
|
|
351
341
|
addLinkMetadata(state.selection, state.tr, {
|
|
352
342
|
action: ACTION.CHANGED_TYPE
|
|
@@ -8,7 +8,6 @@ import { useCallback, useMemo, useRef, useState } from 'react';
|
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl';
|
|
10
10
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
11
|
-
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
12
11
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
13
12
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
14
13
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
@@ -17,7 +16,6 @@ import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
|
17
16
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
18
17
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
19
18
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
20
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
21
19
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
22
20
|
import { editDatasource } from '../editDatasourceAction';
|
|
23
21
|
import { useFetchDatasourceDataInfo } from '../useFetchDatasourceDataInfo';
|
|
@@ -94,9 +92,7 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
94
92
|
}, jsx(FormattedMessage
|
|
95
93
|
// Ignored via go/ees005
|
|
96
94
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
97
|
-
, linkToolbarMessages.editLink))
|
|
98
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
99
|
-
}));
|
|
95
|
+
, linkToolbarMessages.editLink)));
|
|
100
96
|
}
|
|
101
97
|
case 'edit-datasource':
|
|
102
98
|
{
|
|
@@ -110,9 +106,7 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
110
106
|
}, jsx(FormattedMessage
|
|
111
107
|
// Ignored via go/ees005
|
|
112
108
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
113
|
-
, linkToolbarMessages.editDatasourceStandalone))
|
|
114
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
115
|
-
}));
|
|
109
|
+
, linkToolbarMessages.editDatasourceStandalone)));
|
|
116
110
|
}
|
|
117
111
|
case 'edit-dropdown':
|
|
118
112
|
{
|
|
@@ -134,9 +128,7 @@ const EditToolbarButtonWithCardContext = props => {
|
|
|
134
128
|
}, jsx(FormattedMessage
|
|
135
129
|
// Ignored via go/ees005
|
|
136
130
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
137
|
-
, messages.editDropdownTriggerTitle))
|
|
138
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
139
|
-
}));
|
|
131
|
+
, messages.editDropdownTriggerTitle)));
|
|
140
132
|
return jsx(Flex, {
|
|
141
133
|
ref: containerRef
|
|
142
134
|
}, jsx(UiDropdown, {
|
|
@@ -332,7 +332,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
|
|
|
332
332
|
testId: 'inline-card-toolbar-comment-button',
|
|
333
333
|
iconFallback: CommentIcon,
|
|
334
334
|
title: intl.formatMessage(annotationMessages.createComment),
|
|
335
|
-
showTitle:
|
|
335
|
+
showTitle: true,
|
|
336
336
|
onClick: onCommentButtonClick,
|
|
337
337
|
disabled: isOfflineMode(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : (_pluginInjectionApi$c3 = _pluginInjectionApi$c2.sharedState) === null || _pluginInjectionApi$c3 === void 0 ? void 0 : (_pluginInjectionApi$c4 = _pluginInjectionApi$c3.currentState()) === null || _pluginInjectionApi$c4 === void 0 ? void 0 : _pluginInjectionApi$c4.mode)
|
|
338
338
|
}, {
|
|
@@ -720,7 +720,7 @@ const getDatasourceButtonGroup = (metadata, intl, editorAnalyticsApi, node, hove
|
|
|
720
720
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
721
721
|
const testId = 'datasource-overflow-dropdown-trigger';
|
|
722
722
|
|
|
723
|
-
// When canShowAppearanceSwitch is true,
|
|
723
|
+
// When canShowAppearanceSwitch is true, the link appearance dropdown shows, which includes a link preference button
|
|
724
724
|
// So only add the link appearance button when canShowAppearanceSwitch is false
|
|
725
725
|
if (!canShowAppearanceSwitch()) {
|
|
726
726
|
const linkPreferenceButton = getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink);
|
|
@@ -801,9 +801,9 @@ export const getStartingToolbarItems = (options, api) => {
|
|
|
801
801
|
type: 'button',
|
|
802
802
|
onClick: onEditLink,
|
|
803
803
|
title: intl.formatMessage(linkToolbarMessages.editLink),
|
|
804
|
-
showTitle:
|
|
804
|
+
showTitle: false,
|
|
805
805
|
metadata: metadata,
|
|
806
|
-
icon:
|
|
806
|
+
icon: EditIcon
|
|
807
807
|
}, {
|
|
808
808
|
type: 'separator'
|
|
809
809
|
}];
|
|
@@ -7,7 +7,6 @@ import { findOverflowScrollParent } from '@atlaskit/editor-common/Popup/utils';
|
|
|
7
7
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
8
|
import { Card as SmartCard } from '@atlaskit/smart-card/card/lazy';
|
|
9
9
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
10
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
11
10
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
12
11
|
import { visitCardLinkAnalytics } from '../ui/toolbar';
|
|
13
12
|
import { isIntersectionObserverSupported } from './isIntersectionObserverSupported';
|
|
@@ -138,14 +137,13 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
138
137
|
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
139
138
|
}
|
|
140
139
|
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
141
|
-
var onClick = editorExperiment('platform_editor_controls', 'variant1') ? handleOnClick : propsOnClick;
|
|
142
140
|
var card = useMemo(function () {
|
|
143
141
|
if ((isPageSSRed || cardState) && url) {
|
|
144
142
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
145
143
|
key: url,
|
|
146
144
|
url: url,
|
|
147
145
|
appearance: "inline",
|
|
148
|
-
onClick:
|
|
146
|
+
onClick: handleOnClick,
|
|
149
147
|
container: scrollContainer,
|
|
150
148
|
onResolve: onResolve,
|
|
151
149
|
onError: onError,
|
|
@@ -162,7 +160,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
162
160
|
key: url,
|
|
163
161
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
164
162
|
appearance: "inline",
|
|
165
|
-
onClick:
|
|
163
|
+
onClick: handleOnClick,
|
|
166
164
|
container: scrollContainer,
|
|
167
165
|
onResolve: onResolve,
|
|
168
166
|
onError: onError,
|
|
@@ -173,7 +171,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
173
171
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
174
172
|
disablePreviewPanel: disablePreviewPanel
|
|
175
173
|
});
|
|
176
|
-
}, [url, data,
|
|
174
|
+
}, [url, data, handleOnClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel, cardState]);
|
|
177
175
|
|
|
178
176
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
179
177
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -17,7 +17,6 @@ import { getLinkCreationAnalyticsEvent, isFromCurrentDomain } from '@atlaskit/ed
|
|
|
17
17
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
19
|
import { closeHistory } from '@atlaskit/prosemirror-history/closeHistory';
|
|
20
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
21
20
|
import { hideDatasourceModal, queueCards, removeDatasourceStash, resolveCard, setDatasourceStash } from './actions';
|
|
22
21
|
import { pluginKey } from './plugin-key';
|
|
23
22
|
import { shouldReplaceLink } from './shouldReplaceLink';
|
|
@@ -353,25 +352,14 @@ export var convertHyperlinkToSmartCard = function convertHyperlinkToSmartCard(st
|
|
|
353
352
|
shouldReplaceLink: true
|
|
354
353
|
};
|
|
355
354
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
return mark.type === link;
|
|
361
|
-
});
|
|
362
|
-
if (linkMark) {
|
|
363
|
-
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
} else {
|
|
367
|
-
state.tr.doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
368
|
-
var linkMark = node.marks.find(function (mark) {
|
|
369
|
-
return mark.type === link;
|
|
370
|
-
});
|
|
371
|
-
if (linkMark) {
|
|
372
|
-
requests.push(createRequest(linkMark, pos));
|
|
373
|
-
}
|
|
355
|
+
var activeLinkMark = getActiveLinkMark(state);
|
|
356
|
+
if (activeLinkMark) {
|
|
357
|
+
var linkMark = activeLinkMark.node.marks.find(function (mark) {
|
|
358
|
+
return mark.type === link;
|
|
374
359
|
});
|
|
360
|
+
if (linkMark) {
|
|
361
|
+
requests.push(createRequest(linkMark, activeLinkMark.pos));
|
|
362
|
+
}
|
|
375
363
|
}
|
|
376
364
|
addLinkMetadata(state.selection, state.tr, {
|
|
377
365
|
action: ACTION.CHANGED_TYPE
|
|
@@ -11,7 +11,6 @@ import { useCallback, useMemo, useRef, useState } from 'react';
|
|
|
11
11
|
import { css, jsx } from '@emotion/react';
|
|
12
12
|
import { FormattedMessage } from 'react-intl';
|
|
13
13
|
import Button from '@atlaskit/editor-common/FloatingToolbar/Button';
|
|
14
|
-
import Separator from '@atlaskit/editor-common/FloatingToolbar/Separator';
|
|
15
14
|
import { messages } from '@atlaskit/editor-common/messages/card';
|
|
16
15
|
import { linkToolbarMessages } from '@atlaskit/editor-common/messages/link-toolbar';
|
|
17
16
|
import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu/ArrowKeyNavigationProvider/types';
|
|
@@ -20,7 +19,6 @@ import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
|
20
19
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
21
20
|
import ButtonItem from '@atlaskit/menu/button-item';
|
|
22
21
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
23
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
24
22
|
import { focusEditorView, isDatasourceConfigEditable } from '../../pm-plugins/utils';
|
|
25
23
|
import { editDatasource } from '../editDatasourceAction';
|
|
26
24
|
import { useFetchDatasourceDataInfo } from '../useFetchDatasourceDataInfo';
|
|
@@ -103,9 +101,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
103
101
|
}, jsx(FormattedMessage
|
|
104
102
|
// Ignored via go/ees005
|
|
105
103
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
106
|
-
, linkToolbarMessages.editLink))
|
|
107
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
108
|
-
}));
|
|
104
|
+
, linkToolbarMessages.editLink)));
|
|
109
105
|
}
|
|
110
106
|
case 'edit-datasource':
|
|
111
107
|
{
|
|
@@ -119,9 +115,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
119
115
|
}, jsx(FormattedMessage
|
|
120
116
|
// Ignored via go/ees005
|
|
121
117
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
122
|
-
, linkToolbarMessages.editDatasourceStandalone))
|
|
123
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
124
|
-
}));
|
|
118
|
+
, linkToolbarMessages.editDatasourceStandalone)));
|
|
125
119
|
}
|
|
126
120
|
case 'edit-dropdown':
|
|
127
121
|
{
|
|
@@ -143,9 +137,7 @@ var EditToolbarButtonWithCardContext = function EditToolbarButtonWithCardContext
|
|
|
143
137
|
}, jsx(FormattedMessage
|
|
144
138
|
// Ignored via go/ees005
|
|
145
139
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
146
|
-
, messages.editDropdownTriggerTitle))
|
|
147
|
-
areAnyNewToolbarFlagsEnabled: false
|
|
148
|
-
}));
|
|
140
|
+
, messages.editDropdownTriggerTitle)));
|
|
149
141
|
return jsx(Flex, {
|
|
150
142
|
ref: containerRef
|
|
151
143
|
}, jsx(UiDropdown, {
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -334,7 +334,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
|
|
|
334
334
|
testId: 'inline-card-toolbar-comment-button',
|
|
335
335
|
iconFallback: CommentIcon,
|
|
336
336
|
title: intl.formatMessage(annotationMessages.createComment),
|
|
337
|
-
showTitle:
|
|
337
|
+
showTitle: true,
|
|
338
338
|
onClick: onCommentButtonClick,
|
|
339
339
|
disabled: isOfflineMode(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.connectivity) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.sharedState) === null || _pluginInjectionApi$c2 === void 0 || (_pluginInjectionApi$c2 = _pluginInjectionApi$c2.currentState()) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.mode)
|
|
340
340
|
}, {
|
|
@@ -731,7 +731,7 @@ var getDatasourceButtonGroup = function getDatasourceButtonGroup(metadata, intl,
|
|
|
731
731
|
// see hideOnEsc in platform/packages/editor/editor-plugin-floating-toolbar/src/ui/Dropdown.tsx
|
|
732
732
|
var testId = 'datasource-overflow-dropdown-trigger';
|
|
733
733
|
|
|
734
|
-
// When canShowAppearanceSwitch is true,
|
|
734
|
+
// When canShowAppearanceSwitch is true, the link appearance dropdown shows, which includes a link preference button
|
|
735
735
|
// So only add the link appearance button when canShowAppearanceSwitch is false
|
|
736
736
|
if (!canShowAppearanceSwitch()) {
|
|
737
737
|
var linkPreferenceButton = getSettingsButton(intl, editorAnalyticsApi, cardOptions === null || cardOptions === void 0 ? void 0 : cardOptions.userPreferencesLink);
|
|
@@ -812,9 +812,9 @@ export var getStartingToolbarItems = function getStartingToolbarItems(options, a
|
|
|
812
812
|
type: 'button',
|
|
813
813
|
onClick: onEditLink,
|
|
814
814
|
title: intl.formatMessage(linkToolbarMessages.editLink),
|
|
815
|
-
showTitle:
|
|
815
|
+
showTitle: false,
|
|
816
816
|
metadata: metadata,
|
|
817
|
-
icon:
|
|
817
|
+
icon: EditIcon
|
|
818
818
|
}, {
|
|
819
819
|
type: 'separator'
|
|
820
820
|
}];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.0.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"@atlaskit/css": "^1.1.0",
|
|
27
27
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
28
28
|
"@atlaskit/editor-card-provider": "^8.2.0",
|
|
29
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
30
|
-
"@atlaskit/editor-plugin-annotation": "^
|
|
31
|
-
"@atlaskit/editor-plugin-base": "^
|
|
32
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
33
|
-
"@atlaskit/editor-plugin-decorations": "^
|
|
34
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
36
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
37
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^
|
|
38
|
-
"@atlaskit/editor-plugin-grid": "^
|
|
39
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
40
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
41
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
42
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
43
|
-
"@atlaskit/editor-plugin-width": "^
|
|
29
|
+
"@atlaskit/editor-plugin-analytics": "^31.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-annotation": "^31.1.0",
|
|
31
|
+
"@atlaskit/editor-plugin-base": "^32.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-connectivity": "^31.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-decorations": "^31.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-editor-disabled": "^31.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^33.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-feature-flags": "^30.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^33.1.0",
|
|
38
|
+
"@atlaskit/editor-plugin-grid": "^31.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-selection": "^31.1.0",
|
|
40
|
+
"@atlaskit/editor-plugin-toolbar": "^28.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^25.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-user-intent": "^29.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-width": "^32.0.0",
|
|
44
44
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
45
45
|
"@atlaskit/editor-shared-styles": "^5.1.0",
|
|
46
46
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/link": "^5.1.0",
|
|
53
53
|
"@atlaskit/link-analytics": "^13.0.0",
|
|
54
54
|
"@atlaskit/link-client-extension": "^8.0.0",
|
|
55
|
-
"@atlaskit/link-datasource": "^7.
|
|
55
|
+
"@atlaskit/link-datasource": "^7.14.0",
|
|
56
56
|
"@atlaskit/link-extractors": "^5.0.0",
|
|
57
57
|
"@atlaskit/linking-common": "^13.0.0",
|
|
58
58
|
"@atlaskit/linking-types": "^16.1.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
63
63
|
"@atlaskit/primitives": "^22.7.0",
|
|
64
64
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
65
|
-
"@atlaskit/smart-card": "^46.
|
|
65
|
+
"@atlaskit/smart-card": "^46.17.0",
|
|
66
66
|
"@atlaskit/tmp-editor-statsig": "^264.0.0",
|
|
67
67
|
"@atlaskit/tokens": "^20.12.0",
|
|
68
68
|
"@atlaskit/tooltip": "^24.4.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"uuid": "^11.1.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^
|
|
77
|
-
"@atlaskit/link-provider": "^6.
|
|
76
|
+
"@atlaskit/editor-common": "^135.3.0",
|
|
77
|
+
"@atlaskit/link-provider": "^6.2.0",
|
|
78
78
|
"react": "^18.2.0 || ^19.2.0",
|
|
79
79
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
80
80
|
},
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
},
|
|
108
108
|
"compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/e6f3220b-0ca2-445a-a4c5-78cff6ca2a34",
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@atlaskit/editor-common": "^
|
|
111
|
-
"@atlaskit/link-provider": "^6.
|
|
110
|
+
"@atlaskit/editor-common": "^135.3.0",
|
|
111
|
+
"@atlaskit/link-provider": "^6.2.0",
|
|
112
112
|
"react": "^19.2.0",
|
|
113
113
|
"react-intl": "^7.0.0"
|
|
114
114
|
}
|