@atlaskit/editor-plugin-card 2.9.0 → 2.9.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 2.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#125851](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125851)
8
+ [`4ffe0a8ea7929`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ffe0a8ea7929) -
9
+ Refactor node views.
10
+
11
+ ## 2.9.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 2.9.0
4
18
 
5
19
  ### Minor Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.BlockCardComponent = exports.BlockCard = void 0;
7
+ exports.blockCardNodeView = exports.BlockCardComponent = exports.BlockCard = void 0;
8
8
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -21,6 +21,7 @@ var _ui = require("@atlaskit/editor-common/ui");
21
21
  var _utils = require("@atlaskit/editor-common/utils");
22
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
23
  var _smartCard = require("@atlaskit/smart-card");
24
+ var _datasource = require("../nodeviews/datasource");
24
25
  var _actions = require("../pm-plugins/actions");
25
26
  var _utils2 = require("../utils");
26
27
  var _genericCard = require("./genericCard");
@@ -211,4 +212,46 @@ var BlockCard = exports.BlockCard = /*#__PURE__*/function (_ReactNodeView) {
211
212
  }
212
213
  }]);
213
214
  return BlockCard;
214
- }(_reactNodeView.default);
215
+ }(_reactNodeView.default);
216
+ var blockCardNodeView = exports.blockCardNodeView = function blockCardNodeView(_ref3) {
217
+ var pmPluginFactoryParams = _ref3.pmPluginFactoryParams,
218
+ platform = _ref3.platform,
219
+ actionOptions = _ref3.actionOptions,
220
+ showServerActions = _ref3.showServerActions,
221
+ pluginInjectionApi = _ref3.pluginInjectionApi,
222
+ onClickCallback = _ref3.onClickCallback,
223
+ allowDatasource = _ref3.allowDatasource,
224
+ inlineCardViewProducer = _ref3.inlineCardViewProducer;
225
+ return function (node, view, getPos, decorations) {
226
+ var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
227
+ eventDispatcher = pmPluginFactoryParams.eventDispatcher;
228
+ var reactComponentProps = {
229
+ platform: platform,
230
+ actionOptions: actionOptions,
231
+ showServerActions: showServerActions,
232
+ pluginInjectionApi: pluginInjectionApi,
233
+ onClickCallback: onClickCallback
234
+ };
235
+ var isDatasource = (0, _utils2.isDatasourceNode)(node);
236
+ if (isDatasource) {
237
+ var _node$attrs2;
238
+ if (allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id)) {
239
+ var datasourcePosition = typeof getPos === 'function' && getPos();
240
+ var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
241
+ var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
242
+ return new _datasource.Datasource({
243
+ node: node,
244
+ view: view,
245
+ getPos: getPos,
246
+ portalProviderAPI: portalProviderAPI,
247
+ eventDispatcher: eventDispatcher,
248
+ pluginInjectionApi: pluginInjectionApi,
249
+ isNodeNested: isNodeNested
250
+ }).init();
251
+ } else {
252
+ return inlineCardViewProducer(node, view, getPos, decorations);
253
+ }
254
+ }
255
+ return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
256
+ };
257
+ };
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.EmbedCardComponent = exports.EmbedCard = void 0;
7
+ exports.embedCardNodeView = exports.EmbedCardComponent = exports.EmbedCard = void 0;
8
8
  var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -423,4 +423,31 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
423
423
  }
424
424
  }]);
425
425
  return EmbedCard;
426
- }(_reactNodeView.default);
426
+ }(_reactNodeView.default);
427
+ var embedCardNodeView = exports.embedCardNodeView = function embedCardNodeView(_ref4) {
428
+ var allowResizing = _ref4.allowResizing,
429
+ platform = _ref4.platform,
430
+ fullWidthMode = _ref4.fullWidthMode,
431
+ pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
432
+ pluginInjectionApi = _ref4.pluginInjectionApi,
433
+ actionOptions = _ref4.actionOptions,
434
+ showServerActions = _ref4.showServerActions,
435
+ onClickCallback = _ref4.onClickCallback;
436
+ return function (node, view, getPos) {
437
+ var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
438
+ eventDispatcher = pmPluginFactoryParams.eventDispatcher,
439
+ dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
440
+ var reactComponentProps = {
441
+ eventDispatcher: eventDispatcher,
442
+ allowResizing: allowResizing,
443
+ platform: platform,
444
+ fullWidthMode: fullWidthMode,
445
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
446
+ pluginInjectionApi: pluginInjectionApi,
447
+ actionOptions: actionOptions,
448
+ showServerActions: showServerActions,
449
+ onClickCallback: onClickCallback
450
+ };
451
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
452
+ };
453
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.lazyBlockCardView = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
+ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
+ var _blockCard = require("./blockCard");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ var lazyBlockCardView = exports.lazyBlockCardView = function lazyBlockCardView(props) {
15
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
16
+ return (0, _blockCard.blockCardNodeView)(props);
17
+ }
18
+ return (0, _lazyNodeView.withLazyLoading)({
19
+ nodeName: 'blockCard',
20
+ getNodeViewOptions: function getNodeViewOptions() {},
21
+ loader: function loader() {
22
+ var result = Promise.resolve().then(function () {
23
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
24
+ './blockCard'));
25
+ }).then(function (_ref) {
26
+ var blockCardNodeView = _ref.blockCardNodeView;
27
+ return blockCardNodeView(props);
28
+ });
29
+ return result;
30
+ }
31
+ });
32
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.lazyEmbedCardView = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
+ var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
+ var _embedCard = require("./embedCard");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ var lazyEmbedCardView = exports.lazyEmbedCardView = function lazyEmbedCardView(props) {
15
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_lazy-node-views')) {
16
+ return (0, _embedCard.embedCardNodeView)(props);
17
+ }
18
+ return (0, _lazyNodeView.withLazyLoading)({
19
+ nodeName: 'embedCard',
20
+ getNodeViewOptions: function getNodeViewOptions() {},
21
+ loader: function loader() {
22
+ var result = Promise.resolve().then(function () {
23
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-plugin-embed-card-item-nodeview" */
24
+ './embedCard'));
25
+ }).then(function (_ref) {
26
+ var embedCardNodeView = _ref.embedCardNodeView;
27
+ return embedCardNodeView(props);
28
+ });
29
+ return result;
30
+ }
31
+ });
32
+ };
@@ -18,19 +18,17 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
18
18
  var _reactNodeView = require("@atlaskit/editor-common/react-node-view");
