@atlaskit/editor-plugin-card
Version:
Card plugin for @atlaskit/editor-core
577 lines (572 loc) • 26.7 kB
JavaScript
import _get from "@babel/runtime/helpers/get";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _extends from "@babel/runtime/helpers/extends";
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; }
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; }
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; }
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
import React from 'react';
import rafSchedule from 'raf-schd';
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
import uuid from 'uuid/v4';
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
import { findOverflowScrollParent, MediaSingle as RichMediaWrapper, UnsupportedBlock } from '@atlaskit/editor-common/ui';
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
import { akEditorFullPageNarrowBreakout, DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
import { SmartLinkDraggable, SMART_LINK_DRAG_TYPES, SMART_LINK_APPEARANCE } from '@atlaskit/editor-smart-link-draggable';
import { fg } from '@atlaskit/platform-feature-flags';
import { componentWithCondition } from '@atlaskit/platform-feature-flags-react';
import { EmbedResizeMessageListener, Card as SmartCard } from '@atlaskit/smart-card';
import { CardSSR } from '@atlaskit/smart-card/ssr';
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
import { registerCard, removeCard as _removeCard } from '../pm-plugins/actions';
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
import { BlockCardComponent } from './blockCard';
import { Card } from './genericCard';
var selector = function selector(states) {
var _states$widthState, _states$widthState2, _states$editorDisable;
return {
widthStateLineLength: ((_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.lineLength) || 0,
widthStateWidth: ((_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.width) || 0,
editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
};
};
var CardInner = function CardInner(_ref) {
var pluginInjectionApi = _ref.pluginInjectionApi,
getPosSafely = _ref.getPosSafely,
getLineLength = _ref.getLineLength,
view = _ref.view,
smartCard = _ref.smartCard,
updateSize = _ref.updateSize,
getPos = _ref.getPos,
aspectRatio = _ref.aspectRatio,
allowResizing = _ref.allowResizing,
hasPreview = _ref.hasPreview,
heightAlone = _ref.heightAlone,
cardProps = _ref.cardProps,
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent;
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['width', 'editorDisabled'], selector),
widthStateLineLength = _useSharedPluginState.widthStateLineLength,
widthStateWidth = _useSharedPluginState.widthStateWidth,
editorDisabled = _useSharedPluginState.editorDisabled;
var pos = getPosSafely();
if (pos === undefined) {
return null;
}
var lineLength = getLineLength(view, pos, widthStateLineLength);
var containerWidth = isRichMediaInsideOfBlockNode(view, pos) ? lineLength : widthStateWidth;
if (!allowResizing || !hasPreview) {
// There are two ways `width` and `height` can be defined here:
// 1) Either as `heightAlone` as height value and no width
// 2) or as `1` for height and aspectRation (defined or a default one) as a width
// See above for how aspectRation is calculated.
var defaultAspectRatio = DEFAULT_EMBED_CARD_WIDTH / DEFAULT_EMBED_CARD_HEIGHT;
var richMediaWrapperHeight = 1;
var richMediaWrapperWidth = aspectRatio || defaultAspectRatio;
if (heightAlone) {
richMediaWrapperHeight = heightAlone;
richMediaWrapperWidth = undefined;
}
return /*#__PURE__*/React.createElement(RichMediaWrapper
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
, _extends({}, cardProps, {
height: richMediaWrapperHeight,
width: richMediaWrapperWidth,
nodeType: "embedCard",
hasFallbackContainer: hasPreview,
lineLength: lineLength,
containerWidth: containerWidth
}), smartCard);
}
var displayGrid = function displayGrid(visible, gridType, highlight) {
var _pluginInjectionApi$g;
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$g = pluginInjectionApi.grid) === null || _pluginInjectionApi$g === void 0 || (_pluginInjectionApi$g = _pluginInjectionApi$g.actions) === null || _pluginInjectionApi$g === void 0 ? void 0 : _pluginInjectionApi$g.displayGrid(view)({
visible: visible,
gridType: gridType,
highlight: highlight
});
};
return /*#__PURE__*/React.createElement(ResizableEmbedCard
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
, _extends({}, cardProps, {
height: heightAlone,
aspectRatio: aspectRatio,
view: view,
getPos: getPos,
lineLength: lineLength,
gridSize: 12,
containerWidth: containerWidth,
displayGrid: displayGrid,
updateSize: updateSize,
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
isResizeDisabled: editorDisabled
}), smartCard);
};
// eslint-disable-next-line @repo/internal/react/no-class-components
export var EmbedCardComponent = /*#__PURE__*/function (_React$PureComponent) {
function EmbedCardComponent(props) {
var _this;
_classCallCheck(this, EmbedCardComponent);
_this = _callSuper(this, EmbedCardComponent, [props]);
// Ignored via go/ees005
// eslint-disable-next-line @atlaskit/editor/no-as-casting
_defineProperty(_this, "embedIframeRef", /*#__PURE__*/React.createRef());
_defineProperty(_this, "getPosSafely", function () {
var getPos = _this.props.getPos;
if (!getPos || typeof getPos === 'boolean') {
return;
}
try {
return getPos();
} catch (_unused) {
// Can blow up in rare cases, when node has been removed.
}
});
_defineProperty(_this, "onResolve", function (data) {
var view = _this.props.view;
var title = data.title,
url = data.url,
aspectRatio = data.aspectRatio;
var _this$props$node$attr = _this.props.node.attrs,
originalHeight = _this$props$node$attr.originalHeight,
originalWidth = _this$props$node$attr.originalWidth;
if (aspectRatio && !originalHeight && !originalWidth) {
// Assumption here is if ADF already have both height and width set,
// we will going to use that later on in this class as aspectRatio
// Most likely we dealing with an embed that received aspectRatio via onResolve previously
// and now this information already stored in ADF.
_this.setState({
initialAspectRatio: aspectRatio
});
_this.saveOriginalDimensionsAttributes(DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_HEIGHT * aspectRatio);
}
// don't dispatch immediately since we might be in the middle of
// rendering a nodeview
rafSchedule(function () {
var pos = _this.getPosSafely();
if (pos === undefined) {
return;
}
return view.dispatch(registerCard({
title: title,
url: url,
pos: pos,
id: _this.props.id
})(view.state.tr));
})();
try {
var _this$props$cardConte, _this$props$cardConte2;
var cardContext = (_this$props$cardConte = _this.props.cardContext) !== null && _this$props$cardConte !== void 0 && _this$props$cardConte.value ? (_this$props$cardConte2 = _this.props.cardContext) === null || _this$props$cardConte2 === void 0 ? void 0 : _this$props$cardConte2.value : undefined;
var hasPreview = url && cardContext && cardContext.extractors.getPreview(url, 'web');
if (!hasPreview) {
_this.setState({
hasPreview: false
});
}
} catch (_unused2) {}
});
_defineProperty(_this, "updateSize", function (pctWidth, layout) {
var _this$props$view = _this.props.view,
state = _this$props$view.state,
dispatch = _this$props$view.dispatch;
var pos = _this.getPosSafely();
if (pos === undefined) {
return;
}
var tr = state.tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, _this.props.node.attrs), {}, {
width: pctWidth,
layout: layout
}));
tr.setMeta('scrollIntoView', false);
dispatch(tr);
return true;
});
/**
* Defers line-length measurement until the embed card DOM has fully rendered.
*
* When put embed in the expand, reload the page and open that expand, the embed was collapsed.
* Because the `.rich-media-item` can temporarily report `offsetWidth = 1`, as proportional width styles have not been applied yet.
* Measuring at that moment would cache the bogus width and break resize calculations.
* Scheduling a measurement on the next animation frame ensures layout has
* settled. We then force the node view to re-render so `getLineLength`
* re-runs and captures the correct width.
*/
_defineProperty(_this, "scheduleLineLengthRemeasureRaf", rafSchedule(function (view) {
if (view) {
_this.forceUpdate();
}
}));
_defineProperty(_this, "getLineLength", function (view, pos, originalLineLength) {
if (typeof pos === 'number' && isRichMediaInsideOfBlockNode(view, pos)) {
var $pos = view.state.doc.resolve(pos);
var domNode = view.nodeDOM($pos.pos);
if ($pos.nodeAfter && floatingLayouts.indexOf($pos.nodeAfter.attrs.layout) > -1 && domNode && domNode.parentElement) {
return domNode.parentElement.offsetWidth;
}
if (domNode instanceof HTMLElement) {
var measuredWidth = domNode.offsetWidth;
if (measuredWidth <= 1) {
_this.scheduleLineLengthRemeasureRaf(view);
return originalLineLength;
}
return measuredWidth;
}
}
return originalLineLength;
});
/**
* Even though render is capable of listening and reacting to iframely wrapper iframe sent `resize` events
* it's good idea to store latest actual height in ADF, so that when renderer (well, editor as well) is loading
* we will show embed window of appropriate size and avoid unnecessary content jumping.
*/
_defineProperty(_this, "saveOriginalDimensionsAttributes", function (height, width) {
var view = _this.props.view;
// Please, do not copy or use this kind of code below
// @ts-ignore
var fakeTableResizePluginKey = {
key: 'tableFlexiColumnResizing$',
getState: function getState(state) {
// eslint-disable-next-line
return state['tableFlexiColumnResizing$'];
}
};
var fakeTableResizeState = fakeTableResizePluginKey.getState(view.state);
// We are not updating ADF when this function fired while table is resizing.
// Changing ADF in the middle of resize will break table resize plugin logic
// (tables will be considered different at the end of the drag and cell size won't be stored)
// But this is not a big problem, editor user will be seeing latest height anyway (via updated state)
// And even if page to be saved with slightly outdated height, renderer is capable of reading latest height value
// when embed loads, and so it won't be a problem.
if (fakeTableResizeState !== null && fakeTableResizeState !== void 0 && fakeTableResizeState.dragging) {
return;
}
rafSchedule(function () {
var pos = _this.getPosSafely();
if (pos === undefined) {
return;
}
view.dispatch(view.state.tr.step(new SetAttrsStep(pos, {
originalHeight: height,
originalWidth: width
})).setMeta('addToHistory', false));
})();
});
_defineProperty(_this, "onHeightUpdate", function (height) {
_this.setState({
liveHeight: height
});
_this.saveOriginalDimensionsAttributes(height, undefined);
});
_defineProperty(_this, "onError", function (_ref2) {
var err = _ref2.err;
if (err) {
throw err;
}
});
_defineProperty(_this, "removeCardDispatched", false);
_this.scrollContainer = findOverflowScrollParent(props.view.dom) || undefined;
_this.state = {
hasPreview: true
};
return _this;
}
_inherits(EmbedCardComponent, _React$PureComponent);
return _createClass(EmbedCardComponent, [{
key: "componentWillUnmount",
value: function componentWillUnmount() {
this.removeCard();
}
}, {
key: "removeCard",
value: function removeCard() {
if (this.removeCardDispatched) {
return;
}
this.removeCardDispatched = true;
var tr = this.props.view.state.tr;
_removeCard({
id: this.props.id
})(tr);
this.props.view.dispatch(tr);
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
node = _this$props.node,
allowResizing = _this$props.allowResizing,
fullWidthMode = _this$props.fullWidthMode,
view = _this$props.view,
dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
getPos = _this$props.getPos,
pluginInjectionApi = _this$props.pluginInjectionApi,
actionOptions = _this$props.actionOptions,
onClick = _this$props.onClick,
CompetitorPrompt = _this$props.CompetitorPrompt,
isPageSSRed = _this$props.isPageSSRed;
var _node$attrs = node.attrs,
url = _node$attrs.url,
pctWidth = _node$attrs.width,
layout = _node$attrs.layout,
originalHeight = _node$attrs.originalHeight,
originalWidth = _node$attrs.originalWidth;
var _this$state = this.state,
hasPreview = _this$state.hasPreview,
liveHeight = _this$state.liveHeight,
initialAspectRatio = _this$state.initialAspectRatio;
// We don't want to use `originalHeight` when `originalWidth` also present,
// since `heightAlone` is defined only when just height is available.
var heightAlone = liveHeight !== null && liveHeight !== void 0 ? liveHeight : !originalWidth && originalHeight || undefined;
var aspectRatio = !heightAlone && (
// No need getting aspectRatio if heightAlone defined already
initialAspectRatio ||
// If we have initialAspectRatio (coming from iframely) we should go with that
originalHeight && originalWidth && originalWidth / originalHeight) ||
// If ADF contains both width and height we get ratio from that
undefined;
var cardProps = {
layout: layout,
pctWidth: pctWidth,
fullWidthMode: fullWidthMode
};
var smartCard = isPageSSRed ? /*#__PURE__*/React.createElement(CardSSR, {
key: url,
url: url,
appearance: "embed",
onClick: onClick,
onResolve: this.onResolve,
onError: this.onError,
frameStyle: "show",
inheritDimensions: true,
platform: 'web',
container: this.scrollContainer,
embedIframeRef: this.embedIframeRef,
actionOptions: actionOptions,
CompetitorPrompt: CompetitorPrompt,
hideIconLoadingSkeleton: true
}) : /*#__PURE__*/React.createElement(SmartCard, {
key: url,
url: url,
appearance: "embed",
onClick: onClick,
onResolve: this.onResolve,
onError: this.onError,
frameStyle: "show",
inheritDimensions: true,
platform: 'web',
container: this.scrollContainer,
embedIframeRef: this.embedIframeRef,
actionOptions: actionOptions,
CompetitorPrompt: CompetitorPrompt
});
return /*#__PURE__*/React.createElement(SmartLinkDraggable, {
url: url,
appearance: SMART_LINK_APPEARANCE.EMBED,
source: SMART_LINK_DRAG_TYPES.EDITOR
}, /*#__PURE__*/React.createElement(EmbedResizeMessageListener, {
embedIframeRef: this.embedIframeRef,
onHeightUpdate: this.onHeightUpdate
}, /*#__PURE__*/React.createElement(CardInner, {
pluginInjectionApi: pluginInjectionApi,
smartCard: smartCard,
hasPreview: hasPreview,
getPosSafely: this.getPosSafely,
view: view,
getLineLength: this.getLineLength,
eventDispatcher: this.props.eventDispatcher,
updateSize: this.updateSize,
getPos: getPos,
aspectRatio: aspectRatio,
allowResizing: allowResizing,
heightAlone: heightAlone,
cardProps: cardProps,
dispatchAnalyticsEvent: dispatchAnalyticsEvent
})));
}
}]);
}(React.PureComponent);
export var EmbedOrBlockCardComponent = function EmbedOrBlockCardComponent(props) {
var width = useSharedPluginStateSelector(props.pluginInjectionApi, 'width.width');
var viewAsBlockCard = width && width <= akEditorFullPageNarrowBreakout;
return viewAsBlockCard ? /*#__PURE__*/React.createElement(BlockCardComponent, {
id: props.id,
node: props.node,
view: props.view,
getPos: props.getPos,
pluginInjectionApi: props.pluginInjectionApi,
actionOptions: props.actionOptions,
onClick: props.onClick,
CompetitorPrompt: props.CompetitorPrompt,
allowResizing: props.allowResizing,
fullWidthMode: props.fullWidthMode,
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
eventDispatcher: props.eventDispatcher,
cardContext: props.cardContext,
smartCard: props.smartCard,
hasPreview: props.hasPreview,
liveHeight: props.liveHeight,
initialAspectRatio: props.initialAspectRatio,
isPageSSRed: props.isPageSSRed,
provider: props.provider
}) : /*#__PURE__*/React.createElement(EmbedCardComponent, {
id: props.id,
node: props.node,
view: props.view,
getPos: props.getPos,
pluginInjectionApi: props.pluginInjectionApi,
actionOptions: props.actionOptions,
onClick: props.onClick,
CompetitorPrompt: props.CompetitorPrompt,
allowResizing: props.allowResizing,
fullWidthMode: props.fullWidthMode,
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
eventDispatcher: props.eventDispatcher,
cardContext: props.cardContext,
smartCard: props.smartCard,
hasPreview: props.hasPreview,
liveHeight: props.liveHeight,
initialAspectRatio: props.initialAspectRatio,
isPageSSRed: props.isPageSSRed,
provider: props.provider
});
};
var WrappedEmbedCardWithCondition = componentWithCondition(function () {
return editorExperiment('platform_editor_preview_panel_responsiveness', true, {
exposure: true
});
}, EmbedOrBlockCardComponent, EmbedCardComponent);
var WrappedEmbedCard = Card(WrappedEmbedCardWithCondition, UnsupportedBlock);
export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
function EmbedCard() {
var _this2;
_classCallCheck(this, EmbedCard);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this2 = _callSuper(this, EmbedCard, [].concat(args));
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
_defineProperty(_this2, "id", uuid());
_defineProperty(_this2, "updateContentEditable", function (editorViewModeState, divElement) {
divElement.contentEditable = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? 'false' : 'true';
});
return _this2;
}
_inherits(EmbedCard, _ReactNodeView);
return _createClass(EmbedCard, [{
key: "viewShouldUpdate",
value: function viewShouldUpdate(nextNode) {
if (this.node.attrs !== nextNode.attrs) {
return true;
}
return _superPropGet(EmbedCard, "viewShouldUpdate", this, 3)([nextNode]);
}
}, {
key: "createDomRef",
value: function createDomRef() {
var _this$reactComponentP,
_this3 = this,
_this$reactComponentP2;
var domRef = document.createElement('div');
// 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
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 (_ref3) {
var nextSharedState = _ref3.nextSharedState;
return _this3.updateContentEditable(nextSharedState, domRef);
});
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);
domRef.setAttribute('spellcheck', 'false');
return domRef;
}
}, {
key: "render",
value: function render() {
var _this$reactComponentP3 = this.reactComponentProps,
eventDispatcher = _this$reactComponentP3.eventDispatcher,
allowResizing = _this$reactComponentP3.allowResizing,
fullWidthMode = _this$reactComponentP3.fullWidthMode,
dispatchAnalyticsEvent = _this$reactComponentP3.dispatchAnalyticsEvent,
pluginInjectionApi = _this$reactComponentP3.pluginInjectionApi,
onClickCallback = _this$reactComponentP3.onClickCallback,
CompetitorPrompt = _this$reactComponentP3.CompetitorPrompt,
isPageSSRed = _this$reactComponentP3.isPageSSRed,
provider = _this$reactComponentP3.provider;
return /*#__PURE__*/React.createElement(WrappedEmbedCard, {
node: this.node,
view: this.view,
eventDispatcher: eventDispatcher,
getPos: this.getPos,
allowResizing: allowResizing,
fullWidthMode: fullWidthMode,
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
pluginInjectionApi: pluginInjectionApi,
onClickCallback: onClickCallback,
id: this.id,
CompetitorPrompt: CompetitorPrompt,
isPageSSRed: isPageSSRed,
provider: provider
});
}
/**
* Prevent ProseMirror from handling drag events on the smart-element-link,
* allowing native drag to work so SmartLinkDraggable can intercept it.
* @see {@link https://prosemirror.net/docs/ref/#view.NodeView.stopEvent}
*/
}, {
key: "stopEvent",
value: function stopEvent(event) {
if (event.type === 'dragstart') {
var target = event.target;
if (target instanceof HTMLElement && target.closest('[data-smart-element-link]') && fg('cc_drag_and_drop_smart_link_from_content_to_tree')) {
return true;
}
}
return false;
}
}, {
key: "destroy",
value: function destroy() {
var _this$unsubscribe;
(_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
_superPropGet(EmbedCard, "destroy", this, 3)([]);
}
}]);
}(ReactNodeView);
export var embedCardNodeView = function embedCardNodeView(_ref4) {
var allowResizing = _ref4.allowResizing,
fullWidthMode = _ref4.fullWidthMode,
pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
pluginInjectionApi = _ref4.pluginInjectionApi,
actionOptions = _ref4.actionOptions,
onClickCallback = _ref4.onClickCallback,
CompetitorPrompt = _ref4.CompetitorPrompt,
isPageSSRed = _ref4.isPageSSRed,
provider = _ref4.provider;
return function (node, view, getPos) {
var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
eventDispatcher = pmPluginFactoryParams.eventDispatcher,
dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
var reactComponentProps = {
eventDispatcher: eventDispatcher,
allowResizing: allowResizing,
fullWidthMode: fullWidthMode,
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
pluginInjectionApi: pluginInjectionApi,
actionOptions: actionOptions,
onClickCallback: onClickCallback,
CompetitorPrompt: CompetitorPrompt,
isPageSSRed: isPageSSRed,
provider: provider
};
return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps).init();
};
};