@atlaskit/editor-plugin-card 6.5.0 → 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 +8 -0
- package/dist/cjs/nodeviews/inlineCard.js +17 -17
- package/dist/es2019/nodeviews/inlineCard.js +18 -18
- package/dist/esm/nodeviews/inlineCard.js +17 -17
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
3
11
|
## 6.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
*
|
|
@@ -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
|
*
|