19
19
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
20
20
  var _styles = require("@atlaskit/editor-common/styles");
21
- var _utils = require("@atlaskit/editor-common/utils");
22
21
  var _state = require("@atlaskit/editor-prosemirror/state");
23
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
22
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
24
23
  var _linkingCommon = require("@atlaskit/linking-common");
25
24
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
25
  var _eventsFromTr = require("../analytics/events-from-tr");
27
26
  var _localStorage = require("../common/local-storage");
28
- var _blockCard = require("../nodeviews/blockCard");
29
- var _datasource = require("../nodeviews/datasource");
30
- var _embedCard = require("../nodeviews/embedCard");
31
27
  var _inlineCard = require("../nodeviews/inlineCard");
32
- var _utils3 = require("../ui/LayoutButton/utils");
33
- var _utils4 = require("../utils");
28
+ var _lazyBlockCard = require("../nodeviews/lazy-block-card");
29
+ var _lazyEmbedCard = require("../nodeviews/lazy-embed-card");
30
+ var _utils2 = require("../ui/LayoutButton/utils");
31
+ var _utils3 = require("../utils");
34
32
  var _actions = require("./actions");
35
33
  var _pluginKey = require("./plugin-key");
36
34
  var _reducers = _interopRequireDefault(require("./reducers"));
@@ -152,8 +150,8 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
152
150
  return newState;
153
151
  }
154
152
  var linkPosition = pluginState.requests[0].pos;
155
- var canBeUpgradedToBlock = allowBlockCards && (0, _utils4.isBlockSupportedAtPosition)(linkPosition, prevEditorState, 'inline');
156
- var canBeUpgradedToEmbed = allowEmbeds && (0, _utils4.isEmbedSupportedAtPosition)(linkPosition, prevEditorState, 'inline');
153
+ var canBeUpgradedToBlock = allowBlockCards && (0, _utils3.isBlockSupportedAtPosition)(linkPosition, prevEditorState, 'inline');
154
+ var canBeUpgradedToEmbed = allowEmbeds && (0, _utils3.isEmbedSupportedAtPosition)(linkPosition, prevEditorState, 'inline');
157
155
  if (canBeUpgradedToBlock || canBeUpgradedToEmbed) {
158
156
  newState.overlayCandidatePosition = linkPosition;
159
157
  }
@@ -187,13 +185,13 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
187
185
  var isBlockCardSelected = selection instanceof _state.NodeSelection && ((_selection$node = selection.node) === null || _selection$node === void 0 ? void 0 : _selection$node.type) === schema.nodes.blockCard;
