@atlaskit/editor-plugin-insert-block 1.2.4 → 1.3.0
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 +23 -0
- package/dist/cjs/plugin.js +35 -4
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +9 -6
- package/dist/es2019/plugin.js +32 -4
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +11 -3
- package/dist/esm/plugin.js +32 -4
- package/dist/esm/ui/ToolbarInsertBlock/index.js +9 -6
- package/dist/types/plugin.d.ts +3 -0
- package/dist/types/ui/ToolbarInsertBlock/index.d.ts +9 -3
- package/dist/types-ts4.5/plugin.d.ts +3 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/index.d.ts +9 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#98283](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98283)
|
|
8
|
+
[`291c762e17a0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/291c762e17a0) -
|
|
9
|
+
[ED-22802] Introduce insertBlock.actions.toggleAdditionalMenu API
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 1.2.5
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#97698](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97698)
|
|
20
|
+
[`1c7b378c0d3b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1c7b378c0d3b) -
|
|
21
|
+
[HOT-108999] We had an incident where the cursor jumps back a character in table headers for any
|
|
22
|
+
language triggering composition on an empty line.This was fixed in a patch bump of
|
|
23
|
+
prosemirror-view. https://github.com/ProseMirror/prosemirror-view/compare/1.33.4...1.33.5
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 1.2.4
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.insertBlockPlugin = void 0;
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
11
12
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
12
13
|
var _types = require("@atlaskit/editor-common/types");
|
|
13
14
|
var _consts = require("@atlaskit/editor-plugin-block-type/consts");
|
|
14
15
|
var _ToolbarInsertBlock = _interopRequireDefault(require("./ui/ToolbarInsertBlock"));
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
18
|
var toolbarSizeToButtons = function toolbarSizeToButtons(toolbarSize) {
|
|
16
19
|
switch (toolbarSize) {
|
|
17
20
|
case _types.ToolbarSize.XXL:
|
|
@@ -49,8 +52,33 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
49
52
|
var _ref$config = _ref.config,
|
|
50
53
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
51
54
|
api = _ref.api;
|
|
55
|
+
var toggleDropdownMenuOptionsRef = {
|
|
56
|
+
current: null
|
|
57
|
+
};
|
|
58
|
+
var registerToggleDropdownMenuOptions = function registerToggleDropdownMenuOptions(cb) {
|
|
59
|
+
toggleDropdownMenuOptionsRef.current = cb;
|
|
60
|
+
return function () {
|
|
61
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
52
64
|
return {
|
|
53
65
|
name: 'insertBlock',
|
|
66
|
+
actions: {
|
|
67
|
+
toggleAdditionalMenu: function toggleAdditionalMenu() {
|
|
68
|
+
var toggle = toggleDropdownMenuOptionsRef.current;
|
|
69
|
+
if (!toggle) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
toggle();
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
usePluginHook: function usePluginHook() {
|
|
76
|
+
(0, _react.useLayoutEffect)(function () {
|
|
77
|
+
return function () {
|
|
78
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
79
|
+
};
|
|
80
|
+
}, []);
|
|
81
|
+
},
|
|
54
82
|
primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
|
|
55
83
|
var editorView = _ref2.editorView,
|
|
56
84
|
editorActions = _ref2.editorActions,
|
|
@@ -78,7 +106,8 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
|
|
|
78
106
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
79
107
|
isLastItem: isLastItem,
|
|
80
108
|
providers: providers,
|
|
81
|
-
options: options
|
|
109
|
+
options: options,
|
|
110
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
82
111
|
});
|
|
83
112
|
};
|
|
84
113
|
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
@@ -103,7 +132,8 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
103
132
|
isLastItem = _ref3.isLastItem,
|
|
104
133
|
providers = _ref3.providers,
|
|
105
134
|
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
106
|
-
options = _ref3.options
|
|
135
|
+
options = _ref3.options,
|
|
136
|
+
registerToggleDropdownMenuOptions = _ref3.registerToggleDropdownMenuOptions;
|
|
107
137
|
var buttons = toolbarSizeToButtons(toolbarSize);
|
|
108
138
|
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
|
|
109
139
|
dateState = _useSharedPluginState.dateState,
|
|
@@ -155,6 +185,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
155
185
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
156
186
|
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
157
187
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
158
|
-
showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S
|
|
188
|
+
showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S,
|
|
189
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
159
190
|
});
|
|
160
191
|
}
|
|
@@ -63,18 +63,14 @@ var tableButtonWrapper = exports.tableButtonWrapper = function tableButtonWrappe
|
|
|
63
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)")
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
|
-
|
|
67
66
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
68
67
|
var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
69
68
|
(0, _inherits2.default)(ToolbarInsertBlock, _React$PureComponent);
|
|
70
69
|
var _super = _createSuper(ToolbarInsertBlock);
|
|
71
|
-
function ToolbarInsertBlock() {
|
|
70
|
+
function ToolbarInsertBlock(props) {
|
|
72
71
|
var _this;
|
|
73
72
|
(0, _classCallCheck2.default)(this, ToolbarInsertBlock);
|
|
74
|
-
|
|
75
|
-
args[_key] = arguments[_key];
|
|
76
|
-
}
|
|
77
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
73
|
+
_this = _super.call(this, props);
|
|
78
74
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableButtonRef", /*#__PURE__*/_react.default.createRef());
|
|
79
75
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableSelectorButtonRef", /*#__PURE__*/_react.default.createRef());
|
|
80
76
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
|
|
@@ -202,6 +198,11 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
202
198
|
_this.toggleTableSelector(_analytics.INPUT_METHOD.TOOLBAR);
|
|
203
199
|
}
|
|
204
200
|
});
|
|
201
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "componentWillUnmount", function () {
|
|
202
|
+
if (_this.unresgisterToggleDropdownMenuOptions) {
|
|
203
|
+
_this.unresgisterToggleDropdownMenuOptions();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
205
206
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
|
|
206
207
|
_this.togglePlusMenuVisibility();
|
|
207
208
|
});
|
|
@@ -468,6 +469,8 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
468
469
|
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
469
470
|
});
|
|
470
471
|
});
|
|
472
|
+
var registerToggleDropdownMenuOptions = props.registerToggleDropdownMenuOptions;
|
|
473
|
+
_this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(_this.handleClick) : null;
|
|
471
474
|
return _this;
|
|
472
475
|
}
|
|
473
476
|
(0, _createClass2.default)(ToolbarInsertBlock, [{
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useLayoutEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -40,8 +40,33 @@ export const insertBlockPlugin = ({
|
|
|
40
40
|
config: options = {},
|
|
41
41
|
api
|
|
42
42
|
}) => {
|
|
43
|
+
const toggleDropdownMenuOptionsRef = {
|
|
44
|
+
current: null
|
|
45
|
+
};
|
|
46
|
+
const registerToggleDropdownMenuOptions = cb => {
|
|
47
|
+
toggleDropdownMenuOptionsRef.current = cb;
|
|
48
|
+
return () => {
|
|
49
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
43
52
|
return {
|
|
44
53
|
name: 'insertBlock',
|
|
54
|
+
actions: {
|
|
55
|
+
toggleAdditionalMenu: () => {
|
|
56
|
+
const toggle = toggleDropdownMenuOptionsRef.current;
|
|
57
|
+
if (!toggle) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
toggle();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
usePluginHook: () => {
|
|
64
|
+
useLayoutEffect(() => {
|
|
65
|
+
return () => {
|
|
66
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
69
|
+
},
|
|
45
70
|
primaryToolbarComponent({
|
|
46
71
|
editorView,
|
|
47
72
|
editorActions,
|
|
@@ -70,7 +95,8 @@ export const insertBlockPlugin = ({
|
|
|
70
95
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
71
96
|
isLastItem: isLastItem,
|
|
72
97
|
providers: providers,
|
|
73
|
-
options: options
|
|
98
|
+
options: options,
|
|
99
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
74
100
|
});
|
|
75
101
|
};
|
|
76
102
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
@@ -94,7 +120,8 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
94
120
|
isLastItem,
|
|
95
121
|
providers,
|
|
96
122
|
pluginInjectionApi,
|
|
97
|
-
options
|
|
123
|
+
options,
|
|
124
|
+
registerToggleDropdownMenuOptions
|
|
98
125
|
}) {
|
|
99
126
|
var _ref, _ref2, _pluginInjectionApi$i, _pluginInjectionApi$c, _pluginInjectionApi$p, _pluginInjectionApi$b, _pluginInjectionApi$e;
|
|
100
127
|
const buttons = toolbarSizeToButtons(toolbarSize);
|
|
@@ -149,6 +176,7 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
149
176
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
150
177
|
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
151
178
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
152
|
-
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S
|
|
179
|
+
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
|
|
180
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
153
181
|
});
|
|
154
182
|
}
|
|
@@ -65,11 +65,10 @@ css`
|
|
|
65
65
|
border-bottom-left-radius: ${"var(--ds-border-radius-200, 0px)"} !important;
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
|
-
|
|
69
68
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
70
69
|
export class ToolbarInsertBlock extends React.PureComponent {
|
|
71
|
-
constructor(
|
|
72
|
-
super(
|
|
70
|
+
constructor(props) {
|
|
71
|
+
super(props);
|
|
73
72
|
_defineProperty(this, "tableButtonRef", /*#__PURE__*/React.createRef());
|
|
74
73
|
_defineProperty(this, "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
|
|
75
74
|
_defineProperty(this, "state", {
|
|
@@ -199,6 +198,11 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
199
198
|
this.toggleTableSelector(INPUT_METHOD.TOOLBAR);
|
|
200
199
|
}
|
|
201
200
|
});
|
|
201
|
+
_defineProperty(this, "componentWillUnmount", () => {
|
|
202
|
+
if (this.unresgisterToggleDropdownMenuOptions) {
|
|
203
|
+
this.unresgisterToggleDropdownMenuOptions();
|
|
204
|
+
}
|
|
205
|
+
});
|
|
202
206
|
_defineProperty(this, "handleClick", () => {
|
|
203
207
|
this.togglePlusMenuVisibility();
|
|
204
208
|
});
|
|
@@ -488,6 +492,10 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
488
492
|
item,
|
|
489
493
|
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
490
494
|
}));
|
|
495
|
+
const {
|
|
496
|
+
registerToggleDropdownMenuOptions
|
|
497
|
+
} = props;
|
|
498
|
+
this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(this.handleClick) : null;
|
|
491
499
|
}
|
|
492
500
|
static getDerivedStateFromProps(props, state) {
|
|
493
501
|
const [buttons, dropdownItems] = createItems({
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useLayoutEffect } from 'react';
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
4
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -42,8 +42,33 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
42
42
|
var _ref$config = _ref.config,
|
|
43
43
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
44
44
|
api = _ref.api;
|
|
45
|
+
var toggleDropdownMenuOptionsRef = {
|
|
46
|
+
current: null
|
|
47
|
+
};
|
|
48
|
+
var registerToggleDropdownMenuOptions = function registerToggleDropdownMenuOptions(cb) {
|
|
49
|
+
toggleDropdownMenuOptionsRef.current = cb;
|
|
50
|
+
return function () {
|
|
51
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
45
54
|
return {
|
|
46
55
|
name: 'insertBlock',
|
|
56
|
+
actions: {
|
|
57
|
+
toggleAdditionalMenu: function toggleAdditionalMenu() {
|
|
58
|
+
var toggle = toggleDropdownMenuOptionsRef.current;
|
|
59
|
+
if (!toggle) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
toggle();
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
usePluginHook: function usePluginHook() {
|
|
66
|
+
useLayoutEffect(function () {
|
|
67
|
+
return function () {
|
|
68
|
+
toggleDropdownMenuOptionsRef.current = null;
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
},
|
|
47
72
|
primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
|
|
48
73
|
var editorView = _ref2.editorView,
|
|
49
74
|
editorActions = _ref2.editorActions,
|
|
@@ -71,7 +96,8 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
|
|
|
71
96
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
72
97
|
isLastItem: isLastItem,
|
|
73
98
|
providers: providers,
|
|
74
|
-
options: options
|
|
99
|
+
options: options,
|
|
100
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
75
101
|
});
|
|
76
102
|
};
|
|
77
103
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
@@ -96,7 +122,8 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
96
122
|
isLastItem = _ref3.isLastItem,
|
|
97
123
|
providers = _ref3.providers,
|
|
98
124
|
pluginInjectionApi = _ref3.pluginInjectionApi,
|
|
99
|
-
options = _ref3.options
|
|
125
|
+
options = _ref3.options,
|
|
126
|
+
registerToggleDropdownMenuOptions = _ref3.registerToggleDropdownMenuOptions;
|
|
100
127
|
var buttons = toolbarSizeToButtons(toolbarSize);
|
|
101
128
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText']),
|
|
102
129
|
dateState = _useSharedPluginState.dateState,
|
|
@@ -148,6 +175,7 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
148
175
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
149
176
|
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
150
177
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
151
|
-
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S
|
|
178
|
+
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
|
|
179
|
+
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
152
180
|
});
|
|
153
181
|
}
|
|
@@ -53,18 +53,14 @@ export var tableButtonWrapper = function tableButtonWrapper(_ref) {
|
|
|
53
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)")
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
|
-
|
|
57
56
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
58
57
|
export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
59
58
|
_inherits(ToolbarInsertBlock, _React$PureComponent);
|
|
60
59
|
var _super = _createSuper(ToolbarInsertBlock);
|
|
61
|
-
function ToolbarInsertBlock() {
|
|
60
|
+
function ToolbarInsertBlock(props) {
|
|
62
61
|
var _this;
|
|
63
62
|
_classCallCheck(this, ToolbarInsertBlock);
|
|
64
|
-
|
|
65
|
-
args[_key] = arguments[_key];
|
|
66
|
-
}
|
|
67
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
63
|
+
_this = _super.call(this, props);
|
|
68
64
|
_defineProperty(_assertThisInitialized(_this), "tableButtonRef", /*#__PURE__*/React.createRef());
|
|
69
65
|
_defineProperty(_assertThisInitialized(_this), "tableSelectorButtonRef", /*#__PURE__*/React.createRef());
|
|
70
66
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
@@ -192,6 +188,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
192
188
|
_this.toggleTableSelector(INPUT_METHOD.TOOLBAR);
|
|
193
189
|
}
|
|
194
190
|
});
|
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "componentWillUnmount", function () {
|
|
192
|
+
if (_this.unresgisterToggleDropdownMenuOptions) {
|
|
193
|
+
_this.unresgisterToggleDropdownMenuOptions();
|
|
194
|
+
}
|
|
195
|
+
});
|
|
195
196
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function () {
|
|
196
197
|
_this.togglePlusMenuVisibility();
|
|
197
198
|
});
|
|
@@ -458,6 +459,8 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
458
459
|
inputMethod: INPUT_METHOD.INSERT_MENU
|
|
459
460
|
});
|
|
460
461
|
});
|
|
462
|
+
var registerToggleDropdownMenuOptions = props.registerToggleDropdownMenuOptions;
|
|
463
|
+
_this.unresgisterToggleDropdownMenuOptions = registerToggleDropdownMenuOptions ? registerToggleDropdownMenuOptions(_this.handleClick) : null;
|
|
461
464
|
return _this;
|
|
462
465
|
}
|
|
463
466
|
_createClass(ToolbarInsertBlock, [{
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -13,5 +13,8 @@ export interface InsertBlockOptions {
|
|
|
13
13
|
export type InsertBlockPlugin = NextEditorPlugin<'insertBlock', {
|
|
14
14
|
pluginConfiguration: InsertBlockOptions | undefined;
|
|
15
15
|
dependencies: InsertBlockPluginDependencies;
|
|
16
|
+
actions: {
|
|
17
|
+
toggleAdditionalMenu: () => void;
|
|
18
|
+
};
|
|
16
19
|
}>;
|
|
17
20
|
export declare const insertBlockPlugin: InsertBlockPlugin;
|
|
@@ -7,13 +7,18 @@ export declare const tableButtonWrapper: ({ isTableSelectorOpen, isButtonDisable
|
|
|
7
7
|
isTableSelectorOpen: boolean;
|
|
8
8
|
isButtonDisabled: boolean | undefined;
|
|
9
9
|
}) => import("@emotion/react").SerializedStyles;
|
|
10
|
-
|
|
10
|
+
type InternalActions = {
|
|
11
|
+
registerToggleDropdownMenuOptions?: (cb: () => void) => () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare class ToolbarInsertBlock extends React.PureComponent<Props & WrappedComponentProps & InternalActions, State> {
|
|
11
14
|
private dropdownButtonRef?;
|
|
12
15
|
private emojiButtonRef?;
|
|
13
16
|
private plusButtonRef?;
|
|
14
17
|
private tableButtonRef;
|
|
15
18
|
private tableSelectorButtonRef;
|
|
19
|
+
private unresgisterToggleDropdownMenuOptions;
|
|
16
20
|
state: State;
|
|
21
|
+
constructor(props: Props & WrappedComponentProps & InternalActions);
|
|
17
22
|
static getDerivedStateFromProps(props: Props & WrappedComponentProps, state: State): State | null;
|
|
18
23
|
componentDidUpdate(prevProps: Props): void;
|
|
19
24
|
private onOpenChange;
|
|
@@ -30,6 +35,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
|
|
|
30
35
|
private handleSelectedTableSize;
|
|
31
36
|
private handleTableSelectorPressEscape;
|
|
32
37
|
private handleTableSelectorClickOutside;
|
|
38
|
+
componentWillUnmount: () => void;
|
|
33
39
|
render(): jsx.JSX.Element | null;
|
|
34
40
|
private handleClick;
|
|
35
41
|
private handleOpenByKeyboard;
|
|
@@ -53,7 +59,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
|
|
|
53
59
|
private insertToolbarMenuItem;
|
|
54
60
|
private insertInsertMenuItem;
|
|
55
61
|
}
|
|
56
|
-
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
57
|
-
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
62
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps & InternalActions>> & {
|
|
63
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps & InternalActions>;
|
|
58
64
|
};
|
|
59
65
|
export default _default;
|
|
@@ -13,5 +13,8 @@ export interface InsertBlockOptions {
|
|
|
13
13
|
export type InsertBlockPlugin = NextEditorPlugin<'insertBlock', {
|
|
14
14
|
pluginConfiguration: InsertBlockOptions | undefined;
|
|
15
15
|
dependencies: InsertBlockPluginDependencies;
|
|
16
|
+
actions: {
|
|
17
|
+
toggleAdditionalMenu: () => void;
|
|
18
|
+
};
|
|
16
19
|
}>;
|
|
17
20
|
export declare const insertBlockPlugin: InsertBlockPlugin;
|
|
@@ -7,13 +7,18 @@ export declare const tableButtonWrapper: ({ isTableSelectorOpen, isButtonDisable
|
|
|
7
7
|
isTableSelectorOpen: boolean;
|
|
8
8
|
isButtonDisabled: boolean | undefined;
|
|
9
9
|
}) => import("@emotion/react").SerializedStyles;
|
|
10
|
-
|
|
10
|
+
type InternalActions = {
|
|
11
|
+
registerToggleDropdownMenuOptions?: (cb: () => void) => () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare class ToolbarInsertBlock extends React.PureComponent<Props & WrappedComponentProps & InternalActions, State> {
|
|
11
14
|
private dropdownButtonRef?;
|
|
12
15
|
private emojiButtonRef?;
|
|
13
16
|
private plusButtonRef?;
|
|
14
17
|
private tableButtonRef;
|
|
15
18
|
private tableSelectorButtonRef;
|
|
19
|
+
private unresgisterToggleDropdownMenuOptions;
|
|
16
20
|
state: State;
|
|
21
|
+
constructor(props: Props & WrappedComponentProps & InternalActions);
|
|
17
22
|
static getDerivedStateFromProps(props: Props & WrappedComponentProps, state: State): State | null;
|
|
18
23
|
componentDidUpdate(prevProps: Props): void;
|
|
19
24
|
private onOpenChange;
|
|
@@ -30,6 +35,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
|
|
|
30
35
|
private handleSelectedTableSize;
|
|
31
36
|
private handleTableSelectorPressEscape;
|
|
32
37
|
private handleTableSelectorClickOutside;
|
|
38
|
+
componentWillUnmount: () => void;
|
|
33
39
|
render(): jsx.JSX.Element | null;
|
|
34
40
|
private handleClick;
|
|
35
41
|
private handleOpenByKeyboard;
|
|
@@ -53,7 +59,7 @@ export declare class ToolbarInsertBlock extends React.PureComponent<Props & Wrap
|
|
|
53
59
|
private insertToolbarMenuItem;
|
|
54
60
|
private insertInsertMenuItem;
|
|
55
61
|
}
|
|
56
|
-
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps>> & {
|
|
57
|
-
WrappedComponent: React.ComponentType<Props & WrappedComponentProps>;
|
|
62
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<Props & WrappedComponentProps & InternalActions>> & {
|
|
63
|
+
WrappedComponent: React.ComponentType<Props & WrappedComponentProps & InternalActions>;
|
|
58
64
|
};
|
|
59
65
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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": "^79.
|
|
36
|
+
"@atlaskit/editor-common": "^79.2.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",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"@atlaskit/editor-plugin-table": "^7.12.0",
|
|
55
55
|
"@atlaskit/editor-plugin-tasks-and-decisions": "^1.2.0",
|
|
56
56
|
"@atlaskit/editor-plugin-type-ahead": "^1.1.0",
|
|
57
|
-
"@atlaskit/editor-prosemirror": "4.0.
|
|
57
|
+
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
58
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": "^6.
|
|
62
|
-
"@atlaskit/theme": "^12.
|
|
63
|
-
"@atlaskit/tokens": "^1.
|
|
61
|
+
"@atlaskit/primitives": "^6.1.0",
|
|
62
|
+
"@atlaskit/theme": "^12.8.0",
|
|
63
|
+
"@atlaskit/tokens": "^1.46.0",
|
|
64
64
|
"@babel/runtime": "^7.0.0",
|
|
65
65
|
"@emotion/react": "^11.7.1",
|
|
66
66
|
"bind-event-listener": "^3.0.0",
|