@atlaskit/editor-plugin-expand 2.10.1 → 2.10.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/legacyExpand/nodeviews/index.js +33 -14
  3. package/dist/cjs/legacyExpand/plugin.js +3 -2
  4. package/dist/cjs/legacyExpand/pm-plugins/main.js +5 -2
  5. package/dist/cjs/singlePlayerExpand/node-views/index.js +39 -8
  6. package/dist/cjs/singlePlayerExpand/plugin.js +3 -2
  7. package/dist/cjs/singlePlayerExpand/pm-plugins/main.js +5 -2
  8. package/dist/cjs/singlePlayerExpand/ui/NodeView.js +1 -15
  9. package/dist/es2019/legacyExpand/nodeviews/index.js +24 -8
  10. package/dist/es2019/legacyExpand/plugin.js +3 -2
  11. package/dist/es2019/legacyExpand/pm-plugins/main.js +3 -1
  12. package/dist/es2019/singlePlayerExpand/node-views/index.js +35 -6
  13. package/dist/es2019/singlePlayerExpand/plugin.js +3 -2
  14. package/dist/es2019/singlePlayerExpand/pm-plugins/main.js +3 -1
  15. package/dist/es2019/singlePlayerExpand/ui/NodeView.js +0 -13
  16. package/dist/esm/legacyExpand/nodeviews/index.js +33 -14
  17. package/dist/esm/legacyExpand/plugin.js +3 -2
  18. package/dist/esm/legacyExpand/pm-plugins/main.js +5 -2
  19. package/dist/esm/singlePlayerExpand/node-views/index.js +40 -9
  20. package/dist/esm/singlePlayerExpand/plugin.js +3 -2
  21. package/dist/esm/singlePlayerExpand/pm-plugins/main.js +5 -2
  22. package/dist/esm/singlePlayerExpand/ui/NodeView.js +0 -13
  23. package/dist/types/legacyExpand/nodeviews/index.d.ts +6 -2
  24. package/dist/types/legacyExpand/pm-plugins/main.d.ts +2 -1
  25. package/dist/types/singlePlayerExpand/node-views/index.d.ts +7 -2
  26. package/dist/types/singlePlayerExpand/pm-plugins/main.d.ts +2 -1
  27. package/dist/types/singlePlayerExpand/ui/NodeView.d.ts +0 -1
  28. package/dist/types-ts4.5/legacyExpand/nodeviews/index.d.ts +6 -2
  29. package/dist/types-ts4.5/legacyExpand/pm-plugins/main.d.ts +2 -1
  30. package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +7 -2
  31. package/dist/types-ts4.5/singlePlayerExpand/pm-plugins/main.d.ts +2 -1
  32. package/dist/types-ts4.5/singlePlayerExpand/ui/NodeView.d.ts +0 -1
  33. package/package.json +9 -5
@@ -1,9 +1,6 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
1
  import { expandedState } from '@atlaskit/editor-common/expand';
4
2
  import { expandClassNames } from '@atlaskit/editor-common/styles';
5
3
  import { expandMessages } from '@atlaskit/editor-common/ui';
6
- import { ExpandButton } from '../ui/ExpandButton';
7
4
  export const buildExpandClassName = (type, expanded) => {
8
5
  return `${expandClassNames.prefix} ${expandClassNames.type(type)} ${expanded ? expandClassNames.expanded : ''}`;
9
6
  };
@@ -42,14 +39,4 @@ export const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) =>
42
39
  class: expandClassNames.content,
43
40
  contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
44
41
  }, 0]];
45
- };
46
- export const renderIcon = (icon, allowInteractiveExpand, expanded, intl) => {
47
- if (!icon) {
48
- return;
49
- }
50
- ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
51
- intl: intl,
52
- allowInteractiveExpand: allowInteractiveExpand,
53
- expanded: expanded
54
- }), icon);
55
42
  };
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import React from 'react';
5
5
  import ReactDOM from 'react-dom';
6
+ import uuid from 'uuid/v4';
6
7
  import { keyName } from 'w3c-keyname';
7
8
  import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
8
9
  import { expandClassNames } from '@atlaskit/editor-common/styles';
