@atlaskit/editor-plugin-floating-toolbar 4.3.0 → 4.3.1

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,14 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#181594](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/181594)
8
+ [`f7fa55cd505ce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7fa55cd505ce) -
9
+ Avoid using tables commands directly in floating toolbar plugin.
10
+ - Updated dependencies
11
+
3
12
  ## 4.3.0
4
13
 
5
14
  ### Minor Changes
@@ -24,12 +24,11 @@ var _ui = require("@atlaskit/editor-common/ui");
24
24
  var _uiColor = require("@atlaskit/editor-common/ui-color");
25
25
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
26
26
  var _editorPalette = require("@atlaskit/editor-palette");
27
- var _commands = require("@atlaskit/editor-plugin-table/commands");
28
27
  var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
29
28
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
29
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
31
30
  var _forceFocus = require("../pm-plugins/force-focus");
32
- var _commands2 = require("../pm-plugins/toolbar-data/commands");
31
+ var _commands = require("../pm-plugins/toolbar-data/commands");
33
32
  var _Dropdown = _interopRequireDefault(require("./Dropdown"));
34
33
  var _EmojiPickerButton = require("./EmojiPickerButton");
35
34
  var _ExtensionsPlaceholder = require("./ExtensionsPlaceholder");
@@ -105,7 +104,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
105
104
  var ButtonIcon = item.icon;
106
105
  var onClickHandler = function onClickHandler() {
107
106
  if (item.confirmDialog) {
108
- dispatchCommand((0, _commands2.showConfirmDialog)(idx));
107
+ dispatchCommand((0, _commands.showConfirmDialog)(idx));
109
108
  } else {
110
109
  dispatchCommand(item.onClick);
111
110
  if (item.focusEditoronEnter && !(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
@@ -584,38 +583,21 @@ var Toolbar = /*#__PURE__*/function (_Component) {
584
583
  };
585
584
  return _this;
586
585
  }
586
+
587
587
  // remove any decorations added by toolbar buttons i.e danger and selected styling
588
588
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
589
589
  (0, _inherits2.default)(Toolbar, _Component);
590
590
  return (0, _createClass2.default)(Toolbar, [{
591
- key: "resetStylingLegacy",
592
- value: function resetStylingLegacy(_ref3) {
593
- var table = _ref3.table;
591
+ key: "resetStyling",
592
+ value: function resetStyling() {
594
593
  if (this.props.editorView) {
595
594
  var _this$props$api;
596
595
  var _this$props$editorVie2 = this.props.editorView,
597
596
  state = _this$props$editorVie2.state,
598
597
  dispatch = _this$props$editorVie2.dispatch;
599
- if (table) {
600
- return (0, _commands.clearHoverSelection)()(state, dispatch);
601
- }
602
598
  (_this$props$api = this.props.api) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.decorations) === null || _this$props$api === void 0 || _this$props$api.actions.removeDecoration(state, dispatch);
603
599
  }
604
600
  }
605
-
606
- // remove any decorations added by toolbar buttons i.e danger and selected styling
607
- // this prevents https://product-fabric.atlassian.net/browse/ED-10207
608
- }, {
609
- key: "resetStyling",
610
- value: function resetStyling() {
611
- if (this.props.editorView) {
612
- var _this$props$api2;
613
- var _this$props$editorVie3 = this.props.editorView,
614
- state = _this$props$editorVie3.state,
615
- dispatch = _this$props$editorVie3.dispatch;
616
- (_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 || (_this$props$api2 = _this$props$api2.decorations) === null || _this$props$api2 === void 0 || _this$props$api2.actions.removeDecoration(state, dispatch);
617
- }
618
- }
619
601
  }, {
620
602
  key: "setDisableScroll",
621
603
  value: function setDisableScroll(disabled) {
@@ -645,16 +627,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
645
627
  value: function componentDidUpdate(prevProps) {
646
628
  var _this$props;
647
629
  (0, _forceFocus.checkShouldForceFocusAndApply)((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
648
- if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
649
- if (this.props.node !== prevProps.node) {
650
- this.resetStyling();
651
- }
652
- } else {
653
- if (this.props.node !== prevProps.node) {
654
- this.resetStylingLegacy({
655
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
656
- });
657
- }
630
+ if (this.props.node !== prevProps.node) {
631
+ this.resetStyling();
658
632
  }
659
633
  }
660
634
  }, {
@@ -666,13 +640,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
666
640
  dispatch = editorView.dispatch;
667
641
  dispatch((0, _forceFocus.forceFocusSelector)(null)(tr));
668
642
  }
669
- if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
670
- this.resetStyling();
671
- } else {
672
- this.resetStylingLegacy({
673
- table: this.props.node.type.name === 'table'
674
- });
675
- }
643
+ this.resetStyling();
676
644
  }
677
645
  }, {
678
646
  key: "render",
@@ -17,7 +17,6 @@ import { Announcer, FloatingToolbarButton as Button, FloatingToolbarSeparator as
17
17
  import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
18
18
  import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
19
19
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
20
- import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
21
20
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
22
21
  import { fg } from '@atlaskit/platform-feature-flags';
23
22
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -544,34 +543,17 @@ class Toolbar extends Component {
544
543
  mounted: false
545
544
  };
546
545
  }
547
- // remove any decorations added by toolbar buttons i.e danger and selected styling
548
- // this prevents https://product-fabric.atlassian.net/browse/ED-10207
549
- resetStylingLegacy({
550
- table
551
- }) {
552
- if (this.props.editorView) {
553
- var _this$props$api, _this$props$api$decor;
554
- const {
555
- state,
556
- dispatch
557
- } = this.props.editorView;
558
- if (table) {
559
- return clearHoverSelection()(state, dispatch);
560
- }
561
- (_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : (_this$props$api$decor = _this$props$api.decorations) === null || _this$props$api$decor === void 0 ? void 0 : _this$props$api$decor.actions.removeDecoration(state, dispatch);
562
- }
563
- }
564
546
 
565
547
  // remove any decorations added by toolbar buttons i.e danger and selected styling
566
548
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
567
549
  resetStyling() {
568
550
  if (this.props.editorView) {
569
- var _this$props$api2, _this$props$api2$deco;
551
+ var _this$props$api, _this$props$api$decor;
570
552
  const {
571
553
  state,
572
554
  dispatch
573
555
  } = this.props.editorView;
574
- (_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 ? void 0 : (_this$props$api2$deco = _this$props$api2.decorations) === null || _this$props$api2$deco === void 0 ? void 0 : _this$props$api2$deco.actions.removeDecoration(state, dispatch);
556
+ (_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : (_this$props$api$decor = _this$props$api.decorations) === null || _this$props$api$decor === void 0 ? void 0 : _this$props$api$decor.actions.removeDecoration(state, dispatch);
575
557
  }
576
558
  }
577
559
  setDisableScroll(disabled) {
@@ -596,16 +578,8 @@ class Toolbar extends Component {
596
578
  componentDidUpdate(prevProps) {
597
579
  var _this$props;
598
580
  checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
599
- if (fg('platform_editor_remove_slow_table_transactions')) {
600
- if (this.props.node !== prevProps.node) {
601
- this.resetStyling();
602
- }
603
- } else {
604
- if (this.props.node !== prevProps.node) {
605
- this.resetStylingLegacy({
606
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
607
- });
608
- }
581
+ if (this.props.node !== prevProps.node) {
582
+ this.resetStyling();
609
583
  }
610
584
  }
611
585
  componentWillUnmount() {
@@ -621,13 +595,7 @@ class Toolbar extends Component {
621
595
  } = editorView;
622
596
  dispatch(forceFocusSelector(null)(tr));
623
597
  }
624
- if (fg('platform_editor_remove_slow_table_transactions')) {
625
- this.resetStyling();
626
- } else {
627
- this.resetStylingLegacy({
628
- table: this.props.node.type.name === 'table'
629
- });
630
- }
598
+ this.resetStyling();
631
599
  }
632
600
  render() {
633
601
  const {
@@ -24,7 +24,6 @@ import { Announcer, FloatingToolbarButton as Button, FloatingToolbarSeparator as
24
24
  import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
25
25
  import { ColorPickerButton, ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
26
26
  import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
27
- import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
28
27
  import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
29
28
  import { fg } from '@atlaskit/platform-feature-flags';
30
29
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -578,38 +577,21 @@ var Toolbar = /*#__PURE__*/function (_Component) {
578
577
  };
579
578
  return _this;
580
579
  }
580
+
581
581
  // remove any decorations added by toolbar buttons i.e danger and selected styling
582
582
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
583
583
  _inherits(Toolbar, _Component);
584
584
  return _createClass(Toolbar, [{
585
- key: "resetStylingLegacy",
586
- value: function resetStylingLegacy(_ref3) {
587
- var table = _ref3.table;
585
+ key: "resetStyling",
586
+ value: function resetStyling() {
588
587
  if (this.props.editorView) {
589
588
  var _this$props$api;
590
589
  var _this$props$editorVie2 = this.props.editorView,
591
590
  state = _this$props$editorVie2.state,
592
591
  dispatch = _this$props$editorVie2.dispatch;
593
- if (table) {
594
- return clearHoverSelection()(state, dispatch);
595
- }
596
592
  (_this$props$api = this.props.api) === null || _this$props$api === void 0 || (_this$props$api = _this$props$api.decorations) === null || _this$props$api === void 0 || _this$props$api.actions.removeDecoration(state, dispatch);
597
593
  }
598
594
  }
599
-
600
- // remove any decorations added by toolbar buttons i.e danger and selected styling
601
- // this prevents https://product-fabric.atlassian.net/browse/ED-10207
602
- }, {
603
- key: "resetStyling",
604
- value: function resetStyling() {
605
- if (this.props.editorView) {
606
- var _this$props$api2;
607
- var _this$props$editorVie3 = this.props.editorView,
608
- state = _this$props$editorVie3.state,
609
- dispatch = _this$props$editorVie3.dispatch;
610
- (_this$props$api2 = this.props.api) === null || _this$props$api2 === void 0 || (_this$props$api2 = _this$props$api2.decorations) === null || _this$props$api2 === void 0 || _this$props$api2.actions.removeDecoration(state, dispatch);
611
- }
612
- }
613
595
  }, {
614
596
  key: "setDisableScroll",
615
597
  value: function setDisableScroll(disabled) {
@@ -639,16 +621,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
639
621
  value: function componentDidUpdate(prevProps) {
640
622
  var _this$props;
641
623
  checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
642
- if (fg('platform_editor_remove_slow_table_transactions')) {
643
- if (this.props.node !== prevProps.node) {
644
- this.resetStyling();
645
- }
646
- } else {
647
- if (this.props.node !== prevProps.node) {
648
- this.resetStylingLegacy({
649
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
650
- });
651
- }
624
+ if (this.props.node !== prevProps.node) {
625
+ this.resetStyling();
652
626
  }
653
627
  }
654
628
  }, {
@@ -660,13 +634,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
660
634
  dispatch = editorView.dispatch;
661
635
  dispatch(forceFocusSelector(null)(tr));
662
636
  }
663
- if (fg('platform_editor_remove_slow_table_transactions')) {
664
- this.resetStyling();
665
- } else {
666
- this.resetStylingLegacy({
667
- table: this.props.node.type.name === 'table'
668
- });
669
- }
637
+ this.resetStyling();
670
638
  }
671
639
  }, {
672
640
  key: "render",
@@ -1,4 +1,4 @@
1
- import { INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
+ import { type INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
@@ -1,4 +1,4 @@
1
- import { INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
1
+ import { type INPUT_METHOD, type EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { NodeType } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  export declare const copyNode: (nodeType: NodeType | Array<NodeType>, editorAnalyticsApi?: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD) => ({ tr }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "@atlaskit/adf-utils": "^19.20.0",
28
28
  "@atlaskit/button": "^23.2.0",
29
29
  "@atlaskit/checkbox": "^17.1.0",
30
- "@atlaskit/editor-common": "^107.5.0",
30
+ "@atlaskit/editor-common": "^107.6.0",
31
31
  "@atlaskit/editor-palette": "^2.1.0",
32
32
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
33
33
  "@atlaskit/editor-plugin-context-panel": "^4.1.0",
@@ -127,9 +127,6 @@
127
127
  "editor_a11y_remove_redundant_wrap_icon_label": {
128
128
  "type": "boolean"
129
129
  },
130
- "platform_editor_remove_slow_table_transactions": {
131
- "type": "boolean"
132
- },
133
130
  "platform_editor_user_intent_plugin": {
134
131
  "type": "boolean"
135
132
  },