@atlaskit/editor-plugin-floating-toolbar 3.1.0 → 3.1.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 +15 -0
- package/dist/cjs/ui/Input.js +6 -68
- package/dist/cjs/ui/Toolbar.js +20 -23
- package/dist/es2019/ui/Input.js +2 -54
- package/dist/es2019/ui/Toolbar.js +21 -20
- package/dist/esm/ui/Input.js +2 -68
- package/dist/esm/ui/Toolbar.js +21 -24
- package/dist/types/ui/Input.d.ts +1 -14
- package/dist/types-ts4.5/ui/Input.d.ts +1 -14
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-floating-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122243](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/122243)
|
|
8
|
+
[`cd1572955dd3b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cd1572955dd3b) -
|
|
9
|
+
FD-80149: cleans up platform_editor_react18_phase2_v2 in floating toolbar
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 3.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 3.1.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/cjs/ui/Input.js
CHANGED
|
@@ -5,83 +5,21 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.Input = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
11
|
var _react2 = require("@emotion/react");
|
|
18
12
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
13
|
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); }
|
|
20
14
|
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 && {}.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; }
|
|
21
|
-
|
|
22
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /**
|
|
15
|
+
/**
|
|
23
16
|
* @jsxRuntime classic
|
|
24
17
|
* @jsx jsx
|
|
25
|
-
*/
|
|
26
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
27
|
-
var InputOld = exports.InputOld = /*#__PURE__*/function (_Component) {
|
|
28
|
-
function InputOld(props) {
|
|
29
|
-
var _this;
|
|
30
|
-
(0, _classCallCheck2.default)(this, InputOld);
|
|
31
|
-
_this = _callSuper(this, InputOld, [props]);
|
|
32
|
-
(0, _defineProperty2.default)(_this, "handleChange", function (e) {
|
|
33
|
-
_this.setState({
|
|
34
|
-
text: e.target.value
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
(0, _defineProperty2.default)(_this, "handleSubmit", function (e) {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
if (_this.props.onSubmit) {
|
|
40
|
-
_this.props.onSubmit(_this.state.text);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
(0, _defineProperty2.default)(_this, "handleBlur", function (e) {
|
|
44
|
-
e.preventDefault();
|
|
45
|
-
if (_this.props.onBlur) {
|
|
46
|
-
_this.props.onBlur(_this.state.text);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
_this.state = {
|
|
50
|
-
text: props.defaultValue || ''
|
|
51
|
-
};
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
18
|
+
*/
|
|
54
19
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return (0, _createClass2.default)(InputOld, [{
|
|
59
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
60
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
61
|
-
if (this.state.text !== nextProps.defaultValue) {
|
|
62
|
-
this.setState({
|
|
63
|
-
text: nextProps.defaultValue || ''
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "render",
|
|
69
|
-
value: function render() {
|
|
70
|
-
var placeholder = this.props.placeholder;
|
|
71
|
-
return (0, _react2.jsx)("form", {
|
|
72
|
-
onSubmit: this.handleSubmit
|
|
73
|
-
}, (0, _react2.jsx)("input", {
|
|
74
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
75
|
-
css: _ui.panelTextInput,
|
|
76
|
-
value: this.state.text,
|
|
77
|
-
onChange: this.handleChange,
|
|
78
|
-
placeholder: placeholder,
|
|
79
|
-
onBlur: this.handleBlur
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
}]);
|
|
83
|
-
}(_react.Component);
|
|
84
|
-
var InputNew = exports.InputNew = function InputNew(props) {
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
21
|
+
|
|
22
|
+
var Input = exports.Input = function Input(props) {
|
|
85
23
|
var defaultValue = props.defaultValue,
|
|
86
24
|
onBlur = props.onBlur,
|
|
87
25
|
onSubmit = props.onSubmit,
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -164,22 +164,7 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
164
164
|
spotlightConfig: item.spotlightConfig
|
|
165
165
|
}, item.showTitle && item.title);
|
|
166
166
|
case 'input':
|
|
167
|
-
|
|
168
|
-
return (0, _react2.jsx)(_Input.InputNew, {
|
|
169
|
-
key: idx,
|
|
170
|
-
mountPoint: popupsMountPoint,
|
|
171
|
-
boundariesElement: popupsBoundariesElement,
|
|
172
|
-
defaultValue: item.defaultValue,
|
|
173
|
-
placeholder: item.placeholder,
|
|
174
|
-
onSubmit: function onSubmit(value) {
|
|
175
|
-
return dispatchCommand(item.onSubmit(value));
|
|
176
|
-
},
|
|
177
|
-
onBlur: function onBlur(value) {
|
|
178
|
-
return dispatchCommand(item.onBlur(value));
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
return (0, _react2.jsx)(_Input.InputOld, {
|
|
167
|
+
return (0, _react2.jsx)(_Input.Input, {
|
|
183
168
|
key: idx,
|
|
184
169
|
mountPoint: popupsMountPoint,
|
|
185
170
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -352,16 +337,19 @@ var ToolbarItems = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
352
337
|
var groupedItems = groupItems(items.filter(function (item) {
|
|
353
338
|
return !item.hidden;
|
|
354
339
|
}));
|
|
355
|
-
return (0, _react2.jsx)(_buttonGroup.default,
|
|
340
|
+
return (0, _react2.jsx)(_buttonGroup.default, {
|
|
341
|
+
testId: "editor-floating-toolbar-items"
|
|
342
|
+
}, groupedItems.map(function (element, index) {
|
|
356
343
|
var isGroup = Array.isArray(element);
|
|
357
344
|
if (isGroup) {
|
|
358
345
|
return (0, _react2.jsx)("div", {
|
|
359
346
|
// Ignored via go/ees005
|
|
360
347
|
// eslint-disable-next-line react/no-array-index-key
|
|
361
348
|
key: index,
|
|
362
|
-
css: buttonGroupStyles,
|
|
349
|
+
css: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? buttonGroupStylesNew : buttonGroupStyles,
|
|
363
350
|
role: "radiogroup",
|
|
364
|
-
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined
|
|
351
|
+
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
|
|
352
|
+
"data-testid": "editor-floating-toolbar-grouped-buttons"
|
|
365
353
|
}, element.map(function (element) {
|
|
366
354
|
var indexInAllItems = items.findIndex(function (item) {
|
|
367
355
|
return item === element;
|
|
@@ -387,6 +375,10 @@ var buttonGroupStyles = (0, _react2.css)({
|
|
|
387
375
|
display: 'flex',
|
|
388
376
|
gap: "var(--ds-space-050, 4px)"
|
|
389
377
|
});
|
|
378
|
+
var buttonGroupStylesNew = (0, _react2.css)({
|
|
379
|
+
display: 'flex',
|
|
380
|
+
gap: "var(--ds-space-075, 6px)"
|
|
381
|
+
});
|
|
390
382
|
|
|
391
383
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
392
384
|
var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
|
|
@@ -485,13 +477,18 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
|
|
|
485
477
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
486
478
|
(0, _react2.css)({
|
|
487
479
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
488
|
-
padding:
|
|
480
|
+
padding: "var(--ds-space-0, 0)".concat(" 4px ", "var(--ds-space-600, 48px)", " 4px"),
|
|
489
481
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
490
482
|
'> div': {
|
|
491
483
|
minHeight: "var(--ds-space-500, 40px)",
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
484
|
+
gap: "var(--ds-space-075, 6px)",
|
|
485
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
486
|
+
'> div:first-child': {
|
|
487
|
+
marginLeft: 0
|
|
488
|
+
},
|
|
489
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
490
|
+
'> div:last-child': {
|
|
491
|
+
marginRight: 0
|
|
495
492
|
}
|
|
496
493
|
}
|
|
497
494
|
}) : undefined) :
|
package/dist/es2019/ui/Input.js
CHANGED
|
@@ -1,65 +1,13 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
/**
|
|
3
2
|
* @jsxRuntime classic
|
|
4
3
|
* @jsx jsx
|
|
5
4
|
*/
|
|
6
|
-
import React, {
|
|
5
|
+
import React, { useState } from 'react';
|
|
7
6
|
|
|
8
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
8
|
import { jsx } from '@emotion/react';
|
|
10
9
|
import { panelTextInput } from '@atlaskit/editor-common/ui';
|
|
11
|
-
|
|
12
|
-
export class InputOld extends Component {
|
|
13
|
-
constructor(props) {
|
|
14
|
-
super(props);
|
|
15
|
-
_defineProperty(this, "handleChange", e => {
|
|
16
|
-
this.setState({
|
|
17
|
-
text: e.target.value
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
_defineProperty(this, "handleSubmit", e => {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
if (this.props.onSubmit) {
|
|
23
|
-
this.props.onSubmit(this.state.text);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
_defineProperty(this, "handleBlur", e => {
|
|
27
|
-
e.preventDefault();
|
|
28
|
-
if (this.props.onBlur) {
|
|
29
|
-
this.props.onBlur(this.state.text);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
this.state = {
|
|
33
|
-
text: props.defaultValue || ''
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line react/no-unsafe
|
|
39
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
40
|
-
if (this.state.text !== nextProps.defaultValue) {
|
|
41
|
-
this.setState({
|
|
42
|
-
text: nextProps.defaultValue || ''
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
const {
|
|
48
|
-
placeholder
|
|
49
|
-
} = this.props;
|
|
50
|
-
return jsx("form", {
|
|
51
|
-
onSubmit: this.handleSubmit
|
|
52
|
-
}, jsx("input", {
|
|
53
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
54
|
-
css: panelTextInput,
|
|
55
|
-
value: this.state.text,
|
|
56
|
-
onChange: this.handleChange,
|
|
57
|
-
placeholder: placeholder,
|
|
58
|
-
onBlur: this.handleBlur
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export const InputNew = props => {
|
|
10
|
+
export const Input = props => {
|
|
63
11
|
const {
|
|
64
12
|
defaultValue,
|
|
65
13
|
onBlur,
|
|
@@ -25,7 +25,7 @@ import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
|
25
25
|
import Dropdown from './Dropdown';
|
|
26
26
|
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
27
27
|
import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
28
|
-
import {
|
|
28
|
+
import { Input } from './Input';
|
|
29
29
|
import { ScrollButtons } from './ScrollButtons';
|
|
30
30
|
import Select from './Select';
|
|
31
31
|
export function groupItems(items) {
|
|
@@ -145,18 +145,7 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
145
145
|
spotlightConfig: item.spotlightConfig
|
|
146
146
|
}, item.showTitle && item.title);
|
|
147
147
|
case 'input':
|
|
148
|
-
|
|
149
|
-
return jsx(InputNew, {
|
|
150
|
-
key: idx,
|
|
151
|
-
mountPoint: popupsMountPoint,
|
|
152
|
-
boundariesElement: popupsBoundariesElement,
|
|
153
|
-
defaultValue: item.defaultValue,
|
|
154
|
-
placeholder: item.placeholder,
|
|
155
|
-
onSubmit: value => dispatchCommand(item.onSubmit(value)),
|
|
156
|
-
onBlur: value => dispatchCommand(item.onBlur(value))
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return jsx(InputOld, {
|
|
148
|
+
return jsx(Input, {
|
|
160
149
|
key: idx,
|
|
161
150
|
mountPoint: popupsMountPoint,
|
|
162
151
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -319,16 +308,19 @@ const ToolbarItems = /*#__PURE__*/React.memo(({
|
|
|
319
308
|
}
|
|
320
309
|
};
|
|
321
310
|
const groupedItems = groupItems(items.filter(item => !item.hidden));
|
|
322
|
-
return jsx(ButtonGroup,
|
|
311
|
+
return jsx(ButtonGroup, {
|
|
312
|
+
testId: "editor-floating-toolbar-items"
|
|
313
|
+
}, groupedItems.map((element, index) => {
|
|
323
314
|
const isGroup = Array.isArray(element);
|
|
324
315
|
if (isGroup) {
|
|
325
316
|
return jsx("div", {
|
|
326
317
|
// Ignored via go/ees005
|
|
327
318
|
// eslint-disable-next-line react/no-array-index-key
|
|
328
319
|
key: index,
|
|
329
|
-
css: buttonGroupStyles,
|
|
320
|
+
css: editorExperiment('platform_editor_controls', 'variant1') ? buttonGroupStylesNew : buttonGroupStyles,
|
|
330
321
|
role: "radiogroup",
|
|
331
|
-
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined
|
|
322
|
+
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
|
|
323
|
+
"data-testid": "editor-floating-toolbar-grouped-buttons"
|
|
332
324
|
}, element.map(element => {
|
|
333
325
|
const indexInAllItems = items.findIndex(item => item === element);
|
|
334
326
|
return renderItem(element, indexInAllItems);
|
|
@@ -350,6 +342,10 @@ const buttonGroupStyles = css({
|
|
|
350
342
|
display: 'flex',
|
|
351
343
|
gap: "var(--ds-space-050, 4px)"
|
|
352
344
|
});
|
|
345
|
+
const buttonGroupStylesNew = css({
|
|
346
|
+
display: 'flex',
|
|
347
|
+
gap: "var(--ds-space-075, 6px)"
|
|
348
|
+
});
|
|
353
349
|
|
|
354
350
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
355
351
|
const toolbarContainer = (scrollable, hasSelect, firstElementIsSelect) => css({
|
|
@@ -446,13 +442,18 @@ editorExperiment('platform_editor_controls', 'variant1') ?
|
|
|
446
442
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
447
443
|
css({
|
|
448
444
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
449
|
-
padding:
|
|
445
|
+
padding: `${"var(--ds-space-0, 0)"} 4px ${"var(--ds-space-600, 48px)"} 4px`,
|
|
450
446
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
451
447
|
'> div': {
|
|
452
448
|
minHeight: "var(--ds-space-500, 40px)",
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
449
|
+
gap: "var(--ds-space-075, 6px)",
|
|
450
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
451
|
+
'> div:first-child': {
|
|
452
|
+
marginLeft: 0
|
|
453
|
+
},
|
|
454
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
455
|
+
'> div:last-child': {
|
|
456
|
+
marginRight: 0
|
|
456
457
|
}
|
|
457
458
|
}
|
|
458
459
|
}) : undefined) :
|
package/dist/esm/ui/Input.js
CHANGED
|
@@ -1,80 +1,14 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
2
|
/**
|
|
11
3
|
* @jsxRuntime classic
|
|
12
4
|
* @jsx jsx
|
|
13
5
|
*/
|
|
14
|
-
import React, {
|
|
6
|
+
import React, { useState } from 'react';
|
|
15
7
|
|
|
16
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
9
|
import { jsx } from '@emotion/react';
|
|
18
10
|
import { panelTextInput } from '@atlaskit/editor-common/ui';
|
|
19
|
-
|
|
20
|
-
export var InputOld = /*#__PURE__*/function (_Component) {
|
|
21
|
-
function InputOld(props) {
|
|
22
|
-
var _this;
|
|
23
|
-
_classCallCheck(this, InputOld);
|
|
24
|
-
_this = _callSuper(this, InputOld, [props]);
|
|
25
|
-
_defineProperty(_this, "handleChange", function (e) {
|
|
26
|
-
_this.setState({
|
|
27
|
-
text: e.target.value
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
_defineProperty(_this, "handleSubmit", function (e) {
|
|
31
|
-
e.preventDefault();
|
|
32
|
-
if (_this.props.onSubmit) {
|
|
33
|
-
_this.props.onSubmit(_this.state.text);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(_this, "handleBlur", function (e) {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
if (_this.props.onBlur) {
|
|
39
|
-
_this.props.onBlur(_this.state.text);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
_this.state = {
|
|
43
|
-
text: props.defaultValue || ''
|
|
44
|
-
};
|
|
45
|
-
return _this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Ignored via go/ees005
|
|
49
|
-
// eslint-disable-next-line react/no-unsafe
|
|
50
|
-
_inherits(InputOld, _Component);
|
|
51
|
-
return _createClass(InputOld, [{
|
|
52
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
53
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
54
|
-
if (this.state.text !== nextProps.defaultValue) {
|
|
55
|
-
this.setState({
|
|
56
|
-
text: nextProps.defaultValue || ''
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, {
|
|
61
|
-
key: "render",
|
|
62
|
-
value: function render() {
|
|
63
|
-
var placeholder = this.props.placeholder;
|
|
64
|
-
return jsx("form", {
|
|
65
|
-
onSubmit: this.handleSubmit
|
|
66
|
-
}, jsx("input", {
|
|
67
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
68
|
-
css: panelTextInput,
|
|
69
|
-
value: this.state.text,
|
|
70
|
-
onChange: this.handleChange,
|
|
71
|
-
placeholder: placeholder,
|
|
72
|
-
onBlur: this.handleBlur
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
}]);
|
|
76
|
-
}(Component);
|
|
77
|
-
export var InputNew = function InputNew(props) {
|
|
11
|
+
export var Input = function Input(props) {
|
|
78
12
|
var defaultValue = props.defaultValue,
|
|
79
13
|
onBlur = props.onBlur,
|
|
80
14
|
onSubmit = props.onSubmit,
|
package/dist/esm/ui/Toolbar.js
CHANGED
|
@@ -32,7 +32,7 @@ import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
|
32
32
|
import Dropdown from './Dropdown';
|
|
33
33
|
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
34
34
|
import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
35
|
-
import {
|
|
35
|
+
import { Input } from './Input';
|
|
36
36
|
import { ScrollButtons } from './ScrollButtons';
|
|
37
37
|
import Select from './Select';
|
|
38
38
|
export function groupItems(items) {
|
|
@@ -157,22 +157,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
157
157
|
spotlightConfig: item.spotlightConfig
|
|
158
158
|
}, item.showTitle && item.title);
|
|
159
159
|
case 'input':
|
|
160
|
-
|
|
161
|
-
return jsx(InputNew, {
|
|
162
|
-
key: idx,
|
|
163
|
-
mountPoint: popupsMountPoint,
|
|
164
|
-
boundariesElement: popupsBoundariesElement,
|
|
165
|
-
defaultValue: item.defaultValue,
|
|
166
|
-
placeholder: item.placeholder,
|
|
167
|
-
onSubmit: function onSubmit(value) {
|
|
168
|
-
return dispatchCommand(item.onSubmit(value));
|
|
169
|
-
},
|
|
170
|
-
onBlur: function onBlur(value) {
|
|
171
|
-
return dispatchCommand(item.onBlur(value));
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return jsx(InputOld, {
|
|
160
|
+
return jsx(Input, {
|
|
176
161
|
key: idx,
|
|
177
162
|
mountPoint: popupsMountPoint,
|
|
178
163
|
boundariesElement: popupsBoundariesElement,
|
|
@@ -345,16 +330,19 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
345
330
|
var groupedItems = groupItems(items.filter(function (item) {
|
|
346
331
|
return !item.hidden;
|
|
347
332
|
}));
|
|
348
|
-
return jsx(ButtonGroup,
|
|
333
|
+
return jsx(ButtonGroup, {
|
|
334
|
+
testId: "editor-floating-toolbar-items"
|
|
335
|
+
}, groupedItems.map(function (element, index) {
|
|
349
336
|
var isGroup = Array.isArray(element);
|
|
350
337
|
if (isGroup) {
|
|
351
338
|
return jsx("div", {
|
|
352
339
|
// Ignored via go/ees005
|
|
353
340
|
// eslint-disable-next-line react/no-array-index-key
|
|
354
341
|
key: index,
|
|
355
|
-
css: buttonGroupStyles,
|
|
342
|
+
css: editorExperiment('platform_editor_controls', 'variant1') ? buttonGroupStylesNew : buttonGroupStyles,
|
|
356
343
|
role: "radiogroup",
|
|
357
|
-
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined
|
|
344
|
+
"aria-label": groupLabel !== null && groupLabel !== void 0 ? groupLabel : undefined,
|
|
345
|
+
"data-testid": "editor-floating-toolbar-grouped-buttons"
|
|
358
346
|
}, element.map(function (element) {
|
|
359
347
|
var indexInAllItems = items.findIndex(function (item) {
|
|
360
348
|
return item === element;
|
|
@@ -380,6 +368,10 @@ var buttonGroupStyles = css({
|
|
|
380
368
|
display: 'flex',
|
|
381
369
|
gap: "var(--ds-space-050, 4px)"
|
|
382
370
|
});
|
|
371
|
+
var buttonGroupStylesNew = css({
|
|
372
|
+
display: 'flex',
|
|
373
|
+
gap: "var(--ds-space-075, 6px)"
|
|
374
|
+
});
|
|
383
375
|
|
|
384
376
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
385
377
|
var toolbarContainer = function toolbarContainer(scrollable, hasSelect, firstElementIsSelect) {
|
|
@@ -478,13 +470,18 @@ var toolbarOverflow = function toolbarOverflow(_ref2) {
|
|
|
478
470
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
479
471
|
css({
|
|
480
472
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
481
|
-
padding:
|
|
473
|
+
padding: "var(--ds-space-0, 0)".concat(" 4px ", "var(--ds-space-600, 48px)", " 4px"),
|
|
482
474
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
483
475
|
'> div': {
|
|
484
476
|
minHeight: "var(--ds-space-500, 40px)",
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
477
|
+
gap: "var(--ds-space-075, 6px)",
|
|
478
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
479
|
+
'> div:first-child': {
|
|
480
|
+
marginLeft: 0
|
|
481
|
+
},
|
|
482
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
483
|
+
'> div:last-child': {
|
|
484
|
+
marginRight: 0
|
|
488
485
|
}
|
|
489
486
|
}
|
|
490
487
|
}) : undefined) :
|
package/dist/types/ui/Input.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
1
|
import { jsx } from '@emotion/react';
|
|
7
2
|
export interface Props {
|
|
8
3
|
mountPoint?: HTMLElement;
|
|
@@ -15,12 +10,4 @@ export interface Props {
|
|
|
15
10
|
export interface State {
|
|
16
11
|
text: string;
|
|
17
12
|
}
|
|
18
|
-
export declare
|
|
19
|
-
constructor(props: Props);
|
|
20
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
21
|
-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
-
handleSubmit: (e: React.FormEvent) => void;
|
|
23
|
-
handleBlur: (e: React.FocusEvent<Object>) => void;
|
|
24
|
-
render(): jsx.JSX.Element;
|
|
25
|
-
}
|
|
26
|
-
export declare const InputNew: (props: Props) => jsx.JSX.Element;
|
|
13
|
+
export declare const Input: (props: Props) => jsx.JSX.Element;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React, { Component } from 'react';
|
|
6
1
|
import { jsx } from '@emotion/react';
|
|
7
2
|
export interface Props {
|
|
8
3
|
mountPoint?: HTMLElement;
|
|
@@ -15,12 +10,4 @@ export interface Props {
|
|
|
15
10
|
export interface State {
|
|
16
11
|
text: string;
|
|
17
12
|
}
|
|
18
|
-
export declare
|
|
19
|
-
constructor(props: Props);
|
|
20
|
-
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
21
|
-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
22
|
-
handleSubmit: (e: React.FormEvent) => void;
|
|
23
|
-
handleBlur: (e: React.FocusEvent<Object>) => void;
|
|
24
|
-
render(): jsx.JSX.Element;
|
|
25
|
-
}
|
|
26
|
-
export declare const InputNew: (props: Props) => jsx.JSX.Element;
|
|
13
|
+
export declare const Input: (props: Props) => jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-floating-toolbar",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Floating toolbar plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@atlaskit/adf-utils": "^19.19.0",
|
|
29
29
|
"@atlaskit/button": "^21.1.0",
|
|
30
30
|
"@atlaskit/checkbox": "^17.0.0",
|
|
31
|
-
"@atlaskit/editor-common": "^
|
|
31
|
+
"@atlaskit/editor-common": "^101.1.0",
|
|
32
32
|
"@atlaskit/editor-palette": "2.0.0",
|
|
33
|
-
"@atlaskit/editor-plugin-block-controls": "^3.
|
|
33
|
+
"@atlaskit/editor-plugin-block-controls": "^3.3.0",
|
|
34
34
|
"@atlaskit/editor-plugin-context-panel": "^3.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-copy-button": "^2.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
@@ -113,9 +113,6 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"platform-feature-flags": {
|
|
116
|
-
"platform_editor_react18_phase2_v2": {
|
|
117
|
-
"type": "boolean"
|
|
118
|
-
},
|
|
119
116
|
"platform_editor_floating_toolbar_padding_fix": {
|
|
120
117
|
"type": "boolean"
|
|
121
118
|
},
|