188
186
  if (isBlockCardSelected) {
189
187
  var _findDomRefAtPos, _node$attrs;
190
- var datasourceTableRef = (_findDomRefAtPos = (0, _utils2.findDomRefAtPos)(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(_styles.DATASOURCE_INNER_CONTAINER_CLASSNAME));
188
+ var datasourceTableRef = (_findDomRefAtPos = (0, _utils.findDomRefAtPos)(selection.from, domAtPos)) === null || _findDomRefAtPos === void 0 ? void 0 : _findDomRefAtPos.querySelector(".".concat(_styles.DATASOURCE_INNER_CONTAINER_CLASSNAME));
191
189
  var node = selection.node;
192
190
  var isDatasource = !!(node !== null && node !== void 0 && (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.datasource);
193
191
  var shouldUpdateTableRef = datasourceTableRef && (currentState === null || currentState === void 0 ? void 0 : currentState.datasourceTableRef) !== datasourceTableRef;
194
192
  if (isDatasource && shouldUpdateTableRef) {
195
193
  // since we use the plugin state, which is a shared state, we need to update the datasourceTableRef, layout on each selection
196
- var layout = (0, _utils3.isDatasourceTableLayout)(node.attrs.layout) ? node.attrs.layout : _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
194
+ var layout = (0, _utils2.isDatasourceTableLayout)(node.attrs.layout) ? node.attrs.layout : _linkingCommon.DATASOURCE_DEFAULT_LAYOUT;
197
195
  var isNested = selection.$anchor.depth > 0;
198
196
 
199
197
  // we want to disable resize button when datasource table is nested by not setting then datasourceTableRef on selection
@@ -255,55 +253,26 @@ var createPlugin = exports.createPlugin = function createPlugin(options, pluginI
255
253
  props: _objectSpread({
256
254
  nodeViews: {
257
255
  inlineCard: inlineCardViewProducer,
258
- blockCard: function blockCard(node, view, getPos, decorations) {
259
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
260
- eventDispatcher = pmPluginFactoryParams.eventDispatcher;
261
- var reactComponentProps = {
262
- platform: platform,
263
- actionOptions: actionOptions,
264
- showServerActions: showServerActions,
265
- pluginInjectionApi: pluginInjectionApi,
266
- onClickCallback: options.onClickCallback
267
- };
268
- var isDatasource = (0, _utils4.isDatasourceNode)(node);
269
- if (isDatasource) {
270
- var _node$attrs2;
271
- if (options.allowDatasource && platform !== 'mobile' && (0, _utils.canRenderDatasource)(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id)) {
272
- var datasourcePosition = typeof getPos === 'function' && getPos();
273
- var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
274
- var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
275
- return new _datasource.Datasource({
276
- node: node,
277
- view: view,
278
- getPos: getPos,
279
- portalProviderAPI: portalProviderAPI,
280
- eventDispatcher: eventDispatcher,
281
- pluginInjectionApi: pluginInjectionApi,
282
- isNodeNested: isNodeNested
283
- }).init();
284
- } else {
285
- return inlineCardViewProducer(node, view, getPos, decorations);
286
- }
287
- }
288
- return new _blockCard.BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
289
- },
290
- embedCard: function embedCard(node, view, getPos) {
291
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
292
- eventDispatcher = pmPluginFactoryParams.eventDispatcher,
293
- dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
294
- var reactComponentProps = {
295
- eventDispatcher: eventDispatcher,
296
- allowResizing: allowResizing,
297
- platform: platform,
298
- fullWidthMode: fullWidthMode,
299
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
300
- pluginInjectionApi: pluginInjectionApi,
301
- actionOptions: actionOptions,
302
- showServerActions: showServerActions,
303
- onClickCallback: options.onClickCallback
304
- };
305
- return new _embedCard.EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
306
- }
256
+ blockCard: (0, _lazyBlockCard.lazyBlockCardView)({
257
+ pmPluginFactoryParams: pmPluginFactoryParams,
258
+ platform: platform,
259
+ actionOptions: actionOptions,
260
+ showServerActions: showServerActions,
261
+ pluginInjectionApi: pluginInjectionApi,
262
+ onClickCallback: onClickCallback,
263
+ allowDatasource: options.allowDatasource,
264
+ inlineCardViewProducer: inlineCardViewProducer
265
+ }),
266
+ embedCard: (0, _lazyEmbedCard.lazyEmbedCardView)({
267
+ allowResizing: allowResizing,
268
+ platform: platform,
269
+ fullWidthMode: fullWidthMode,
270
+ pmPluginFactoryParams: pmPluginFactoryParams,
271
+ pluginInjectionApi: pluginInjectionApi,
272
+ actionOptions: actionOptions,
273
+ showServerActions: showServerActions,
274
+ onClickCallback: options.onClickCallback
275
+ })
307
276
  }
308
277
  }, enableInlineUpgradeFeatures && {
309
278
  handleKeyDown: function handleKeyDown(view) {
@@ -4,9 +4,10 @@ import PropTypes from 'prop-types';
4
4
  import rafSchedule from 'raf-schd';
5
5
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
6
6
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
7
- import { browser } from '@atlaskit/editor-common/utils';
7
+ import { browser, canRenderDatasource } from '@atlaskit/editor-common/utils';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { Card as SmartCard } from '@atlaskit/smart-card';
10
+ import { Datasource } from '../nodeviews/datasource';
10
11
  import { registerCard } from '../pm-plugins/actions';
11
12
  import { isDatasourceNode } from '../utils';
12
13
  import { Card } from './genericCard';
@@ -168,4 +169,47 @@ export class BlockCard extends ReactNodeView {
168
169
  var _this$unsubscribe;
169
170
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
170
171
  }
171
- }
172
+ }
173
+ export const blockCardNodeView = ({
174
+ pmPluginFactoryParams,
175
+ platform,
176
+ actionOptions,
177
+ showServerActions,
178
+ pluginInjectionApi,
179
+ onClickCallback,
180
+ allowDatasource,
181
+ inlineCardViewProducer
182
+ }) => (node, view, getPos, decorations) => {
183
+ const {
184
+ portalProviderAPI,
185
+ eventDispatcher
186
+ } = pmPluginFactoryParams;
187
+ const reactComponentProps = {
188
+ platform,
189
+ actionOptions,
190
+ showServerActions,
191
+ pluginInjectionApi,
192
+ onClickCallback: onClickCallback
193
+ };
194
+ const isDatasource = isDatasourceNode(node);
195
+ if (isDatasource) {
196
+ var _node$attrs, _node$attrs$datasourc;
197
+ if (allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : (_node$attrs$datasourc = _node$attrs.datasource) === null || _node$attrs$datasourc === void 0 ? void 0 : _node$attrs$datasourc.id)) {
198
+ const datasourcePosition = typeof getPos === 'function' && getPos();
199
+ const datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
200
+ const isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
201
+ return new Datasource({
202
+ node,
203
+ view,
204
+ getPos,
205
+ portalProviderAPI,
206
+ eventDispatcher,
207
+ pluginInjectionApi,
208
+ isNodeNested
209
+ }).init();
210
+ } else {
211
+ return inlineCardViewProducer(node, view, getPos, decorations);
212
+ }
213
+ }
214
+ return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
215
+ };
@@ -391,4 +391,32 @@ export class EmbedCard extends ReactNodeView {
391
391
  var _this$unsubscribe;
392
392
  (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 ? void 0 : _this$unsubscribe.call(this);
393
393
  }
394
- }
394
+ }
395
+ export const embedCardNodeView = ({
396
+ allowResizing,
397
+ platform,
398
+ fullWidthMode,
399
+ pmPluginFactoryParams,
400
+ pluginInjectionApi,
401
+ actionOptions,
402
+ showServerActions,
403
+ onClickCallback
404
+ }) => (node, view, getPos) => {
405
+ const {
406
+ portalProviderAPI,
407
+ eventDispatcher,
408
+ dispatchAnalyticsEvent
409
+ } = pmPluginFactoryParams;
410
+ const reactComponentProps = {
411
+ eventDispatcher,
412
+ allowResizing,
413
+ platform,
414
+ fullWidthMode,
415
+ dispatchAnalyticsEvent,
416
+ pluginInjectionApi,
417
+ actionOptions,
418
+ showServerActions,
419
+ onClickCallback: onClickCallback
420
+ };
421
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
422
+ };
@@ -0,0 +1,21 @@
1
+ import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { blockCardNodeView } from './blockCard';
4
+ export const lazyBlockCardView = props => {
5
+ if (!fg('platform_editor_lazy-node-views')) {
6
+ return blockCardNodeView(props);
7
+ }
8
+ return withLazyLoading({
9
+ nodeName: 'blockCard',
10
+ getNodeViewOptions: () => {},
11
+ loader: () => {
12
+ const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
13
+ './blockCard').then(({
14
+ blockCardNodeView
15
+ }) => {
16
+ return blockCardNodeView(props);
17
+ });
18
+ return result;
19
+ }
20
+ });
21
+ };
@@ -0,0 +1,21 @@
1
+ import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { embedCardNodeView } from './embedCard';
4
+ export const lazyEmbedCardView = props => {
5
+ if (!fg('platform_editor_lazy-node-views')) {
6
+ return embedCardNodeView(props);
7
+ }
8
+ return withLazyLoading({
9
+ nodeName: 'embedCard',
10
+ getNodeViewOptions: () => {},
11
+ loader: () => {
12
+ const result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-embed-card-item-nodeview" */
13
+ './embedCard').then(({
14
+ embedCardNodeView
15
+ }) => {
16
+ return embedCardNodeView(props);
17
+ });
18
+ return result;
19
+ }
20
+ });
21
+ };
@@ -2,19 +2,17 @@ import rafSchedule from 'raf-schd';
2
2
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
5
- import { canRenderDatasource } from '@atlaskit/editor-common/utils';
6
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
6
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
8
7
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
9
8
  import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { eventsFromTransaction } from '../analytics/events-from-tr';
11
10
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
12
- import { BlockCard } from '../nodeviews/blockCard';
13
- import { Datasource } from '../nodeviews/datasource';
14
- import { EmbedCard } from '../nodeviews/embedCard';
15
11
  import { InlineCardNodeView } from '../nodeviews/inlineCard';
12
+ import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
13
+ import { lazyEmbedCardView } from '../nodeviews/lazy-embed-card';
16
14
  import { isDatasourceTableLayout } from '../ui/LayoutButton/utils';
17
- import { isBlockSupportedAtPosition, isDatasourceNode, isEmbedSupportedAtPosition } from '../utils';
15
+ import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from '../utils';
18
16
  import { clearOverlayCandidate, setCardLayoutAndDatasourceTableRef, setDatasourceTableRef } from './actions';
19
17
  import { pluginKey } from './plugin-key';
20
18
  import reducer from './reducers';
@@ -246,59 +244,26 @@ export const createPlugin = (options, pluginInjectionApi) => pmPluginFactoryPara
246
244
  props: {
247
245
  nodeViews: {
248
246
  inlineCard: inlineCardViewProducer,
249
- blockCard: (node, view, getPos, decorations) => {
250
- const {
251
- portalProviderAPI,
252
- eventDispatcher
253
- } = pmPluginFactoryParams;
254
- const reactComponentProps = {
255
- platform,
256
- actionOptions,
257
- showServerActions,
258
- pluginInjectionApi,
259
- onClickCallback: options.onClickCallback
260
- };
261
- const isDatasource = isDatasourceNode(node);
262
- if (isDatasource) {
263
- var _node$attrs2, _node$attrs2$datasour;
264
- if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$datasour = _node$attrs2.datasource) === null || _node$attrs2$datasour === void 0 ? void 0 : _node$attrs2$datasour.id)) {
265
- const datasourcePosition = typeof getPos === 'function' && getPos();
266
- const datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
267
- const isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
268
- return new Datasource({
269
- node,
270
- view,
271
- getPos,
272
- portalProviderAPI,
273
- eventDispatcher,
274
- pluginInjectionApi,
275
- isNodeNested
276
- }).init();
277
- } else {
278
- return inlineCardViewProducer(node, view, getPos, decorations);
279
- }
280
- }
281
- return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
282
- },
283
- embedCard: (node, view, getPos) => {
284
- const {
285
- portalProviderAPI,
286
- eventDispatcher,
287
- dispatchAnalyticsEvent
288
- } = pmPluginFactoryParams;
289
- const reactComponentProps = {
290
- eventDispatcher,
291
- allowResizing,
292
- platform,
293
- fullWidthMode,
294
- dispatchAnalyticsEvent,
295
- pluginInjectionApi,
296
- actionOptions,
297
- showServerActions,
298
- onClickCallback: options.onClickCallback
299
- };
300
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
301
- }
247
+ blockCard: lazyBlockCardView({
248
+ pmPluginFactoryParams,
249
+ platform,
250
+ actionOptions,
251
+ showServerActions,
252
+ pluginInjectionApi,
253
+ onClickCallback,
254
+ allowDatasource: options.allowDatasource,
255
+ inlineCardViewProducer
256
+ }),
257
+ embedCard: lazyEmbedCardView({
258
+ allowResizing,
259
+ platform,
260
+ fullWidthMode,
261
+ pmPluginFactoryParams,
262
+ pluginInjectionApi,
263
+ actionOptions,
264
+ showServerActions,
265
+ onClickCallback: options.onClickCallback
266
+ })
302
267
  },
