@atlaskit/editor-plugin-floating-toolbar 3.0.1 → 3.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,31 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 3.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#121533](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121533)
8
+ [`9efef36af09aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9efef36af09aa) -
9
+ Wire up the copy functionality in floating toolbar overflow menu
10
+
11
+ ### Patch Changes
12
+
13
+ - [#121662](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121662)
14
+ [`9b32bffcee007`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9b32bffcee007) -
15
+ [ux] [ED-26870] Allow toolbar height to expand
16
+ - Updated dependencies
17
+
18
+ ## 3.0.2
19
+
20
+ ### Patch Changes
21
+
22
+ - [#121092](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121092)
23
+ [`8cd08b738070d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8cd08b738070d) -
24
+ [ux] Implemented full height separator as per design for media and card
25
+ - [#121249](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121249)
26
+ [`d14ccaecc153a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d14ccaecc153a) -
27
+ ED-26862 contextual toolbar minor updates
28
+
3
29
  ## 3.0.1
4
30
 
5
31
  ### Patch Changes
@@ -21,8 +21,9 @@ var _ui = require("@atlaskit/editor-common/ui");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
22
  var _utils = require("@atlaskit/editor-prosemirror/utils");
23
23
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
24
+ var _commands = require("./pm-plugins/commands");
24
25
  var _forceFocus = _interopRequireWildcard(require("./pm-plugins/force-focus"));
25
- var _commands = require("./pm-plugins/toolbar-data/commands");
26
+ var _commands2 = require("./pm-plugins/toolbar-data/commands");
26
27
  var _plugin = require("./pm-plugins/toolbar-data/plugin");
27
28
  var _pluginKey = require("./pm-plugins/toolbar-data/plugin-key");
28
29
  var _utils2 = require("./pm-plugins/utils");
@@ -164,6 +165,11 @@ var floatingToolbarPlugin = exports.floatingToolbarPlugin = function floatingToo
164
165
  actions: {
165
166
  forceFocusSelector: _forceFocus.forceFocusSelector
166
167
  },
168
+ commands: {
169
+ copyNode: function copyNode(nodeType) {
170
+ return (0, _commands.copyNode)(nodeType);
171
+ }
172
+ },
167
173
  getSharedState: function getSharedState(editorState) {
168
174
  var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
169
175
  if (!editorState) {
@@ -399,7 +405,7 @@ function ContentComponent(_ref5) {
399
405
  }
400
406
  },
401
407
  onClose: function onClose() {
402
- dispatchCommand((0, _commands.hideConfirmDialog)());
408
+ dispatchCommand((0, _commands2.hideConfirmDialog)());
403
409
  // Need to set focus to Editor here,
404
410
  // As when the Confirmation dialog pop up, and user interacts with the dialog, Editor loses focus.
405
411
  // So when Confirmation dialog is closed, Editor does not have the focus, then cursor goes to the position 1 of the doc,
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.copyNode = void 0;
7
+ var _browser = require("@atlaskit/editor-common/browser");
8
+ var _clipboard = require("@atlaskit/editor-common/clipboard");
9
+ var _copyButton = require("@atlaskit/editor-common/copy-button");
10
+ var _state = require("@atlaskit/editor-prosemirror/state");
11
+ var copyNode = exports.copyNode = function copyNode(nodeType, editorAnalyticsAp) {
12
+ return function (_ref) {
13
+ var tr = _ref.tr;
14
+ // const { tr, schema } = state;
15
+
16
+ // This command should only be triggered by the Copy button in the floating toolbar
17
+ // which is only visible when selection is inside the target node
18
+ var contentNodeWithPos = (0, _copyButton.getSelectedNodeOrNodeParentByNodeType)({
19
+ nodeType: nodeType,
20
+ selection: tr.selection
21
+ });
22
+ if (!contentNodeWithPos) {
23
+ return tr;
24
+ }
25
+ var schema = tr.doc.type.schema;
26
+ var copyToClipboardTr = tr;
27
+ var domNode = (0, _copyButton.toDOM)(contentNodeWithPos.node, schema);
28
+ if (domNode) {
29
+ var div = document.createElement('div');
30
+ div.appendChild(domNode);
31
+
32
+ // if copying inline content
33
+ if (contentNodeWithPos.node.type.inlineContent) {
34
+ // The "1 1" refers to the start and end depth of the slice
35
+ // since we're copying the text inside a paragraph, it will always be 1 1
36
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
39
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
40
+ } else {
41
+ // The "0 0" refers to the start and end depth of the slice
42
+ // since we're copying the block node only, it will always be 0 0
43
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
44
+ // Ignored via go/ees005
45
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
46
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
47
+ }
48
+ // 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
49
+ // 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
50
+ if (_browser.browser.safari && tr.selection instanceof _state.NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
51
+ (0, _clipboard.copyHTMLToClipboardPolyfill)(div);
52
+ } else {
53
+ (0, _clipboard.copyHTMLToClipboard)(div);
54
+ }
55
+ }
56
+ copyToClipboardTr.setMeta('scrollIntoView', false);
57
+ return copyToClipboardTr;
58
+ };
59
+ };
@@ -344,7 +344,8 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
344
344
  });
345
345
  case 'separator':
346
346
  return (0, _react2.jsx)(_ui.FloatingToolbarSeparator, {
347
- key: idx
347
+ key: idx,
348
+ fullHeight: item.fullHeight
348
349
  });
349
350
  }
350
351
  };
@@ -432,7 +433,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
432
433
  (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ?
433
434
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
434
435
  (0, _react2.css)({
435
- height: "var(--ds-space-500, 40px)"
436
+ minHeight: "var(--ds-space-500, 40px)"
436
437
  }) : undefined);
437
438
  };
438
439
 
@@ -478,7 +479,22 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
478
479
  marginRight: "var(--ds-space-100, 8px)"
479
480
  }
480
481
  }
481
- }) :
482
+ },
483
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
484
+ (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ?
485
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
486
+ (0, _react2.css)({
487
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
488
+ padding: paddingFeatureFlag ? "var(--ds-space-0, 0)".concat(" 0 ", "var(--ds-space-050, 4px)") : "var(--ds-space-0, 0)".concat(" 0 ", "var(--ds-space-600, 48px)"),
489
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
490
+ '> div': {
491
+ minHeight: "var(--ds-space-500, 40px)",
492
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
493
+ '> div:has(+ [data-editor-popup="true"]:last-of-type)': {
494
+ marginRight: "var(--ds-space-100, 8px)"
495
+ }
496
+ }
497
+ }) : undefined) :
482
498
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
483
499
  (0, _react2.css)({
484
500
  display: 'flex'
@@ -513,6 +529,11 @@ var Toolbar = /*#__PURE__*/function (_Component) {
513
529
  event.preventDefault();
514
530
  event.stopPropagation();
515
531
  });
532
+ (0, _defineProperty2.default)(_this, "handleMouseDown", function (event) {
533
+ // Prevents selection toolbar from closing when clicking on the toolbar
534
+ event.stopPropagation();
535
+ event.preventDefault();
536
+ });
516
537
  _this.scrollContainerRef = /*#__PURE__*/_react.default.createRef();
517
538
  _this.mountRef = /*#__PURE__*/_react.default.createRef();
518
539
  _this.toolbarContainerRef = /*#__PURE__*/_react.default.createRef();
@@ -628,7 +649,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
628
649
  "data-testid": "editor-floating-toolbar"
629
650
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
630
651
  ,
631
- className: className
652
+ className: className,
653
+ onMouseDown: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? this.handleMouseDown : undefined
632
654
  }, (0, _react2.jsx)(_ui.Announcer, {
633
655
  text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer)) : intl.formatMessage(_floatingToolbar.messages.floatingToolbarAnnouncer),
634
656
  delay: 250
@@ -9,6 +9,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
9
9
  import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
10
10
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
11
11
  import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
12
+ import { copyNode } from './pm-plugins/commands';
12
13
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
13
14
  import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
14
15
  import { createPlugin as floatingToolbarDataPluginFactory } from './pm-plugins/toolbar-data/plugin';
@@ -147,6 +148,9 @@ export const floatingToolbarPlugin = ({
147
148
  actions: {
148
149
  forceFocusSelector
149
150
  },
151
+ commands: {
152
+ copyNode: nodeType => copyNode(nodeType)
153
+ },
150
154
  getSharedState(editorState) {
151
155
  var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
152
156
  if (!editorState) {
@@ -0,0 +1,52 @@
1
+ import { browser } from '@atlaskit/editor-common/browser';
2
+ import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '@atlaskit/editor-common/clipboard';
3
+ import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ export const copyNode = (nodeType, editorAnalyticsAp) => ({
6
+ tr
7
+ }) => {
8
+ // const { tr, schema } = state;
9
+
10
+ // This command should only be triggered by the Copy button in the floating toolbar
11
+ // which is only visible when selection is inside the target node
12
+ const contentNodeWithPos = getSelectedNodeOrNodeParentByNodeType({
13
+ nodeType,
14
+ selection: tr.selection
15
+ });
16
+ if (!contentNodeWithPos) {
17
+ return tr;
18
+ }
19
+ const schema = tr.doc.type.schema;
20
+ const copyToClipboardTr = tr;
21
+ const domNode = toDOM(contentNodeWithPos.node, schema);
22
+ if (domNode) {
23
+ const div = document.createElement('div');
24
+ div.appendChild(domNode);
25
+
26
+ // if copying inline content
27
+ if (contentNodeWithPos.node.type.inlineContent) {
28
+ // The "1 1" refers to the start and end depth of the slice
29
+ // since we're copying the text inside a paragraph, it will always be 1 1
30
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
33
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
34
+ } else {
35
+ // The "0 0" refers to the start and end depth of the slice
36
+ // since we're copying the block node only, it will always be 0 0
37
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
38
+ // Ignored via go/ees005
39
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
40
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
41
+ }
42
+ // 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
43
+ // 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
44
+ if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
45
+ copyHTMLToClipboardPolyfill(div);
46
+ } else {
47
+ copyHTMLToClipboard(div);
48
+ }
49
+ }
50
+ copyToClipboardTr.setMeta('scrollIntoView', false);
51
+ return copyToClipboardTr;
52
+ };
@@ -313,7 +313,8 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
313
313
  });
314
314
  case 'separator':
315
315
  return jsx(Separator, {
316
- key: idx
316
+ key: idx,
317
+ fullHeight: item.fullHeight
317
318
  });
318
319
  }
319
320
  };
@@ -394,7 +395,7 @@ css({
394
395
  editorExperiment('platform_editor_controls', 'variant1') ?
395
396
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
396
397
  css({
397
- height: "var(--ds-space-500, 40px)"
398
+ minHeight: "var(--ds-space-500, 40px)"
398
399
  }) : undefined);
399
400
 
400
401
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
@@ -439,7 +440,22 @@ css({
439
440
  marginRight: "var(--ds-space-100, 8px)"
440
441
  }
441
442
  }
442
- }) :
443
+ },
444
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
445
+ editorExperiment('platform_editor_controls', 'variant1') ?
446
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
447
+ css({
448
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
449
+ padding: paddingFeatureFlag ? `${"var(--ds-space-0, 0)"} 0 ${"var(--ds-space-050, 4px)"}` : `${"var(--ds-space-0, 0)"} 0 ${"var(--ds-space-600, 48px)"}`,
450
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
451
+ '> div': {
452
+ minHeight: "var(--ds-space-500, 40px)",
453
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
454
+ '> div:has(+ [data-editor-popup="true"]:last-of-type)': {
455
+ marginRight: "var(--ds-space-100, 8px)"
456
+ }
457
+ }
458
+ }) : undefined) :
443
459
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
444
460
  css({
445
461
  display: 'flex'
@@ -469,6 +485,11 @@ class Toolbar extends Component {
469
485
  event.preventDefault();
470
486
  event.stopPropagation();
471
487
  });
488
+ _defineProperty(this, "handleMouseDown", event => {
489
+ // Prevents selection toolbar from closing when clicking on the toolbar
490
+ event.stopPropagation();
491
+ event.preventDefault();
492
+ });
472
493
  this.scrollContainerRef = /*#__PURE__*/React.createRef();
473
494
  this.mountRef = /*#__PURE__*/React.createRef();
474
495
  this.toolbarContainerRef = /*#__PURE__*/React.createRef();
@@ -574,7 +595,8 @@ class Toolbar extends Component {
574
595
  "data-testid": "editor-floating-toolbar"
575
596
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
576
597
  ,
577
- className: className
598
+ className: className,
599
+ onMouseDown: editorExperiment('platform_editor_controls', 'variant1') ? this.handleMouseDown : undefined
578
600
  }, jsx(Announcer, {
579
601
  text: mediaAssistiveMessage ? `${mediaAssistiveMessage}, ${intl.formatMessage(messages.floatingToolbarAnnouncer)}` : intl.formatMessage(messages.floatingToolbarAnnouncer),
580
602
  delay: 250
@@ -12,6 +12,7 @@ import { Popup } from '@atlaskit/editor-common/ui';
12
12
  import { AllSelection, PluginKey } from '@atlaskit/editor-prosemirror/state';
13
13
  import { findDomRefAtPos, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
14
14
  import { editorExperiment, unstable_editorExperimentParam } from '@atlaskit/tmp-editor-statsig/experiments';
15
+ import { copyNode as _copyNode } from './pm-plugins/commands';
15
16
  import forceFocusPlugin, { forceFocusSelector } from './pm-plugins/force-focus';
16
17
  import { hideConfirmDialog } from './pm-plugins/toolbar-data/commands';
17
18
  import { createPlugin as floatingToolbarDataPluginFactory } from './pm-plugins/toolbar-data/plugin';
@@ -152,6 +153,11 @@ export var floatingToolbarPlugin = function floatingToolbarPlugin(_ref) {
152
153
  actions: {
153
154
  forceFocusSelector: forceFocusSelector
154
155
  },
156
+ commands: {
157
+ copyNode: function copyNode(nodeType) {
158
+ return _copyNode(nodeType);
159
+ }
160
+ },
155
161
  getSharedState: function getSharedState(editorState) {
156
162
  var _pluginKey$getState$g, _pluginKey$getState, _pluginKey$getState$g2;
157
163
  if (!editorState) {
@@ -0,0 +1,53 @@
1
+ import { browser } from '@atlaskit/editor-common/browser';
2
+ import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '@atlaskit/editor-common/clipboard';
3
+ import { getSelectedNodeOrNodeParentByNodeType, toDOM } from '@atlaskit/editor-common/copy-button';
4
+ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
5
+ export var copyNode = function copyNode(nodeType, editorAnalyticsAp) {
6
+ return function (_ref) {
7
+ var tr = _ref.tr;
8
+ // const { tr, schema } = state;
9
+
10
+ // This command should only be triggered by the Copy button in the floating toolbar
11
+ // which is only visible when selection is inside the target node
12
+ var contentNodeWithPos = getSelectedNodeOrNodeParentByNodeType({
13
+ nodeType: nodeType,
14
+ selection: tr.selection
15
+ });
16
+ if (!contentNodeWithPos) {
17
+ return tr;
18
+ }
19
+ var schema = tr.doc.type.schema;
20
+ var copyToClipboardTr = tr;
21
+ var domNode = toDOM(contentNodeWithPos.node, schema);
22
+ if (domNode) {
23
+ var div = document.createElement('div');
24
+ div.appendChild(domNode);
25
+
26
+ // if copying inline content
27
+ if (contentNodeWithPos.node.type.inlineContent) {
28
+ // The "1 1" refers to the start and end depth of the slice
29
+ // since we're copying the text inside a paragraph, it will always be 1 1
30
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
33
+ div.firstChild.setAttribute('data-pm-slice', '1 1 []');
34
+ } else {
35
+ // The "0 0" refers to the start and end depth of the slice
36
+ // since we're copying the block node only, it will always be 0 0
37
+ // https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
38
+ // Ignored via go/ees005
39
+ // eslint-disable-next-line @atlaskit/editor/no-as-casting
40
+ div.firstChild.setAttribute('data-pm-slice', '0 0 []');
41
+ }
42
+ // 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
43
+ // 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
44
+ if (browser.safari && tr.selection instanceof NodeSelection && (tr.selection.node.type === schema.nodes.extension || tr.selection.node.type === schema.nodes.mediaSingle)) {
45
+ copyHTMLToClipboardPolyfill(div);
46
+ } else {
47
+ copyHTMLToClipboard(div);
48
+ }
49
+ }
50
+ copyToClipboardTr.setMeta('scrollIntoView', false);
51
+ return copyToClipboardTr;
52
+ };
53
+ };
@@ -337,7 +337,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
337
337
  });
338
338
  case 'separator':
339
339
  return jsx(Separator, {
340
- key: idx
340
+ key: idx,
341
+ fullHeight: item.fullHeight
341
342
  });
342
343
  }
343
344
  };
@@ -425,7 +426,7 @@ var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstEle
425
426
  editorExperiment('platform_editor_controls', 'variant1') ?
426
427
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
427
428
  css({
428
- height: "var(--ds-space-500, 40px)"
429
+ minHeight: "var(--ds-space-500, 40px)"
429
430
  }) : undefined);
430
431
  };
431
432
 
@@ -471,7 +472,22 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
471
472
  marginRight: "var(--ds-space-100, 8px)"
472
473
  }
473
474
  }
474
- }) :
475
+ },
476
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values
477
+ editorExperiment('platform_editor_controls', 'variant1') ?
478
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
479
+ css({
480
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
481
+ padding: paddingFeatureFlag ? "var(--ds-space-0, 0)".concat(" 0 ", "var(--ds-space-050, 4px)") : "var(--ds-space-0, 0)".concat(" 0 ", "var(--ds-space-600, 48px)"),
482
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
483
+ '> div': {
484
+ minHeight: "var(--ds-space-500, 40px)",
485
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
486
+ '> div:has(+ [data-editor-popup="true"]:last-of-type)': {
487
+ marginRight: "var(--ds-space-100, 8px)"
488
+ }
489
+ }
490
+ }) : undefined) :
475
491
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
476
492
  css({
477
493
  display: 'flex'
@@ -506,6 +522,11 @@ var Toolbar = /*#__PURE__*/function (_Component) {
506
522
  event.preventDefault();
507
523
  event.stopPropagation();
508
524
  });
525
+ _defineProperty(_this, "handleMouseDown", function (event) {
526
+ // Prevents selection toolbar from closing when clicking on the toolbar
527
+ event.stopPropagation();
528
+ event.preventDefault();
529
+ });
509
530
  _this.scrollContainerRef = /*#__PURE__*/React.createRef();
510
531
  _this.mountRef = /*#__PURE__*/React.createRef();
511
532
  _this.toolbarContainerRef = /*#__PURE__*/React.createRef();
@@ -621,7 +642,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
621
642
  "data-testid": "editor-floating-toolbar"
622
643
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
623
644
  ,
624
- className: className
645
+ className: className,
646
+ onMouseDown: editorExperiment('platform_editor_controls', 'variant1') ? this.handleMouseDown : undefined
625
647
  }, jsx(Announcer, {
626
648
  text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(messages.floatingToolbarAnnouncer)) : intl.formatMessage(messages.floatingToolbarAnnouncer),
627
649
  delay: 250
@@ -0,0 +1,6 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsAp?: EditorAnalyticsAPI | undefined) => ({ tr }: {
5
+ tr: Transaction;
6
+ }) => Transaction;
@@ -0,0 +1,6 @@
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsAp?: EditorAnalyticsAPI | undefined) => ({ tr }: {
5
+ tr: Transaction;
6
+ }) => Transaction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "3.0.1",
3
+ "version": "3.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,20 +25,20 @@
25
25
  ".": "./src/index.ts"
26
26
  },
27
27
  "dependencies": {
28
- "@atlaskit/adf-utils": "^19.18.0",
28
+ "@atlaskit/adf-utils": "^19.19.0",
29
29
  "@atlaskit/button": "^21.1.0",
30
30
  "@atlaskit/checkbox": "^17.0.0",
31
- "@atlaskit/editor-common": "^100.4.0",
31
+ "@atlaskit/editor-common": "^100.5.0",
32
32
  "@atlaskit/editor-palette": "2.0.0",
33
- "@atlaskit/editor-plugin-block-controls": "^3.1.0",
33
+ "@atlaskit/editor-plugin-block-controls": "^3.2.0",
34
34
  "@atlaskit/editor-plugin-context-panel": "^3.0.0",
35
35
  "@atlaskit/editor-plugin-copy-button": "^2.0.0",
36
36
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
37
37
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
39
- "@atlaskit/editor-plugin-emoji": "^3.0.0",
40
- "@atlaskit/editor-plugin-extension": "^4.0.0",
41
- "@atlaskit/editor-plugin-table": "^10.2.0",
39
+ "@atlaskit/editor-plugin-emoji": "^3.1.0",
40
+ "@atlaskit/editor-plugin-extension": "^4.1.0",
41
+ "@atlaskit/editor-plugin-table": "^10.3.0",
42
42
  "@atlaskit/editor-prosemirror": "7.0.0",
43
43
  "@atlaskit/emoji": "^68.0.0",
44
44
  "@atlaskit/icon": "^24.1.0",
@@ -48,8 +48,8 @@
48
48
  "@atlaskit/primitives": "^14.1.0",
49
49
  "@atlaskit/select": "^20.0.0",
50
50
  "@atlaskit/theme": "^17.0.0",
51
- "@atlaskit/tmp-editor-statsig": "^3.3.0",
52
- "@atlaskit/tokens": "^4.2.0",
51
+ "@atlaskit/tmp-editor-statsig": "^3.4.0",
52
+ "@atlaskit/tokens": "^4.3.0",
53
53
  "@atlaskit/tooltip": "^20.0.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@emotion/react": "^11.7.1",