@atlaskit/editor-plugin-card 16.4.5 → 16.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 +18 -0
- package/dist/cjs/nodeviews/genericCard.js +6 -2
- package/dist/cjs/nodeviews/inlineCard.js +4 -2
- package/dist/cjs/pm-plugins/main.js +3 -0
- package/dist/cjs/ui/WithCardContext.js +18 -3
- package/dist/es2019/nodeviews/genericCard.js +6 -2
- package/dist/es2019/nodeviews/inlineCard.js +4 -2
- package/dist/es2019/pm-plugins/main.js +3 -0
- package/dist/es2019/ui/WithCardContext.js +14 -3
- package/dist/esm/nodeviews/genericCard.js +6 -2
- package/dist/esm/nodeviews/inlineCard.js +4 -2
- package/dist/esm/pm-plugins/main.js +3 -0
- package/dist/esm/ui/WithCardContext.js +16 -3
- package/dist/types/nodeviews/genericCard.d.ts +1 -0
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/ui/WithCardContext.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/WithCardContext.d.ts +3 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-card
|
|
2
2
|
|
|
3
|
+
## 16.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 16.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`c939283d6f41a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c939283d6f41a) -
|
|
14
|
+
[EDITOR-6181](https://hello.jira.atlassian.cloud/browse/EDITOR-6181) - fix inline smart cards in
|
|
15
|
+
SSR streaming
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 16.4.5
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -19,6 +19,7 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
19
19
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
20
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
21
|
var _link = _interopRequireDefault(require("@atlaskit/link"));
|
|
22
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
23
|
var _doc = require("../pm-plugins/doc");
|
|
23
24
|
var _state = require("../pm-plugins/util/state");
|
|
24
25
|
var _utils2 = require("../pm-plugins/utils");
|
|
@@ -86,7 +87,8 @@ function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
86
87
|
_this2 = this;
|
|
87
88
|
var _this$props = this.props,
|
|
88
89
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
89
|
-
onClickCallback = _this$props.onClickCallback
|
|
90
|
+
onClickCallback = _this$props.onClickCallback,
|
|
91
|
+
smartCardContext = _this$props.smartCardContext;
|
|
90
92
|
var _titleUrlPairFromNode = (0, _utils2.titleUrlPairFromNode)(this.props.node),
|
|
91
93
|
url = _titleUrlPairFromNode.url;
|
|
92
94
|
if (url && !(0, _adfSchema.isSafeUrl)(url)) {
|
|
@@ -124,7 +126,9 @@ function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
124
126
|
url: url
|
|
125
127
|
}, function (_ref2) {
|
|
126
128
|
var onClick = _ref2.onClick;
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(_WithCardContext.WithCardContext,
|
|
129
|
+
return /*#__PURE__*/_react.default.createElement(_WithCardContext.WithCardContext, {
|
|
130
|
+
value: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
131
|
+
}, function (cardContext) {
|
|
128
132
|
return /*#__PURE__*/_react.default.createElement(SmartCardComponent, (0, _extends2.default)({
|
|
129
133
|
key: url,
|
|
130
134
|
cardContext: cardContext
|
|
@@ -202,7 +202,8 @@ function InlineCardNodeView(props) {
|
|
|
202
202
|
onClickCallback = props.onClickCallback,
|
|
203
203
|
isPageSSRed = props.isPageSSRed,
|
|
204
204
|
provider = props.provider,
|
|
205
|
-
CompetitorPrompt = props.CompetitorPrompt
|
|
205
|
+
CompetitorPrompt = props.CompetitorPrompt,
|
|
206
|
+
smartCardContext = props.smartCardContext;
|
|
206
207
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, (0, _expVal.expVal)('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && (0, _platformFeatureFlags.fg)('cc_drag_and_drop_smart_link_from_content_to_tree') ? ['editorViewMode', 'card'] : ['editorViewMode'], (0, _expVal.expVal)('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && (0, _platformFeatureFlags.fg)('cc_drag_and_drop_smart_link_from_content_to_tree') ? selectorWithCard : selectorWithoutCard),
|
|
207
208
|
mode = _useSharedPluginState.mode,
|
|
208
209
|
resolvedInlineSmartLinks = _useSharedPluginState.resolvedInlineSmartLinks;
|
|
@@ -238,7 +239,8 @@ function InlineCardNodeView(props) {
|
|
|
238
239
|
onClickCallback: onClickCallback,
|
|
239
240
|
isPageSSRed: isPageSSRed,
|
|
240
241
|
provider: provider,
|
|
241
|
-
appearance: "inline"
|
|
242
|
+
appearance: "inline",
|
|
243
|
+
smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
242
244
|
// Ignored via go/ees005
|
|
243
245
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
244
246
|
}, enableInlineUpgradeFeatures && (0, _utils.getAwarenessProps)(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
|
|
@@ -15,6 +15,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
15
15
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
16
16
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
19
|
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
19
20
|
var _inlineCard = require("../nodeviews/inlineCard");
|
|
20
21
|
var _lazyBlockCard = require("../nodeviews/lazy-block-card");
|
|
@@ -59,6 +60,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
59
60
|
onClickCallback = options.onClickCallback,
|
|
60
61
|
isPageSSRed = options.isPageSSRed,
|
|
61
62
|
provider = options.provider,
|
|
63
|
+
smartCardContext = options.smartCardContext,
|
|
62
64
|
CompetitorPrompt = options.CompetitorPrompt,
|
|
63
65
|
embedCardTransformers = options.embedCardTransformers;
|
|
64
66
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
@@ -75,6 +77,7 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
|
|
|
75
77
|
onClickCallback: onClickCallback,
|
|
76
78
|
isPageSSRed: isPageSSRed,
|
|
77
79
|
provider: provider,
|
|
80
|
+
smartCardContext: (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
|
|
78
81
|
CompetitorPrompt: CompetitorPrompt
|
|
79
82
|
}
|
|
80
83
|
});
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.WithCardContext = void 0;
|
|
8
|
-
var
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
16
|
var WithCardContext = exports.WithCardContext = function WithCardContext(_ref) {
|
|
11
|
-
var children = _ref.children
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
value = _ref.value;
|
|
12
19
|
var cardContext = (0, _linkProvider.useSmartCardContext)();
|
|
13
|
-
|
|
20
|
+
var cardContextWithValue = (0, _react.useMemo)(function () {
|
|
21
|
+
if (!(0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
22
|
+
return cardContext;
|
|
23
|
+
}
|
|
24
|
+
return value ? _objectSpread(_objectSpread({}, cardContext), {}, {
|
|
25
|
+
value: value
|
|
26
|
+
}) : cardContext;
|
|
27
|
+
}, [value, cardContext]);
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children(cardContextWithValue));
|
|
14
29
|
};
|
|
@@ -6,6 +6,7 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
|
6
6
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import Link from '@atlaskit/link';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
10
11
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
11
12
|
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
@@ -62,7 +63,8 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
62
63
|
var _getPluginState;
|
|
63
64
|
const {
|
|
64
65
|
pluginInjectionApi,
|
|
65
|
-
onClickCallback
|
|
66
|
+
onClickCallback,
|
|
67
|
+
smartCardContext
|
|
66
68
|
} = this.props;
|
|
67
69
|
const {
|
|
68
70
|
url
|
|
@@ -102,7 +104,9 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
102
104
|
url: url
|
|
103
105
|
}, ({
|
|
104
106
|
onClick
|
|
105
|
-
}) => /*#__PURE__*/React.createElement(WithCardContext,
|
|
107
|
+
}) => /*#__PURE__*/React.createElement(WithCardContext, {
|
|
108
|
+
value: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
109
|
+
}, cardContext => /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
106
110
|
key: url,
|
|
107
111
|
cardContext: cardContext
|
|
108
112
|
// Ignored via go/ees005
|
|
@@ -199,7 +199,8 @@ export function InlineCardNodeView(props) {
|
|
|
199
199
|
onClickCallback,
|
|
200
200
|
isPageSSRed,
|
|
201
201
|
provider,
|
|
202
|
-
CompetitorPrompt
|
|
202
|
+
CompetitorPrompt,
|
|
203
|
+
smartCardContext
|
|
203
204
|
} = props;
|
|
204
205
|
const {
|
|
205
206
|
mode,
|
|
@@ -237,7 +238,8 @@ export function InlineCardNodeView(props) {
|
|
|
237
238
|
onClickCallback: onClickCallback,
|
|
238
239
|
isPageSSRed: isPageSSRed,
|
|
239
240
|
provider: provider,
|
|
240
|
-
appearance: "inline"
|
|
241
|
+
appearance: "inline",
|
|
242
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
241
243
|
// Ignored via go/ees005
|
|
242
244
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
243
245
|
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
|
|
@@ -6,6 +6,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
6
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
10
11
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
11
12
|
import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
|
|
@@ -48,6 +49,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
48
49
|
onClickCallback,
|
|
49
50
|
isPageSSRed,
|
|
50
51
|
provider,
|
|
52
|
+
smartCardContext,
|
|
51
53
|
CompetitorPrompt,
|
|
52
54
|
embedCardTransformers
|
|
53
55
|
} = options;
|
|
@@ -65,6 +67,7 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
|
|
|
65
67
|
onClickCallback,
|
|
66
68
|
isPageSSRed,
|
|
67
69
|
provider,
|
|
70
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
|
|
68
71
|
CompetitorPrompt
|
|
69
72
|
}
|
|
70
73
|
});
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
export const WithCardContext = ({
|
|
4
|
-
children
|
|
5
|
+
children,
|
|
6
|
+
value
|
|
5
7
|
}) => {
|
|
6
8
|
const cardContext = useSmartCardContext();
|
|
7
|
-
|
|
9
|
+
const cardContextWithValue = useMemo(() => {
|
|
10
|
+
if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
11
|
+
return cardContext;
|
|
12
|
+
}
|
|
13
|
+
return value ? {
|
|
14
|
+
...cardContext,
|
|
15
|
+
value
|
|
16
|
+
} : cardContext;
|
|
17
|
+
}, [value, cardContext]);
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContextWithValue));
|
|
8
19
|
};
|
|
@@ -13,6 +13,7 @@ import { AnalyticsContext } from '@atlaskit/analytics-next';
|
|
|
13
13
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
14
14
|
import { getAnalyticsEditorAppearance } from '@atlaskit/editor-common/utils';
|
|
15
15
|
import Link from '@atlaskit/link';
|
|
16
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
16
17
|
import { changeSelectedCardToLinkFallback } from '../pm-plugins/doc';
|
|
17
18
|
import { getPluginState } from '../pm-plugins/util/state';
|
|
18
19
|
import { titleUrlPairFromNode } from '../pm-plugins/utils';
|
|
@@ -77,7 +78,8 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
77
78
|
_this2 = this;
|
|
78
79
|
var _this$props = this.props,
|
|
79
80
|
pluginInjectionApi = _this$props.pluginInjectionApi,
|
|
80
|
-
onClickCallback = _this$props.onClickCallback
|
|
81
|
+
onClickCallback = _this$props.onClickCallback,
|
|
82
|
+
smartCardContext = _this$props.smartCardContext;
|
|
81
83
|
var _titleUrlPairFromNode = titleUrlPairFromNode(this.props.node),
|
|
82
84
|
url = _titleUrlPairFromNode.url;
|
|
83
85
|
if (url && !isSafeUrl(url)) {
|
|
@@ -115,7 +117,9 @@ export function Card(SmartCardComponent, UnsupportedComponent) {
|
|
|
115
117
|
url: url
|
|
116
118
|
}, function (_ref2) {
|
|
117
119
|
var onClick = _ref2.onClick;
|
|
118
|
-
return /*#__PURE__*/React.createElement(WithCardContext,
|
|
120
|
+
return /*#__PURE__*/React.createElement(WithCardContext, {
|
|
121
|
+
value: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
122
|
+
}, function (cardContext) {
|
|
119
123
|
return /*#__PURE__*/React.createElement(SmartCardComponent, _extends({
|
|
120
124
|
key: url,
|
|
121
125
|
cardContext: cardContext
|
|
@@ -190,7 +190,8 @@ export function InlineCardNodeView(props) {
|
|
|
190
190
|
onClickCallback = props.onClickCallback,
|
|
191
191
|
isPageSSRed = props.isPageSSRed,
|
|
192
192
|
provider = props.provider,
|
|
193
|
-
CompetitorPrompt = props.CompetitorPrompt
|
|
193
|
+
CompetitorPrompt = props.CompetitorPrompt,
|
|
194
|
+
smartCardContext = props.smartCardContext;
|
|
194
195
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, expVal('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && fg('cc_drag_and_drop_smart_link_from_content_to_tree') ? ['editorViewMode', 'card'] : ['editorViewMode'], expVal('cc_dnd_smart_link_changeboard_platform_css', 'isEnabled', false) && fg('cc_drag_and_drop_smart_link_from_content_to_tree') ? selectorWithCard : selectorWithoutCard),
|
|
195
196
|
mode = _useSharedPluginState.mode,
|
|
196
197
|
resolvedInlineSmartLinks = _useSharedPluginState.resolvedInlineSmartLinks;
|
|
@@ -226,7 +227,8 @@ export function InlineCardNodeView(props) {
|
|
|
226
227
|
onClickCallback: onClickCallback,
|
|
227
228
|
isPageSSRed: isPageSSRed,
|
|
228
229
|
provider: provider,
|
|
229
|
-
appearance: "inline"
|
|
230
|
+
appearance: "inline",
|
|
231
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
230
232
|
// Ignored via go/ees005
|
|
231
233
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
232
234
|
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), CompetitorPromptComponent);
|
|
@@ -10,6 +10,7 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
10
10
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
11
|
import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
14
|
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
14
15
|
import { InlineCardNodeView } from '../nodeviews/inlineCard';
|
|
15
16
|
import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
|
|
@@ -52,6 +53,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
52
53
|
onClickCallback = options.onClickCallback,
|
|
53
54
|
isPageSSRed = options.isPageSSRed,
|
|
54
55
|
provider = options.provider,
|
|
56
|
+
smartCardContext = options.smartCardContext,
|
|
55
57
|
CompetitorPrompt = options.CompetitorPrompt,
|
|
56
58
|
embedCardTransformers = options.embedCardTransformers;
|
|
57
59
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
@@ -68,6 +70,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
68
70
|
onClickCallback: onClickCallback,
|
|
69
71
|
isPageSSRed: isPageSSRed,
|
|
70
72
|
provider: provider,
|
|
73
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined,
|
|
71
74
|
CompetitorPrompt: CompetitorPrompt
|
|
72
75
|
}
|
|
73
76
|
});
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
2
5
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
6
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
7
|
export var WithCardContext = function WithCardContext(_ref) {
|
|
4
|
-
var children = _ref.children
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
value = _ref.value;
|
|
5
10
|
var cardContext = useSmartCardContext();
|
|
6
|
-
|
|
11
|
+
var cardContextWithValue = useMemo(function () {
|
|
12
|
+
if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
13
|
+
return cardContext;
|
|
14
|
+
}
|
|
15
|
+
return value ? _objectSpread(_objectSpread({}, cardContext), {}, {
|
|
16
|
+
value: value
|
|
17
|
+
}) : cardContext;
|
|
18
|
+
}, [value, cardContext]);
|
|
19
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContextWithValue));
|
|
7
20
|
};
|
|
@@ -33,6 +33,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
33
|
onClickCallback?: OnClickCallback;
|
|
34
34
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
35
35
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
36
|
+
smartCardContext?: CardContext;
|
|
36
37
|
useAlternativePreloader?: boolean;
|
|
37
38
|
view: EditorView;
|
|
38
39
|
}
|
|
@@ -5,7 +5,7 @@ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemir
|
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import type { InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
7
|
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
|
-
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider'>;
|
|
8
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'smartCardContext'>;
|
|
9
9
|
/**
|
|
10
10
|
* Inline card node view component that renders a Smart Link inline card within the editor.
|
|
11
11
|
*
|
|
@@ -5,6 +5,7 @@ import type { CardOptions, CardReplacementInputMethod, EmbedCardTransformers, On
|
|
|
5
5
|
import type { CardAppearance, CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import type { DatasourceModalType, EditorAppearance, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
9
|
import type { DatasourceAdf, DatasourceAdfView } from '@atlaskit/linking-common';
|
|
9
10
|
import type { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
10
11
|
import type { EditorCardPluginEvents } from '../ui/analytics/create-events-queue';
|
|
@@ -126,6 +127,7 @@ export type CardPluginOptions = CardOptions & {
|
|
|
126
127
|
linkPicker?: LinkPickerOptions;
|
|
127
128
|
lpLinkPicker?: boolean;
|
|
128
129
|
onClickCallback?: OnClickCallback;
|
|
130
|
+
smartCardContext?: CardContext;
|
|
129
131
|
};
|
|
130
132
|
export type SetProvider = {
|
|
131
133
|
provider: CardProvider | null;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
-
|
|
3
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
4
|
+
export declare const WithCardContext: ({ children, value, }: {
|
|
4
5
|
children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
|
|
6
|
+
value?: CardContext;
|
|
5
7
|
}) => React.JSX.Element;
|
|
@@ -33,6 +33,7 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
33
|
onClickCallback?: OnClickCallback;
|
|
34
34
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
35
35
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
36
|
+
smartCardContext?: CardContext;
|
|
36
37
|
useAlternativePreloader?: boolean;
|
|
37
38
|
view: EditorView;
|
|
38
39
|
}
|
|
@@ -5,7 +5,7 @@ import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemir
|
|
|
5
5
|
import type { SmartCardProps } from './genericCard';
|
|
6
6
|
import type { InlineCardWithAwarenessProps } from './inlineCardWithAwareness';
|
|
7
7
|
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick, onResolve, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
|
-
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider'>;
|
|
8
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'smartCardContext'>;
|
|
9
9
|
/**
|
|
10
10
|
* Inline card node view component that renders a Smart Link inline card within the editor.
|
|
11
11
|
*
|
|
@@ -5,6 +5,7 @@ import type { CardOptions, CardReplacementInputMethod, EmbedCardTransformers, On
|
|
|
5
5
|
import type { CardAppearance, CardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import type { DatasourceModalType, EditorAppearance, LinkPickerOptions } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
9
|
import type { DatasourceAdf, DatasourceAdfView } from '@atlaskit/linking-common';
|
|
9
10
|
import type { SmartLinkEvents } from '@atlaskit/smart-card';
|
|
10
11
|
import type { EditorCardPluginEvents } from '../ui/analytics/create-events-queue';
|
|
@@ -126,6 +127,7 @@ export type CardPluginOptions = CardOptions & {
|
|
|
126
127
|
linkPicker?: LinkPickerOptions;
|
|
127
128
|
lpLinkPicker?: boolean;
|
|
128
129
|
onClickCallback?: OnClickCallback;
|
|
130
|
+
smartCardContext?: CardContext;
|
|
129
131
|
};
|
|
130
132
|
export type SetProvider = {
|
|
131
133
|
provider: CardProvider | null;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
-
|
|
3
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
4
|
+
export declare const WithCardContext: ({ children, value, }: {
|
|
4
5
|
children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
|
|
6
|
+
value?: CardContext;
|
|
5
7
|
}) => React.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-card",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.5.1",
|
|
4
4
|
"description": "Card plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.9.0",
|
|
33
33
|
"@atlaskit/analytics-next": "^11.2.0",
|
|
34
34
|
"@atlaskit/custom-steps": "^0.16.0",
|
|
35
35
|
"@atlaskit/editor-card-provider": "^6.7.0",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
64
|
-
"@atlaskit/smart-card": "^44.
|
|
65
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
+
"@atlaskit/smart-card": "^44.6.0",
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^75.0.0",
|
|
66
66
|
"@atlaskit/tokens": "^13.0.0",
|
|
67
67
|
"@babel/runtime": "^7.0.0",
|
|
68
68
|
"@emotion/react": "^11.7.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^114.
|
|
75
|
+
"@atlaskit/editor-common": "^114.19.0",
|
|
76
76
|
"@atlaskit/link-provider": "^4.3.0",
|
|
77
77
|
"react": "^18.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|