303
268
  ...(enableInlineUpgradeFeatures && {
304
269
  handleKeyDown: view => {
@@ -13,9 +13,10 @@ import PropTypes from 'prop-types';
13
13
  import rafSchedule from 'raf-schd';
14
14
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
15
15
  import { findOverflowScrollParent, UnsupportedBlock } from '@atlaskit/editor-common/ui';
16
- import { browser } from '@atlaskit/editor-common/utils';
16
+ import { browser, canRenderDatasource } from '@atlaskit/editor-common/utils';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
18
  import { Card as SmartCard } from '@atlaskit/smart-card';
19
+ import { Datasource } from '../nodeviews/datasource';
19
20
  import { registerCard } from '../pm-plugins/actions';
20
21
  import { isDatasourceNode } from '../utils';
21
22
  import { Card } from './genericCard';
@@ -205,4 +206,46 @@ export var BlockCard = /*#__PURE__*/function (_ReactNodeView) {
205
206
  }
206
207
  }]);
207
208
  return BlockCard;
208
- }(ReactNodeView);
209
+ }(ReactNodeView);
210
+ export var blockCardNodeView = function blockCardNodeView(_ref3) {
211
+ var pmPluginFactoryParams = _ref3.pmPluginFactoryParams,
212
+ platform = _ref3.platform,
213
+ actionOptions = _ref3.actionOptions,
214
+ showServerActions = _ref3.showServerActions,
215
+ pluginInjectionApi = _ref3.pluginInjectionApi,
216
+ onClickCallback = _ref3.onClickCallback,
217
+ allowDatasource = _ref3.allowDatasource,
218
+ inlineCardViewProducer = _ref3.inlineCardViewProducer;
219
+ return function (node, view, getPos, decorations) {
220
+ var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
221
+ eventDispatcher = pmPluginFactoryParams.eventDispatcher;
222
+ var reactComponentProps = {
223
+ platform: platform,
224
+ actionOptions: actionOptions,
225
+ showServerActions: showServerActions,
226
+ pluginInjectionApi: pluginInjectionApi,
227
+ onClickCallback: onClickCallback
228
+ };
229
+ var isDatasource = isDatasourceNode(node);
230
+ if (isDatasource) {
231
+ var _node$attrs2;
232
+ if (allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id)) {
233
+ var datasourcePosition = typeof getPos === 'function' && getPos();
234
+ var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
235
+ var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
236
+ return new Datasource({
237
+ node: node,
238
+ view: view,
239
+ getPos: getPos,
240
+ portalProviderAPI: portalProviderAPI,
241
+ eventDispatcher: eventDispatcher,
242
+ pluginInjectionApi: pluginInjectionApi,
243
+ isNodeNested: isNodeNested
244
+ }).init();
245
+ } else {
246
+ return inlineCardViewProducer(node, view, getPos, decorations);
247
+ }
248
+ }
249
+ return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
250
+ };
251
+ };
@@ -416,4 +416,31 @@ export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
416
416
  }
