@atlaskit/editor-plugin-insert-block 1.3.3 → 1.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/.eslintrc.js CHANGED
@@ -1,26 +1,26 @@
1
1
  module.exports = {
2
- rules: {
3
- '@typescript-eslint/no-duplicate-imports': 'error',
4
- '@typescript-eslint/no-explicit-any': 'error',
5
- '@typescript-eslint/ban-types': [
6
- 'error',
7
- {
8
- types: {
9
- 'React.FC':
10
- 'Please use types directly on props instead, and explicitly define children if required',
11
- 'React.FunctionalComponent':
12
- 'Please use types directly on props instead, and explicitly define children if required',
13
- },
14
- extendDefaults: false,
15
- },
16
- ],
17
- },
18
- overrides: [
19
- {
20
- files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
21
- rules: {
22
- '@typescript-eslint/no-explicit-any': 'off',
23
- },
24
- },
25
- ],
2
+ rules: {
3
+ '@typescript-eslint/no-duplicate-imports': 'error',
4
+ '@typescript-eslint/no-explicit-any': 'error',
5
+ '@typescript-eslint/ban-types': [
6
+ 'error',
7
+ {
8
+ types: {
9
+ 'React.FC':
10
+ 'Please use types directly on props instead, and explicitly define children if required',
11
+ 'React.FunctionalComponent':
12
+ 'Please use types directly on props instead, and explicitly define children if required',
13
+ },
14
+ extendDefaults: false,
15
+ },
16
+ ],
17
+ },
18
+ overrides: [
19
+ {
20
+ files: ['**/__tests__/**/*.{js,ts,tsx}', '**/examples/**/*.{js,ts,tsx}'],
21
+ rules: {
22
+ '@typescript-eslint/no-explicit-any': 'off',
23
+ },
24
+ },
25
+ ],
26
26
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 1.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.3.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#107314](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107314)
14
+ [`799512a15da6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/799512a15da6) -
15
+ [ED-23568] Rerendering the primary toolbar component caused the insert block toggle to stop
16
+ working, fixed the lifecycle methods on that component to be able to deal with a rerender
17
+
3
18
  ## 1.3.3
4
19
 
5
20
  ### Patch Changes
package/LICENSE.md CHANGED
@@ -1,13 +1,11 @@
1
1
  Copyright 2023 Atlassian Pty Ltd
2
2
 
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
4
+ compliance with the License. You may obtain a copy of the License at
6
5
 
7
6
  http://www.apache.org/licenses/LICENSE-2.0
8
7
 
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.
8
+ Unless required by applicable law or agreed to in writing, software distributed under the License is
9
+ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
10
+ implied. See the License for the specific language governing permissions and limitations under the
11
+ License.
@@ -60,19 +60,23 @@ var tableButtonWrapper = exports.tableButtonWrapper = function tableButtonWrappe
60
60
  var isTableSelectorOpen = _ref.isTableSelectorOpen,
61
61
  isButtonDisabled = _ref.isButtonDisabled;
62
62
  return (// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation due to mixins
63
- (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n ", "\n ", "\n\n .table-toolbar-btn {\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n margin-right: ", ";\n padding: ", ";\n & > span {\n min-width: 16px;\n margin: ", ";\n }\n }\n .table-selector-toolbar-btn {\n padding: ", ";\n & > span {\n margin: ", ";\n width: 16px !important;\n display: flex;\n justify-content: center;\n }\n\n border-top-left-radius: ", " !important;\n border-bottom-left-radius: ", " !important;\n }\n "])), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn'), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn'), "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-space-025, 1px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)")
63
+ (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t\tdisplay: flex;\n\t\t", "\n\t\t", "\n\n .table-toolbar-btn {\n\t\t\tborder-top-right-radius: ", ";\n\t\t\tborder-bottom-right-radius: ", ";\n\t\t\tmargin-right: ", ";\n\t\t\tpadding: ", ";\n\t\t\t& > span {\n\t\t\t\tmin-width: 16px;\n\t\t\t\tmargin: ", ";\n\t\t\t}\n\t\t}\n\t\t.table-selector-toolbar-btn {\n\t\t\tpadding: ", ";\n\t\t\t& > span {\n\t\t\t\tmargin: ", ";\n\t\t\t\twidth: 16px !important;\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t}\n\n\t\t\tborder-top-left-radius: ", " !important;\n\t\t\tborder-bottom-left-radius: ", " !important;\n\t\t}\n\t"])), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn'), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn'), "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-space-025, 1px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)")
64
64
  );
65
65
  };
66
66
  // eslint-disable-next-line @repo/internal/react/no-class-components
67
67
  var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
68
68
  (0, _inherits2.default)(ToolbarInsertBlock, _React$PureComponent);
69
69
  var _super = _createSuper(ToolbarInsertBlock);
70
- function ToolbarInsertBlock(props) {
70
+ function ToolbarInsertBlock() {
71
71
  var _this;
72
72
  (0, _classCallCheck2.default)(this, ToolbarInsertBlock);
73
- _this = _super.call(this, props);
73
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
74
+ args[_key] = arguments[_key];
75
+ }
76
+ _this = _super.call.apply(_super, [this].concat(args));
74
77
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableButtonRef", /*#__PURE__*/_react.default.createRef());
75
78
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableSelectorButtonRef", /*#__PURE__*/_react.default.createRef());
79
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unregisterToggleDropdownMenuOptions", null);
76
80
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
77
81
  isPlusMenuOpen: false,
78
82
  emojiPickerOpen: false,
@@ -198,10 +202,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
198
202
  _this.toggleTableSelector(_analytics.INPUT_METHOD.TOOLBAR);
199
203
  }
200
204
  });
205
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentDidMount", function () {
206
+ _this.unregisterToggleDropdownMenuOptions = _this.props.registerToggleDropdownMenuOptions ? _this.props.registerToggleDropdownMenuOptions(_this.handleClick) : null;
207
+ });
201
208
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillUnmount", function () {
202
- if (_this.unresgisterToggleDropdownMenuOptions) {
203
- _this.unresgisterToggleDropdownMenuOptions();
204
- }
209
+ var _this$unregisterToggl, _this2;
210
+ (_this$unregisterToggl = (_this2 = _this).unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 || _this$unregisterToggl.call(_this2);
205
211
  });
206
212
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
207
213
  _this.togglePlusMenuVisibility();
@@ -477,8 +483,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
477
483
  inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
478
484
  });
479
485
  });
480
- var registerToggleDropdownMenuOptions = props.registerToggleDropdownMenuOptions;
481
- _this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(_this.handleClick) : null;
482
486
  return _this;
483
487
  }
484
488
  (0, _createClass2.default)(ToolbarInsertBlock, [{
@@ -511,7 +515,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
511
515
  }, {
512
516
  key: "renderPopup",
513
517
  value: function renderPopup() {
514
- var _this2 = this;
518
+ var _this3 = this;
515
519
  var emojiPickerOpen = this.state.emojiPickerOpen;
516
520
  var _this$props12 = this.props,
517
521
  popupsMountPoint = _this$props12.popupsMountPoint,
@@ -529,8 +533,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
529
533
  return null;
530
534
  }
531
535
  var onUnmount = function onUnmount() {
532
- var _this2$props$pluginIn;
533
- return (_this2$props$pluginIn = _this2.props.pluginInjectionApi) === null || _this2$props$pluginIn === void 0 || (_this2$props$pluginIn = _this2$props$pluginIn.core) === null || _this2$props$pluginIn === void 0 || (_this2$props$pluginIn = _this2$props$pluginIn.actions) === null || _this2$props$pluginIn === void 0 ? void 0 : _this2$props$pluginIn.focus();
536
+ var _this3$props$pluginIn;
537
+ return (_this3$props$pluginIn = _this3.props.pluginInjectionApi) === null || _this3$props$pluginIn === void 0 || (_this3$props$pluginIn = _this3$props$pluginIn.core) === null || _this3$props$pluginIn === void 0 || (_this3$props$pluginIn = _this3$props$pluginIn.actions) === null || _this3$props$pluginIn === void 0 ? void 0 : _this3$props$pluginIn.focus();
534
538
  };
535
539
  return (0, _react2.jsx)(_ui.Popup, {
536
540
  target: ref,
@@ -591,7 +595,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
591
595
  }, {
592
596
  key: "render",
593
597
  value: function render() {
594
- var _this3 = this,
598
+ var _this4 = this,
595
599
  _tableButton,
596
600
  _tableButton2,
597
601
  _tableButton3,
@@ -657,7 +661,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
657
661
  return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
658
662
  item: btn,
659
663
  testId: String(btn.content),
660
- ref: btn.value.name === 'emoji' ? _this3.handleEmojiButtonRef : noop,
664
+ ref: btn.value.name === 'emoji' ? _this4.handleEmojiButtonRef : noop,
661
665
  key: btn.value.name,
662
666
  spacing: isReducedSpacing ? 'none' : 'default',
663
667
  disabled: isDisabled || btn.isDisabled,
@@ -667,7 +671,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
667
671
  "aria-label": btn['aria-label'],
668
672
  "aria-haspopup": btn['aria-haspopup'],
669
673
  "aria-keyshortcuts": btn['aria-keyshortcuts'],
670
- onItemClick: _this3.insertToolbarMenuItem
674
+ onItemClick: _this4.insertToolbarMenuItem
671
675
  });
672
676
  }), this.props.tableSelectorSupported && (isTableButtonVisible || isTableSizeVisible) && (0, _react2.jsx)("div", {
673
677
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
@@ -38,39 +38,40 @@ export const tableButtonWrapper = ({
38
38
  }) =>
39
39
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation due to mixins
40
40
  css`
41
- display: flex;
42
- ${!isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn')}
43
- ${!isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn')}
41
+ display: flex;
42
+ ${!isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn')}
43
+ ${!isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn')}
44
44
 
45
45
  .table-toolbar-btn {
46
- border-top-right-radius: ${"var(--ds-border-radius-200, 0px)"};
47
- border-bottom-right-radius: ${"var(--ds-border-radius-200, 0px)"};
48
- margin-right: ${"var(--ds-space-025, 1px)"};
49
- padding: ${"var(--ds-space-0, 0px)"};
50
- & > span {
51
- min-width: 16px;
52
- margin: ${"var(--ds-space-0, 0px)"};
53
- }
54
- }
55
- .table-selector-toolbar-btn {
56
- padding: ${"var(--ds-space-0, 0px)"};
57
- & > span {
58
- margin: ${"var(--ds-space-0, 0px)"};
59
- width: 16px !important;
60
- display: flex;
61
- justify-content: center;
62
- }
46
+ border-top-right-radius: ${"var(--ds-border-radius-200, 0px)"};
47
+ border-bottom-right-radius: ${"var(--ds-border-radius-200, 0px)"};
48
+ margin-right: ${"var(--ds-space-025, 1px)"};
49
+ padding: ${"var(--ds-space-0, 0px)"};
50
+ & > span {
51
+ min-width: 16px;
52
+ margin: ${"var(--ds-space-0, 0px)"};
53
+ }
54
+ }
55
+ .table-selector-toolbar-btn {
56
+ padding: ${"var(--ds-space-0, 0px)"};
57
+ & > span {
58
+ margin: ${"var(--ds-space-0, 0px)"};
59
+ width: 16px !important;
60
+ display: flex;
61
+ justify-content: center;
62
+ }
63
63
 
64
- border-top-left-radius: ${"var(--ds-border-radius-200, 0px)"} !important;
65
- border-bottom-left-radius: ${"var(--ds-border-radius-200, 0px)"} !important;
66
- }
67
- `;
64
+ border-top-left-radius: ${"var(--ds-border-radius-200, 0px)"} !important;
65
+ border-bottom-left-radius: ${"var(--ds-border-radius-200, 0px)"} !important;
66
+ }
67
+ `;
68
68
  // eslint-disable-next-line @repo/internal/react/no-class-components
69
69
  export class ToolbarInsertBlock extends React.PureComponent {
70
- constructor(props) {
71
- super(props);
70
+ constructor(...args) {
71
+ super(...args);
72
72
  _defineProperty(this, "tableButtonRef", /*#__PURE__*/React.createRef());
73
73
  _defineProperty(this, "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
74
+ _defineProperty(this, "unregisterToggleDropdownMenuOptions", null);
74
75
  _defineProperty(this, "state", {
75
76
  isPlusMenuOpen: false,
76
77
  emojiPickerOpen: false,
@@ -198,10 +199,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
198
199
  this.toggleTableSelector(INPUT_METHOD.TOOLBAR);
199
200
  }
200
201
  });
202
+ _defineProperty(this, "componentDidMount", () => {
203
+ this.unregisterToggleDropdownMenuOptions = this.props.registerToggleDropdownMenuOptions ? this.props.registerToggleDropdownMenuOptions(this.handleClick) : null;
204
+ });
201
205
  _defineProperty(this, "componentWillUnmount", () => {
202
- if (this.unresgisterToggleDropdownMenuOptions) {
203
- this.unresgisterToggleDropdownMenuOptions();
204
- }
206
+ var _this$unregisterToggl;
207
+ (_this$unregisterToggl = this.unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 ? void 0 : _this$unregisterToggl.call(this);
205
208
  });
206
209
  _defineProperty(this, "handleClick", () => {
207
210
  this.togglePlusMenuVisibility();
@@ -500,10 +503,6 @@ export class ToolbarInsertBlock extends React.PureComponent {
500
503
  item,
501
504
  inputMethod: INPUT_METHOD.INSERT_MENU
502
505
  }));
503
- const {
504
- registerToggleDropdownMenuOptions
505
- } = props;
506
- this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(this.handleClick) : null;
507
506
  }
508
507
  static getDerivedStateFromProps(props, state) {
509
508
  const [buttons, dropdownItems] = createItems({
@@ -50,19 +50,23 @@ export var tableButtonWrapper = function tableButtonWrapper(_ref) {
50
50
  var isTableSelectorOpen = _ref.isTableSelectorOpen,
51
51
  isButtonDisabled = _ref.isButtonDisabled;
52
52
  return (// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Needs manual remediation due to mixins
53
- css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n ", "\n ", "\n\n .table-toolbar-btn {\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n margin-right: ", ";\n padding: ", ";\n & > span {\n min-width: 16px;\n margin: ", ";\n }\n }\n .table-selector-toolbar-btn {\n padding: ", ";\n & > span {\n margin: ", ";\n width: 16px !important;\n display: flex;\n justify-content: center;\n }\n\n border-top-left-radius: ", " !important;\n border-bottom-left-radius: ", " !important;\n }\n "])), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn'), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn'), "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-space-025, 1px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)")
53
+ css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n\t\tdisplay: flex;\n\t\t", "\n\t\t", "\n\n .table-toolbar-btn {\n\t\t\tborder-top-right-radius: ", ";\n\t\t\tborder-bottom-right-radius: ", ";\n\t\t\tmargin-right: ", ";\n\t\t\tpadding: ", ";\n\t\t\t& > span {\n\t\t\t\tmin-width: 16px;\n\t\t\t\tmargin: ", ";\n\t\t\t}\n\t\t}\n\t\t.table-selector-toolbar-btn {\n\t\t\tpadding: ", ";\n\t\t\t& > span {\n\t\t\t\tmargin: ", ";\n\t\t\t\twidth: 16px !important;\n\t\t\t\tdisplay: flex;\n\t\t\t\tjustify-content: center;\n\t\t\t}\n\n\t\t\tborder-top-left-radius: ", " !important;\n\t\t\tborder-bottom-left-radius: ", " !important;\n\t\t}\n\t"])), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-selector-toolbar-btn'), !isTableSelectorOpen && !isButtonDisabled && getHoverStyles('.table-toolbar-btn'), "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-space-025, 1px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-space-0, 0px)", "var(--ds-border-radius-200, 0px)", "var(--ds-border-radius-200, 0px)")
54
54
  );
55
55
  };
56
56
  // eslint-disable-next-line @repo/internal/react/no-class-components
57
57
  export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
58
58
  _inherits(ToolbarInsertBlock, _React$PureComponent);
59
59
  var _super = _createSuper(ToolbarInsertBlock);
60
- function ToolbarInsertBlock(props) {
60
+ function ToolbarInsertBlock() {
61
61
  var _this;
62
62
  _classCallCheck(this, ToolbarInsertBlock);
63
- _this = _super.call(this, props);
63
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
64
+ args[_key] = arguments[_key];
65
+ }
66
+ _this = _super.call.apply(_super, [this].concat(args));
64
67
  _defineProperty(_assertThisInitialized(_this), "tableButtonRef", /*#__PURE__*/React.createRef());
65
68
  _defineProperty(_assertThisInitialized(_this), "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
69
+ _defineProperty(_assertThisInitialized(_this), "unregisterToggleDropdownMenuOptions", null);
66
70
  _defineProperty(_assertThisInitialized(_this), "state", {
67
71
  isPlusMenuOpen: false,
68
72
  emojiPickerOpen: false,
@@ -188,10 +192,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
188
192
  _this.toggleTableSelector(INPUT_METHOD.TOOLBAR);
189
193
  }
190
194
  });
195
+ _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
196
+ _this.unregisterToggleDropdownMenuOptions = _this.props.registerToggleDropdownMenuOptions ? _this.props.registerToggleDropdownMenuOptions(_this.handleClick) : null;
197
+ });
191
198
  _defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
192
- if (_this.unresgisterToggleDropdownMenuOptions) {
193
- _this.unresgisterToggleDropdownMenuOptions();
194
- }
199
+ var _this$unregisterToggl, _this2;
200
+ (_this$unregisterToggl = (_this2 = _this).unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 || _this$unregisterToggl.call(_this2);
195
201
  });
196
202
  _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
197
203
  _this.togglePlusMenuVisibility();
@@ -467,8 +473,6 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
467
473
  inputMethod: INPUT_METHOD.INSERT_MENU
468
474
  });
469
475
  });
470
- var registerToggleDropdownMenuOptions = props.registerToggleDropdownMenuOptions;
471
- _this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(_this.handleClick) : null;
472
476
  return _this;
473
477
  }
474
478
  _createClass(ToolbarInsertBlock, [{
@@ -501,7 +505,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
501
505
  }, {
502
506
  key: "renderPopup",
503
507
  value: function renderPopup() {
504
- var _this2 = this;
508
+ var _this3 = this;
505
509
  var emojiPickerOpen = this.state.emojiPickerOpen;
506
510
  var _this$props12 = this.props,
507
511
  popupsMountPoint = _this$props12.popupsMountPoint,
@@ -519,8 +523,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
519
523
  return null;
520
524
  }
521
525
  var onUnmount = function onUnmount() {
522
- var _this2$props$pluginIn;
523
- return (_this2$props$pluginIn = _this2.props.pluginInjectionApi) === null || _this2$props$pluginIn === void 0 || (_this2$props$pluginIn = _this2$props$pluginIn.core) === null || _this2$props$pluginIn === void 0 || (_this2$props$pluginIn = _this2$props$pluginIn.actions) === null || _this2$props$pluginIn === void 0 ? void 0 : _this2$props$pluginIn.focus();
526
+ var _this3$props$pluginIn;
527
+ return (_this3$props$pluginIn = _this3.props.pluginInjectionApi) === null || _this3$props$pluginIn === void 0 || (_this3$props$pluginIn = _this3$props$pluginIn.core) === null || _this3$props$pluginIn === void 0 || (_this3$props$pluginIn = _this3$props$pluginIn.actions) === null || _this3$props$pluginIn === void 0 ? void 0 : _this3$props$pluginIn.focus();
524
528
  };
525
529
  return jsx(Popup, {
526
530
  target: ref,
@@ -581,7 +585,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
581
585
  }, {
582
586
  key: "render",
583
587
  value: function render() {
584
- var _this3 = this,
588
+ var _this4 = this,
585
589
  _tableButton,
586
590
  _tableButton2,
587
591
  _tableButton3,
@@ -647,7 +651,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
647
651
  return jsx(ToolbarButton, {
648
652
  item: btn,
649
653
  testId: String(btn.content),
650
- ref: btn.value.name === 'emoji' ? _this3.handleEmojiButtonRef : noop,
654
+ ref: btn.value.name === 'emoji' ? _this4.handleEmojiButtonRef : noop,
651
655
  key: btn.value.name,
652
656
  spacing: isReducedSpacing ? 'none' : 'default',
653
657
  disabled: isDisabled || btn.isDisabled,
@@ -657,7 +661,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
657
661
  "aria-label": btn['aria-label'],
658
662
  "aria-haspopup": btn['aria-haspopup'],
659
663
  "aria-keyshortcuts": btn['aria-keyshortcuts'],
660
- onItemClick: _this3.insertToolbarMenuItem
664
+ onItemClick: _this4.insertToolbarMenuItem
661
665
  });
662
666
  }), this.props.tableSelectorSupported && (isTableButtonVisible || isTableSizeVisible) && jsx("div", {
663
667
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
@@ -16,9 +16,8 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
16
16
  private plusButtonRef?;
17
17
  private tableButtonRef;
18
18
  private tableSelectorButtonRef;
19
- private unresgisterToggleDropdownMenuOptions;
19
+ private unregisterToggleDropdownMenuOptions;
20
20
  state: State;
21
- constructor(props: Props & WrappedComponentProps & InternalActions);
22
21
  static getDerivedStateFromProps(props: Props & WrappedComponentProps, state: State): State | null;
23
22
  componentDidUpdate(prevProps: Props): void;
24
23
  private onOpenChange;
@@ -35,6 +34,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
35
34
  private handleSelectedTableSize;
36
35
  private handleTableSelectorPressEscape;
37
36
  private handleTableSelectorClickOutside;
37
+ componentDidMount: () => void;
38
38
  componentWillUnmount: () => void;
39
39
  render(): jsx.JSX.Element | null;
40
40
  private handleClick;
@@ -16,9 +16,8 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
16
16
  private plusButtonRef?;
17
17
  private tableButtonRef;
18
18
  private tableSelectorButtonRef;
19
- private unresgisterToggleDropdownMenuOptions;
19
+ private unregisterToggleDropdownMenuOptions;
20
20
  state: State;
21
- constructor(props: Props & WrappedComponentProps & InternalActions);
22
21
  static getDerivedStateFromProps(props: Props & WrappedComponentProps, state: State): State | null;
23
22
  componentDidUpdate(prevProps: Props): void;
24
23
  private onOpenChange;
@@ -35,6 +34,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
35
34
  private handleSelectedTableSize;
36
35
  private handleTableSelectorPressEscape;
37
36
  private handleTableSelectorClickOutside;
37
+ componentDidMount: () => void;
38
38
  componentWillUnmount: () => void;
39
39
  render(): jsx.JSX.Element | null;
40
40
  private handleClick;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^81.1.0",
36
+ "@atlaskit/editor-common": "^82.0.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
38
- "@atlaskit/editor-plugin-block-type": "^3.4.0",
38
+ "@atlaskit/editor-plugin-block-type": "^3.5.0",
39
39
  "@atlaskit/editor-plugin-code-block": "^1.3.0",
40
40
  "@atlaskit/editor-plugin-date": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-emoji": "^1.3.0",
42
42
  "@atlaskit/editor-plugin-expand": "^1.7.0",
43
43
  "@atlaskit/editor-plugin-extension": "^1.5.0",
44
- "@atlaskit/editor-plugin-hyperlink": "^1.7.0",
44
+ "@atlaskit/editor-plugin-hyperlink": "^2.0.0",
45
45
  "@atlaskit/editor-plugin-image-upload": "^1.1.0",
46
46
  "@atlaskit/editor-plugin-layout": "^1.2.0",
47
47
  "@atlaskit/editor-plugin-media": "^1.20.0",
@@ -55,10 +55,10 @@
55
55
  "@atlaskit/editor-plugin-tasks-and-decisions": "^1.3.0",
56
56
  "@atlaskit/editor-plugin-type-ahead": "^1.2.0",
57
57
  "@atlaskit/editor-prosemirror": "4.0.1",
58
- "@atlaskit/editor-shared-styles": "^2.11.0",
58
+ "@atlaskit/editor-shared-styles": "^2.12.0",
59
59
  "@atlaskit/emoji": "^67.6.0",
60
60
  "@atlaskit/icon": "^22.3.0",
61
- "@atlaskit/primitives": "^6.3.0",
61
+ "@atlaskit/primitives": "^6.5.0",
62
62
  "@atlaskit/theme": "^12.8.0",
63
63
  "@atlaskit/tokens": "^1.49.0",
64
64
  "@babel/runtime": "^7.0.0",
@@ -77,7 +77,6 @@
77
77
  "@af/visual-regression": "*",
78
78
  "@atlaskit/ssr": "*",
79
79
  "@atlaskit/visual-regression": "*",
80
- "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
81
80
  "@testing-library/react": "^12.1.5",
82
81
  "react-dom": "^16.8.0",
83
82
  "typescript": "~5.4.2"
@@ -114,6 +113,5 @@
114
113
  "import-no-extraneous-disable-for-examples-and-docs"
115
114
  ]
116
115
  }
117
- },
118
- "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
116
+ }
119
117
  }
package/report.api.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  ## API Report File for "@atlaskit/editor-plugin-insert-block"
4
4
 
5
- > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using
6
+ > [API Extractor](https://api-extractor.com/).
6
7
  > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
8
 
8
9
  ### Table of contents
@@ -41,29 +42,29 @@ import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
41
42
 
42
43
  // @public (undocumented)
43
44
  interface InsertBlockOptions {
44
- // (undocumented)
45
- allowExpand?: boolean;
46
- // (undocumented)
47
- allowTables?: boolean;
48
- // (undocumented)
49
- horizontalRuleEnabled?: boolean;
50
- // (undocumented)
51
- insertMenuItems?: any;
52
- // (undocumented)
53
- nativeStatusSupported?: boolean;
54
- // (undocumented)
55
- replacePlusMenuWithElementBrowser?: boolean;
56
- // (undocumented)
57
- showElementBrowserLink?: boolean;
45
+ // (undocumented)
46
+ allowExpand?: boolean;
47
+ // (undocumented)
48
+ allowTables?: boolean;
49
+ // (undocumented)
50
+ horizontalRuleEnabled?: boolean;
51
+ // (undocumented)
52
+ insertMenuItems?: any;
53
+ // (undocumented)
54
+ nativeStatusSupported?: boolean;
55
+ // (undocumented)
56
+ replacePlusMenuWithElementBrowser?: boolean;
57
+ // (undocumented)
58
+ showElementBrowserLink?: boolean;
58
59
  }
59
60
 
60
61
  // @public (undocumented)
61
62
  export type InsertBlockPlugin = NextEditorPlugin<
62
- 'insertBlock',
63
- {
64
- pluginConfiguration: InsertBlockOptions | undefined;
65
- dependencies: InsertBlockPluginDependencies;
66
- }
63
+ 'insertBlock',
64
+ {
65
+ pluginConfiguration: InsertBlockOptions | undefined;
66
+ dependencies: InsertBlockPluginDependencies;
67
+ }
67
68
  >;
68
69
 
69
70
  // @public (undocumented)
@@ -71,27 +72,27 @@ export const insertBlockPlugin: InsertBlockPlugin;
71
72
 
72
73
  // @public (undocumented)
73
74
  type InsertBlockPluginDependencies = [
74
- OptionalPlugin<FeatureFlagsPlugin>,
75
- TypeAheadPlugin,
76
- OptionalPlugin<TablePlugin>,
77
- OptionalPlugin<HyperlinkPlugin>,
78
- OptionalPlugin<DatePlugin>,
79
- OptionalPlugin<BlockTypePlugin>,
80
- OptionalPlugin<AnalyticsPlugin>,
81
- OptionalPlugin<ImageUploadPlugin>,
82
- OptionalPlugin<EmojiPlugin>,
83
- OptionalPlugin<QuickInsertPlugin>,
84
- OptionalPlugin<RulePlugin>,
85
- OptionalPlugin<CodeBlockPlugin>,
86
- OptionalPlugin<PanelPlugin>,
87
- OptionalPlugin<MediaPlugin>,
88
- OptionalPlugin<MentionsPlugin>,
89
- OptionalPlugin<StatusPlugin>,
90
- OptionalPlugin<LayoutPlugin>,
91
- OptionalPlugin<ExpandPlugin>,
92
- OptionalPlugin<PlaceholderTextPlugin>,
93
- OptionalPlugin<ExtensionPlugin>,
94
- OptionalPlugin<TasksAndDecisionsPlugin>,
75
+ OptionalPlugin<FeatureFlagsPlugin>,
76
+ TypeAheadPlugin,
77
+ OptionalPlugin<TablePlugin>,
78
+ OptionalPlugin<HyperlinkPlugin>,
79
+ OptionalPlugin<DatePlugin>,
80
+ OptionalPlugin<BlockTypePlugin>,
81
+ OptionalPlugin<AnalyticsPlugin>,
82
+ OptionalPlugin<ImageUploadPlugin>,
83
+ OptionalPlugin<EmojiPlugin>,
84
+ OptionalPlugin<QuickInsertPlugin>,
85
+ OptionalPlugin<RulePlugin>,
86
+ OptionalPlugin<CodeBlockPlugin>,
87
+ OptionalPlugin<PanelPlugin>,
88
+ OptionalPlugin<MediaPlugin>,
89
+ OptionalPlugin<MentionsPlugin>,
90
+ OptionalPlugin<StatusPlugin>,
91
+ OptionalPlugin<LayoutPlugin>,
92
+ OptionalPlugin<ExpandPlugin>,
93
+ OptionalPlugin<PlaceholderTextPlugin>,
94
+ OptionalPlugin<ExtensionPlugin>,
95
+ OptionalPlugin<TasksAndDecisionsPlugin>,
95
96
  ];
96
97
 
97
98
  // (No @packageDocumentation comment for this package)
@@ -105,9 +106,9 @@ type InsertBlockPluginDependencies = [
105
106
 
106
107
  ```json
107
108
  {
108
- "react": "^16.8.0",
109
- "react-dom": "^16.8.0",
110
- "react-intl-next": "npm:react-intl@^5.18.1"
109
+ "react": "^16.8.0",
110
+ "react-dom": "^16.8.0",
111
+ "react-intl-next": "npm:react-intl@^5.18.1"
111
112
  }
112
113
  ```
113
114