@atlaskit/editor-plugin-card 7.5.1 → 7.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 +28 -0
- package/dist/cjs/nodeviews/blockCard.js +78 -22
- package/dist/cjs/nodeviews/embedCard.js +78 -27
- package/dist/cjs/nodeviews/inlineCard.js +51 -6
- package/dist/cjs/nodeviews/inlineCardWithAwareness.js +7 -2
- package/dist/cjs/pm-plugins/main.js +7 -2
- package/dist/es2019/nodeviews/blockCard.js +36 -6
- package/dist/es2019/nodeviews/embedCard.js +38 -10
- package/dist/es2019/nodeviews/inlineCard.js +25 -3
- package/dist/es2019/nodeviews/inlineCardWithAwareness.js +7 -2
- package/dist/es2019/pm-plugins/main.js +5 -0
- package/dist/esm/nodeviews/blockCard.js +78 -23
- package/dist/esm/nodeviews/embedCard.js +78 -27
- package/dist/esm/nodeviews/inlineCard.js +52 -7
- package/dist/esm/nodeviews/inlineCardWithAwareness.js +7 -2
- package/dist/esm/pm-plugins/main.js +7 -2
- package/dist/types/nodeviews/blockCard.d.ts +10 -3
- package/dist/types/nodeviews/embedCard.d.ts +5 -2
- package/dist/types/nodeviews/genericCard.d.ts +2 -1
- package/dist/types/nodeviews/inlineCard.d.ts +2 -2
- package/dist/types/nodeviews/inlineCardWithAwareness.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/blockCard.d.ts +10 -3
- package/dist/types-ts4.5/nodeviews/embedCard.d.ts +5 -2
- package/dist/types-ts4.5/nodeviews/genericCard.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/inlineCard.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/inlineCardWithAwareness.d.ts +1 -1
- package/package.json +6 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _get from "@babel/runtime/helpers/get";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
5
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
@@ -7,6 +8,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
9
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
10
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
11
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
12
|
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; }
|
|
11
13
|
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; }
|
|
12
14
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -15,6 +17,7 @@ import React from 'react';
|
|
|
15
17
|
import rafSchedule from 'raf-schd';
|
|
16
18
|
import uuid from 'uuid/v4';
|
|
17
19
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
20
|
+
import { EditorCardProvider } from '@atlaskit/editor-card-provider';
|
|
18
21
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
19
22
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
20
23
|
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
@@ -131,9 +134,6 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
131
134
|
// Ignored via go/ees005
|
|
132
135
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
133
136
|
_defineProperty(_this, "embedIframeRef", /*#__PURE__*/React.createRef());
|
|
134
|
-
_defineProperty(_this, "state", {
|
|
135
|
-
hasPreview: true
|
|
136
|
-
});
|
|
137
137
|
_defineProperty(_this, "getPosSafely", function () {
|
|
138
138
|
var getPos = _this.props.getPos;
|
|
139
139
|
if (!getPos || typeof getPos === 'boolean') {
|
|
@@ -271,10 +271,54 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
271
271
|
});
|
|
272
272
|
_defineProperty(_this, "removeCardDispatched", false);
|
|
273
273
|
_this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
|
|
274
|
+
_this.state = {
|
|
275
|
+
hasPreview: true,
|
|
276
|
+
isSSRDataAvailable: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && props.isPageSSRed
|
|
277
|
+
};
|
|
274
278
|
return _this;
|
|
275
279
|
}
|
|
276
280
|
_inherits(EmbedCardComponent, _React$PureComponent);
|
|
277
281
|
return _createClass(EmbedCardComponent, [{
|
|
282
|
+
key: "componentDidMount",
|
|
283
|
+
value: function componentDidMount() {
|
|
284
|
+
var _this2 = this;
|
|
285
|
+
if (!expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
var provider = this.props.provider;
|
|
289
|
+
if (!provider) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
var updateSSRDataAvailability = /*#__PURE__*/function () {
|
|
293
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
294
|
+
var resolvedProvider;
|
|
295
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
296
|
+
while (1) switch (_context.prev = _context.next) {
|
|
297
|
+
case 0:
|
|
298
|
+
_context.next = 2;
|
|
299
|
+
return provider;
|
|
300
|
+
case 2:
|
|
301
|
+
resolvedProvider = _context.sent;
|
|
302
|
+
if (resolvedProvider instanceof EditorCardProvider) {
|
|
303
|
+
_this2.setState(function (state) {
|
|
304
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
305
|
+
isSSRDataAvailable: resolvedProvider.getCacheStatusForNode(_this2.props.node) === 'ssr'
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
case 4:
|
|
310
|
+
case "end":
|
|
311
|
+
return _context.stop();
|
|
312
|
+
}
|
|
313
|
+
}, _callee);
|
|
314
|
+
}));
|
|
315
|
+
return function updateSSRDataAvailability() {
|
|
316
|
+
return _ref3.apply(this, arguments);
|
|
317
|
+
};
|
|
318
|
+
}();
|
|
319
|
+
void updateSSRDataAvailability();
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
278
322
|
key: "componentWillUnmount",
|
|
279
323
|
value: function componentWillUnmount() {
|
|
280
324
|
this.removeCard();
|
|
@@ -346,7 +390,8 @@ export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
346
390
|
container: this.scrollContainer,
|
|
347
391
|
embedIframeRef: this.embedIframeRef,
|
|
348
392
|
actionOptions: actionOptions,
|
|
349
|
-
CompetitorPrompt: CompetitorPrompt
|
|
393
|
+
CompetitorPrompt: CompetitorPrompt,
|
|
394
|
+
hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && this.state.isSSRDataAvailable
|
|
350
395
|
}) : /*#__PURE__*/React.createElement(SmartCard, {
|
|
351
396
|
key: url,
|
|
352
397
|
url: url,
|
|
@@ -405,7 +450,8 @@ export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props)
|
|
|
405
450
|
hasPreview: props.hasPreview,
|
|
406
451
|
liveHeight: props.liveHeight,
|
|
407
452
|
initialAspectRatio: props.initialAspectRatio,
|
|
408
|
-
isPageSSRed: props.isPageSSRed
|
|
453
|
+
isPageSSRed: props.isPageSSRed,
|
|
454
|
+
provider: props.provider
|
|
409
455
|
}) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
|
|
410
456
|
id: props.id,
|
|
411
457
|
node: props.node,
|
|
@@ -424,7 +470,8 @@ export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props)
|
|
|
424
470
|
hasPreview: props.hasPreview,
|
|
425
471
|
liveHeight: props.liveHeight,
|
|
426
472
|
initialAspectRatio: props.initialAspectRatio,
|
|
427
|
-
isPageSSRed: props.isPageSSRed
|
|
473
|
+
isPageSSRed: props.isPageSSRed,
|
|
474
|
+
provider: props.provider
|
|
428
475
|
});
|
|
429
476
|
};
|
|
430
477
|
var WrappedEmbedCardWithCondition = componentWithCondition(function () {
|
|
@@ -433,17 +480,17 @@ var WrappedEmbedCardWithCondition = componentWithCondition(function () {
|
|
|
433
480
|
var WrappedEmbedCard = Card(WrappedEmbedCardWithCondition, UnsupportedBlock);
|
|
434
481
|
export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
435
482
|
function EmbedCard() {
|
|
436
|
-
var
|
|
483
|
+
var _this3;
|
|
437
484
|
_classCallCheck(this, EmbedCard);
|
|
438
485
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
439
486
|
args[_key] = arguments[_key];
|
|
440
487
|
}
|
|
441
|
-
|
|
442
|
-
_defineProperty(
|
|
443
|
-
_defineProperty(
|
|
488
|
+
_this3 = _callSuper(this, EmbedCard, [].concat(args));
|
|
489
|
+
_defineProperty(_this3, "id", uuid());
|
|
490
|
+
_defineProperty(_this3, "updateContentEditable", function (editorViewModeState, divElement) {
|
|
444
491
|
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
|
|
445
492
|
});
|
|
446
|
-
return
|
|
493
|
+
return _this3;
|
|
447
494
|
}
|
|
448
495
|
_inherits(EmbedCard, _ReactNodeView);
|
|
449
496
|
return _createClass(EmbedCard, [{
|
|
@@ -458,13 +505,13 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
458
505
|
key: "createDomRef",
|
|
459
506
|
value: function createDomRef() {
|
|
460
507
|
var _this$reactComponentP,
|
|
461
|
-
|
|
508
|
+
_this4 = this,
|
|
462
509
|
_this$reactComponentP2;
|
|
463
510
|
var domRef = document.createElement('div');
|
|
464
511
|
// It is a tradeoff for the bug mentioned that occurs in Chrome: https://product-fabric.atlassian.net/browse/ED-5379, https://github.com/ProseMirror/prosemirror/issues/884
|
|
465
|
-
this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (
|
|
466
|
-
var nextSharedState =
|
|
467
|
-
return
|
|
512
|
+
this.unsubscribe = (_this$reactComponentP = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP === void 0 || (_this$reactComponentP = _this$reactComponentP.editorViewMode) === null || _this$reactComponentP === void 0 ? void 0 : _this$reactComponentP.sharedState.onChange(function (_ref4) {
|
|
513
|
+
var nextSharedState = _ref4.nextSharedState;
|
|
514
|
+
return _this4.updateContentEditable(nextSharedState, domRef);
|
|
468
515
|
});
|
|
469
516
|
this.updateContentEditable((_this$reactComponentP2 = this.reactComponentProps.pluginInjectionApi) === null || _this$reactComponentP2 === void 0 || (_this$reactComponentP2 = _this$reactComponentP2.editorViewMode) === null || _this$reactComponentP2 === void 0 ? void 0 : _this$reactComponentP2.sharedState.currentState(), domRef);
|
|
470
517
|
domRef.setAttribute('spellcheck', 'false');
|
|
@@ -481,7 +528,8 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
481
528
|
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
|
|
482
529
|
onClickCallback = _this$reactComponentP3.onClickCallback,
|
|
483
530
|
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
|
|
484
|
-
isPageSSRed = _this$reactComponentP3.isPageSSRed
|
|
531
|
+
isPageSSRed = _this$reactComponentP3.isPageSSRed,
|
|
532
|
+
provider = _this$reactComponentP3.provider;
|
|
485
533
|
return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
|
|
486
534
|
node: this.node,
|
|
487
535
|
view: this.view,
|
|
@@ -494,7 +542,8 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
494
542
|
onClickCallback: onClickCallback,
|
|
495
543
|
id: this.id,
|
|
496
544
|
CompetitorPrompt: CompetitorPrompt,
|
|
497
|
-
isPageSSRed: isPageSSRed
|
|
545
|
+
isPageSSRed: isPageSSRed,
|
|
546
|
+
provider: provider
|
|
498
547
|
});
|
|
499
548
|
}
|
|
500
549
|
}, {
|
|
@@ -506,15 +555,16 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
506
555
|
}
|
|
507
556
|
}]);
|
|
508
557
|
}(ReactNodeView);
|
|
509
|
-
export var embedCardNodeView = function embedCardNodeView(
|
|
510
|
-
var allowResizing =
|
|
511
|
-
fullWidthMode =
|
|
512
|
-
pmPluginFactoryParams =
|
|
513
|
-
pluginInjectionApi =
|
|
514
|
-
actionOptions =
|
|
515
|
-
onClickCallback =
|
|
516
|
-
CompetitorPrompt =
|
|
517
|
-
isPageSSRed =
|
|
558
|
+
export var embedCardNodeView = function embedCardNodeView(_ref5) {
|
|
559
|
+
var allowResizing = _ref5.allowResizing,
|
|
560
|
+
fullWidthMode = _ref5.fullWidthMode,
|
|
561
|
+
pmPluginFactoryParams = _ref5.pmPluginFactoryParams,
|
|
562
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
563
|
+
actionOptions = _ref5.actionOptions,
|
|
564
|
+
onClickCallback = _ref5.onClickCallback,
|
|
565
|
+
CompetitorPrompt = _ref5.CompetitorPrompt,
|
|
566
|
+
isPageSSRed = _ref5.isPageSSRed,
|
|
567
|
+
provider = _ref5.provider;
|
|
518
568
|
return function (node, view, getPos) {
|
|
519
569
|
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
|
|
520
570
|
eventDispatcher = pmPluginFactoryParams.eventDispatcher,
|
|
@@ -528,7 +578,8 @@ export var embedCardNodeView = function embedCardNodeView(_ref4) {
|
|
|
528
578
|
actionOptions: actionOptions,
|
|
529
579
|
onClickCallback: onClickCallback,
|
|
530
580
|
CompetitorPrompt: CompetitorPrompt,
|
|
531
|
-
isPageSSRed: isPageSSRed
|
|
581
|
+
isPageSSRed: isPageSSRed,
|
|
582
|
+
provider: provider
|
|
532
583
|
};
|
|
533
584
|
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
|
|
534
585
|
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
6
|
import rafSchedule from 'raf-schd';
|
|
4
7
|
import uuid from 'uuid/v4';
|
|
8
|
+
import { EditorCardProvider } from '@atlaskit/editor-card-provider';
|
|
5
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
10
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
11
|
import { UnsupportedInline, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
8
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
13
|
import { Card as SmartCard } from '@atlaskit/smart-card';
|
|
10
14
|
import { CardSSR } from '@atlaskit/smart-card/ssr';
|
|
15
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
11
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
17
|
import { registerCard, removeCard } from '../pm-plugins/actions';
|
|
13
18
|
import { getAwarenessProps } from '../pm-plugins/utils';
|
|
@@ -27,6 +32,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
27
32
|
showHoverPreview = _ref.showHoverPreview,
|
|
28
33
|
hoverPreviewOptions = _ref.hoverPreviewOptions,
|
|
29
34
|
isPageSSRed = _ref.isPageSSRed,
|
|
35
|
+
provider = _ref.provider,
|
|
30
36
|
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
31
37
|
disablePreviewPanel = _ref.disablePreviewPanel;
|
|
32
38
|
var _node$attrs = node.attrs,
|
|
@@ -43,6 +49,42 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
49
|
view.dispatch(tr);
|
|
44
50
|
};
|
|
45
51
|
}, [getPos, view]);
|
|
52
|
+
var _useState = useState(expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && isPageSSRed),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
isSSRDataAvailable = _useState2[0],
|
|
55
|
+
setIsSSRDataAvailable = _useState2[1];
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (!expValEquals('platform_editor_smart_card_otp', 'isEnabled', true)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!provider) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
var updateSSRDataAvailability = /*#__PURE__*/function () {
|
|
64
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
65
|
+
var resolvedProvider;
|
|
66
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
67
|
+
while (1) switch (_context.prev = _context.next) {
|
|
68
|
+
case 0:
|
|
69
|
+
_context.next = 2;
|
|
70
|
+
return provider;
|
|
71
|
+
case 2:
|
|
72
|
+
resolvedProvider = _context.sent;
|
|
73
|
+
if (resolvedProvider instanceof EditorCardProvider) {
|
|
74
|
+
setIsSSRDataAvailable(resolvedProvider.getCacheStatusForNode(node) === 'ssr');
|
|
75
|
+
}
|
|
76
|
+
case 4:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee);
|
|
81
|
+
}));
|
|
82
|
+
return function updateSSRDataAvailability() {
|
|
83
|
+
return _ref2.apply(this, arguments);
|
|
84
|
+
};
|
|
85
|
+
}();
|
|
86
|
+
void updateSSRDataAvailability();
|
|
87
|
+
}, [provider, node]);
|
|
46
88
|
var scrollContainer = useMemo(
|
|
47
89
|
// Ignored via go/ees005
|
|
48
90
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -87,8 +129,8 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
87
129
|
var handleOnClick = useCallback(function (event) {
|
|
88
130
|
if (event.metaKey || event.ctrlKey) {
|
|
89
131
|
var _pluginInjectionApi$a;
|
|
90
|
-
var
|
|
91
|
-
editorAnalyticsApi =
|
|
132
|
+
var _ref3 = (_pluginInjectionApi$a = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.analytics) !== null && _pluginInjectionApi$a !== void 0 ? _pluginInjectionApi$a : {},
|
|
133
|
+
editorAnalyticsApi = _ref3.actions;
|
|
92
134
|
visitCardLinkAnalytics(editorAnalyticsApi, INPUT_METHOD.META_CLICK)(view.state, view.dispatch);
|
|
93
135
|
window.open(url, '_blank');
|
|
94
136
|
} else {
|
|
@@ -114,7 +156,8 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
114
156
|
isHovered: isHovered,
|
|
115
157
|
showHoverPreview: showHoverPreview,
|
|
116
158
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
117
|
-
disablePreviewPanel: disablePreviewPanel
|
|
159
|
+
disablePreviewPanel: disablePreviewPanel,
|
|
160
|
+
hideIconLoadingSkeleton: expValEquals('platform_editor_smart_card_otp', 'isEnabled', true) && isSSRDataAvailable
|
|
118
161
|
});
|
|
119
162
|
}
|
|
120
163
|
return /*#__PURE__*/React.createElement(SmartCard, {
|
|
@@ -132,7 +175,7 @@ export var InlineCard = /*#__PURE__*/memo(function (_ref) {
|
|
|
132
175
|
hoverPreviewOptions: hoverPreviewOptions,
|
|
133
176
|
disablePreviewPanel: disablePreviewPanel
|
|
134
177
|
});
|
|
135
|
-
}, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel]);
|
|
178
|
+
}, [url, data, onClick, scrollContainer, onResolve, onError, useAlternativePreloader, actionOptions, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, disablePreviewPanel, isSSRDataAvailable]);
|
|
136
179
|
|
|
137
180
|
// [WS-2307]: we only render card wrapped into a Provider when the value is ready,
|
|
138
181
|
// otherwise if we got data, we can render the card directly since it doesn't need the Provider
|
|
@@ -177,6 +220,7 @@ export function InlineCardNodeView(props) {
|
|
|
177
220
|
pluginInjectionApi = props.pluginInjectionApi,
|
|
178
221
|
onClickCallback = props.onClickCallback,
|
|
179
222
|
isPageSSRed = props.isPageSSRed,
|
|
223
|
+
provider = props.provider,
|
|
180
224
|
CompetitorPrompt = props.CompetitorPrompt;
|
|
181
225
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
182
226
|
mode = _useSharedState.mode;
|
|
@@ -194,13 +238,14 @@ export function InlineCardNodeView(props) {
|
|
|
194
238
|
pluginInjectionApi: pluginInjectionApi,
|
|
195
239
|
onClickCallback: onClickCallback,
|
|
196
240
|
isPageSSRed: isPageSSRed,
|
|
241
|
+
provider: provider,
|
|
197
242
|
appearance: "inline"
|
|
198
243
|
// Ignored via go/ees005
|
|
199
244
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
200
245
|
}, enableInlineUpgradeFeatures && getAwarenessProps(view.state, getPos, allowEmbeds, allowBlockCards, mode === 'view'))), fg('prompt_whiteboard_competitor_link_gate') && CompetitorPromptComponent);
|
|
201
246
|
}
|
|
202
|
-
export var inlineCardNodeView = function inlineCardNodeView(
|
|
203
|
-
var inlineCardViewProducer =
|
|
247
|
+
export var inlineCardNodeView = function inlineCardNodeView(_ref4) {
|
|
248
|
+
var inlineCardViewProducer = _ref4.inlineCardViewProducer;
|
|
204
249
|
return function (node, view, getPos, decorations) {
|
|
205
250
|
return inlineCardViewProducer(node, view, getPos, decorations);
|
|
206
251
|
};
|
|
@@ -43,6 +43,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
43
43
|
isOverlayEnabled = _ref.isOverlayEnabled,
|
|
44
44
|
isSelected = _ref.isSelected,
|
|
45
45
|
isPageSSRed = _ref.isPageSSRed,
|
|
46
|
+
provider = _ref.provider,
|
|
46
47
|
appearance = _ref.appearance;
|
|
47
48
|
var _useState = useState(false),
|
|
48
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -107,10 +108,11 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
107
108
|
cardContext: cardContext,
|
|
108
109
|
isHovered: isHovered,
|
|
109
110
|
isPageSSRed: isPageSSRed,
|
|
111
|
+
provider: provider,
|
|
110
112
|
pluginInjectionApi: pluginInjectionApi,
|
|
111
113
|
disablePreviewPanel: true
|
|
112
114
|
}));
|
|
113
|
-
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, pluginInjectionApi]);
|
|
115
|
+
}, [isResolvedViewRendered, node, editorAppearance, view, getPos, useAlternativePreloader, actionOptions, onResolve, onClick, cardContext, isHovered, isPageSSRed, provider, pluginInjectionApi]);
|
|
114
116
|
var innerCardOriginal = useMemo(function () {
|
|
115
117
|
return /*#__PURE__*/React.createElement(InlineCard, {
|
|
116
118
|
node: node,
|
|
@@ -123,10 +125,11 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
123
125
|
cardContext: cardContext,
|
|
124
126
|
isHovered: isHovered,
|
|
125
127
|
isPageSSRed: isPageSSRed,
|
|
128
|
+
provider: provider,
|
|
126
129
|
pluginInjectionApi: pluginInjectionApi,
|
|
127
130
|
showHoverPreview: false
|
|
128
131
|
});
|
|
129
|
-
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, pluginInjectionApi]);
|
|
132
|
+
}, [actionOptions, cardContext, getPos, isHovered, node, onClick, onResolve, useAlternativePreloader, view, isPageSSRed, provider, pluginInjectionApi]);
|
|
130
133
|
var shouldShowOpenButtonOverlay = useMemo(function () {
|
|
131
134
|
var shouldShowOpenButtonOverlayInChomeless = editorAppearance === 'chromeless';
|
|
132
135
|
return (mode === 'edit' || editorAppearance === 'comment' || shouldShowOpenButtonOverlayInChomeless) && (editorExperiment('platform_editor_controls', 'variant1') || expValEquals('platform_editor_preview_panel_linking_exp', 'isEnabled', true));
|
|
@@ -191,6 +194,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
191
194
|
cardContext: cardContext,
|
|
192
195
|
isHovered: isHovered,
|
|
193
196
|
isPageSSRed: isPageSSRed,
|
|
197
|
+
provider: provider,
|
|
194
198
|
pluginInjectionApi: pluginInjectionApi,
|
|
195
199
|
showHoverPreview: mode === 'view' && showHoverPreview,
|
|
196
200
|
disablePreviewPanel: true
|
|
@@ -207,6 +211,7 @@ export var InlineCardWithAwareness = /*#__PURE__*/memo(function (_ref) {
|
|
|
207
211
|
cardContext: cardContext,
|
|
208
212
|
isHovered: isHovered,
|
|
209
213
|
isPageSSRed: isPageSSRed,
|
|
214
|
+
provider: provider,
|
|
210
215
|
pluginInjectionApi: pluginInjectionApi,
|
|
211
216
|
showHoverPreview: mode === 'view' && showHoverPreview
|
|
212
217
|
});
|
|
@@ -47,6 +47,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
47
47
|
allowBlockCards = options.allowBlockCards,
|
|
48
48
|
onClickCallback = options.onClickCallback,
|
|
49
49
|
isPageSSRed = options.isPageSSRed,
|
|
50
|
+
provider = options.provider,
|
|
50
51
|
CompetitorPrompt = options.CompetitorPrompt;
|
|
51
52
|
var enableInlineUpgradeFeatures = !!showUpgradeDiscoverability;
|
|
52
53
|
var inlineCardViewProducer = getInlineNodeViewProducer({
|
|
@@ -61,6 +62,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
61
62
|
pluginInjectionApi: pluginInjectionApi,
|
|
62
63
|
onClickCallback: onClickCallback,
|
|
63
64
|
isPageSSRed: isPageSSRed,
|
|
65
|
+
provider: provider,
|
|
64
66
|
CompetitorPrompt: CompetitorPrompt
|
|
65
67
|
}
|
|
66
68
|
});
|
|
@@ -189,7 +191,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
189
191
|
// Find requests in this state that weren't in the old one.
|
|
190
192
|
var newRequests = getNewRequests(oldState, currentState);
|
|
191
193
|
// Ask the CardProvider to resolve all new requests.
|
|
192
|
-
var
|
|
194
|
+
var _provider = currentState.provider;
|
|
193
195
|
newRequests.forEach(function (request) {
|
|
194
196
|
/**
|
|
195
197
|
* Queue each asynchronous resolve request on separate frames.
|
|
@@ -202,7 +204,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
202
204
|
*/
|
|
203
205
|
var invoke = rafSchedule(function () {
|
|
204
206
|
var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$a3;
|
|
205
|
-
return resolveWithProvider(view,
|
|
207
|
+
return resolveWithProvider(view, _provider, request, options, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, (_pluginInjectionApi$a2 = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 || (_pluginInjectionApi$a3 = _pluginInjectionApi$a3.sharedState.currentState()) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.createAnalyticsEvent) !== null && _pluginInjectionApi$a2 !== void 0 ? _pluginInjectionApi$a2 : undefined);
|
|
206
208
|
});
|
|
207
209
|
rafCancellationCallbacks.push(invoke.cancel);
|
|
208
210
|
invoke();
|
|
@@ -229,6 +231,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
229
231
|
inlineCard: lazyInlineCardView({
|
|
230
232
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
231
233
|
isPageSSRed: isPageSSRed
|
|
234
|
+
// no need provider here, it's in the inlineCardViewProducer.extraComponentProps
|
|
232
235
|
}),
|
|
233
236
|
blockCard: lazyBlockCardView({
|
|
234
237
|
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
@@ -238,6 +241,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
238
241
|
allowDatasource: options.allowDatasource,
|
|
239
242
|
inlineCardViewProducer: inlineCardViewProducer,
|
|
240
243
|
isPageSSRed: isPageSSRed,
|
|
244
|
+
provider: provider,
|
|
241
245
|
CompetitorPrompt: options.CompetitorPrompt
|
|
242
246
|
}),
|
|
243
247
|
embedCard: lazyEmbedCardView({
|
|
@@ -248,6 +252,7 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
|
|
|
248
252
|
actionOptions: actionOptions,
|
|
249
253
|
onClickCallback: options.onClickCallback,
|
|
250
254
|
isPageSSRed: isPageSSRed,
|
|
255
|
+
provider: provider,
|
|
251
256
|
CompetitorPrompt: options.CompetitorPrompt
|
|
252
257
|
})
|
|
253
258
|
}
|
|
@@ -5,10 +5,14 @@ import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { Datasource } from '../nodeviews/datasource';
|
|
7
7
|
import type { SmartCardProps } from './genericCard';
|
|
8
|
+
interface State {
|
|
9
|
+
isSSRDataAvailable?: boolean;
|
|
10
|
+
}
|
|
8
11
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
|
|
9
12
|
id?: string;
|
|
10
|
-
}> {
|
|
13
|
+
}, State> {
|
|
11
14
|
private scrollContainer?;
|
|
15
|
+
state: State;
|
|
12
16
|
constructor(props: SmartCardProps & {
|
|
13
17
|
id?: string;
|
|
14
18
|
});
|
|
@@ -16,6 +20,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
16
20
|
title?: string;
|
|
17
21
|
url?: string;
|
|
18
22
|
}) => void;
|
|
23
|
+
componentDidMount(): void;
|
|
19
24
|
componentWillUnmount(): void;
|
|
20
25
|
private removeCardDispatched;
|
|
21
26
|
private removeCard;
|
|
@@ -25,7 +30,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
25
30
|
}) => void;
|
|
26
31
|
render(): React.JSX.Element;
|
|
27
32
|
}
|
|
28
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
33
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
29
34
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
30
35
|
private id;
|
|
31
36
|
unsubscribe: (() => void) | undefined;
|
|
@@ -48,5 +53,7 @@ export interface BlockCardNodeViewProperties {
|
|
|
48
53
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
49
54
|
pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
|
|
50
55
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
56
|
+
provider: BlockCardNodeViewProps['provider'];
|
|
51
57
|
}
|
|
52
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
58
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
59
|
+
export {};
|
|
@@ -9,6 +9,7 @@ import type { SmartCardProps } from './genericCard';
|
|
|
9
9
|
export type EmbedCardState = {
|
|
10
10
|
hasPreview: boolean;
|
|
11
11
|
initialAspectRatio?: number;
|
|
12
|
+
isSSRDataAvailable?: boolean;
|
|
12
13
|
liveHeight?: number;
|
|
13
14
|
};
|
|
14
15
|
export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps & {
|
|
@@ -38,13 +39,14 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
|
|
|
38
39
|
onError: ({ err }: {
|
|
39
40
|
err?: Error;
|
|
40
41
|
}) => void;
|
|
42
|
+
componentDidMount(): void;
|
|
41
43
|
componentWillUnmount(): void;
|
|
42
44
|
private removeCardDispatched;
|
|
43
45
|
private removeCard;
|
|
44
46
|
render(): React.JSX.Element;
|
|
45
47
|
}
|
|
46
48
|
export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
|
|
47
|
-
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
49
|
+
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
48
50
|
export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
|
|
49
51
|
private id;
|
|
50
52
|
unsubscribe: (() => void) | undefined;
|
|
@@ -63,5 +65,6 @@ export interface EmbedCardNodeViewProperties {
|
|
|
63
65
|
onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
|
|
64
66
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
65
67
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
68
|
+
provider: EmbedCardNodeViewProps['provider'];
|
|
66
69
|
}
|
|
67
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
70
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { OnClickCallback } from '@atlaskit/editor-common/card';
|
|
5
5
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
6
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
|
+
import type { ProviderFactory, Providers } from '@atlaskit/editor-common/provider-factory';
|
|
7
7
|
import type { ReactComponentProps, getPosHandler } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
9
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -51,6 +51,7 @@ export interface SmartCardProps extends CardProps {
|
|
|
51
51
|
onClick?: EventHandler<MouseEvent | KeyboardEvent> | undefined;
|
|
52
52
|
onResolve?: (tr: Transaction, title?: string) => void;
|
|
53
53
|
pluginInjectionApi?: ExtractInjectionAPI<typeof cardPlugin>;
|
|
54
|
+
provider?: Providers['cardProvider'];
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
56
57
|
*
|
|
@@ -4,8 +4,8 @@ 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: propsOnClick, onResolve: onRes, 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'>;
|
|
7
|
+
export declare const InlineCard: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, onClick: propsOnClick, onResolve: onRes, isHovered, showHoverPreview, hoverPreviewOptions, isPageSSRed, provider, pluginInjectionApi, disablePreviewPanel, }: SmartCardProps) => React.JSX.Element | null>;
|
|
8
|
+
export type InlineCardNodeViewProps = Pick<SmartCardProps, 'useAlternativePreloader' | 'actionOptions' | 'allowEmbeds' | 'allowBlockCards' | 'enableInlineUpgradeFeatures' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt' | 'provider'>;
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
11
11
|
* @param props
|
|
@@ -5,4 +5,4 @@ export type InlineCardWithAwarenessProps = {
|
|
|
5
5
|
isPulseEnabled?: boolean;
|
|
6
6
|
isSelected?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, pluginInjectionApi, onClick, isPulseEnabled, isOverlayEnabled, isSelected, isPageSSRed, appearance, }: SmartCardProps & InlineCardWithAwarenessProps) => React.JSX.Element>;
|
|
8
|
+
export declare const InlineCardWithAwareness: React.MemoExoticComponent<({ node, cardContext, actionOptions, useAlternativePreloader, view, getPos, pluginInjectionApi, onClick, isPulseEnabled, isOverlayEnabled, isSelected, isPageSSRed, provider, appearance, }: SmartCardProps & InlineCardWithAwarenessProps) => React.JSX.Element>;
|
|
@@ -5,10 +5,14 @@ import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
import { Datasource } from '../nodeviews/datasource';
|
|
7
7
|
import type { SmartCardProps } from './genericCard';
|
|
8
|
+
interface State {
|
|
9
|
+
isSSRDataAvailable?: boolean;
|
|
10
|
+
}
|
|
8
11
|
export declare class BlockCardComponent extends React.PureComponent<SmartCardProps & {
|
|
9
12
|
id?: string;
|
|
10
|
-
}> {
|
|
13
|
+
}, State> {
|
|
11
14
|
private scrollContainer?;
|
|
15
|
+
state: State;
|
|
12
16
|
constructor(props: SmartCardProps & {
|
|
13
17
|
id?: string;
|
|
14
18
|
});
|
|
@@ -16,6 +20,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
16
20
|
title?: string;
|
|
17
21
|
url?: string;
|
|
18
22
|
}) => void;
|
|
23
|
+
componentDidMount(): void;
|
|
19
24
|
componentWillUnmount(): void;
|
|
20
25
|
private removeCardDispatched;
|
|
21
26
|
private removeCard;
|
|
@@ -25,7 +30,7 @@ export declare class BlockCardComponent extends React.PureComponent<SmartCardPro
|
|
|
25
30
|
}) => void;
|
|
26
31
|
render(): React.JSX.Element;
|
|
27
32
|
}
|
|
28
|
-
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
33
|
+
export type BlockCardNodeViewProps = Pick<SmartCardProps, 'actionOptions' | 'pluginInjectionApi' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
29
34
|
export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
|
|
30
35
|
private id;
|
|
31
36
|
unsubscribe: (() => void) | undefined;
|
|
@@ -48,5 +53,7 @@ export interface BlockCardNodeViewProperties {
|
|
|
48
53
|
onClickCallback: BlockCardNodeViewProps['onClickCallback'];
|
|
49
54
|
pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
|
|
50
55
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
56
|
+
provider: BlockCardNodeViewProps['provider'];
|
|
51
57
|
}
|
|
52
|
-
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
58
|
+
export declare const blockCardNodeView: ({ pmPluginFactoryParams, actionOptions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, CompetitorPrompt, isPageSSRed, provider, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => import("prosemirror-view").NodeView | Datasource | BlockCard;
|
|
59
|
+
export {};
|
|
@@ -9,6 +9,7 @@ import type { SmartCardProps } from './genericCard';
|
|
|
9
9
|
export type EmbedCardState = {
|
|
10
10
|
hasPreview: boolean;
|
|
11
11
|
initialAspectRatio?: number;
|
|
12
|
+
isSSRDataAvailable?: boolean;
|
|
12
13
|
liveHeight?: number;
|
|
13
14
|
};
|
|
14
15
|
export declare class EmbedCardComponent extends React.PureComponent<SmartCardProps & {
|
|
@@ -38,13 +39,14 @@ export declare class EmbedCardComponent extends React.PureComponent<SmartCardPro
|
|
|
38
39
|
onError: ({ err }: {
|
|
39
40
|
err?: Error;
|
|
40
41
|
}) => void;
|
|
42
|
+
componentDidMount(): void;
|
|
41
43
|
componentWillUnmount(): void;
|
|
42
44
|
private removeCardDispatched;
|
|
43
45
|
private removeCard;
|
|
44
46
|
render(): React.JSX.Element;
|
|
45
47
|
}
|
|
46
48
|
export declare const EmbedOrBlockCardComponent: (props: ComponentProps<typeof EmbedCardComponent>) => React.JSX.Element;
|
|
47
|
-
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'CompetitorPrompt'>;
|
|
49
|
+
export type EmbedCardNodeViewProps = Pick<SmartCardProps, 'eventDispatcher' | 'allowResizing' | 'fullWidthMode' | 'dispatchAnalyticsEvent' | 'pluginInjectionApi' | 'actionOptions' | 'onClickCallback' | 'isPageSSRed' | 'provider' | 'CompetitorPrompt'>;
|
|
48
50
|
export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
|
|
49
51
|
private id;
|
|
50
52
|
unsubscribe: (() => void) | undefined;
|
|
@@ -63,5 +65,6 @@ export interface EmbedCardNodeViewProperties {
|
|
|
63
65
|
onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
|
|
64
66
|
pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
|
|
65
67
|
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
68
|
+
provider: EmbedCardNodeViewProps['provider'];
|
|
66
69
|
}
|
|
67
|
-
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|
|
70
|
+
export declare const embedCardNodeView: ({ allowResizing, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, onClickCallback, CompetitorPrompt, isPageSSRed, provider, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
|