@@ -53,12 +54,12 @@ var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditabl
53
54
  }, 0]];
54
55
  };
55
56
  export var ExpandNodeView = /*#__PURE__*/function () {
56
- function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api) {
57
+ function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
57
58
  var _this = this,
58
59
  _api$editorDisabled;
59
- var allowInteractiveExpand = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
60
- var __livePage = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
61
- var cleanUpEditorDisabledOnChange = arguments.length > 9 ? arguments[9] : undefined;
60
+ var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
61
+ var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
62
+ var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
62
63
  _classCallCheck(this, ExpandNodeView);
63
64
  _defineProperty(this, "allowInteractiveExpand", true);
64
65
  _defineProperty(this, "isMobile", false);
@@ -404,6 +405,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
404
405
  var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(_node, this.__livePage, this.intl, api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled)),
405
406
  dom = _DOMSerializer$render.dom,
406
407
  contentDOM = _DOMSerializer$render.contentDOM;
408
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
407
409
  this.allowInteractiveExpand = allowInteractiveExpand;
408
410
  this.getPos = getPos;
409
411
  this.view = view;
@@ -416,6 +418,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
416
418
  this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
417
419
  this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
418
420
  this.content = this.dom.querySelector(".".concat(expandClassNames.content));
421
+ this.renderKey = uuid();
419
422
  this.renderIcon(this.intl);
420
423
  this.initHandlers();
421
424
  }