417
417
  }]);
418
418
  return EmbedCard;
419
- }(ReactNodeView);
419
+ }(ReactNodeView);
420
+ export var embedCardNodeView = function embedCardNodeView(_ref4) {
421
+ var allowResizing = _ref4.allowResizing,
422
+ platform = _ref4.platform,
423
+ fullWidthMode = _ref4.fullWidthMode,
424
+ pmPluginFactoryParams = _ref4.pmPluginFactoryParams,
425
+ pluginInjectionApi = _ref4.pluginInjectionApi,
426
+ actionOptions = _ref4.actionOptions,
427
+ showServerActions = _ref4.showServerActions,
428
+ onClickCallback = _ref4.onClickCallback;
429
+ return function (node, view, getPos) {
430
+ var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
431
+ eventDispatcher = pmPluginFactoryParams.eventDispatcher,
432
+ dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
433
+ var reactComponentProps = {
434
+ eventDispatcher: eventDispatcher,
435
+ allowResizing: allowResizing,
436
+ platform: platform,
437
+ fullWidthMode: fullWidthMode,
438
+ dispatchAnalyticsEvent: dispatchAnalyticsEvent,
439
+ pluginInjectionApi: pluginInjectionApi,
440
+ actionOptions: actionOptions,
441
+ showServerActions: showServerActions,
442
+ onClickCallback: onClickCallback
443
+ };
444
+ return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
445
+ };
446
+ };
@@ -0,0 +1,20 @@
1
+ import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { blockCardNodeView } from './blockCard';
4
+ export var lazyBlockCardView = function lazyBlockCardView(props) {
5
+ if (!fg('platform_editor_lazy-node-views')) {
6
+ return blockCardNodeView(props);
7
+ }
8
+ return withLazyLoading({
9
+ nodeName: 'blockCard',
10
+ getNodeViewOptions: function getNodeViewOptions() {},
11
+ loader: function loader() {
12
+ var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-tasks-and-decisions_task-item-nodeview" */
13
+ './blockCard').then(function (_ref) {
14
+ var blockCardNodeView = _ref.blockCardNodeView;
15
+ return blockCardNodeView(props);
16
+ });
17
+ return result;
18
+ }
19
+ });
20
+ };
@@ -0,0 +1,20 @@
1
+ import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { embedCardNodeView } from './embedCard';
4
+ export var lazyEmbedCardView = function lazyEmbedCardView(props) {
5
+ if (!fg('platform_editor_lazy-node-views')) {
6
+ return embedCardNodeView(props);
7
+ }
8
+ return withLazyLoading({
9
+ nodeName: 'embedCard',
10
+ getNodeViewOptions: function getNodeViewOptions() {},
11
+ loader: function loader() {
12
+ var result = import( /* webpackChunkName: "@atlaskit-internal_editor-plugin-embed-card-item-nodeview" */
13
+ './embedCard').then(function (_ref) {
14
+ var embedCardNodeView = _ref.embedCardNodeView;
15
+ return embedCardNodeView(props);
16
+ });
17
+ return result;
18
+ }
19
+ });
20
+ };
@@ -6,19 +6,17 @@ import rafSchedule from 'raf-schd';
6
6
  import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { DATASOURCE_INNER_CONTAINER_CLASSNAME } from '@atlaskit/editor-common/styles';
