@atlaskit/editor-plugin-insert-block 1.2.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#92968](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92968) [`f33e18f5cfa8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f33e18f5cfa8) - [ux] [ED-22585] - Made sure that table buttons do not render if they are not visible
8
+ - Updated dependencies
9
+
10
+ ## 1.2.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#94316](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/94316) [`35fd5ed8e1d7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/35fd5ed8e1d7) - Upgrading internal dependency `bind-event-listener` to `@^3.0.0`
15
+
3
16
  ## 1.2.0
4
17
 
5
18
  ### Minor Changes
@@ -604,6 +604,14 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
604
604
  var _this$props14 = this.props,
605
605
  isDisabled = _this$props14.isDisabled,
606
606
  isReducedSpacing = _this$props14.isReducedSpacing;
607
+ var isTableButtonVisible = buttons.some(function (_ref6) {
608
+ var value = _ref6.value;
609
+ return value.name === 'table';
610
+ });
611
+ var isTableSizeVisible = buttons.some(function (_ref7) {
612
+ var value = _ref7.value;
613
+ return value.name === 'table selector';
614
+ });
607
615
  if (buttons.length === 0 && dropdownItems.length === 0) {
608
616
  return null;
609
617
  }
@@ -650,13 +658,13 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
650
658
  "aria-keyshortcuts": btn['aria-keyshortcuts'],
651
659
  onItemClick: _this3.insertToolbarMenuItem
652
660
  });
