@atlaskit/editor-plugin-insert-block 2.3.3 → 2.3.5

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,22 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 2.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#153789](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153789)
8
+ [`5062618c0206b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5062618c0206b) -
9
+ fix issue where insert menu would show with right rail when clicking blank page more elements
10
+ button
11
+
12
+ ## 2.3.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [#154004](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154004)
17
+ [`0d7fa2dd04c16`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d7fa2dd04c16) -
18
+ remove button variation from right rail experiment
19
+
3
20
  ## 2.3.3
4
21
 
5
22
  ### Patch Changes
@@ -32,7 +32,7 @@ var BlockInsertElementBrowser = exports.BlockInsertElementBrowser = function Blo
32
32
  "aria-expanded": props.open,
33
33
  "aria-haspopup": true,
34
34
  handleRef: props.onRef,
35
- selected: props.open,
35
+ selected: props.open || props.isActive,
36
36
  disabled: props.disabled,
37
37
  onClick: props.onClick,
38
38
  onKeyDown: props.onKeyDown,
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.BlockInsertMenu = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _hooks = require("@atlaskit/editor-common/hooks");
9
10
  var _blockInsertElementBrowser = require("./block-insert-element-browser");
10
11
  var _dropdownButton = require("./dropdown-button");
11
12
  var BlockInsertMenu = exports.BlockInsertMenu = function BlockInsertMenu(props) {
13
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(props.pluginInjectionApi, ['insertBlock']),
14
+ insertBlockState = _useSharedPluginState.insertBlockState;
15
+ var isActive = (insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen) || false;
12
16
  if (props.items.length === 0) {
13
17
  return null;
14
18
  }
@@ -44,6 +48,7 @@ var BlockInsertMenu = exports.BlockInsertMenu = function BlockInsertMenu(props)
44
48
  togglePlusMenuVisibility: props.togglePlusMenuVisibility,
45
49
  showElementBrowserLink: props.showElementBrowserLink,
46
50
  pluginInjectionApi: props.pluginInjectionApi,
47
- isFullPageAppearance: props.isFullPageAppearance
51
+ isFullPageAppearance: props.isFullPageAppearance,
52
+ isActive: isActive
48
53
  });
49
54
  };
@@ -28,7 +28,6 @@ var _picker = require("@atlaskit/emoji/picker");
28
28
  var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
29
29
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
30
30
  var _commands = require("../../pm-plugins/commands");
31
- var _MainToolBarIcon = require("../ElementRail/MainToolBarIcon");
32
31
  var _blockInsertMenu = require("./block-insert-menu");
33
32
  var _createItems3 = require("./create-items");
34
33
  var _messages = require("./messages");
@@ -671,7 +670,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
671
670
  _tableSelectorButton5,
672
671
  _tableSelectorButton6,
673
672
  _this$props$isDisable,
674
- _this$props$isDisable2,
675
673
  _this$props$pluginInj3;
676
674
  var _this$state2 = this.state,
677
675
  buttons = _this$state2.buttons,
@@ -780,19 +778,15 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
780
778
  onKeyDown: this.handleTableSelectorOpenByKeyboard
781
779
  })), (0, _react2.jsx)("span", {
782
780
  css: _styles.wrapperStyle
783
- }, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true) ? (0, _react2.jsx)(_MainToolBarIcon.RightRailIcon, {
784
- onClick: this.handleClick,
785
- isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
786
- api: this.props.pluginInjectionApi
787
- }) : (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
781
+ }, this.renderPopup(), this.renderTableSelectorPopup(), (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
788
782
  popupsMountPoint: this.props.popupsMountPoint,
789
783
  popupsBoundariesElement: this.props.popupsBoundariesElement,
790
784
  popupsScrollableElement: this.props.popupsScrollableElement,
791
- disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
785
+ disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
792
786
  editorView: this.props.editorView,
793
787
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
794
788
  label: this.props.intl.formatMessage(_messages.messages.insertMenu),
795
- open: this.state.isPlusMenuOpen,
789
+ open: this.state.isPlusMenuOpen && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', false),
796
790
  plusButtonRef: this.plusButtonRef,
797
791
  items: this.state.dropdownItems,
798
792
  onRef: this.handleDropDownButtonRef,
@@ -25,7 +25,7 @@ export const BlockInsertElementBrowser = props => {
25
25
  "aria-expanded": props.open,
26
26
  "aria-haspopup": true,
27
27
  handleRef: props.onRef,
28
- selected: props.open,
28
+ selected: props.open || props.isActive,
29
29
  disabled: props.disabled,
30
30
  onClick: props.onClick,
31
31
  onKeyDown: props.onKeyDown,
@@ -1,7 +1,12 @@
1
1
  import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
2
3
  import { BlockInsertElementBrowser } from './block-insert-element-browser';
3
4
  import { DropDownButton } from './dropdown-button';
4
5
  export const BlockInsertMenu = props => {
6
+ const {
7
+ insertBlockState
8
+ } = useSharedPluginState(props.pluginInjectionApi, ['insertBlock']);
9
+ const isActive = (insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen) || false;
5
10
  if (props.items.length === 0) {
6
11
  return null;
7
12
  }
@@ -37,6 +42,7 @@ export const BlockInsertMenu = props => {
37
42
  togglePlusMenuVisibility: props.togglePlusMenuVisibility,
38
43
  showElementBrowserLink: props.showElementBrowserLink,
39
44
  pluginInjectionApi: props.pluginInjectionApi,
40
- isFullPageAppearance: props.isFullPageAppearance
45
+ isFullPageAppearance: props.isFullPageAppearance,
46
+ isActive: isActive
41
47
  });
42
48
  };
@@ -18,7 +18,6 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
18
18
  import * as colors from '@atlaskit/theme/colors';
19
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
20
20
  import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
21
- import { RightRailIcon } from '../ElementRail/MainToolBarIcon';
22
21
  import { BlockInsertMenu } from './block-insert-menu';
23
22
  import { createItems } from './create-items';
24
23
  import { messages } from './messages';
@@ -714,7 +713,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
714
713
  });
715
714
  }
716
715
  render() {
717
- var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$isDisable2, _this$props$pluginInj7;
716
+ var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$pluginInj7;
718
717
  const {
719
718
  buttons,
720
719
  dropdownItems,
@@ -813,19 +812,15 @@ export class ToolbarInsertBlock extends React.PureComponent {
813
812
  onKeyDown: this.handleTableSelectorOpenByKeyboard
814
813
  })), jsx("span", {
815
814
  css: wrapperStyle
816
- }, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true) ? jsx(RightRailIcon, {
817
- onClick: this.handleClick,
818
- isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
819
- api: this.props.pluginInjectionApi
820
- }) : jsx(BlockInsertMenu, {
815
+ }, this.renderPopup(), this.renderTableSelectorPopup(), jsx(BlockInsertMenu, {
821
816
  popupsMountPoint: this.props.popupsMountPoint,
822
817
  popupsBoundariesElement: this.props.popupsBoundariesElement,
823
818
  popupsScrollableElement: this.props.popupsScrollableElement,
824
- disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
819
+ disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
825
820
  editorView: this.props.editorView,
826
821
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
827
822
  label: this.props.intl.formatMessage(messages.insertMenu),
828
- open: this.state.isPlusMenuOpen,
823
+ open: this.state.isPlusMenuOpen && editorExperiment('insert-menu-in-right-rail', false),
829
824
  plusButtonRef: this.plusButtonRef,
830
825
  items: this.state.dropdownItems,
831
826
  onRef: this.handleDropDownButtonRef,
@@ -25,7 +25,7 @@ export var BlockInsertElementBrowser = function BlockInsertElementBrowser(props)
25
25
  "aria-expanded": props.open,
26
26
  "aria-haspopup": true,
27
27
  handleRef: props.onRef,
28
- selected: props.open,
28
+ selected: props.open || props.isActive,
29
29
  disabled: props.disabled,
30
30
  onClick: props.onClick,
31
31
  onKeyDown: props.onKeyDown,
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
2
3
  import { BlockInsertElementBrowser } from './block-insert-element-browser';
3
4
  import { DropDownButton } from './dropdown-button';
4
5
  export var BlockInsertMenu = function BlockInsertMenu(props) {
6
+ var _useSharedPluginState = useSharedPluginState(props.pluginInjectionApi, ['insertBlock']),
7
+ insertBlockState = _useSharedPluginState.insertBlockState;
8
+ var isActive = (insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen) || false;
5
9
  if (props.items.length === 0) {
6
10
  return null;
7
11
  }
@@ -37,6 +41,7 @@ export var BlockInsertMenu = function BlockInsertMenu(props) {
37
41
  togglePlusMenuVisibility: props.togglePlusMenuVisibility,
38
42
  showElementBrowserLink: props.showElementBrowserLink,
39
43
  pluginInjectionApi: props.pluginInjectionApi,
40
- isFullPageAppearance: props.isFullPageAppearance
44
+ isFullPageAppearance: props.isFullPageAppearance,
45
+ isActive: isActive
41
46
  });
42
47
  };
@@ -34,7 +34,6 @@ import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
34
34
  import * as colors from '@atlaskit/theme/colors';
35
35
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
36
36
  import { toggleInsertMenuRightRail } from '../../pm-plugins/commands';
37
- import { RightRailIcon } from '../ElementRail/MainToolBarIcon';
38
37
  import { BlockInsertMenu } from './block-insert-menu';
39
38
  import { createItems } from './create-items';
40
39
  import { messages } from './messages';
@@ -662,7 +661,6 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
662
661
  _tableSelectorButton5,
663
662
  _tableSelectorButton6,
664
663
  _this$props$isDisable,
665
- _this$props$isDisable2,
666
664
  _this$props$pluginInj3;
667
665
  var _this$state2 = this.state,
668
666
  buttons = _this$state2.buttons,
@@ -771,19 +769,15 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
771
769
  onKeyDown: this.handleTableSelectorOpenByKeyboard
772
770
  })), jsx("span", {
773
771
  css: wrapperStyle
774
- }, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true) ? jsx(RightRailIcon, {
775
- onClick: this.handleClick,
776
- isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
777
- api: this.props.pluginInjectionApi
778
- }) : jsx(BlockInsertMenu, {
772
+ }, this.renderPopup(), this.renderTableSelectorPopup(), jsx(BlockInsertMenu, {
779
773
  popupsMountPoint: this.props.popupsMountPoint,
780
774
  popupsBoundariesElement: this.props.popupsBoundariesElement,
781
775
  popupsScrollableElement: this.props.popupsScrollableElement,
782
- disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
776
+ disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
783
777
  editorView: this.props.editorView,
784
778
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
785
779
  label: this.props.intl.formatMessage(messages.insertMenu),
786
- open: this.state.isPlusMenuOpen,
780
+ open: this.state.isPlusMenuOpen && editorExperiment('insert-menu-in-right-rail', false),
787
781
  plusButtonRef: this.plusButtonRef,
788
782
  items: this.state.dropdownItems,
789
783
  onRef: this.handleDropDownButtonRef,
@@ -24,6 +24,7 @@ export interface BlockInsertElementBrowserProps {
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
26
  isFullPageAppearance?: boolean;
27
+ isActive: boolean;
27
28
  }
28
29
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => JSX.Element;
29
30
  export {};
@@ -24,6 +24,7 @@ export interface BlockInsertElementBrowserProps {
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
26
  isFullPageAppearance?: boolean;
27
+ isActive: boolean;
27
28
  }
28
29
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => JSX.Element;
29
30
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.RightRailIcon = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _reactIntlNext = require("react-intl-next");
10
- var _hooks = require("@atlaskit/editor-common/hooks");
11
- var _keymaps = require("@atlaskit/editor-common/keymaps");
12
- var _messages = require("@atlaskit/editor-common/messages");
13
- var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/add"));
14
- var _primitives = require("@atlaskit/primitives");
15
- var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
16
- var wrapperStyles = (0, _primitives.xcss)({
17
- width: '32px',
18
- height: '32px',
19
- display: 'flex',
20
- flexDirection: 'column',
21
- justifyContent: 'center',
22
- alignItems: 'center'
23
- });
24
- var buttonStyles = (0, _primitives.xcss)({
25
- boxSizing: 'border-box',
26
- display: 'flex',
27
- flexDirection: 'column',
28
- justifyContent: 'center',
29
- alignItems: 'center',
30
- height: "var(--ds-space-300, 24px)",
31
- width: "var(--ds-space-300, 24px)",
32
- border: 'none',
33
- backgroundColor: 'color.background.neutral.subtle',
34
- borderRadius: 'border.radius.circle',
35
- color: 'color.text',
36
- zIndex: 'card',
37
- outline: 'none',
38
- ':hover': {
39
- backgroundColor: 'color.background.neutral.hovered'
40
- },
41
- ':active': {
42
- backgroundColor: 'color.background.neutral.pressed'
43
- },
44
- ':focus': {
45
- outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
46
- }
47
- });
48
- var disabledStyles = (0, _primitives.xcss)({
49
- color: 'color.text.disabled',
50
- backgroundColor: 'color.background.neutral.subtle',
51
- ':hover': {
52
- backgroundColor: 'color.background.neutral.subtle'
53
- },
54
- ':active': {
55
- backgroundColor: 'color.background.neutral.subtle'
56
- }
57
- });
58
- var activeStyles = (0, _primitives.xcss)({
59
- backgroundColor: 'color.background.selected',
60
- color: 'color.text.selected',
61
- ':hover': {
62
- backgroundColor: 'color.background.selected',
63
- color: 'color.text.selected'
64
- }
65
- });
66
- var RightRailIcon = exports.RightRailIcon = function RightRailIcon(_ref) {
67
- var onClick = _ref.onClick,
68
- isDisabled = _ref.isDisabled,
69
- api = _ref.api;
70
- var _useIntl = (0, _reactIntlNext.useIntl)(),
71
- formatMessage = _useIntl.formatMessage;
72
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['insertBlock']),
73
- insertBlockState = _useSharedPluginState.insertBlockState;
74
- var isOpen = insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen;
75
- return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
76
- xcss: [wrapperStyles]
77
- }, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
78
- content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent
79
- // Re-using insertRightRailTitle for tooltip, both messages are the same
80
- , {
81
- description: formatMessage(_messages.toolbarInsertBlockMessages.insertRightRailTitle),
82
- shortcutOverride: "/"
83
- })
84
- }, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
85
- type: "button",
86
- "aria-label": formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
87
- xcss: [buttonStyles, isDisabled ? disabledStyles : undefined, isOpen ? activeStyles : undefined],
88
- onClick: onClick,
89
- isDisabled: isDisabled
90
- }, /*#__PURE__*/_react.default.createElement(_add.default, {
91
- label: formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
92
- size: "medium"
93
- }))));
94
- };
@@ -1,90 +0,0 @@
1
- import React from 'react';
2
- import { useIntl } from 'react-intl-next';
3
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
- import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
5
- import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
6
- import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
7
- import { Box, Pressable, xcss } from '@atlaskit/primitives';
8
- import Tooltip from '@atlaskit/tooltip';
9
- const wrapperStyles = xcss({
10
- width: '32px',
11
- height: '32px',
12
- display: 'flex',
13
- flexDirection: 'column',
14
- justifyContent: 'center',
15
- alignItems: 'center'
16
- });
17
- const buttonStyles = xcss({
18
- boxSizing: 'border-box',
19
- display: 'flex',
20
- flexDirection: 'column',
21
- justifyContent: 'center',
22
- alignItems: 'center',
23
- height: "var(--ds-space-300, 24px)",
24
- width: "var(--ds-space-300, 24px)",
25
- border: 'none',
26
- backgroundColor: 'color.background.neutral.subtle',
27
- borderRadius: 'border.radius.circle',
28
- color: 'color.text',
29
- zIndex: 'card',
30
- outline: 'none',
31
- ':hover': {
32
- backgroundColor: 'color.background.neutral.hovered'
33
- },
34
- ':active': {
35
- backgroundColor: 'color.background.neutral.pressed'
36
- },
37
- ':focus': {
38
- outline: `2px solid ${"var(--ds-border-focused, #388BFF)"}`
39
- }
40
- });
41
- const disabledStyles = xcss({
42
- color: 'color.text.disabled',
43
- backgroundColor: 'color.background.neutral.subtle',
44
- ':hover': {
45
- backgroundColor: 'color.background.neutral.subtle'
46
- },
47
- ':active': {
48
- backgroundColor: 'color.background.neutral.subtle'
49
- }
50
- });
51
- const activeStyles = xcss({
52
- backgroundColor: 'color.background.selected',
53
- color: 'color.text.selected',
54
- ':hover': {
55
- backgroundColor: 'color.background.selected',
56
- color: 'color.text.selected'
57
- }
58
- });
59
- export const RightRailIcon = ({
60
- onClick,
61
- isDisabled,
62
- api
63
- }) => {
64
- const {
65
- formatMessage
66
- } = useIntl();
67
- const {
68
- insertBlockState
69
- } = useSharedPluginState(api, ['insertBlock']);
70
- const isOpen = insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen;
71
- return /*#__PURE__*/React.createElement(Box, {
72
- xcss: [wrapperStyles]
73
- }, /*#__PURE__*/React.createElement(Tooltip, {
74
- content: /*#__PURE__*/React.createElement(ToolTipContent
75
- // Re-using insertRightRailTitle for tooltip, both messages are the same
76
- , {
77
- description: formatMessage(toolbarInsertBlockMessages.insertRightRailTitle),
78
- shortcutOverride: "/"
79
- })
80
- }, /*#__PURE__*/React.createElement(Pressable, {
81
- type: "button",
82
- "aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
83
- xcss: [buttonStyles, isDisabled ? disabledStyles : undefined, isOpen ? activeStyles : undefined],
84
- onClick: onClick,
85
- isDisabled: isDisabled
86
- }, /*#__PURE__*/React.createElement(EditorAddIcon, {
87
- label: formatMessage(toolbarInsertBlockMessages.insertMenu),
88
- size: "medium"
89
- }))));
90
- };
@@ -1,87 +0,0 @@
1
- import React from 'react';
2
- import { useIntl } from 'react-intl-next';
3
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
- import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
5
- import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
6
- import EditorAddIcon from '@atlaskit/icon/glyph/editor/add';
7
- import { Box, Pressable, xcss } from '@atlaskit/primitives';
8
- import Tooltip from '@atlaskit/tooltip';
9
- var wrapperStyles = xcss({
10
- width: '32px',
11
- height: '32px',
12
- display: 'flex',
13
- flexDirection: 'column',
14
- justifyContent: 'center',
15
- alignItems: 'center'
16
- });
17
- var buttonStyles = xcss({
18
- boxSizing: 'border-box',
19
- display: 'flex',
20
- flexDirection: 'column',
21
- justifyContent: 'center',
22
- alignItems: 'center',
23
- height: "var(--ds-space-300, 24px)",
24
- width: "var(--ds-space-300, 24px)",
25
- border: 'none',
26
- backgroundColor: 'color.background.neutral.subtle',
27
- borderRadius: 'border.radius.circle',
28
- color: 'color.text',
29
- zIndex: 'card',
30
- outline: 'none',
31
- ':hover': {
32
- backgroundColor: 'color.background.neutral.hovered'
33
- },
34
- ':active': {
35
- backgroundColor: 'color.background.neutral.pressed'
36
- },
37
- ':focus': {
38
- outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
39
- }
40
- });
41
- var disabledStyles = xcss({
42
- color: 'color.text.disabled',
43
- backgroundColor: 'color.background.neutral.subtle',
44
- ':hover': {
45
- backgroundColor: 'color.background.neutral.subtle'
46
- },
47
- ':active': {
48
- backgroundColor: 'color.background.neutral.subtle'
49
- }
50
- });
51
- var activeStyles = xcss({
52
- backgroundColor: 'color.background.selected',
53
- color: 'color.text.selected',
54
- ':hover': {
55
- backgroundColor: 'color.background.selected',
56
- color: 'color.text.selected'
57
- }
58
- });
59
- export var RightRailIcon = function RightRailIcon(_ref) {
60
- var onClick = _ref.onClick,
61
- isDisabled = _ref.isDisabled,
62
- api = _ref.api;
63
- var _useIntl = useIntl(),
64
- formatMessage = _useIntl.formatMessage;
65
- var _useSharedPluginState = useSharedPluginState(api, ['insertBlock']),
66
- insertBlockState = _useSharedPluginState.insertBlockState;
67
- var isOpen = insertBlockState === null || insertBlockState === void 0 ? void 0 : insertBlockState.menuBrowserOpen;
68
- return /*#__PURE__*/React.createElement(Box, {
69
- xcss: [wrapperStyles]
70
- }, /*#__PURE__*/React.createElement(Tooltip, {
71
- content: /*#__PURE__*/React.createElement(ToolTipContent
72
- // Re-using insertRightRailTitle for tooltip, both messages are the same
73
- , {
74
- description: formatMessage(toolbarInsertBlockMessages.insertRightRailTitle),
75
- shortcutOverride: "/"
76
- })
77
- }, /*#__PURE__*/React.createElement(Pressable, {
78
- type: "button",
79
- "aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
80
- xcss: [buttonStyles, isDisabled ? disabledStyles : undefined, isOpen ? activeStyles : undefined],
81
- onClick: onClick,
82
- isDisabled: isDisabled
83
- }, /*#__PURE__*/React.createElement(EditorAddIcon, {
84
- label: formatMessage(toolbarInsertBlockMessages.insertMenu),
85
- size: "medium"
86
- }))));
87
- };
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { type InsertBlockPlugin } from '../../plugin';
4
- type Props = {
5
- onClick: () => void;
6
- isDisabled: boolean;
7
- api?: ExtractInjectionAPI<InsertBlockPlugin>;
8
- };
9
- export declare const RightRailIcon: ({ onClick, isDisabled, api }: Props) => JSX.Element;
10
- export {};
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import { type InsertBlockPlugin } from '../../plugin';
4
- type Props = {
5
- onClick: () => void;
6
- isDisabled: boolean;
7
- api?: ExtractInjectionAPI<InsertBlockPlugin>;
8
- };
9
- export declare const RightRailIcon: ({ onClick, isDisabled, api }: Props) => JSX.Element;
10
- export {};