9
- import { canRenderDatasource } from '@atlaskit/editor-common/utils';
10
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
10
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
12
11
  import { DATASOURCE_DEFAULT_LAYOUT } from '@atlaskit/linking-common';
13
12
  import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { eventsFromTransaction } from '../analytics/events-from-tr';
15
14
  import { isLocalStorageKeyDiscovered } from '../common/local-storage';
16
- import { BlockCard } from '../nodeviews/blockCard';
17
- import { Datasource } from '../nodeviews/datasource';
18
- import { EmbedCard } from '../nodeviews/embedCard';
19
15
  import { InlineCardNodeView } from '../nodeviews/inlineCard';
16
+ import { lazyBlockCardView } from '../nodeviews/lazy-block-card';
17
+ import { lazyEmbedCardView } from '../nodeviews/lazy-embed-card';
20
18
  import { isDatasourceTableLayout } from '../ui/LayoutButton/utils';
21
- import { isBlockSupportedAtPosition, isDatasourceNode, isEmbedSupportedAtPosition } from '../utils';
19
+ import { isBlockSupportedAtPosition, isEmbedSupportedAtPosition } from '../utils';
22
20
  import { clearOverlayCandidate, setCardLayoutAndDatasourceTableRef, setDatasourceTableRef } from './actions';
23
21
  import { pluginKey } from './plugin-key';
24
22
  import reducer from './reducers';
