@atlaskit/editor-plugin-floating-toolbar 4.1.5 → 4.1.7

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,17 @@
1
1
  # @atlaskit/editor-plugin-floating-toolbar
2
2
 
3
+ ## 4.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 4.1.5
4
16
 
5
17
  ### Patch Changes
@@ -584,8 +584,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
584
584
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
585
585
  (0, _inherits2.default)(Toolbar, _Component);
586
586
  return (0, _createClass2.default)(Toolbar, [{
587
- key: "resetStyling",
588
- value: function resetStyling(_ref3) {
587
+ key: "resetStylingLegacy",
588
+ value: function resetStylingLegacy(_ref3) {
589
589
  var table = _ref3.table;
590
590
  if (this.props.editorView) {
591
591
  var _this$props$api;
@@ -598,6 +598,20 @@ var Toolbar = /*#__PURE__*/function (_Component) {
598
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);
599
599
  }
600
600
  }
601
+
602
+ // remove any decorations added by toolbar buttons i.e danger and selected styling
603
+ // this prevents https://product-fabric.atlassian.net/browse/ED-10207
604
+ }, {
605
+ key: "resetStyling",
606
+ value: function resetStyling() {
607
+ if (this.props.editorView) {
608
+ var _this$props$api2;
609
+ var _this$props$editorVie3 = this.props.editorView,
610
+ state = _this$props$editorVie3.state,
611
+ dispatch = _this$props$editorVie3.dispatch;
612
+ (_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);
613
+ }
614
+ }
601
615
  }, {
602
616
  key: "setDisableScroll",
603
617
  value: function setDisableScroll(disabled) {
@@ -627,10 +641,16 @@ var Toolbar = /*#__PURE__*/function (_Component) {
627
641
  value: function componentDidUpdate(prevProps) {
628
642
  var _this$props;
629
643
  (0, _forceFocus.checkShouldForceFocusAndApply)((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
630
- if (this.props.node !== prevProps.node) {
631
- this.resetStyling({
632
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
633
- });
644
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
645
+ if (this.props.node !== prevProps.node) {
646
+ this.resetStyling();
647
+ }
648
+ } else {
649
+ if (this.props.node !== prevProps.node) {
650
+ this.resetStylingLegacy({
651
+ table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
652
+ });
653
+ }
634
654
  }
635
655
  }
636
656
  }, {
@@ -642,9 +662,13 @@ var Toolbar = /*#__PURE__*/function (_Component) {
642
662
  dispatch = editorView.dispatch;
643
663
  dispatch((0, _forceFocus.forceFocusSelector)(null)(tr));
644
664
  }
645
- this.resetStyling({
646
- table: this.props.node.type.name === 'table'
647
- });
665
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
666
+ this.resetStyling();
667
+ } else {
668
+ this.resetStylingLegacy({
669
+ table: this.props.node.type.name === 'table'
670
+ });
671
+ }
648
672
  }
649
673
  }, {
650
674
  key: "render",
@@ -541,7 +541,7 @@ class Toolbar extends Component {
541
541
  }
542
542
  // remove any decorations added by toolbar buttons i.e danger and selected styling
543
543
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
544
- resetStyling({
544
+ resetStylingLegacy({
545
545
  table
546
546
  }) {
547
547
  if (this.props.editorView) {
@@ -556,6 +556,19 @@ class Toolbar extends Component {
556
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);
557
557
  }
558
558
  }
559
+
560
+ // remove any decorations added by toolbar buttons i.e danger and selected styling
561
+ // this prevents https://product-fabric.atlassian.net/browse/ED-10207
562
+ resetStyling() {
563
+ if (this.props.editorView) {
564
+ var _this$props$api2, _this$props$api2$deco;
565
+ const {
566
+ state,
567
+ dispatch
568
+ } = this.props.editorView;
569
+ (_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);
570
+ }
571
+ }
559
572
  setDisableScroll(disabled) {
560
573
  // wait before setting disabled state incase users jumping from one popup to another
561
574
  if (disabled) {
@@ -578,10 +591,16 @@ class Toolbar extends Component {
578
591
  componentDidUpdate(prevProps) {
579
592
  var _this$props;
580
593
  checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
581
- if (this.props.node !== prevProps.node) {
582
- this.resetStyling({
583
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
584
- });
594
+ if (fg('platform_editor_remove_slow_table_transactions')) {
595
+ if (this.props.node !== prevProps.node) {
596
+ this.resetStyling();
597
+ }
598
+ } else {
599
+ if (this.props.node !== prevProps.node) {
600
+ this.resetStylingLegacy({
601
+ table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
602
+ });
603
+ }
585
604
  }
586
605
  }
587
606
  componentWillUnmount() {
@@ -597,9 +616,13 @@ class Toolbar extends Component {
597
616
  } = editorView;
598
617
  dispatch(forceFocusSelector(null)(tr));
599
618
  }
600
- this.resetStyling({
601
- table: this.props.node.type.name === 'table'
602
- });
619
+ if (fg('platform_editor_remove_slow_table_transactions')) {
620
+ this.resetStyling();
621
+ } else {
622
+ this.resetStylingLegacy({
623
+ table: this.props.node.type.name === 'table'
624
+ });
625
+ }
603
626
  }
604
627
  render() {
605
628
  const {
@@ -577,8 +577,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
577
577
  // this prevents https://product-fabric.atlassian.net/browse/ED-10207
578
578
  _inherits(Toolbar, _Component);
579
579
  return _createClass(Toolbar, [{
580
- key: "resetStyling",
581
- value: function resetStyling(_ref3) {
580
+ key: "resetStylingLegacy",
581
+ value: function resetStylingLegacy(_ref3) {
582
582
  var table = _ref3.table;
583
583
  if (this.props.editorView) {
584
584
  var _this$props$api;
@@ -591,6 +591,20 @@ var Toolbar = /*#__PURE__*/function (_Component) {
591
591
  (_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);
592
592
  }
593
593
  }
594
+
595
+ // remove any decorations added by toolbar buttons i.e danger and selected styling
596
+ // this prevents https://product-fabric.atlassian.net/browse/ED-10207
597
+ }, {
598
+ key: "resetStyling",
599
+ value: function resetStyling() {
600
+ if (this.props.editorView) {
601
+ var _this$props$api2;
602
+ var _this$props$editorVie3 = this.props.editorView,
603
+ state = _this$props$editorVie3.state,
604
+ dispatch = _this$props$editorVie3.dispatch;
605
+ (_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);
606
+ }
607
+ }
594
608
  }, {
595
609
  key: "setDisableScroll",
596
610
  value: function setDisableScroll(disabled) {
@@ -620,10 +634,16 @@ var Toolbar = /*#__PURE__*/function (_Component) {
620
634
  value: function componentDidUpdate(prevProps) {
621
635
  var _this$props;
622
636
  checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
623
- if (this.props.node !== prevProps.node) {
624
- this.resetStyling({
625
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
626
- });
637
+ if (fg('platform_editor_remove_slow_table_transactions')) {
638
+ if (this.props.node !== prevProps.node) {
639
+ this.resetStyling();
640
+ }
641
+ } else {
642
+ if (this.props.node !== prevProps.node) {
643
+ this.resetStylingLegacy({
644
+ table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
645
+ });
646
+ }
627
647
  }
628
648
  }
629
649
  }, {
@@ -635,9 +655,13 @@ var Toolbar = /*#__PURE__*/function (_Component) {
635
655
  dispatch = editorView.dispatch;
636
656
  dispatch(forceFocusSelector(null)(tr));
637
657
  }
638
- this.resetStyling({
639
- table: this.props.node.type.name === 'table'
640
- });
658
+ if (fg('platform_editor_remove_slow_table_transactions')) {
659
+ this.resetStyling();
660
+ } else {
661
+ this.resetStylingLegacy({
662
+ table: this.props.node.type.name === 'table'
663
+ });
664
+ }
641
665
  }
642
666
  }, {
643
667
  key: "render",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "4.1.5",
3
+ "version": "4.1.7",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/adf-utils": "^19.19.0",
29
29
  "@atlaskit/button": "^23.0.0",
30
30
  "@atlaskit/checkbox": "^17.1.0",
31
- "@atlaskit/editor-common": "^105.2.0",
31
+ "@atlaskit/editor-common": "^105.5.0",
32
32
  "@atlaskit/editor-palette": "^2.1.0",
33
33
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
34
34
  "@atlaskit/editor-plugin-context-panel": "^4.1.0",
@@ -44,13 +44,13 @@
44
44
  "@atlaskit/editor-prosemirror": "7.0.0",
45
45
  "@atlaskit/emoji": "^69.2.0",
46
46
  "@atlaskit/icon": "^26.0.0",
47
- "@atlaskit/menu": "^5.0.0",
47
+ "@atlaskit/menu": "^7.0.0",
48
48
  "@atlaskit/modal-dialog": "^14.2.0",
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
50
  "@atlaskit/primitives": "^14.7.0",
51
- "@atlaskit/select": "^20.4.0",
51
+ "@atlaskit/select": "^20.5.0",
52
52
  "@atlaskit/theme": "^18.0.0",
53
- "@atlaskit/tmp-editor-statsig": "^4.21.0",
53
+ "@atlaskit/tmp-editor-statsig": "^4.22.0",
54
54
  "@atlaskit/tokens": "^4.8.0",
55
55
  "@atlaskit/tooltip": "^20.0.0",
56
56
  "@babel/runtime": "^7.0.0",
@@ -137,6 +137,9 @@
137
137
  "platform_editor_no_selection_until_interaction": {
138
138
  "type": "boolean"
139
139
  },
140
+ "platform_editor_remove_slow_table_transactions": {
141
+ "type": "boolean"
142
+ },
140
143
  "platform_editor_user_intent_plugin": {
141
144
  "type": "boolean"
142
145
  },