@@ -467,16 +470,27 @@ export var ExpandNodeView = /*#__PURE__*/function () {
467
470
  }, {
468
471
  key: "renderIcon",
469
472
  value: function renderIcon(intl, node) {
473
+ var _this3 = this;
470
474
  if (!this.icon) {
471
475
  return;
472
476
  }
473
477
  var _ref = node && node.attrs || this.node.attrs,
474
478
  __expanded = _ref.__expanded;
475
- ReactDOM.render( /*#__PURE__*/React.createElement(ExpandIconButton, {
476
- intl: intl,
477
- allowInteractiveExpand: this.allowInteractiveExpand,
478
- expanded: this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
479
- }), this.icon);
479
+ if (fg('platform_editor_react18_plugin_portalprovider')) {
480
+ this.nodeViewPortalProviderAPI.render(function () {
481
+ return /*#__PURE__*/React.createElement(ExpandIconButton, {
482
+ intl: intl,
483
+ allowInteractiveExpand: _this3.allowInteractiveExpand,
484
+ expanded: _this3.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
485
+ });
486
+ }, this.icon, this.renderKey);
487
+ } else {
488
+ ReactDOM.render( /*#__PURE__*/React.createElement(ExpandIconButton, {
489
+ intl: intl,
490
+ allowInteractiveExpand: this.allowInteractiveExpand,
491
+ expanded: this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
492
+ }), this.icon);
493
+ }
480
494
  }
481
495
  }, {
482
496
  key: "stopEvent",
@@ -500,7 +514,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
500
514
  }, {
501
515
  key: "update",
502
516
  value: function update(node, _decorations) {
503
- var _this3 = this;
517
+ var _this4 = this;
504
518
  if (this.node.type === node.type) {
505
519
  if (this.node.attrs.__expanded !== node.attrs.__expanded) {
506
520
  // Instead of re-rendering the view on an expand toggle
@@ -519,8 +533,8 @@ export var ExpandNodeView = /*#__PURE__*/function () {
519
533
  // since we're intentionally being less aggressive about re-rendering.
520
534
  // We also apply a rAF to avoid abrupt continuous replacement of the title.
521
535
  window.requestAnimationFrame(function () {
522
- if (_this3.input && _this3.node.attrs.title !== _this3.input.value) {
523
- _this3.input.value = _this3.node.attrs.title;
536
+ if (_this4.input && _this4.node.attrs.title !== _this4.input.value) {
537
+ _this4.input.value = _this4.node.attrs.title;
524
538
  }
525
539
  });
526
540
  this.node = node;
@@ -553,7 +567,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
553
567
  if (this.icon) {
554
568
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
555
569
  this.icon.removeEventListener('keydown', this.handleIconKeyDown);
556
- ReactDOM.unmountComponentAtNode(this.icon);
570
+ if (fg('platform_editor_react18_plugin_portalprovider')) {
571
+ this.nodeViewPortalProviderAPI.remove(this.renderKey);
572
+ } else {
573
+ ReactDOM.unmountComponentAtNode(this.icon);
574
+ }
557
575
  }
558
576
  (_this$decorationClean2 = this.decorationCleanup) === null || _this$decorationClean2 === void 0 || _this$decorationClean2.call(this);
559
577
  if (this.cleanUpEditorDisabledOnChange) {
@@ -576,11 +594,12 @@ export default function (_ref2) {
576
594
  var getIntl = _ref2.getIntl,
577
595
  isMobile = _ref2.isMobile,
578
596
  api = _ref2.api,
597
+ nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI,
579
598
  _ref2$allowInteractiv = _ref2.allowInteractiveExpand,
580
599
  allowInteractiveExpand = _ref2$allowInteractiv === void 0 ? true : _ref2$allowInteractiv,
581
600
  __livePage = _ref2.__livePage;
582
601
  return function (node, view, getPos) {
583
602
  var _api$selection;
584
- return new ExpandNodeView(node, view, getPos, getIntl, isMobile, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.actions) === null || _api$selection === void 0 ? void 0 : _api$selection.selectNearNode, api, allowInteractiveExpand, __livePage);
603
+ return new ExpandNodeView(node, view, getPos, getIntl, isMobile, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.actions) === null || _api$selection === void 0 ? void 0 : _api$selection.selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage);
585
604
  };
586
605
  }
@@ -40,8 +40,9 @@ export var expandPlugin = function expandPlugin(_ref) {
40
40
  plugin: function plugin(_ref2) {
41
41
  var _options$allowInterac;
42
42
  var dispatch = _ref2.dispatch,
43
- getIntl = _ref2.getIntl;
44
- return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
43
+ getIntl = _ref2.getIntl,
44
+ nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
45
+ return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, nodeViewPortalProviderAPI, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
45
46
  }
46
47
  }, {
47
48
  name: 'expandKeymap',
@@ -16,8 +16,9 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
16
16
  var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
17
17
  var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
18
18
  var api = arguments.length > 4 ? arguments[4] : undefined;
19
- var allowInteractiveExpand = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
20
- var __livePage = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
19
+ var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
20
+ var allowInteractiveExpand = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
21
+ var __livePage = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
21
22
  var state = createPluginState(dispatch, {});
22
23
  var isMobile = false;
23
24
  return new SafePlugin({
@@ -29,6 +30,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
29
30
  getIntl: getIntl,
30
31
  isMobile: isMobile,
31
32
  api: api,
33
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
32
34
  allowInteractiveExpand: allowInteractiveExpand,
33
35
  __livePage: __livePage
34
36
  }),
@@ -36,6 +38,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
36
38
  getIntl: getIntl,
37
39
  isMobile: isMobile,
38
40
  api: api,
41
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
39
42
  allowInteractiveExpand: allowInteractiveExpand,
40
43
  __livePage: __livePage
41
44
  })
@@ -1,7 +1,9 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import React from 'react';
4
5
  import ReactDOM from 'react-dom';
6
+ import uuid from 'uuid/v4';
5
7
  import { keyName } from 'w3c-keyname';
6
8
  import { expandedState, isExpandCollapsed } from '@atlaskit/editor-common/expand';
7
9
  import { GapCursorSelection, RelativeSelectionPos, Side } from '@atlaskit/editor-common/selection';
@@ -10,16 +12,18 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
10
12
  import { redo, undo } from '@atlaskit/editor-prosemirror/history';
11
13
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
12
14
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
15
+ import { fg } from '@atlaskit/platform-feature-flags';
13
16
  import { deleteExpand, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
14
- import { buildExpandClassName, renderIcon, toDOM } from '../ui/NodeView';
17
+ import { ExpandButton } from '../ui/ExpandButton';
18
+ import { buildExpandClassName, toDOM } from '../ui/NodeView';
15
19
  export var ExpandNodeView = /*#__PURE__*/function () {
16
- function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api) {
20
+ function ExpandNodeView(_node, view, getPos, getIntl, isMobile, selectNearNode, api, nodeViewPortalProviderAPI) {
17
21
  var _this = this,
18
22
  _api$editorDisabled,
19
23
  _this$api6;
20
- var allowInteractiveExpand = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : true;
21
- var __livePage = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : false;
22
- var cleanUpEditorDisabledOnChange = arguments.length > 9 ? arguments[9] : undefined;
24
+ var allowInteractiveExpand = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
25
+ var __livePage = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : false;
26
+ var cleanUpEditorDisabledOnChange = arguments.length > 10 ? arguments[10] : undefined;
23
27
  _classCallCheck(this, ExpandNodeView);
24
28
  _defineProperty(this, "allowInteractiveExpand", true);
25
29
  _defineProperty(this, "isMobile", false);
@@ -351,10 +355,31 @@ export var ExpandNodeView = /*#__PURE__*/function () {
351
355
  }
352
356
  return contentEditable;
353
357
  });
358
+ _defineProperty(this, "renderIcon", function (icon, expanded) {
359
+ if (!icon) {
360
+ return;
361
+ }
362
+ if (fg('platform_editor_react18_plugin_portalprovider')) {
363
+ _this.nodeViewPortalProviderAPI.render(function () {
364
+ return /*#__PURE__*/React.createElement(ExpandButton, {
365
+ intl: _this.intl,
366
+ allowInteractiveExpand: _this.allowInteractiveExpand,
367
+ expanded: expanded
368
+ });
369
+ }, icon, _this.renderKey);
370
+ } else {
371
+ ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
372
+ intl: _this.intl,
373
+ allowInteractiveExpand: _this.allowInteractiveExpand,
374
+ expanded: expanded
375
+ }), icon);
376
+ }
377
+ });
354
378
  this.selectNearNode = selectNearNode;
355
379
  this.__livePage = __livePage;
356
380
  this.cleanUpEditorDisabledOnChange = cleanUpEditorDisabledOnChange;
357
381
  this.intl = getIntl();
382
+ this.nodeViewPortalProviderAPI = nodeViewPortalProviderAPI;
358
383
  this.allowInteractiveExpand = allowInteractiveExpand;
359
384
  this.getPos = getPos;
360
385
  this.view = view;
@@ -369,11 +394,12 @@ export var ExpandNodeView = /*#__PURE__*/function () {
369
394
  this.icon = this.dom.querySelector(".".concat(expandClassNames.icon));
370
395
  this.input = this.dom.querySelector(".".concat(expandClassNames.titleInput));
371
396
  this.titleContainer = this.dom.querySelector(".".concat(expandClassNames.titleContainer));
397
+ this.renderKey = uuid();
372
398
  this.content = this.dom.querySelector(".".concat(expandClassNames.content));
373
399
  if (!expandedState.has(this.node)) {
374
400
  expandedState.set(this.node, false);
375
401
  }
376
- renderIcon(this.icon, this.allowInteractiveExpand, !isExpandCollapsed(this.node), this.intl);
402
+ this.renderIcon(this.icon, !isExpandCollapsed(this.node));
377
403
  if (!this.input || !this.titleContainer || !this.icon) {
378
404
  return;
379
405
  }
@@ -462,7 +488,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
462
488
  var _expandedState$get;
463
489
  this.dom.className = buildExpandClassName(node.type.name, expanded);
464
490
  // Re-render the icon to update the aria-expanded attribute
465
- renderIcon(this.icon ? this.icon : null, this.allowInteractiveExpand, (_expandedState$get = expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false, this.intl);
491
+ this.renderIcon(this.icon ? this.icon : null, (_expandedState$get = expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false);
466
492
  }
467
493
  this.updateExpandBodyContentEditable();
468
494
  }
@@ -492,7 +518,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
492
518
  if (this.cleanUpEditorDisabledOnChange) {
493
519
  this.cleanUpEditorDisabledOnChange();
494
520
  }
495
- ReactDOM.unmountComponentAtNode(this.icon);
521
+ if (fg('platform_editor_react18_plugin_portalprovider')) {
522
+ this.nodeViewPortalProviderAPI.remove(this.renderKey);
523
+ } else {
524
+ ReactDOM.unmountComponentAtNode(this.icon);
525
+ }
496
526
  }
497
527
  }]);