@@ -242,55 +240,26 @@ export var createPlugin = function createPlugin(options, pluginInjectionApi) {
242
240
  props: _objectSpread({
243
241
  nodeViews: {
244
242
  inlineCard: inlineCardViewProducer,
245
- blockCard: function blockCard(node, view, getPos, decorations) {
246
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
247
- eventDispatcher = pmPluginFactoryParams.eventDispatcher;
248
- var reactComponentProps = {
249
- platform: platform,
250
- actionOptions: actionOptions,
251
- showServerActions: showServerActions,
252
- pluginInjectionApi: pluginInjectionApi,
253
- onClickCallback: options.onClickCallback
254
- };
255
- var isDatasource = isDatasourceNode(node);
256
- if (isDatasource) {
257
- var _node$attrs2;
258
- if (options.allowDatasource && platform !== 'mobile' && canRenderDatasource(node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.datasource) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.id)) {
259
- var datasourcePosition = typeof getPos === 'function' && getPos();
260
- var datasourceResolvedPosition = datasourcePosition && view.state.doc.resolve(datasourcePosition);
261
- var isNodeNested = !!(datasourceResolvedPosition && datasourceResolvedPosition.depth > 0);
262
- return new Datasource({
263
- node: node,
264
- view: view,
265
- getPos: getPos,
266
- portalProviderAPI: portalProviderAPI,
267
- eventDispatcher: eventDispatcher,
268
- pluginInjectionApi: pluginInjectionApi,
269
- isNodeNested: isNodeNested
270
- }).init();
271
- } else {
272
- return inlineCardViewProducer(node, view, getPos, decorations);
273
- }
274
- }
275
- return new BlockCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
276
- },
277
- embedCard: function embedCard(node, view, getPos) {
278
- var portalProviderAPI = pmPluginFactoryParams.portalProviderAPI,
279
- eventDispatcher = pmPluginFactoryParams.eventDispatcher,
280
- dispatchAnalyticsEvent = pmPluginFactoryParams.dispatchAnalyticsEvent;
281
- var reactComponentProps = {
282
- eventDispatcher: eventDispatcher,
283
- allowResizing: allowResizing,
284
- platform: platform,
285
- fullWidthMode: fullWidthMode,
286
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
287
- pluginInjectionApi: pluginInjectionApi,
288
- actionOptions: actionOptions,
289
- showServerActions: showServerActions,
290
- onClickCallback: options.onClickCallback
291
- };
292
- return new EmbedCard(node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps, undefined).init();
293
- }
243
+ blockCard: lazyBlockCardView({
244
+ pmPluginFactoryParams: pmPluginFactoryParams,
245
+ platform: platform,
246
+ actionOptions: actionOptions,
247
+ showServerActions: showServerActions,
248
+ pluginInjectionApi: pluginInjectionApi,
249
+ onClickCallback: onClickCallback,
250
+ allowDatasource: options.allowDatasource,
251
+ inlineCardViewProducer: inlineCardViewProducer
252
+ }),
253
+ embedCard: lazyEmbedCardView({
254
+ allowResizing: allowResizing,
255
+ platform: platform,
256
+ fullWidthMode: fullWidthMode,
257
+ pmPluginFactoryParams: pmPluginFactoryParams,
258
+ pluginInjectionApi: pluginInjectionApi,
259
+ actionOptions: actionOptions,
260
+ showServerActions: showServerActions,
261
+ onClickCallback: options.onClickCallback
262
+ })
294
263
  }
295
264
  }, enableInlineUpgradeFeatures && {
296
265
  handleKeyDown: function handleKeyDown(view) {
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
+ import ReactNodeView, { type getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
4
+ import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
5
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
- import type { Decoration, DecorationSource } from '@atlaskit/editor-prosemirror/view';
6
+ import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
7
+ import { Datasource } from '../nodeviews/datasource';
6
8
  import type { SmartCardProps } from './genericCard';
7
9
  export declare class BlockCardComponent extends React.PureComponent<SmartCardProps> {
8
10
  private scrollContainer?;
@@ -30,3 +32,14 @@ export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
30
32
  render(): JSX.Element;
31
33
  destroy(): void;
32
34
  }
35
+ export interface BlockCardNodeViewProperties {
36
+ pmPluginFactoryParams: PMPluginFactoryParams;
37
+ platform: BlockCardNodeViewProps['platform'];
38
+ actionOptions: BlockCardNodeViewProps['actionOptions'];
39
+ showServerActions: BlockCardNodeViewProps['showServerActions'];
40
+ pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
41
+ onClickCallback: BlockCardNodeViewProps['onClickCallback'];
42
+ allowDatasource: boolean | undefined;
43
+ inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
44
+ }
45
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, platform, actionOptions, showServerActions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => Datasource | BlockCard | import("prosemirror-view").NodeView;
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
4
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
6
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { cardPlugin } from '../index';
6
9
  import type { SmartCardProps } from './genericCard';
7
10
  export type EmbedCardState = {
8
11
  hasPreview: boolean;
@@ -47,3 +50,14 @@ export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
47
50
  render(): JSX.Element;
48
51
  destroy(): void;
49
52
  }
53
+ export interface EmbedCardNodeViewProperties {
54
+ allowResizing: EmbedCardNodeViewProps['allowResizing'];
55
+ platform: EmbedCardNodeViewProps['platform'];
56
+ fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
57
+ pmPluginFactoryParams: PMPluginFactoryParams;
58
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
59
+ actionOptions: EmbedCardNodeViewProps['actionOptions'];
60
+ showServerActions: EmbedCardNodeViewProps['showServerActions'];
61
+ onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
62
+ }
63
+ export declare const embedCardNodeView: ({ allowResizing, platform, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, showServerActions, onClickCallback, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -0,0 +1,2 @@
1
+ import { type BlockCardNodeViewProperties } from './blockCard';
2
+ export declare const lazyBlockCardView: (props: BlockCardNodeViewProperties) => ((node: import("prosemirror-model").Node, view: import("prosemirror-view").EditorView, getPos: () => number | undefined, decorations: readonly import("prosemirror-view").Decoration[]) => import("./datasource").Datasource | import("./blockCard").BlockCard | import("prosemirror-view").NodeView) | import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
@@ -0,0 +1,2 @@
1
+ import { type EmbedCardNodeViewProperties } from './embedCard';
2
+ export declare const lazyEmbedCardView: (props: EmbedCardNodeViewProperties) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: import("prosemirror-model").Node, view: import("prosemirror-view").EditorView, getPos: () => number | undefined) => import("./embedCard").EmbedCard);
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
3
+ import ReactNodeView, { type getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
4
+ import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
4
5
  import type { Node } from '@atlaskit/editor-prosemirror/model';
5
- import type { Decoration, DecorationSource } from '@atlaskit/editor-prosemirror/view';
6
+ import type { Decoration, DecorationSource, EditorView } from '@atlaskit/editor-prosemirror/view';
7
+ import { Datasource } from '../nodeviews/datasource';
6
8
  import type { SmartCardProps } from './genericCard';
7
9
  export declare class BlockCardComponent extends React.PureComponent<SmartCardProps> {
8
10
  private scrollContainer?;
@@ -30,3 +32,14 @@ export declare class BlockCard extends ReactNodeView<BlockCardNodeViewProps> {
30
32
  render(): JSX.Element;
31
33
  destroy(): void;
32
34
  }
35
+ export interface BlockCardNodeViewProperties {
36
+ pmPluginFactoryParams: PMPluginFactoryParams;
37
+ platform: BlockCardNodeViewProps['platform'];
38
+ actionOptions: BlockCardNodeViewProps['actionOptions'];
39
+ showServerActions: BlockCardNodeViewProps['showServerActions'];
40
+ pluginInjectionApi: BlockCardNodeViewProps['pluginInjectionApi'];
41
+ onClickCallback: BlockCardNodeViewProps['onClickCallback'];
42
+ allowDatasource: boolean | undefined;
43
+ inlineCardViewProducer: ReturnType<typeof getInlineNodeViewProducer>;
44
+ }
45
+ export declare const blockCardNodeView: ({ pmPluginFactoryParams, platform, actionOptions, showServerActions, pluginInjectionApi, onClickCallback, allowDatasource, inlineCardViewProducer, }: BlockCardNodeViewProperties) => (node: Node, view: EditorView, getPos: () => number | undefined, decorations: readonly Decoration[]) => Datasource | BlockCard | import("prosemirror-view").NodeView;
@@ -2,7 +2,10 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import type { RichMediaLayout } from '@atlaskit/adf-schema';
4
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
+ import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
5
6
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { cardPlugin } from '../index';
6
9
  import type { SmartCardProps } from './genericCard';
7
10
  export type EmbedCardState = {
8
11
  hasPreview: boolean;
@@ -47,3 +50,14 @@ export declare class EmbedCard extends ReactNodeView<EmbedCardNodeViewProps> {
47
50
  render(): JSX.Element;
48
51
  destroy(): void;
49
52
  }
53
+ export interface EmbedCardNodeViewProperties {
54
+ allowResizing: EmbedCardNodeViewProps['allowResizing'];
55
+ platform: EmbedCardNodeViewProps['platform'];
56
+ fullWidthMode: EmbedCardNodeViewProps['fullWidthMode'];
57
+ pmPluginFactoryParams: PMPluginFactoryParams;
58
+ pluginInjectionApi: ExtractInjectionAPI<typeof cardPlugin> | undefined;
59
+ actionOptions: EmbedCardNodeViewProps['actionOptions'];
60
+ showServerActions: EmbedCardNodeViewProps['showServerActions'];
61
+ onClickCallback: EmbedCardNodeViewProps['onClickCallback'];
62
+ }
63
+ export declare const embedCardNodeView: ({ allowResizing, platform, fullWidthMode, pmPluginFactoryParams, pluginInjectionApi, actionOptions, showServerActions, onClickCallback, }: EmbedCardNodeViewProperties) => (node: PMNode, view: EditorView, getPos: () => number | undefined) => EmbedCard;
@@ -0,0 +1,2 @@
1
+ import { type BlockCardNodeViewProperties } from './blockCard';
2
+ export declare const lazyBlockCardView: (props: BlockCardNodeViewProperties) => ((node: import("prosemirror-model").Node, view: import("prosemirror-view").EditorView, getPos: () => number | undefined, decorations: readonly import("prosemirror-view").Decoration[]) => import("./datasource").Datasource | import("./blockCard").BlockCard | import("prosemirror-view").NodeView) | import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor;
@@ -0,0 +1,2 @@
1
+ import { type EmbedCardNodeViewProperties } from './embedCard';
2
+ export declare const lazyEmbedCardView: (props: EmbedCardNodeViewProperties) => import("@atlaskit/editor-common/lazy-node-view").NodeViewConstructor | ((node: import("prosemirror-model").Node, view: import("prosemirror-view").EditorView, getPos: () => number | undefined) => import("./embedCard").EmbedCard);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/link-datasource": "^2.9.0",
54
54
  "@atlaskit/linking-common": "^5.8.0",
55
55
  "@atlaskit/linking-types": "^8.12.0",
56
- "@atlaskit/menu": "2.8.1",
56
+ "@atlaskit/menu": "2.9.0",
57
57
  "@atlaskit/platform-feature-flags": "^0.3.0",
58
58
  "@atlaskit/primitives": "^11.1.0",
59
59
  "@atlaskit/smart-card": "^27.11.0",
@@ -125,6 +125,9 @@
125
125
  "platform.linking-platform.datasource.enable-confluence-search-modal": {
126
126
  "type": "boolean"
127
127
  },
128
+ "platform_editor_lazy-node-views": {
129
+ "type": "boolean"
130
+ },
128
131
  "platform.editor.card.inject-settings-button": {
129
132
  "type": "boolean"
130
133
  },