653
- }), this.props.tableSelectorSupported && (0, _react2.jsx)("div", {
661
+ }), this.props.tableSelectorSupported && (isTableButtonVisible || isTableSizeVisible) && (0, _react2.jsx)("div", {
654
662
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
655
663
  css: tableButtonWrapper({
656
664
  isTableSelectorOpen: isTableSelectorOpen,
657
665
  isButtonDisabled: (_tableButton = tableButton) === null || _tableButton === void 0 ? void 0 : _tableButton.isDisabled
658
666
  })
659
- }, (0, _react2.jsx)(_uiMenu.ToolbarButton, {
667
+ }, isTableButtonVisible && (0, _react2.jsx)(_uiMenu.ToolbarButton, {
660
668
  className: "table-toolbar-btn",
661
669
  item: tableButton,
662
670
  ref: this.tableButtonRef,
@@ -671,7 +679,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
671
679
  "aria-haspopup": tableButton ? tableButton['aria-haspopup'] : undefined,
672
680
  "aria-keyshortcuts": tableButton ? tableButton['aria-keyshortcuts'] : undefined,
673
681
  onItemClick: this.insertToolbarMenuItem
674
- }), (0, _react2.jsx)(_uiMenu.ToolbarButton, {
682
+ }), isTableButtonVisible && (0, _react2.jsx)(_uiMenu.ToolbarButton, {
675
683
  className: "table-selector-toolbar-btn",
676
684
  item: tableSelectorButton,
677
685
  testId: String((_tableSelectorButton = tableSelectorButton) === null || _tableSelectorButton === void 0 ? void 0 : _tableSelectorButton.content),
@@ -645,6 +645,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
645
645
  isDisabled,
646
646
  isReducedSpacing
647
647
  } = this.props;
648
+ const isTableButtonVisible = buttons.some(({
649
+ value
650
+ }) => value.name === 'table');
651
+ const isTableSizeVisible = buttons.some(({
652
+ value
653
+ }) => value.name === 'table selector');
648
654
  if (buttons.length === 0 && dropdownItems.length === 0) {
649
655
  return null;
650
656
  }
@@ -682,13 +688,13 @@ export class ToolbarInsertBlock extends React.PureComponent {
682
688
  "aria-keyshortcuts": btn['aria-keyshortcuts'],
683
689
  onItemClick: this.insertToolbarMenuItem
684
690
  });
685
- }), this.props.tableSelectorSupported && jsx("div", {
691
+ }), this.props.tableSelectorSupported && (isTableButtonVisible || isTableSizeVisible) && jsx("div", {
686
692
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
687
693
  css: tableButtonWrapper({
688
694
  isTableSelectorOpen,
689
695
  isButtonDisabled: (_tableButton = tableButton) === null || _tableButton === void 0 ? void 0 : _tableButton.isDisabled
690
696
  })
691
- }, jsx(ToolbarButton, {
697
+ }, isTableButtonVisible && jsx(ToolbarButton, {
692
698
  className: "table-toolbar-btn",
693
699
  item: tableButton,
694
700
  ref: this.tableButtonRef,
@@ -703,7 +709,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
703
709
  "aria-haspopup": tableButton ? tableButton['aria-haspopup'] : undefined,
704
710
  "aria-keyshortcuts": tableButton ? tableButton['aria-keyshortcuts'] : undefined,
705
711
  onItemClick: this.insertToolbarMenuItem
706
- }), jsx(ToolbarButton, {
712
+ }), isTableButtonVisible && jsx(ToolbarButton, {
707
713
  className: "table-selector-toolbar-btn",
708
714
  item: tableSelectorButton,
709
715
  testId: String((_tableSelectorButton = tableSelectorButton) === null || _tableSelectorButton === void 0 ? void 0 : _tableSelectorButton.content),
@@ -594,6 +594,14 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
594
594
  var _this$props14 = this.props,
595
595
  isDisabled = _this$props14.isDisabled,
596
596
  isReducedSpacing = _this$props14.isReducedSpacing;
597
+ var isTableButtonVisible = buttons.some(function (_ref6) {
598
+ var value = _ref6.value;
599
+ return value.name === 'table';
600
+ });
601
+ var isTableSizeVisible = buttons.some(function (_ref7) {
602
+ var value = _ref7.value;
603
+ return value.name === 'table selector';
604
+ });
597
605
  if (buttons.length === 0 && dropdownItems.length === 0) {
598
606
  return null;
599
607
  }
@@ -640,13 +648,13 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
640
648
  "aria-keyshortcuts": btn['aria-keyshortcuts'],
641
649
  onItemClick: _this3.insertToolbarMenuItem
642
650
  });
643
- }), this.props.tableSelectorSupported && jsx("div", {
651
+ }), this.props.tableSelectorSupported && (isTableButtonVisible || isTableSizeVisible) && jsx("div", {
644
652
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
645
653
  css: tableButtonWrapper({
646
654
  isTableSelectorOpen: isTableSelectorOpen,
647
655
  isButtonDisabled: (_tableButton = tableButton) === null || _tableButton === void 0 ? void 0 : _tableButton.isDisabled
648
656
  })
649
- }, jsx(ToolbarButton, {
657
+ }, isTableButtonVisible && jsx(ToolbarButton, {
650
658
  className: "table-toolbar-btn",
651
659
  item: tableButton,
652
660
  ref: this.tableButtonRef,
@@ -661,7 +669,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
661
669
  "aria-haspopup": tableButton ? tableButton['aria-haspopup'] : undefined,
662
670
  "aria-keyshortcuts": tableButton ? tableButton['aria-keyshortcuts'] : undefined,
663
671
  onItemClick: this.insertToolbarMenuItem
664
- }), jsx(ToolbarButton, {
672
+ }), isTableButtonVisible && jsx(ToolbarButton, {
665
673
  className: "table-selector-toolbar-btn",
666
674
  item: tableSelectorButton,
667
675
  testId: String((_tableSelectorButton = tableSelectorButton) === null || _tableSelectorButton === void 0 ? void 0 : _tableSelectorButton.content),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^78.31.0",
36
+ "@atlaskit/editor-common": "^78.33.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-block-type": "^3.1.0",
39
39
  "@atlaskit/editor-plugin-code-block": "^1.2.0",
@@ -51,19 +51,19 @@
51
51
  "@atlaskit/editor-plugin-quick-insert": "^1.1.0",
52
52
  "@atlaskit/editor-plugin-rule": "^1.2.0",
53
53
  "@atlaskit/editor-plugin-status": "^1.1.0",
54
- "@atlaskit/editor-plugin-table": "^7.8.0",
54
+ "@atlaskit/editor-plugin-table": "^7.10.0",
55
55
  "@atlaskit/editor-plugin-tasks-and-decisions": "^1.1.0",
56
56
  "@atlaskit/editor-plugin-type-ahead": "^1.1.0",
57
57
  "@atlaskit/editor-prosemirror": "4.0.0",
58
- "@atlaskit/editor-shared-styles": "^2.9.0",
58
+ "@atlaskit/editor-shared-styles": "^2.10.0",
59
59
  "@atlaskit/emoji": "^67.6.0",
60
60
  "@atlaskit/icon": "^22.1.0",
61
- "@atlaskit/primitives": "^5.5.0",
61
+ "@atlaskit/primitives": "^5.6.0",
62
62
  "@atlaskit/theme": "^12.7.0",
63
- "@atlaskit/tokens": "^1.43.0",
63
+ "@atlaskit/tokens": "^1.44.0",
64
64
  "@babel/runtime": "^7.0.0",
65
65
  "@emotion/react": "^11.7.1",
66
- "bind-event-listener": "^2.1.1",
66
+ "bind-event-listener": "^3.0.0",
67
67
  "lodash": "^4.17.21",
68
68
  "memoize-one": "^6.0.0"
69
69
  },