498
528
  return ExpandNodeView;
@@ -501,11 +531,12 @@ export default function (_ref) {
501
531
  var getIntl = _ref.getIntl,
502
532
  isMobile = _ref.isMobile,
503
533
  api = _ref.api,
534
+ nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI,
504
535
  _ref$allowInteractive = _ref.allowInteractiveExpand,
505
536
  allowInteractiveExpand = _ref$allowInteractive === void 0 ? true : _ref$allowInteractive,
506
537
  __livePage = _ref.__livePage;
507
538
  return function (node, view, getPos) {
508
539
  var _api$selection;
509
- return new ExpandNodeView(node, view, getPos, getIntl, isMobile, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.actions) === null || _api$selection === void 0 ? void 0 : _api$selection.selectNearNode, api, allowInteractiveExpand, __livePage);
540
+ return new ExpandNodeView(node, view, getPos, getIntl, isMobile, api === null || api === void 0 || (_api$selection = api.selection) === null || _api$selection === void 0 || (_api$selection = _api$selection.actions) === null || _api$selection === void 0 ? void 0 : _api$selection.selectNearNode, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage);
510
541
  };
511
542
  }
@@ -39,8 +39,9 @@ export var expandPlugin = function expandPlugin(_ref) {
39
39
  plugin: function plugin(_ref2) {
40
40
  var _options$allowInterac;
41
41
  var dispatch = _ref2.dispatch,
42
- getIntl = _ref2.getIntl;
43
- return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
42
+ getIntl = _ref2.getIntl,
43
+ nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
44
+ return createPlugin(dispatch, getIntl, options.appearance, options.useLongPressSelection, api, nodeViewPortalProviderAPI, (_options$allowInterac = options.allowInteractiveExpand) !== null && _options$allowInterac !== void 0 ? _options$allowInterac : true, options.__livePage);
44
45
  }
45
46
  }, {
46
47
  name: 'expandKeymap',
@@ -15,8 +15,9 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
15
15
  var appearance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'full-page';
16
16
  var useLongPressSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
17
17
  var api = arguments.length > 4 ? arguments[4] : undefined;
18
- var allowInteractiveExpand = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
19
- var __livePage = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
18
+ var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
19
+ var allowInteractiveExpand = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : true;
20
+ var __livePage = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
20
21
  var isMobile = false;
21
22
  return new SafePlugin({
22
23
  key: pluginKey,
@@ -26,6 +27,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
26
27
  getIntl: getIntl,
27
28
  isMobile: isMobile,
28
29
  api: api,
30
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
29
31
  allowInteractiveExpand: allowInteractiveExpand,
30
32
  __livePage: __livePage
31
33
  }),
@@ -33,6 +35,7 @@ export var createPlugin = function createPlugin(dispatch, getIntl) {
33
35
  getIntl: getIntl,
34
36
  isMobile: isMobile,
35
37
  api: api,
38
+ nodeViewPortalProviderAPI: nodeViewPortalProviderAPI,
36
39
  allowInteractiveExpand: allowInteractiveExpand,
37
40
  __livePage: __livePage
38
41
  })
