@atlaskit/editor-plugin-card 16.5.4 → 16.7.0
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 +22 -0
- package/dist/cjs/cardPlugin.js +18 -4
- package/dist/cjs/nodeviews/blockCard.js +16 -5
- package/dist/cjs/nodeviews/embedCard.js +16 -5
- package/dist/cjs/nodeviews/genericCard.js +2 -6
- package/dist/cjs/nodeviews/inlineCard.js +8 -4
- package/dist/cjs/pm-plugins/doc.js +87 -22
- package/dist/cjs/pm-plugins/main.js +12 -5
- package/dist/cjs/ui/SmartCardSSRReactContextsProvider.js +28 -0
- package/dist/cjs/ui/WithCardContext.js +3 -18
- package/dist/es2019/cardPlugin.js +12 -1
- package/dist/es2019/nodeviews/blockCard.js +16 -5
- package/dist/es2019/nodeviews/embedCard.js +16 -5
- package/dist/es2019/nodeviews/genericCard.js +2 -6
- package/dist/es2019/nodeviews/inlineCard.js +8 -4
- package/dist/es2019/pm-plugins/doc.js +83 -21
- package/dist/es2019/pm-plugins/main.js +12 -5
- package/dist/es2019/ui/SmartCardSSRReactContextsProvider.js +22 -0
- package/dist/es2019/ui/WithCardContext.js +3 -14
- package/dist/esm/cardPlugin.js +19 -5
- package/dist/esm/nodeviews/blockCard.js +16 -5
- package/dist/esm/nodeviews/embedCard.js +16 -5
- package/dist/esm/nodeviews/genericCard.js +2 -6
- package/dist/esm/nodeviews/inlineCard.js +8 -4
- package/dist/esm/pm-plugins/doc.js +86 -21
- package/dist/esm/pm-plugins/main.js +12 -5
- package/dist/esm/ui/SmartCardSSRReactContextsProvider.js +21 -0
- package/dist/esm/ui/WithCardContext.js +3 -16
- package/dist/types/cardPluginType.d.ts +9 -3
- package/dist/types/nodeviews/blockCard.d.ts +6 -2
- package/dist/types/nodeviews/embedCard.d.ts +6 -2
- package/dist/types/nodeviews/genericCard.d.ts +3 -1
- package/dist/types/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types/pm-plugins/doc.d.ts +9 -0
- package/dist/types/ui/SmartCardSSRReactContextsProvider.d.ts +10 -0
- package/dist/types/ui/WithCardContext.d.ts +1 -3
- package/dist/types-ts4.5/cardPluginType.d.ts +9 -3
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +6 -2
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +6 -2
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/doc.d.ts +9 -0
- package/dist/types-ts4.5/ui/SmartCardSSRReactContextsProvider.d.ts +10 -0
- package/dist/types-ts4.5/ui/WithCardContext.d.ts +1 -3
- package/package.json +4 -4
|
@@ -193,6 +193,45 @@ export var handleFallbackWithAnalytics = function handleFallbackWithAnalytics(re
|
|
|
193
193
|
return true;
|
|
194
194
|
};
|
|
195
195
|
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Shared options used by both `queueCardsFromChangedTr` and
|
|
199
|
+
* `queueCardsFromRange` to build smart-link resolution requests for text
|
|
200
|
+
* nodes carrying a `link` mark.
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Per-node walker shared by `queueCardsFromChangedTr` and
|
|
205
|
+
* `queueCardsFromRange`. Pushes a smart-link resolution request for every
|
|
206
|
+
* text node carrying a qualifying `link` mark.
|
|
207
|
+
*
|
|
208
|
+
* Returning `true`/`false` follows the ProseMirror `nodesBetween`/
|
|
209
|
+
* `nodesBetweenChanged` walker contract: `true` to descend into children,
|
|
210
|
+
* `false` to skip subtree.
|
|
211
|
+
*/
|
|
212
|
+
var collectLinkRequest = function collectLinkRequest(requests, node, pos, options) {
|
|
213
|
+
if (!node.isText) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
var linkMark = node.marks.find(function (mark) {
|
|
217
|
+
return mark.type === options.linkMarkType;
|
|
218
|
+
});
|
|
219
|
+
if (linkMark) {
|
|
220
|
+
if (!shouldReplaceLink(node, options.normalizeLinkText)) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
requests.push({
|
|
224
|
+
url: linkMark.attrs.href,
|
|
225
|
+
pos: pos,
|
|
226
|
+
appearance: options.appearance,
|
|
227
|
+
compareLinkText: options.normalizeLinkText,
|
|
228
|
+
source: options.source,
|
|
229
|
+
analyticsAction: options.analyticsAction,
|
|
230
|
+
sourceEvent: options.sourceEvent
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
234
|
+
};
|
|
196
235
|
export var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr, source, analyticsAction) {
|
|
197
236
|
var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
198
237
|
var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
@@ -200,28 +239,16 @@ export var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr,
|
|
|
200
239
|
var schema = state.schema;
|
|
201
240
|
var link = schema.marks.link;
|
|
202
241
|
var requests = [];
|
|
242
|
+
var options = {
|
|
243
|
+
analyticsAction: analyticsAction,
|
|
244
|
+
appearance: appearance,
|
|
245
|
+
linkMarkType: link,
|
|
246
|
+
normalizeLinkText: normalizeLinkText,
|
|
247
|
+
source: source,
|
|
248
|
+
sourceEvent: sourceEvent
|
|
249
|
+
};
|
|
203
250
|
nodesBetweenChanged(tr, function (node, pos) {
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
var linkMark = node.marks.find(function (mark) {
|
|
208
|
-
return mark.type === link;
|
|
209
|
-
});
|
|
210
|
-
if (linkMark) {
|
|
211
|
-
if (!shouldReplaceLink(node, normalizeLinkText)) {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
requests.push({
|
|
215
|
-
url: linkMark.attrs.href,
|
|
216
|
-
pos: pos,
|
|
217
|
-
appearance: appearance,
|
|
218
|
-
compareLinkText: normalizeLinkText,
|
|
219
|
-
source: source,
|
|
220
|
-
analyticsAction: analyticsAction,
|
|
221
|
-
sourceEvent: sourceEvent
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
return false;
|
|
251
|
+
return collectLinkRequest(requests, node, pos, options);
|
|
225
252
|
});
|
|
226
253
|
if (analyticsAction) {
|
|
227
254
|
addLinkMetadata(state.selection, tr, {
|
|
@@ -230,6 +257,44 @@ export var queueCardsFromChangedTr = function queueCardsFromChangedTr(state, tr,
|
|
|
230
257
|
}
|
|
231
258
|
return queueCards(requests)(tr);
|
|
232
259
|
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Queue link-mark → smart-link resolution for text nodes within an explicit
|
|
263
|
+
* document range, rather than the entire step range of the transaction.
|
|
264
|
+
*
|
|
265
|
+
* Use this instead of `queueCardsFromChangedTr` when you know the exact range
|
|
266
|
+
* that was inserted/modified and want to avoid accidentally queuing pre-existing
|
|
267
|
+
* links that happen to fall within the broader step range.
|
|
268
|
+
*/
|
|
269
|
+
export var queueCardsFromRange = function queueCardsFromRange(state, tr, from, to, source, analyticsAction) {
|
|
270
|
+
var normalizeLinkText = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
|
|
271
|
+
var sourceEvent = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : undefined;
|
|
272
|
+
var appearance = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 'inline';
|
|
273
|
+
var schema = state.schema;
|
|
274
|
+
var link = schema.marks.link;
|
|
275
|
+
var requests = [];
|
|
276
|
+
var options = {
|
|
277
|
+
analyticsAction: analyticsAction,
|
|
278
|
+
appearance: appearance,
|
|
279
|
+
linkMarkType: link,
|
|
280
|
+
normalizeLinkText: normalizeLinkText,
|
|
281
|
+
source: source,
|
|
282
|
+
sourceEvent: sourceEvent
|
|
283
|
+
};
|
|
284
|
+
var clampedFrom = Math.max(0, from);
|
|
285
|
+
var clampedTo = Math.min(tr.doc.content.size, to);
|
|
286
|
+
if (clampedFrom < clampedTo) {
|
|
287
|
+
tr.doc.nodesBetween(clampedFrom, clampedTo, function (node, pos) {
|
|
288
|
+
return collectLinkRequest(requests, node, pos, options);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
if (analyticsAction) {
|
|
292
|
+
addLinkMetadata(state.selection, tr, {
|
|
293
|
+
action: analyticsAction
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return queueCards(requests)(tr);
|
|
297
|
+
};
|
|
233
298
|
export var queueCardFromChangedTr = function queueCardFromChangedTr(state, tr, source, analyticsAction) {
|
|
234
299
|
var normalizeLinkText = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
235
300
|
var sourceEvent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : undefined;
|
|
@@ -3,6 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
import rafSchedule from 'raf-schd';
|
|
6
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
6
7
|
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
7
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
9
|
import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
|
|
@@ -53,9 +54,10 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
53
54
|
onClickCallback = options.onClickCallback,
|
|
54
55
|
isPageSSRed = options.isPageSSRed,
|
|
55
56
|
provider = options.provider,
|
|
56
|
-
smartCardContext = options.smartCardContext,
|
|
57
57
|
CompetitorPrompt = options.CompetitorPrompt,
|
|
58
|
+
smartCardContext = options.smartCardContext,
|
|
58
59
|
embedCardTransformers = options.embedCardTransformers;
|
|
60
|
+
var intl = pmPluginFactoryParams.getIntl();
|
|
59
61
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
60
62
|
var inlineCardViewProducer = getInlineNodeViewProducer({
|
|
61
63
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
@@ -70,8 +72,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
70
72
|
onClickCallback: onClickCallback,
|
|
71
73
|
isPageSSRed: isPageSSRed,
|
|
72
74
|
provider: provider,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : CompetitorPrompt,
|
|
76
|
+
intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
|
|
77
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
75
78
|
}
|
|
76
79
|
});
|
|
77
80
|
return new SafePlugin({
|
|
@@ -270,7 +273,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
270
273
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
271
274
|
isPageSSRed: isPageSSRed,
|
|
272
275
|
provider: provider,
|
|
273
|
-
CompetitorPrompt: options.CompetitorPrompt
|
|
276
|
+
CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
|
|
277
|
+
intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
|
|
278
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
274
279
|
}),
|
|
275
280
|
embedCard: lazyEmbedCardView({
|
|
276
281
|
allowResizing: allowResizing,
|
|
@@ -281,7 +286,9 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
281
286
|
onClickCallback: options.onClickCallback,
|
|
282
287
|
isPageSSRed: isPageSSRed,
|
|
283
288
|
provider: provider,
|
|
284
|
-
CompetitorPrompt: options.CompetitorPrompt
|
|
289
|
+
CompetitorPrompt: isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? undefined : options.CompetitorPrompt,
|
|
290
|
+
intl: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? intl : undefined,
|
|
291
|
+
smartCardContext: expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? smartCardContext : undefined
|
|
285
292
|
})
|
|
286
293
|
}
|
|
287
294
|
}, enableInlineUpgradeFeatures && {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RawIntlProvider } from 'react-intl';
|
|
3
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
4
|
+
import { SmartCardContext } from '@atlaskit/link-provider';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
export function SmartCardSSRReactContextsProvider(_ref) {
|
|
7
|
+
var smartCardContext = _ref.smartCardContext,
|
|
8
|
+
children = _ref.children,
|
|
9
|
+
intl = _ref.intl;
|
|
10
|
+
if (!expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) || !isSSR()) {
|
|
11
|
+
return children;
|
|
12
|
+
}
|
|
13
|
+
if (!intl || !smartCardContext) {
|
|
14
|
+
return children;
|
|
15
|
+
}
|
|
16
|
+
return /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
17
|
+
value: intl
|
|
18
|
+
}, /*#__PURE__*/React.createElement(SmartCardContext.Provider, {
|
|
19
|
+
value: smartCardContext
|
|
20
|
+
}, children));
|
|
21
|
+
}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import
|
|
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';
|
|
1
|
+
import React from 'react';
|
|
5
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
3
|
export var WithCardContext = function WithCardContext(_ref) {
|
|
8
|
-
var children = _ref.children
|
|
9
|
-
value = _ref.value;
|
|
4
|
+
var children = _ref.children;
|
|
10
5
|
var cardContext = useSmartCardContext();
|
|
11
|
-
|
|
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));
|
|
6
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children(cardContext));
|
|
20
7
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { CardPluginActions, CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
4
|
+
import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
6
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
7
|
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
6
8
|
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
@@ -38,6 +40,10 @@ export type CardPluginDependencies = [
|
|
|
38
40
|
];
|
|
39
41
|
export type CardPlugin = NextEditorPlugin<'card', {
|
|
40
42
|
actions: CardPluginActions;
|
|
43
|
+
commands: {
|
|
44
|
+
/** EditorCommand form of `queueCardsFromRange`. Prefer over the action. */
|
|
45
|
+
queueCardsFromRange: (from: number, to: number, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null, appearance?: CardAppearance) => EditorCommand;
|
|
46
|
+
};
|
|
41
47
|
dependencies: CardPluginDependencies;
|
|
42
48
|
pluginConfiguration: CardPluginOptions | undefined;
|
|
43
49
|
sharedState: CardPluginState | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { IntlShape } from 'react-intl';
|
|
2
3
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
4
|
import type { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
5
|
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
9
|
import { Datasource } from '../nodeviews/datasource';
|
|
8
10
|
import type { SmartCardProps } from './genericCard';
|
|
9
11
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
|
|
@@ -26,7 +28,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
26
28
|
}) => void;
|
|
27
29
|
render(): React.JSX.Element;
|
|
28
30
|
}
|
|
29
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
31
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
|
|
30
32
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
31
33
|
private id;
|
|
32
34
|
unsubscribe: (() => void) | undefined;
|
|
@@ -51,10 +53,12 @@ export interface BlockCardNodeViewProperties {
|
|
|
51
53
|
sourceUrl: string;
|
|
52
54
|
}>;
|
|
53
55
|
inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
|
|
56
|
+
intl?: IntlShape;
|
|
54
57
|
isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
|
|
55
58
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
56
59
|
pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
|
|
57
60
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
58
61
|
provider: BlockCardNodeViewProps['provider'];
|
|
62
|
+
smartCardContext?: CardContext;
|
|
59
63
|
}
|
|
60
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
|
|
64
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
|
+
import type { IntlShape } from 'react-intl';
|
|
3
4
|
import type { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
4
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
6
|
import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
10
|
import type { cardPlugin } from '../index';
|
|
9
11
|
import type { SmartCardProps } from './genericCard';
|
|
10
12
|
/**
|
|
@@ -68,7 +70,7 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
|
|
|
68
70
|
render(): React.JSX.Element;
|
|
69
71
|
}
|
|
70
72
|
export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
|
|
71
|
-
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
73
|
+
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
|
|
72
74
|
export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
|
|
73
75
|
private id;
|
|
74
76
|
unsubscribe: (() => void) | undefined;
|
|
@@ -89,10 +91,12 @@ export interface EmbedCardNodeViewProperties {
|
|
|
89
91
|
allowResizing: EmbedCardNodeViewProps['allowResizing'];
|
|
90
92
|
CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
|
|
91
93
|
fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
|
|
94
|
+
intl?: IntlShape;
|
|
92
95
|
isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
|
|
93
96
|
onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
|
|
94
97
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
95
98
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
96
99
|
provider: EmbedCardNodeViewProps['provider'];
|
|
100
|
+
smartCardContext?: CardContext;
|
|
97
101
|
}
|
|
98
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
102
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { IntlShape } from 'react-intl';
|
|
3
4
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import type { OnClickCallback } from '@atlaskit/editor-common/card';
|
|
5
6
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
@@ -33,7 +34,6 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
34
|
onClickCallback?: OnClickCallback;
|
|
34
35
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
35
36
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
36
|
-
smartCardContext?: CardContext;
|
|
37
37
|
useAlternativePreloader?: boolean;
|
|
38
38
|
view: EditorView;
|
|
39
39
|
}
|
|
@@ -47,12 +47,14 @@ export interface SmartCardProps extends CardProps {
|
|
|
47
47
|
}>;
|
|
48
48
|
disablePreviewPanel?: BaseCardProps['disablePreviewPanel'];
|
|
49
49
|
enableInlineUpgradeFeatures?: boolean;
|
|
50
|
+
intl?: IntlShape;
|
|
50
51
|
isHovered?: boolean;
|
|
51
52
|
isPageSSRed?: boolean;
|
|
52
53
|
onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
|
|
53
54
|
onResolve?: (tr: Transaction, title?: string) => void;
|
|
54
55
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
55
56
|
provider?: Providers['cardProvider'];
|
|
57
|
+
smartCardContext?: CardContext;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
*
|
|
@@ -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' | 'smartCardContext'>;
|
|
8
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'intl' | 'smartCardContext'>;
|
|
9
9
|
/**
|
|
10
10
|
* Inline card node view component that renders a Smart Link inline card within the editor.
|
|
11
11
|
*
|
|
@@ -12,6 +12,15 @@ import type { Request } from '../types';
|
|
|
12
12
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent, embedCardNodeTransformer?: EmbedCardNodeTransformer) => Command;
|
|
13
13
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
14
14
|
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction;
|
|
15
|
+
/**
|
|
16
|
+
* Queue link-mark → smart-link resolution for text nodes within an explicit
|
|
17
|
+
* document range, rather than the entire step range of the transaction.
|
|
18
|
+
*
|
|
19
|
+
* Use this instead of `queueCardsFromChangedTr` when you know the exact range
|
|
20
|
+
* that was inserted/modified and want to avoid accidentally queuing pre-existing
|
|
21
|
+
* links that happen to fall within the broader step range.
|
|
22
|
+
*/
|
|
23
|
+
export declare const queueCardsFromRange: (state: EditorState, tr: Transaction, from: number, to: number, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction;
|
|
15
24
|
export declare const queueCardFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, previousAppearance?: CardAppearance | "url") => Transaction;
|
|
16
25
|
export declare const convertHyperlinkToSmartCard: (state: EditorState, source: CardReplacementInputMethod, appearance: CardAppearance, normalizeLinkText?: boolean) => Transaction;
|
|
17
26
|
export declare const changeSelectedCardToLink: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IntlShape } from 'react-intl';
|
|
3
|
+
import { type CardContext } from '@atlaskit/link-provider';
|
|
4
|
+
interface Props {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
intl: IntlShape | undefined;
|
|
7
|
+
smartCardContext: CardContext | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function SmartCardSSRReactContextsProvider({ smartCardContext, children, intl, }: Props): ReactNode;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
-
|
|
4
|
-
export declare const WithCardContext: ({ children, value, }: {
|
|
3
|
+
export declare const WithCardContext: ({ children, }: {
|
|
5
4
|
children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
|
|
6
|
-
value?: CardContext;
|
|
7
5
|
}) => React.JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { CardPluginActions, CardReplacementInputMethod } from '@atlaskit/editor-common/card';
|
|
4
|
+
import type { CardAppearance } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
6
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
7
|
import type { InlineCommentPluginState } from '@atlaskit/editor-plugin-annotation';
|
|
6
8
|
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
@@ -38,6 +40,10 @@ export type CardPluginDependencies = [
|
|
|
38
40
|
];
|
|
39
41
|
export type CardPlugin = NextEditorPlugin<'card', {
|
|
40
42
|
actions: CardPluginActions;
|
|
43
|
+
commands: {
|
|
44
|
+
/** EditorCommand form of `queueCardsFromRange`. Prefer over the action. */
|
|
45
|
+
queueCardsFromRange: (from: number, to: number, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null, appearance?: CardAppearance) => EditorCommand;
|
|
46
|
+
};
|
|
41
47
|
dependencies: CardPluginDependencies;
|
|
42
48
|
pluginConfiguration: CardPluginOptions | undefined;
|
|
43
49
|
sharedState: CardPluginState | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { IntlShape } from 'react-intl';
|
|
2
3
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
4
|
import type { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
4
5
|
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
7
9
|
import { Datasource } from '../nodeviews/datasource';
|
|
8
10
|
import type { SmartCardProps } from './genericCard';
|
|
9
11
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
|
|
@@ -26,7 +28,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
26
28
|
}) => void;
|
|
27
29
|
render(): React.JSX.Element;
|
|
28
30
|
}
|
|
29
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
31
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
|
|
30
32
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
31
33
|
private id;
|
|
32
34
|
unsubscribe: (() => void) | undefined;
|
|
@@ -51,10 +53,12 @@ export interface BlockCardNodeViewProperties {
|
|
|
51
53
|
sourceUrl: string;
|
|
52
54
|
}>;
|
|
53
55
|
inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
|
|
56
|
+
intl?: IntlShape;
|
|
54
57
|
isPageSSRed: BlockCardNodeViewProps['isPageSSRed'];
|
|
55
58
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
56
59
|
pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
|
|
57
60
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
58
61
|
provider: BlockCardNodeViewProps['provider'];
|
|
62
|
+
smartCardContext?: CardContext;
|
|
59
63
|
}
|
|
60
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
|
|
64
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => BlockCard | Datasource | NodeView;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
|
+
import type { IntlShape } from 'react-intl';
|
|
3
4
|
import type { RichMediaLayout } from '@atlaskit/adf-schema';
|
|
4
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
6
|
import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
6
7
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
8
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { CardContext } from '@atlaskit/link-provider';
|
|
8
10
|
import type { cardPlugin } from '../index';
|
|
9
11
|
import type { SmartCardProps } from './genericCard';
|
|
10
12
|
/**
|
|
@@ -68,7 +70,7 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
|
|
|
68
70
|
render(): React.JSX.Element;
|
|
69
71
|
}
|
|
70
72
|
export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
|
|
71
|
-
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
73
|
+
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt' | 'intl' | 'smartCardContext'>;
|
|
72
74
|
export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
|
|
73
75
|
private id;
|
|
74
76
|
unsubscribe: (() => void) | undefined;
|
|
@@ -89,10 +91,12 @@ export interface EmbedCardNodeViewProperties {
|
|
|
89
91
|
allowResizing: EmbedCardNodeViewProps['allowResizing'];
|
|
90
92
|
CompetitorPrompt?: EmbedCardNodeViewProps['CompetitorPrompt'];
|
|
91
93
|
fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
|
|
94
|
+
intl?: IntlShape;
|
|
92
95
|
isPageSSRed: EmbedCardNodeViewProps['isPageSSRed'];
|
|
93
96
|
onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
|
|
94
97
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
95
98
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
96
99
|
provider: EmbedCardNodeViewProps['provider'];
|
|
100
|
+
smartCardContext?: CardContext;
|
|
97
101
|
}
|
|
98
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
102
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, intl, smartCardContext, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EventHandler, KeyboardEvent, MouseEvent } from 'react';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { IntlShape } from 'react-intl';
|
|
3
4
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import type { OnClickCallback } from '@atlaskit/editor-common/card';
|
|
5
6
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
@@ -33,7 +34,6 @@ export interface CardProps extends CardNodeViewProps {
|
|
|
33
34
|
onClickCallback?: OnClickCallback;
|
|
34
35
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
35
36
|
showHoverPreview?: BaseCardProps['showHoverPreview'];
|
|
36
|
-
smartCardContext?: CardContext;
|
|
37
37
|
useAlternativePreloader?: boolean;
|
|
38
38
|
view: EditorView;
|
|
39
39
|
}
|
|
@@ -47,12 +47,14 @@ export interface SmartCardProps extends CardProps {
|
|
|
47
47
|
}>;
|
|
48
48
|
disablePreviewPanel?: BaseCardProps['disablePreviewPanel'];
|
|
49
49
|
enableInlineUpgradeFeatures?: boolean;
|
|
50
|
+
intl?: IntlShape;
|
|
50
51
|
isHovered?: boolean;
|
|
51
52
|
isPageSSRed?: boolean;
|
|
52
53
|
onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
|
|
53
54
|
onResolve?: (tr: Transaction, title?: string) => void;
|
|
54
55
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
55
56
|
provider?: Providers['cardProvider'];
|
|
57
|
+
smartCardContext?: CardContext;
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
*
|
|
@@ -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' | 'smartCardContext'>;
|
|
8
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider' | 'intl' | 'smartCardContext'>;
|
|
9
9
|
/**
|
|
10
10
|
* Inline card node view component that renders a Smart Link inline card within the editor.
|
|
11
11
|
*
|
|
@@ -12,6 +12,15 @@ import type { Request } from '../types';
|
|
|
12
12
|
export declare const replaceQueuedUrlWithCard: (url: string, cardData: CardAdf | DatasourceAdf, analyticsAction?: ACTION, editorAnalyticsApi?: EditorAnalyticsAPI, createAnalyticsEvent?: CreateUIAnalyticsEvent, embedCardNodeTransformer?: EmbedCardNodeTransformer) => Command;
|
|
13
13
|
export declare const handleFallbackWithAnalytics: (request: Request, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
|
|
14
14
|
export declare const queueCardsFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction;
|
|
15
|
+
/**
|
|
16
|
+
* Queue link-mark → smart-link resolution for text nodes within an explicit
|
|
17
|
+
* document range, rather than the entire step range of the transaction.
|
|
18
|
+
*
|
|
19
|
+
* Use this instead of `queueCardsFromChangedTr` when you know the exact range
|
|
20
|
+
* that was inserted/modified and want to avoid accidentally queuing pre-existing
|
|
21
|
+
* links that happen to fall within the broader step range.
|
|
22
|
+
*/
|
|
23
|
+
export declare const queueCardsFromRange: (state: EditorState, tr: Transaction, from: number, to: number, source: CardReplacementInputMethod, analyticsAction?: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, appearance?: CardAppearance) => Transaction;
|
|
15
24
|
export declare const queueCardFromChangedTr: (state: EditorState, tr: Transaction, source: CardReplacementInputMethod, analyticsAction: ACTION, normalizeLinkText?: boolean, sourceEvent?: UIAnalyticsEvent | null | undefined, previousAppearance?: CardAppearance | "url") => Transaction;
|
|
16
25
|
export declare const convertHyperlinkToSmartCard: (state: EditorState, source: CardReplacementInputMethod, appearance: CardAppearance, normalizeLinkText?: boolean) => Transaction;
|
|
17
26
|
export declare const changeSelectedCardToLink: (text?: string, href?: string, sendAnalytics?: boolean, node?: Node, pos?: number, editorAnalyticsApi?: EditorAnalyticsAPI) => Command;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type IntlShape } from 'react-intl';
|
|
3
|
+
import { type CardContext } from '@atlaskit/link-provider';
|
|
4
|
+
interface Props {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
intl: IntlShape | undefined;
|
|
7
|
+
smartCardContext: CardContext | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function SmartCardSSRReactContextsProvider({ smartCardContext, children, intl, }: Props): ReactNode;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useSmartCardContext } from '@atlaskit/link-provider';
|
|
3
|
-
|
|
4
|
-
export declare const WithCardContext: ({ children, value, }: {
|
|
3
|
+
export declare const WithCardContext: ({ children, }: {
|
|
5
4
|
children: (cardContext: ReturnType<typeof useSmartCardContext>) => React.ReactNode;
|
|
6
|
-
value?: CardContext;
|
|
7
5
|
}) => 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.7.0",
|
|
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.11.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",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
63
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
64
64
|
"@atlaskit/smart-card": "^44.9.0",
|
|
65
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
65
|
+
"@atlaskit/tmp-editor-statsig": "^79.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.30.0",
|
|
76
76
|
"@atlaskit/link-provider": "^4.4.0",
|
|
77
77
|
"react": "^18.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|