@atlaskit/editor-plugin-floating-toolbar 20.0.12 → 21.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 21.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`21d8655ca13bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/21d8655ca13bf) -
8
+ Migrate the editor floating toolbar's lazy-loaded extension controls to react-loosely-lazy behind
9
+ the `platform_editor_loosely_lazy_migration` experiment.
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8d37dc7e55d62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8d37dc7e55d62) -
14
+ Clean up shipped experiment `platform_editor_block_menu`
15
+ - Updated dependencies
16
+
17
+ ## 21.0.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 20.0.12
4
24
 
5
25
  ### Patch Changes
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.copyNode = void 0;
7
- var _browser = require("@atlaskit/editor-common/browser");
8
7
  var _clipboard = require("@atlaskit/editor-common/clipboard");
9
8
  var _copyButton = require("@atlaskit/editor-common/copy-button");
10
- var _state = require("@atlaskit/editor-prosemirror/state");
11
- var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
12
9
  var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
13
10
  return function (_ref) {
14
11
  var tr = _ref.tr;
@@ -26,39 +23,7 @@ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsApi
26
23
  var schema = tr.doc.type.schema;
27
24
  var copyToClipboardTr = tr;
28
25
  var domNode = (0, _copyButton.toDOM)(contentNodeWithPos.node, schema);
29
- if ((0, _editorExperiment.editorExperiment)('platform_editor_block_menu', true)) {
30
- (0, _copyButton.copyDomNode)(domNode, contentNodeWithPos.node.type, tr.selection);
31
- } else {
32
- if (domNode) {
33
- var div = document.createElement('div');
34
- var browser = (0, _browser.getBrowserInfo)();
35
- div.appendChild(domNode);
36
-
37
- // if copying inline content
38
- if (contentNodeWithPos.node.type.inlineContent) {
39
- // The "1 1" refers to the start and end depth of the slice
40
- // since we're copying the text inside a paragraph, it will always be 1 1
41
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
42
- // Ignored via go/ees005
43
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
44
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
45
- } else {
46
- // The "0 0" refers to the start and end depth of the slice
47
- // since we're copying the block node only, it will always be 0 0
48
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
49
- // Ignored via go/ees005
50
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
51
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
52
- }
53
- // ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
54
- // MEX-2528 safari has a bug related to the mediaSingle node with border or link. The image tag within the clipboard is not recognized as HTML when using the ClipboardItem API. To address this, we have to switch to ClipboardPolyfill
55
- if (browser.safari && tr.selection instanceof _state.NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
56
- (0, _clipboard.copyHTMLToClipboardPolyfill)(div);
57
- } else {
58
- (0, _clipboard.copyHTMLToClipboard)(div);
59
- }
60
- }
61
- }
26
+ (0, _copyButton.copyDomNode)(domNode, contentNodeWithPos.node.type, tr.selection);
62
27
  if (editorAnalyticsApi) {
63
28
  var analyticsPayload = (0, _clipboard.getNodeCopiedAnalyticsPayload)(contentNodeWithPos.node, inputMethod);
64
29
  editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
@@ -16,8 +16,12 @@ var _extensions = require("@atlaskit/editor-common/extensions");
16
16
  var _nesting = require("@atlaskit/editor-common/nesting");
17
17
  var _ui = require("@atlaskit/editor-common/ui");
18
18
  var _utils = require("@atlaskit/editor-common/utils");
19
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
20
+ var _reactLooselyLazy = require("react-loosely-lazy");
19
21
  var _Dropdown = _interopRequireDefault(require("./Dropdown"));
20
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
23
+ // oxlint-disable-next-line @atlassian/no-restricted-imports
24
+
21
25
  var noop = function noop() {
22
26
  return null;
23
27
  };
@@ -51,13 +55,25 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
51
55
  return _ref.apply(this, arguments);
52
56
  };
53
57
  }();
54
- var ExtensionButton = function ExtensionButton(props) {
55
- var item = props.item,
56
- node = props.node,
57
- extensionApi = props.extensionApi,
58
- areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
59
- var ButtonIcon = _react.default.useMemo(function () {
60
- return item.icon ? (0, _reactLoadable.default)({
58
+ var ButtonIconLazy = function ButtonIconLazy(_ref2) {
59
+ var icon = _ref2.icon,
60
+ label = _ref2.label;
61
+ var Icon = _react.default.useMemo(function () {
62
+ return (0, _reactLooselyLazy.lazyForPaint)(function () {
63
+ return resolveExtensionIcon(icon);
64
+ });
65
+ }, [icon]);
66
+ return /*#__PURE__*/_react.default.createElement(_reactLooselyLazy.LazySuspense, {
67
+ fallback: null
68
+ }, /*#__PURE__*/_react.default.createElement(Icon, {
69
+ label: label
70
+ }));
71
+ };
72
+ var ButtonIconLoadable = function ButtonIconLoadable(_ref3) {
73
+ var icon = _ref3.icon,
74
+ label = _ref3.label;
75
+ var Icon = _react.default.useMemo(function () {
76
+ return (0, _reactLoadable.default)({
61
77
  // Ignored via go/ees005
62
78
  // eslint-disable-next-line require-await
63
79
  loader: function () {
@@ -65,7 +81,7 @@ var ExtensionButton = function ExtensionButton(props) {
65
81
  return _regenerator.default.wrap(function (_context2) {
66
82
  while (1) switch (_context2.prev = _context2.next) {
67
83
  case 0:
68
- return _context2.abrupt("return", resolveExtensionIcon(item.icon));
84
+ return _context2.abrupt("return", resolveExtensionIcon(icon));
69
85
  case 1:
70
86
  case "end":
71
87
  return _context2.stop();
@@ -78,8 +94,28 @@ var ExtensionButton = function ExtensionButton(props) {
78
94
  return loader;
79
95
  }(),
80
96
  loading: noop
81
- }) : undefined;
82
- }, [item.icon]);
97
+ });
98
+ }, [icon]);
99
+ return /*#__PURE__*/_react.default.createElement(Icon, {
100
+ label: label
101
+ });
102
+ };
103
+ var ExtensionIcon = function ExtensionIcon(_ref4) {
104
+ var icon = _ref4.icon,
105
+ label = _ref4.label;
106
+ return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/_react.default.createElement(ButtonIconLazy, {
107
+ icon: icon,
108
+ label: label
109
+ }) : /*#__PURE__*/_react.default.createElement(ButtonIconLoadable, {
110
+ icon: icon,
111
+ label: label
112
+ });
113
+ };
114
+ var ExtensionButton = function ExtensionButton(props) {
115
+ var item = props.item,
116
+ node = props.node,
117
+ extensionApi = props.extensionApi,
118
+ areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
83
119
  var onClick = function onClick() {
84
120
  if (typeof item.action !== 'function') {
85
121
  throw new Error("'action' of context toolbar item '".concat(item.key, "' is not a function"));
@@ -104,7 +140,8 @@ var ExtensionButton = function ExtensionButton(props) {
104
140
  return /*#__PURE__*/_react.default.createElement(_ui.FloatingToolbarButton, {
105
141
  title: item.label,
106
142
  ariaLabel: getAriaLabel(),
107
- icon: ButtonIcon ? /*#__PURE__*/_react.default.createElement(ButtonIcon, {
143
+ icon: item.icon ? /*#__PURE__*/_react.default.createElement(ExtensionIcon, {
144
+ icon: item.icon,
108
145
  label: item.label || ''
109
146
  }) : undefined,
110
147
  onClick: onClick,
@@ -1,8 +1,5 @@
1
- import { getBrowserInfo } from '@atlaskit/editor-common/browser';
2
- import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
1
+ import { getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
2
  import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
6
3
  export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
7
4
  tr
8
5
  }) => {
@@ -20,39 +17,7 @@ export const copyNode = (nodeType, editorAnalyticsApi, inputMethod) => ({
20
17
  const schema = tr.doc.type.schema;
21
18
  const copyToClipboardTr = tr;
22
19
  const domNode = toDOM(contentNodeWithPos.node, schema);
23
- if (editorExperiment('platform_editor_block_menu', true)) {
24
- copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
25
- } else {
26
- if (domNode) {
27
- const div = document.createElement('div');
28
- const browser = getBrowserInfo();
29
- div.appendChild(domNode);
30
-
31
- // if copying inline content
32
- if (contentNodeWithPos.node.type.inlineContent) {
33
- // The "1 1" refers to the start and end depth of the slice
34
- // since we're copying the text inside a paragraph, it will always be 1 1
35
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
36
- // Ignored via go/ees005
37
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
38
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
39
- } else {
40
- // The "0 0" refers to the start and end depth of the slice
41
- // since we're copying the block node only, it will always be 0 0
42
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
43
- // Ignored via go/ees005
44
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
45
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
46
- }
47
- // ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
48
- // MEX-2528 safari has a bug related to the mediaSingle node with border or link. The image tag within the clipboard is not recognized as HTML when using the ClipboardItem API. To address this, we have to switch to ClipboardPolyfill
49
- if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
50
- copyHTMLToClipboardPolyfill(div);
51
- } else {
52
- copyHTMLToClipboard(div);
53
- }
54
- }
55
- }
20
+ copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
56
21
  if (editorAnalyticsApi) {
57
22
  const analyticsPayload = getNodeCopiedAnalyticsPayload(contentNodeWithPos.node, inputMethod);
58
23
  editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
@@ -5,6 +5,9 @@ import { getContextualToolbarItemsFromModule } from '@atlaskit/editor-common/ext
5
5
  import { isNestedTablesSupported, isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
6
6
  import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
7
7
  import { nodeToJSON } from '@atlaskit/editor-common/utils';
8
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
9
+ // oxlint-disable-next-line @atlassian/no-restricted-imports
10
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
8
11
  import Dropdown from './Dropdown';
9
12
  const noop = () => null;
10
13
  const isDefaultExport = mod => {
@@ -17,6 +20,43 @@ const resolveExtensionIcon = async getIcon => {
17
20
  const maybeIcon = await getIcon();
18
21
  return isDefaultExport(maybeIcon) ? maybeIcon.default : maybeIcon;
19
22
  };
23
+ const ButtonIconLazy = ({
24
+ icon,
25
+ label
26
+ }) => {
27
+ const Icon = React.useMemo(() => lazyForPaint(() => resolveExtensionIcon(icon)), [icon]);
28
+ return /*#__PURE__*/React.createElement(LazySuspense, {
29
+ fallback: null
30
+ }, /*#__PURE__*/React.createElement(Icon, {
31
+ label: label
32
+ }));
33
+ };
34
+ const ButtonIconLoadable = ({
35
+ icon,
36
+ label
37
+ }) => {
38
+ const Icon = React.useMemo(() => Loadable({
39
+ // Ignored via go/ees005
40
+ // eslint-disable-next-line require-await
41
+ loader: async () => resolveExtensionIcon(icon),
42
+ loading: noop
43
+ }), [icon]);
44
+ return /*#__PURE__*/React.createElement(Icon, {
45
+ label: label
46
+ });
47
+ };
48
+ const ExtensionIcon = ({
49
+ icon,
50
+ label
51
+ }) => {
52
+ return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(ButtonIconLazy, {
53
+ icon: icon,
54
+ label: label
55
+ }) : /*#__PURE__*/React.createElement(ButtonIconLoadable, {
56
+ icon: icon,
57
+ label: label
58
+ });
59
+ };
20
60
  const ExtensionButton = props => {
21
61
  const {
22
62
  item,
@@ -24,12 +64,6 @@ const ExtensionButton = props => {
24
64
  extensionApi,
25
65
  areAnyNewToolbarFlagsEnabled
26
66
  } = props;
27
- const ButtonIcon = React.useMemo(() => item.icon ? Loadable({
28
- // Ignored via go/ees005
29
- // eslint-disable-next-line require-await
30
- loader: async () => resolveExtensionIcon(item.icon),
31
- loading: noop
32
- }) : undefined, [item.icon]);
33
67
  const onClick = () => {
34
68
  if (typeof item.action !== 'function') {
35
69
  throw new Error(`'action' of context toolbar item '${item.key}' is not a function`);
@@ -54,7 +88,8 @@ const ExtensionButton = props => {
54
88
  return /*#__PURE__*/React.createElement(Button, {
55
89
  title: item.label,
56
90
  ariaLabel: getAriaLabel(),
57
- icon: ButtonIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
91
+ icon: item.icon ? /*#__PURE__*/React.createElement(ExtensionIcon, {
92
+ icon: item.icon,
58
93
  label: item.label || ''
59
94
  }) : undefined,
60
95
  onClick: onClick,
@@ -1,8 +1,5 @@
1
- import { getBrowserInfo } from '@atlaskit/editor-common/browser';
2
- import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill, getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
1
+ import { getNodeCopiedAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
3
2
  import { copyDomNode, getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
- import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
6
3
  export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMethod) {
7
4
  return function (_ref) {
8
5
  var tr = _ref.tr;
@@ -20,39 +17,7 @@ export var copyNode = function copyNode(nodeType, editorAnalyticsApi, inputMetho
20
17
  var schema = tr.doc.type.schema;
21
18
  var copyToClipboardTr = tr;
22
19
  var domNode = toDOM(contentNodeWithPos.node, schema);
23
- if (editorExperiment('platform_editor_block_menu', true)) {
24
- copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
25
- } else {
26
- if (domNode) {
27
- var div = document.createElement('div');
28
- var browser = getBrowserInfo();
29
- div.appendChild(domNode);
30
-
31
- // if copying inline content
32
- if (contentNodeWithPos.node.type.inlineContent) {
33
- // The "1 1" refers to the start and end depth of the slice
34
- // since we're copying the text inside a paragraph, it will always be 1 1
35
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
36
- // Ignored via go/ees005
37
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
38
- div.firstChild.setAttribute('data-pm-slice', '1 1 []');
39
- } else {
40
- // The "0 0" refers to the start and end depth of the slice
41
- // since we're copying the block node only, it will always be 0 0
42
- // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
43
- // Ignored via go/ees005
44
- // eslint-disable-next-line @atlaskit/editor/no-as-casting
45
- div.firstChild.setAttribute('data-pm-slice', '0 0 []');
46
- }
47
- // ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
48
- // MEX-2528 safari has a bug related to the mediaSingle node with border or link. The image tag within the clipboard is not recognized as HTML when using the ClipboardItem API. To address this, we have to switch to ClipboardPolyfill
49
- if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
50
- copyHTMLToClipboardPolyfill(div);
51
- } else {
52
- copyHTMLToClipboard(div);
53
- }
54
- }
55
- }
20
+ copyDomNode(domNode, contentNodeWithPos.node.type, tr.selection);
56
21
  if (editorAnalyticsApi) {
57
22
  var analyticsPayload = getNodeCopiedAnalyticsPayload(contentNodeWithPos.node, inputMethod);
58
23
  editorAnalyticsApi.attachAnalyticsEvent(analyticsPayload)(copyToClipboardTr);
@@ -8,6 +8,9 @@ import { getContextualToolbarItemsFromModule } from '@atlaskit/editor-common/ext
8
8
  import { isNestedTablesSupported, isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
9
9
  import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
10
10
  import { nodeToJSON } from '@atlaskit/editor-common/utils';
11
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
12
+ // oxlint-disable-next-line @atlassian/no-restricted-imports
13
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
11
14
  import Dropdown from './Dropdown';
12
15
  var noop = function noop() {
13
16
  return null;
@@ -42,13 +45,25 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
42
45
  return _ref.apply(this, arguments);
43
46
  };
44
47
  }();
45
- var ExtensionButton = function ExtensionButton(props) {
46
- var item = props.item,
47
- node = props.node,
48
- extensionApi = props.extensionApi,
49
- areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
50
- var ButtonIcon = React.useMemo(function () {
51
- return item.icon ? Loadable({
48
+ var ButtonIconLazy = function ButtonIconLazy(_ref2) {
49
+ var icon = _ref2.icon,
50
+ label = _ref2.label;
51
+ var Icon = React.useMemo(function () {
52
+ return lazyForPaint(function () {
53
+ return resolveExtensionIcon(icon);
54
+ });
55
+ }, [icon]);
56
+ return /*#__PURE__*/React.createElement(LazySuspense, {
57
+ fallback: null
58
+ }, /*#__PURE__*/React.createElement(Icon, {
59
+ label: label
60
+ }));
61
+ };
62
+ var ButtonIconLoadable = function ButtonIconLoadable(_ref3) {
63
+ var icon = _ref3.icon,
64
+ label = _ref3.label;
65
+ var Icon = React.useMemo(function () {
66
+ return Loadable({
52
67
  // Ignored via go/ees005
53
68
  // eslint-disable-next-line require-await
54
69
  loader: function () {
@@ -56,7 +71,7 @@ var ExtensionButton = function ExtensionButton(props) {
56
71
  return _regeneratorRuntime.wrap(function (_context2) {
57
72
  while (1) switch (_context2.prev = _context2.next) {
58
73
  case 0:
59
- return _context2.abrupt("return", resolveExtensionIcon(item.icon));
74
+ return _context2.abrupt("return", resolveExtensionIcon(icon));
60
75
  case 1:
61
76
  case "end":
62
77
  return _context2.stop();
@@ -69,8 +84,28 @@ var ExtensionButton = function ExtensionButton(props) {
69
84
  return loader;
70
85
  }(),
71
86
  loading: noop
72
- }) : undefined;
73
- }, [item.icon]);
87
+ });
88
+ }, [icon]);
89
+ return /*#__PURE__*/React.createElement(Icon, {
90
+ label: label
91
+ });
92
+ };
93
+ var ExtensionIcon = function ExtensionIcon(_ref4) {
94
+ var icon = _ref4.icon,
95
+ label = _ref4.label;
96
+ return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(ButtonIconLazy, {
97
+ icon: icon,
98
+ label: label
99
+ }) : /*#__PURE__*/React.createElement(ButtonIconLoadable, {
100
+ icon: icon,
101
+ label: label
102
+ });
103
+ };
104
+ var ExtensionButton = function ExtensionButton(props) {
105
+ var item = props.item,
106
+ node = props.node,
107
+ extensionApi = props.extensionApi,
108
+ areAnyNewToolbarFlagsEnabled = props.areAnyNewToolbarFlagsEnabled;
74
109
  var onClick = function onClick() {
75
110
  if (typeof item.action !== 'function') {
76
111
  throw new Error("'action' of context toolbar item '".concat(item.key, "' is not a function"));
@@ -95,7 +130,8 @@ var ExtensionButton = function ExtensionButton(props) {
95
130
  return /*#__PURE__*/React.createElement(Button, {
96
131
  title: item.label,
97
132
  ariaLabel: getAriaLabel(),
98
- icon: ButtonIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
133
+ icon: item.icon ? /*#__PURE__*/React.createElement(ExtensionIcon, {
134
+ icon: item.icon,
99
135
  label: item.label || ''
100
136
  }) : undefined,
101
137
  onClick: onClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "20.0.12",
3
+ "version": "21.1.0",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -25,36 +25,38 @@
25
25
  "@atlaskit/button": "^25.3.0",
26
26
  "@atlaskit/checkbox": "^19.2.0",
27
27
  "@atlaskit/editor-palette": "^3.5.0",
28
- "@atlaskit/editor-plugin-analytics": "^18.0.0",
29
- "@atlaskit/editor-plugin-context-panel": "^20.0.0",
30
- "@atlaskit/editor-plugin-copy-button": "^18.0.0",
31
- "@atlaskit/editor-plugin-decorations": "^18.0.0",
32
- "@atlaskit/editor-plugin-editor-disabled": "^18.0.0",
33
- "@atlaskit/editor-plugin-editor-viewmode": "^20.0.0",
34
- "@atlaskit/editor-plugin-emoji": "^19.1.0",
35
- "@atlaskit/editor-plugin-extension": "^21.1.0",
36
- "@atlaskit/editor-plugin-interaction": "^31.0.0",
37
- "@atlaskit/editor-plugin-user-intent": "^16.0.0",
38
- "@atlaskit/editor-prosemirror": "^8.0.0",
28
+ "@atlaskit/editor-plugin-analytics": "^19.0.0",
29
+ "@atlaskit/editor-plugin-context-panel": "^21.0.0",
30
+ "@atlaskit/editor-plugin-copy-button": "^19.0.0",
31
+ "@atlaskit/editor-plugin-decorations": "^19.0.0",
32
+ "@atlaskit/editor-plugin-editor-disabled": "^19.0.0",
33
+ "@atlaskit/editor-plugin-editor-viewmode": "^21.0.0",
34
+ "@atlaskit/editor-plugin-emoji": "^20.0.0",
35
+ "@atlaskit/editor-plugin-extension": "^22.0.0",
36
+ "@atlaskit/editor-plugin-interaction": "^32.0.0",
37
+ "@atlaskit/editor-plugin-user-intent": "^17.0.0",
38
+ "@atlaskit/editor-prosemirror": "^9.0.0",
39
39
  "@atlaskit/emoji": "^72.4.0",
40
40
  "@atlaskit/icon": "^37.7.0",
41
41
  "@atlaskit/menu": "^11.0.0",
42
42
  "@atlaskit/modal-dialog": "^16.6.0",
43
+ "@atlaskit/platform-feature-experiments": "^0.3.0",
43
44
  "@atlaskit/platform-feature-flags": "^2.2.0",
44
45
  "@atlaskit/primitives": "^22.5.0",
45
46
  "@atlaskit/select": "^22.11.0",
46
- "@atlaskit/tmp-editor-statsig": "^199.0.0",
47
- "@atlaskit/tokens": "^18.1.0",
47
+ "@atlaskit/tmp-editor-statsig": "^200.0.0",
48
+ "@atlaskit/tokens": "^18.2.0",
48
49
  "@atlaskit/tooltip": "^24.3.0",
49
50
  "@babel/runtime": "^7.0.0",
50
51
  "@emotion/react": "^11.7.1",
51
52
  "bind-event-listener": "^3.0.0",
52
53
  "lodash": "^4.17.21",
53
54
  "raf-schd": "^4.0.3",
54
- "react-loadable": "^5.1.0"
55
+ "react-loadable": "^5.1.0",
56
+ "react-loosely-lazy": "^1.0.0"
55
57
  },
56
58
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^122.12.0",
59
+ "@atlaskit/editor-common": "^123.0.0",
58
60
  "react": "^18.2.0 || ^19.2.0",
59
61
  "react-dom": "^18.2.0 || ^19.2.0",
60
62
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"