@@ -1,9 +1,6 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
1
  import { expandedState } from '@atlaskit/editor-common/expand';
4
2
  import { expandClassNames } from '@atlaskit/editor-common/styles';
5
3
  import { expandMessages } from '@atlaskit/editor-common/ui';
6
- import { ExpandButton } from '../ui/ExpandButton';
7
4
  export var buildExpandClassName = function buildExpandClassName(type, expanded) {
8
5
  return "".concat(expandClassNames.prefix, " ").concat(expandClassNames.type(type), " ").concat(expanded ? expandClassNames.expanded : '');
9
6
  };
@@ -42,14 +39,4 @@ export var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, content
42
39
  class: expandClassNames.content,
43
40
  contenteditable: contentEditable !== undefined ? contentEditable ? 'true' : 'false' : undefined
44
41
  }, 0]];
45
- };
46
- export var renderIcon = function renderIcon(icon, allowInteractiveExpand, expanded, intl) {
47
- if (!icon) {
48
- return;
49
- }
50
- ReactDOM.render( /*#__PURE__*/React.createElement(ExpandButton, {
51
- intl: intl,
52
- allowInteractiveExpand: allowInteractiveExpand,
53
- expanded: expanded
54
- }), icon);
55
42
  };
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
2
3
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
4
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
@@ -21,8 +22,10 @@ export declare class ExpandNodeView implements NodeView {
21
22
  allowInteractiveExpand: boolean;
22
23
  isMobile: boolean;
23
24
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
25
+ nodeViewPortalProviderAPI: PortalProviderAPI;
24
26
  decorationCleanup?: () => boolean | undefined;
25
- constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
27
+ renderKey: string;
28
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
26
29
  private initHandlers;
27
30
  private focusTitle;
28
31
  private handleIconKeyDown;
@@ -52,10 +55,11 @@ export declare class ExpandNodeView implements NodeView {
52
55
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
53
56
  destroy(): void;
54
57
  }
55
- export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
58
+ export default function ({ getIntl, isMobile, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage, }: {
56
59
  getIntl: () => IntlShape;
57
60
  isMobile: boolean;
58
61
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
62
+ nodeViewPortalProviderAPI: PortalProviderAPI;
59
63
  allowInteractiveExpand: boolean;
60
64
  __livePage: boolean;
61
65
  }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,12 +1,13 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
6
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
6
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
8
  import type { ExpandPlugin } from '../../types';
8
9
  export declare function containsClass(element: Element | null, className: string): boolean;
9
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
11
  /**
11
12
  * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
12
13
  */
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
2
3
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
4
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
@@ -21,8 +22,10 @@ export declare class ExpandNodeView implements NodeView {
21
22
  allowInteractiveExpand: boolean;
22
23
  isMobile: boolean;
23
24
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
25
+ nodeViewPortalProviderAPI: PortalProviderAPI;
24
26
  decorationCleanup?: () => boolean | undefined;
25
- constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
27
+ renderKey: string;
28
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
26
29
  private focusTitle;
27
30
  private handleIconKeyDown;
28
31
  private handleClick;
@@ -50,12 +53,14 @@ export declare class ExpandNodeView implements NodeView {
50
53
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
51
54
  updateExpandToggleIcon(node: PmNode): void;
52
55
  updateExpandBodyContentEditable(): void;
56
+ renderIcon: (icon: HTMLElement | null, expanded: boolean) => void;
53
57
  destroy(): void;
54
58
  }
55
- export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
59
+ export default function ({ getIntl, isMobile, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage, }: {
56
60
  getIntl: () => IntlShape;
57
61
  isMobile: boolean;
58
62
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
63
+ nodeViewPortalProviderAPI: PortalProviderAPI;
59
64
  allowInteractiveExpand: boolean;
60
65
  __livePage: boolean;
61
66
  }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,5 +1,6 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
6
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
@@ -8,7 +9,7 @@ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
8
9
  import type { ExpandPlugin } from '../../types';
9
10
  export declare const pluginKey: PluginKey<any>;
10
11
  export declare function containsClass(element: Element | null, className: string): boolean;
11
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
13
  /**
13
14
  * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
14
15
  */
@@ -2,4 +2,3 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
4
4
  export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape, titleReadOnly?: boolean, contentEditable?: boolean) => DOMOutputSpec;
5
- export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, expanded: boolean, intl?: IntlShape) => void;
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
2
3
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
4
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
@@ -21,8 +22,10 @@ export declare class ExpandNodeView implements NodeView {
21
22
  allowInteractiveExpand: boolean;
22
23
  isMobile: boolean;
23
24
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
25
+ nodeViewPortalProviderAPI: PortalProviderAPI;
24
26
  decorationCleanup?: () => boolean | undefined;
25
- constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
27
+ renderKey: string;
28
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
26
29
  private initHandlers;
27
30
  private focusTitle;
28
31
  private handleIconKeyDown;
@@ -52,10 +55,11 @@ export declare class ExpandNodeView implements NodeView {
52
55
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
53
56
  destroy(): void;
54
57
  }
55
- export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
58
+ export default function ({ getIntl, isMobile, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage, }: {
56
59
  getIntl: () => IntlShape;
57
60
  isMobile: boolean;
58
61
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
62
+ nodeViewPortalProviderAPI: PortalProviderAPI;
59
63
  allowInteractiveExpand: boolean;
60
64
  __livePage: boolean;
61
65
  }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,12 +1,13 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
6
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
6
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
8
  import type { ExpandPlugin } from '../../types';
8
9
  export declare function containsClass(element: Element | null, className: string): boolean;
9
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<import("../../types").ExpandPluginState>;
10
11
  /**
11
12
  * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
12
13
  */
@@ -1,4 +1,5 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
2
3
  import type { SetSelectionRelativeToNode } from '@atlaskit/editor-common/selection';
3
4
  import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
4
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
@@ -21,8 +22,10 @@ export declare class ExpandNodeView implements NodeView {
21
22
  allowInteractiveExpand: boolean;
22
23
  isMobile: boolean;
23
24
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
25
+ nodeViewPortalProviderAPI: PortalProviderAPI;
24
26
  decorationCleanup?: () => boolean | undefined;
25
- constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
27
+ renderKey: string;
28
+ constructor(node: PmNode, view: EditorView, getPos: getPosHandlerNode, getIntl: () => IntlShape, isMobile: boolean, selectNearNode: SetSelectionRelativeToNode | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean, cleanUpEditorDisabledOnChange?: (() => void) | undefined);
26
29
  private focusTitle;
27
30
  private handleIconKeyDown;
28
31
  private handleClick;
@@ -50,12 +53,14 @@ export declare class ExpandNodeView implements NodeView {
50
53
  update(node: PmNode, _decorations: readonly Decoration[]): boolean;
51
54
  updateExpandToggleIcon(node: PmNode): void;
52
55
  updateExpandBodyContentEditable(): void;
56
+ renderIcon: (icon: HTMLElement | null, expanded: boolean) => void;
53
57
  destroy(): void;
54
58
  }
55
- export default function ({ getIntl, isMobile, api, allowInteractiveExpand, __livePage, }: {
59
+ export default function ({ getIntl, isMobile, api, nodeViewPortalProviderAPI, allowInteractiveExpand, __livePage, }: {
56
60
  getIntl: () => IntlShape;
57
61
  isMobile: boolean;
58
62
  api: ExtractInjectionAPI<ExpandPlugin> | undefined;
63
+ nodeViewPortalProviderAPI: PortalProviderAPI;
59
64
  allowInteractiveExpand: boolean;
60
65
  __livePage: boolean;
61
66
  }): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
@@ -1,5 +1,6 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
5
  import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
6
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
@@ -8,7 +9,7 @@ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
8
9
  import type { ExpandPlugin } from '../../types';
9
10
  export declare const pluginKey: PluginKey<any>;
10
11
  export declare function containsClass(element: Element | null, className: string): boolean;
11
- export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
+ export declare const createPlugin: (dispatch: Dispatch, getIntl: () => IntlShape, appearance: EditorAppearance | undefined, useLongPressSelection: boolean | undefined, api: ExtractInjectionAPI<ExpandPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, allowInteractiveExpand?: boolean, __livePage?: boolean) => SafePlugin<any>;
12
13
  /**
13
14
  * Convert a nested expand to an expand when dropped outside an expand or table. Convert an expand to a nested expand when dropped inside an expand or table.
14
15
  */
@@ -2,4 +2,3 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  export declare const buildExpandClassName: (type: string, expanded: boolean) => string;
4
4
  export declare const toDOM: (node: PmNode, __livePage: boolean, intl?: IntlShape, titleReadOnly?: boolean, contentEditable?: boolean) => DOMOutputSpec;
5
- export declare const renderIcon: (icon: HTMLElement | null, allowInteractiveExpand: boolean, expanded: boolean, intl?: IntlShape) => void;