@atlaskit/editor-plugin-card 6.4.5 → 6.5.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 +20 -0
- package/dist/cjs/nodeviews/blockCard.js +12 -6
- package/dist/cjs/nodeviews/inlineCard.js +17 -17
- package/dist/cjs/pm-plugins/main.js +2 -1
- package/dist/es2019/nodeviews/blockCard.js +12 -6
- package/dist/es2019/nodeviews/inlineCard.js +18 -18
- package/dist/es2019/pm-plugins/main.js +2 -1
- package/dist/esm/nodeviews/blockCard.js +12 -6
- package/dist/esm/nodeviews/inlineCard.js +17 -17
- package/dist/esm/pm-plugins/main.js +2 -1
- package/dist/types/nodeviews/blockCard.d.ts +6 -2
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +6 -2
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 6.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165822](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165822)
|
|
8
|
+
[`abe794a9fdd4f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/abe794a9fdd4f) -
|
|
9
|
+
ED-28147 fix exposure and gating for smart link cmd or ctrl click
|
|
10
|
+
|
|
11
|
+
## 6.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#161907](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161907)
|
|
16
|
+
[`0f083a35b280f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f083a35b280f) -
|
|
17
|
+
[ux] Add optional CompetitorPrompt component to display for Smart Link card for experiment
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 6.4.5
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -111,7 +111,8 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
111
111
|
node = _this$props2.node,
|
|
112
112
|
cardContext = _this$props2.cardContext,
|
|
113
113
|
actionOptions = _this$props2.actionOptions,
|
|
114
|
-
onClick = _this$props2.onClick
|
|
114
|
+
onClick = _this$props2.onClick,
|
|
115
|
+
CompetitorPrompt = _this$props2.CompetitorPrompt;
|
|
115
116
|
var _node$attrs = node.attrs,
|
|
116
117
|
url = _node$attrs.url,
|
|
117
118
|
data = _node$attrs.data;
|
|
@@ -124,7 +125,8 @@ var BlockCardComponent = exports.BlockCardComponent = /*#__PURE__*/function (_Re
|
|
|
124
125
|
onResolve: this.onResolve,
|
|
125
126
|
onError: this.onError,
|
|
126
127
|
platform: 'web',
|
|
127
|
-
actionOptions: actionOptions
|
|
128
|
+
actionOptions: actionOptions,
|
|
129
|
+
CompetitorPrompt: CompetitorPrompt
|
|
128
130
|
}), this.gapCursorSpan());
|
|
129
131
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
130
132
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -192,7 +194,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
192
194
|
var _this$reactComponentP3 = this.reactComponentProps,
|
|
193
195
|
actionOptions = _this$reactComponentP3.actionOptions,
|
|
194
196
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
195
|
-
onClickCallback = _this$reactComponentP3.onClickCallback
|
|
197
|
+
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
198
|
+
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
|
|
196
199
|
return /*#__PURE__*/_react.default.createElement(WrappedBlockCard, {
|
|
197
200
|
node: this.node,
|
|
198
201
|
view: this.view,
|
|
@@ -200,7 +203,8 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
200
203
|
actionOptions: actionOptions,
|
|
201
204
|
pluginInjectionApi: pluginInjectionApi,
|
|
202
205
|
onClickCallback: onClickCallback,
|
|
203
|
-
id: this.id
|
|
206
|
+
id: this.id,
|
|
207
|
+
CompetitorPrompt: CompetitorPrompt
|
|
204
208
|
});
|
|
205
209
|
}
|
|
206
210
|
}, {
|
|
@@ -235,14 +239,16 @@ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_
|
|
|
235
239
|
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
236
240
|
onClickCallback = _ref3.onClickCallback,
|
|
237
241
|
allowDatasource = _ref3.allowDatasource,
|
|
238
|
-
inlineCardViewProducer = _ref3.inlineCardViewProducer
|
|
242
|
+
inlineCardViewProducer = _ref3.inlineCardViewProducer,
|
|
243
|
+
CompetitorPrompt = _ref3.CompetitorPrompt;
|
|
239
244
|
return function (node, view, getPos, decorations) {
|
|
240
245
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
241
246
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
242
247
|
var reactComponentProps = {
|
|
243
248
|
actionOptions: actionOptions,
|
|
244
249
|
pluginInjectionApi: pluginInjectionApi,
|
|
245
|
-
onClickCallback: onClickCallback
|
|
250
|
+
onClickCallback: onClickCallback,
|
|
251
|
+
CompetitorPrompt: CompetitorPrompt
|
|
246
252
|
};
|
|
247
253
|
var isDatasource = (0, _utils2.isDatasourceNode)(node);
|
|
248
254
|
if (isDatasource) {
|
|
@@ -37,7 +37,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
37
37
|
useAlternativePreloader = _ref.useAlternativePreloader,
|
|
38
38
|
view = _ref.view,
|
|
39
39
|
getPos = _ref.getPos,
|
|
40
|
-
|
|
40
|
+
propsOnClick = _ref.onClick,
|
|
41
41
|
onRes = _ref.onResolve,
|
|
42
42
|
isHovered = _ref.isHovered,
|
|
43
43
|
showHoverPreview = _ref.showHoverPreview,
|
|
@@ -100,27 +100,27 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
100
100
|
});
|
|
101
101
|
}, [onResolve]);
|
|
102
102
|
var handleOnClick = (0, _react.useCallback)(function (event) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
(0, _toolbar.visitCardLinkAnalyticsOnly)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
113
|
-
window.open(url, '_blank');
|
|
114
|
-
}
|
|
103
|
+
if (event.metaKey || event.ctrlKey) {
|
|
104
|
+
var _pluginInjectionApi$a;
|
|
105
|
+
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
106
|
+
editorAnalyticsApi = _ref2.actions;
|
|
107
|
+
(0, _toolbar.visitCardLinkAnalyticsOnly)(editorAnalyticsApi, _analytics.INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
108
|
+
window.open(url, '_blank');
|
|
109
|
+
} else {
|
|
110
|
+
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
111
|
+
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
115
112
|
}
|
|
116
|
-
}, [
|
|
113
|
+
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
114
|
+
var onClick = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _experiments.editorExperiment)('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
115
|
+
exposure: true
|
|
116
|
+
}) ? handleOnClick : propsOnClick;
|
|
117
117
|
var card = (0, _react.useMemo)(function () {
|
|
118
118
|
if (isPageSSRed && url && (0, _platformFeatureFlags.fg)('platform_ssr_smartlinks_editor')) {
|
|
119
119
|
return /*#__PURE__*/_react.default.createElement(_ssr.CardSSR, {
|
|
120
120
|
key: url,
|
|
121
121
|
url: url,
|
|
122
122
|
appearance: "inline",
|
|
123
|
-
onClick:
|
|
123
|
+
onClick: onClick,
|
|
124
124
|
container: scrollContainer,
|
|
125
125
|
onResolve: onResolve,
|
|
126
126
|
onError: onError,
|
|
@@ -135,7 +135,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
135
135
|
key: url,
|
|
136
136
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
137
137
|
appearance: "inline",
|
|
138
|
-
onClick:
|
|
138
|
+
onClick: onClick,
|
|
139
139
|
container: scrollContainer,
|
|
140
140
|
onResolve: onResolve,
|
|
141
141
|
onError: onError,
|
|
@@ -145,7 +145,7 @@ var InlineCard = exports.InlineCard = /*#__PURE__*/(0, _react.memo)(function (_r
|
|
|
145
145
|
showHoverPreview: showHoverPreview,
|
|
146
146
|
hoverPreviewOptions: hoverPreviewOptions
|
|
147
147
|
});
|
|
148
|
-
}, [url, data,
|
|
148
|
+
}, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
149
149
|
|
|
150
150
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
151
151
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -263,7 +263,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
263
263
|
pluginInjectionApi: pluginInjectionApi,
|
|
264
264
|
onClickCallback: onClickCallback,
|
|
265
265
|
allowDatasource: options.allowDatasource,
|
|
266
|
-
inlineCardViewProducer: inlineCardViewProducer
|
|
266
|
+
inlineCardViewProducer: inlineCardViewProducer,
|
|
267
|
+
CompetitorPrompt: options.CompetitorPrompt
|
|
267
268
|
}),
|
|
268
269
|
embedCard: (0, _lazyEmbedCard.lazyEmbedCardView)({
|
|
269
270
|
allowResizing: allowResizing,
|
|
@@ -92,7 +92,8 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
92
92
|
node,
|
|
93
93
|
cardContext,
|
|
94
94
|
actionOptions,
|
|
95
|
-
onClick
|
|
95
|
+
onClick,
|
|
96
|
+
CompetitorPrompt
|
|
96
97
|
} = this.props;
|
|
97
98
|
const {
|
|
98
99
|
url,
|
|
@@ -107,7 +108,8 @@ export class BlockCardComponent extends React.PureComponent {
|
|
|
107
108
|
onResolve: this.onResolve,
|
|
108
109
|
onError: this.onError,
|
|
109
110
|
platform: 'web',
|
|
110
|
-
actionOptions: actionOptions
|
|
111
|
+
actionOptions: actionOptions,
|
|
112
|
+
CompetitorPrompt: CompetitorPrompt
|
|
111
113
|
}), this.gapCursorSpan());
|
|
112
114
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
113
115
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -155,7 +157,8 @@ export class BlockCard extends ReactNodeView {
|
|
|
155
157
|
const {
|
|
156
158
|
actionOptions,
|
|
157
159
|
pluginInjectionApi,
|
|
158
|
-
onClickCallback
|
|
160
|
+
onClickCallback,
|
|
161
|
+
CompetitorPrompt
|
|
159
162
|
} = this.reactComponentProps;
|
|
160
163
|
return /*#__PURE__*/React.createElement(WrappedBlockCard, {
|
|
161
164
|
node: this.node,
|
|
@@ -164,7 +167,8 @@ export class BlockCard extends ReactNodeView {
|
|
|
164
167
|
actionOptions: actionOptions,
|
|
165
168
|
pluginInjectionApi: pluginInjectionApi,
|
|
166
169
|
onClickCallback: onClickCallback,
|
|
167
|
-
id: this.id
|
|
170
|
+
id: this.id,
|
|
171
|
+
CompetitorPrompt: CompetitorPrompt
|
|
168
172
|
});
|
|
169
173
|
}
|
|
170
174
|
destroy() {
|
|
@@ -196,7 +200,8 @@ export const blockCardNodeView = ({
|
|
|
196
200
|
pluginInjectionApi,
|
|
197
201
|
onClickCallback,
|
|
198
202
|
allowDatasource,
|
|
199
|
-
inlineCardViewProducer
|
|
203
|
+
inlineCardViewProducer,
|
|
204
|
+
CompetitorPrompt
|
|
200
205
|
}) => (node, view, getPos, decorations) => {
|
|
201
206
|
const {
|
|
202
207
|
portalProviderAPI,
|
|
@@ -205,7 +210,8 @@ export const blockCardNodeView = ({
|
|
|
205
210
|
const reactComponentProps = {
|
|
206
211
|
actionOptions,
|
|
207
212
|
pluginInjectionApi,
|
|
208
|
-
onClickCallback: onClickCallback
|
|
213
|
+
onClickCallback: onClickCallback,
|
|
214
|
+
CompetitorPrompt
|
|
209
215
|
};
|
|
210
216
|
const isDatasource = isDatasourceNode(node);
|
|
211
217
|
if (isDatasource) {
|
|
@@ -25,7 +25,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
25
25
|
useAlternativePreloader,
|
|
26
26
|
view,
|
|
27
27
|
getPos,
|
|
28
|
-
onClick,
|
|
28
|
+
onClick: propsOnClick,
|
|
29
29
|
onResolve: onRes,
|
|
30
30
|
isHovered,
|
|
31
31
|
showHoverPreview,
|
|
@@ -94,28 +94,28 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
94
94
|
});
|
|
95
95
|
}, [onResolve]);
|
|
96
96
|
const handleOnClick = useCallback(event => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
108
|
-
window.open(url, '_blank');
|
|
109
|
-
}
|
|
97
|
+
if (event.metaKey || event.ctrlKey) {
|
|
98
|
+
var _pluginInjectionApi$a;
|
|
99
|
+
const {
|
|
100
|
+
actions: editorAnalyticsApi
|
|
101
|
+
} = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {};
|
|
102
|
+
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
103
|
+
window.open(url, '_blank');
|
|
104
|
+
} else {
|
|
105
|
+
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
106
|
+
propsOnClick === null || propsOnClick === void 0 ? void 0 : propsOnClick(event);
|
|
110
107
|
}
|
|
111
|
-
}, [
|
|
108
|
+
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
109
|
+
const onClick = editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
110
|
+
exposure: true
|
|
111
|
+
}) ? handleOnClick : propsOnClick;
|
|
112
112
|
const card = useMemo(() => {
|
|
113
113
|
if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
|
|
114
114
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
115
115
|
key: url,
|
|
116
116
|
url: url,
|
|
117
117
|
appearance: "inline",
|
|
118
|
-
onClick:
|
|
118
|
+
onClick: onClick,
|
|
119
119
|
container: scrollContainer,
|
|
120
120
|
onResolve: onResolve,
|
|
121
121
|
onError: onError,
|
|
@@ -130,7 +130,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
130
130
|
key: url,
|
|
131
131
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
132
132
|
appearance: "inline",
|
|
133
|
-
onClick:
|
|
133
|
+
onClick: onClick,
|
|
134
134
|
container: scrollContainer,
|
|
135
135
|
onResolve: onResolve,
|
|
136
136
|
onError: onError,
|
|
@@ -140,7 +140,7 @@ export const InlineCard = /*#__PURE__*/memo(({
|
|
|
140
140
|
showHoverPreview: showHoverPreview,
|
|
141
141
|
hoverPreviewOptions: hoverPreviewOptions
|
|
142
142
|
});
|
|
143
|
-
}, [url, data,
|
|
143
|
+
}, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
144
144
|
|
|
145
145
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
146
146
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -262,7 +262,8 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
262
262
|
pluginInjectionApi,
|
|
263
263
|
onClickCallback,
|
|
264
264
|
allowDatasource: options.allowDatasource,
|
|
265
|
-
inlineCardViewProducer
|
|
265
|
+
inlineCardViewProducer,
|
|
266
|
+
CompetitorPrompt: options.CompetitorPrompt
|
|
266
267
|
}),
|
|
267
268
|
embedCard: lazyEmbedCardView({
|
|
268
269
|
allowResizing,
|
|
@@ -105,7 +105,8 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
105
105
|
node = _this$props2.node,
|
|
106
106
|
cardContext = _this$props2.cardContext,
|
|
107
107
|
actionOptions = _this$props2.actionOptions,
|
|
108
|
-
onClick = _this$props2.onClick
|
|
108
|
+
onClick = _this$props2.onClick,
|
|
109
|
+
CompetitorPrompt = _this$props2.CompetitorPrompt;
|
|
109
110
|
var _node$attrs = node.attrs,
|
|
110
111
|
url = _node$attrs.url,
|
|
111
112
|
data = _node$attrs.data;
|
|
@@ -118,7 +119,8 @@ export var BlockCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
118
119
|
onResolve: this.onResolve,
|
|
119
120
|
onError: this.onError,
|
|
120
121
|
platform: 'web',
|
|
121
|
-
actionOptions: actionOptions
|
|
122
|
+
actionOptions: actionOptions,
|
|
123
|
+
CompetitorPrompt: CompetitorPrompt
|
|
122
124
|
}), this.gapCursorSpan());
|
|
123
125
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
124
126
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -186,7 +188,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
186
188
|
var _this$reactComponentP3 = this.reactComponentProps,
|
|
187
189
|
actionOptions = _this$reactComponentP3.actionOptions,
|
|
188
190
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
189
|
-
onClickCallback = _this$reactComponentP3.onClickCallback
|
|
191
|
+
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
192
|
+
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt;
|
|
190
193
|
return /*#__PURE__*/React.createElement(WrappedBlockCard, {
|
|
191
194
|
node: this.node,
|
|
192
195
|
view: this.view,
|
|
@@ -194,7 +197,8 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
194
197
|
actionOptions: actionOptions,
|
|
195
198
|
pluginInjectionApi: pluginInjectionApi,
|
|
196
199
|
onClickCallback: onClickCallback,
|
|
197
|
-
id: this.id
|
|
200
|
+
id: this.id,
|
|
201
|
+
CompetitorPrompt: CompetitorPrompt
|
|
198
202
|
});
|
|
199
203
|
}
|
|
200
204
|
}, {
|
|
@@ -229,14 +233,16 @@ export var blockCardNodeView = function blockCardNodeView(_ref3) {
|
|
|
229
233
|
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
230
234
|
onClickCallback = _ref3.onClickCallback,
|
|
231
235
|
allowDatasource = _ref3.allowDatasource,
|
|
232
|
-
inlineCardViewProducer = _ref3.inlineCardViewProducer
|
|
236
|
+
inlineCardViewProducer = _ref3.inlineCardViewProducer,
|
|
237
|
+
CompetitorPrompt = _ref3.CompetitorPrompt;
|
|
233
238
|
return function (node, view, getPos, decorations) {
|
|
234
239
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
235
240
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher;
|
|
236
241
|
var reactComponentProps = {
|
|
237
242
|
actionOptions: actionOptions,
|
|
238
243
|
pluginInjectionApi: pluginInjectionApi,
|
|
239
|
-
onClickCallback: onClickCallback
|
|
244
|
+
onClickCallback: onClickCallback,
|
|
245
|
+
CompetitorPrompt: CompetitorPrompt
|
|
240
246
|
};
|
|
241
247
|
var isDatasource = isDatasourceNode(node);
|
|
242
248
|
if (isDatasource) {
|
|
@@ -26,7 +26,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
26
26
|
useAlternativePreloader = _ref.useAlternativePreloader,
|
|
27
27
|
view = _ref.view,
|
|
28
28
|
getPos = _ref.getPos,
|
|
29
|
-
|
|
29
|
+
propsOnClick = _ref.onClick,
|
|
30
30
|
onRes = _ref.onResolve,
|
|
31
31
|
isHovered = _ref.isHovered,
|
|
32
32
|
showHoverPreview = _ref.showHoverPreview,
|
|
@@ -89,27 +89,27 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
89
89
|
});
|
|
90
90
|
}, [onResolve]);
|
|
91
91
|
var handleOnClick = useCallback(function (event) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
102
|
-
window.open(url, '_blank');
|
|
103
|
-
}
|
|
92
|
+
if (event.metaKey || event.ctrlKey) {
|
|
93
|
+
var _pluginInjectionApi$a;
|
|
94
|
+
var _ref2 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
95
|
+
editorAnalyticsApi = _ref2.actions;
|
|
96
|
+
visitCardLinkAnalyticsOnly(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
97
|
+
window.open(url, '_blank');
|
|
98
|
+
} else {
|
|
99
|
+
// only trigger the provided onClick callback if the meta key or ctrl key is not pressed
|
|
100
|
+
propsOnClick === null || propsOnClick === void 0 || propsOnClick(event);
|
|
104
101
|
}
|
|
105
|
-
}, [
|
|
102
|
+
}, [propsOnClick, url, view, pluginInjectionApi]);
|
|
103
|
+
var onClick = editorExperiment('platform_editor_controls', 'variant1') && editorExperiment('platform_editor_smart_link_cmd_ctrl_click', true, {
|
|
104
|
+
exposure: true
|
|
105
|
+
}) ? handleOnClick : propsOnClick;
|
|
106
106
|
var card = useMemo(function () {
|
|
107
107
|
if (isPageSSRed && url && fg('platform_ssr_smartlinks_editor')) {
|
|
108
108
|
return /*#__PURE__*/React.createElement(CardSSR, {
|
|
109
109
|
key: url,
|
|
110
110
|
url: url,
|
|
111
111
|
appearance: "inline",
|
|
112
|
-
onClick:
|
|
112
|
+
onClick: onClick,
|
|
113
113
|
container: scrollContainer,
|
|
114
114
|
onResolve: onResolve,
|
|
115
115
|
onError: onError,
|
|
@@ -124,7 +124,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
124
124
|
key: url,
|
|
125
125
|
url: url !== null && url !== void 0 ? url : data.url,
|
|
126
126
|
appearance: "inline",
|
|
127
|
-
onClick:
|
|
127
|
+
onClick: onClick,
|
|
128
128
|
container: scrollContainer,
|
|
129
129
|
onResolve: onResolve,
|
|
130
130
|
onError: onError,
|
|
@@ -134,7 +134,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
134
134
|
showHoverPreview: showHoverPreview,
|
|
135
135
|
hoverPreviewOptions: hoverPreviewOptions
|
|
136
136
|
});
|
|
137
|
-
}, [url, data,
|
|
137
|
+
}, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed]);
|
|
138
138
|
|
|
139
139
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
140
140
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -256,7 +256,8 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
256
256
|
pluginInjectionApi: pluginInjectionApi,
|
|
257
257
|
onClickCallback: onClickCallback,
|
|
258
258
|
allowDatasource: options.allowDatasource,
|
|
259
|
-
inlineCardViewProducer: inlineCardViewProducer
|
|
259
|
+
inlineCardViewProducer: inlineCardViewProducer,
|
|
260
|
+
CompetitorPrompt: options.CompetitorPrompt
|
|
260
261
|
}),
|
|
261
262
|
embedCard: lazyEmbedCardView({
|
|
262
263
|
allowResizing: allowResizing,
|
|
@@ -25,7 +25,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
25
25
|
}) => void;
|
|
26
26
|
render(): React.JSX.Element;
|
|
27
27
|
}
|
|
28
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
28
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'CompetitorPrompt'>;
|
|
29
29
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
30
30
|
private id;
|
|
31
31
|
unsubscribe: (() => void) | undefined;
|
|
@@ -45,5 +45,9 @@ export interface BlockCardNodeViewProperties {
|
|
|
45
45
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
46
46
|
allowDatasource: boolean | undefined;
|
|
47
47
|
inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
|
|
48
|
+
CompetitorPrompt?: React.ComponentType<{
|
|
49
|
+
sourceUrl: string;
|
|
50
|
+
linkType?: string;
|
|
51
|
+
}>;
|
|
48
52
|
}
|
|
49
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
53
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
|
-
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
7
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick: propsOnClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
8
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -25,7 +25,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
25
25
|
}) => void;
|
|
26
26
|
render(): React.JSX.Element;
|
|
27
27
|
}
|
|
28
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback'>;
|
|
28
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'CompetitorPrompt'>;
|
|
29
29
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
30
30
|
private id;
|
|
31
31
|
unsubscribe: (() => void) | undefined;
|
|
@@ -45,5 +45,9 @@ export interface BlockCardNodeViewProperties {
|
|
|
45
45
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
46
46
|
allowDatasource: boolean | undefined;
|
|
47
47
|
inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
|
|
48
|
+
CompetitorPrompt?: React.ComponentType<{
|
|
49
|
+
sourceUrl: string;
|
|
50
|
+
linkType?: string;
|
|
51
|
+
}>;
|
|
48
52
|
}
|
|
49
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
53
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
@@ -4,7 +4,7 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
4
4
|
import type { Decoration, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import { type InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
|
-
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
7
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick: propsOnClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
8
|
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | '__livePage' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
9
9
|
/**
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@atlaskit/menu": "^8.0.0",
|
|
62
62
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
63
63
|
"@atlaskit/primitives": "^14.8.0",
|
|
64
|
-
"@atlaskit/smart-card": "^38.
|
|
64
|
+
"@atlaskit/smart-card": "^38.7.0",
|
|
65
65
|
"@atlaskit/theme": "^18.0.0",
|
|
66
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
66
|
+
"@atlaskit/tmp-editor-statsig": "^5.11.0",
|
|
67
67
|
"@atlaskit/tokens": "^5.0.0",
|
|
68
68
|
"@babel/runtime": "^7.0.0",
|
|
69
69
|
"@emotion/react": "^11.7.1",
|