@atlaskit/editor-plugin-status 19.0.2 → 19.0.4
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 +18 -0
- package/dist/cjs/nodeviews/StatusNodeView.js +4 -2
- package/dist/cjs/nodeviews/statusNodeSpec.js +4 -2
- package/dist/cjs/ui/statusPicker.js +16 -5
- package/dist/cjs/utils/normalizeStatusColor.js +9 -0
- package/dist/es2019/nodeviews/StatusNodeView.js +4 -2
- package/dist/es2019/nodeviews/statusNodeSpec.js +4 -2
- package/dist/es2019/ui/statusPicker.js +15 -5
- package/dist/es2019/utils/normalizeStatusColor.js +1 -0
- package/dist/esm/nodeviews/StatusNodeView.js +4 -2
- package/dist/esm/nodeviews/statusNodeSpec.js +4 -2
- package/dist/esm/ui/statusPicker.js +16 -5
- package/dist/esm/utils/normalizeStatusColor.js +3 -0
- package/dist/types/utils/normalizeStatusColor.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-status
|
|
2
2
|
|
|
3
|
+
## 19.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`30567ec57fc8c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30567ec57fc8c) -
|
|
8
|
+
Opt the status picker into the ten-colour `palette` from `@atlaskit/status` behind
|
|
9
|
+
`platform_editor_update_status_colors`, uppercase the `data-color` attribute so the hex CSS
|
|
10
|
+
selectors match, and split the editor status styles so the pre-experiment semantic colour rules
|
|
11
|
+
can be deleted with the experiment. Hex colour rules are applied behind
|
|
12
|
+
`platform_editor_gracefully_render_status_color`.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 19.0.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 19.0.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
|
+
var _normalizeStatusColor = require("../utils/normalizeStatusColor");
|
|
14
15
|
var _statusNodeSpec = require("./statusNodeSpec");
|
|
15
16
|
/**
|
|
16
17
|
*
|
|
@@ -72,9 +73,10 @@ var StatusNodeView = exports.StatusNodeView = /*#__PURE__*/function () {
|
|
|
72
73
|
}
|
|
73
74
|
if (node.attrs.color !== this.node.attrs.color) {
|
|
74
75
|
var _this$box, _this$domElement2;
|
|
75
|
-
|
|
76
|
+
var dataColor = (0, _normalizeStatusColor.normalizeStatusColorAttr)(node.attrs.color);
|
|
77
|
+
(_this$box = this.box) === null || _this$box === void 0 || _this$box.setAttribute('data-color', dataColor);
|
|
76
78
|
// Also update data-color on outer wrapper for parseDOM extraction when copying
|
|
77
|
-
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color',
|
|
79
|
+
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color', dataColor);
|
|
78
80
|
}
|
|
79
81
|
if (!node.attrs.text) {
|
|
80
82
|
this.setPlaceholder();
|
|
@@ -10,6 +10,7 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
|
10
10
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
11
11
|
var _whitespace = require("@atlaskit/editor-common/whitespace");
|
|
12
12
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
|
+
var _normalizeStatusColor = require("../utils/normalizeStatusColor");
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
16
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
@@ -21,6 +22,7 @@ var statusToDOM = exports.statusToDOM = function statusToDOM(node) {
|
|
|
21
22
|
color = _node$attrs.color,
|
|
22
23
|
style = _node$attrs.style,
|
|
23
24
|
localId = _node$attrs.localId;
|
|
25
|
+
var dataColor = (0, _normalizeStatusColor.normalizeStatusColorAttr)(color);
|
|
24
26
|
var editorNodeWrapperAttrs = {
|
|
25
27
|
class: 'statusView-content-wrap inlineNodeView',
|
|
26
28
|
'data-testid': 'statusContainerView',
|
|
@@ -28,7 +30,7 @@ var statusToDOM = exports.statusToDOM = function statusToDOM(node) {
|
|
|
28
30
|
localid: localId,
|
|
29
31
|
// Required for parseDOM to correctly parse status when NodeView DOM is copied directly
|
|
30
32
|
'data-node-type': 'status',
|
|
31
|
-
'data-color':
|
|
33
|
+
'data-color': dataColor,
|
|
32
34
|
'data-text': text // Text stored as attribute for parseDOM extraction
|
|
33
35
|
};
|
|
34
36
|
var statusElementAttrs = {
|
|
@@ -39,7 +41,7 @@ var statusToDOM = exports.statusToDOM = function statusToDOM(node) {
|
|
|
39
41
|
} : {}),
|
|
40
42
|
class: 'status-lozenge-span',
|
|
41
43
|
'data-node-type': 'status',
|
|
42
|
-
'data-color':
|
|
44
|
+
'data-color': dataColor,
|
|
43
45
|
'data-style': style
|
|
44
46
|
};
|
|
45
47
|
var lozengeWrapperAttrs = {
|
|
@@ -83,15 +83,23 @@ var suggestedStatusesContainerStyles = (0, _react2.css)({
|
|
|
83
83
|
var STATUS_PICKER_FIT_HEIGHT = 288;
|
|
84
84
|
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
85
85
|
var MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
86
|
-
|
|
86
|
+
// ColorPalette: swatches per row * 32px slot + 16px inline margin.
|
|
87
|
+
var STATUS_PICKER_CONTENT_WIDTH = 208; // 6 * 32 + 16
|
|
88
|
+
var STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH = 176; // 5 * 32 + 16
|
|
87
89
|
var STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
88
|
-
var
|
|
90
|
+
var statusPickerWidthStylesOld = (0, _react2.css)({
|
|
89
91
|
width: "".concat(STATUS_PICKER_CONTENT_WIDTH, "px")
|
|
90
92
|
});
|
|
91
|
-
var
|
|
93
|
+
var statusPickerWidthStyles = (0, _react2.css)({
|
|
94
|
+
width: "".concat(STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH, "px")
|
|
95
|
+
});
|
|
96
|
+
var statusPickerWithScrollbarWidthStylesOld = (0, _react2.css)({
|
|
92
97
|
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
93
98
|
width: "".concat(STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
94
99
|
});
|
|
100
|
+
var statusPickerWithScrollbarWidthStyles = (0, _react2.css)({
|
|
101
|
+
width: "".concat(STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
102
|
+
});
|
|
95
103
|
|
|
96
104
|
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
97
105
|
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
@@ -441,7 +449,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
441
449
|
key: "renderWithSetOutsideClickTargetRef",
|
|
442
450
|
value: function renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
443
451
|
var _this3 = this,
|
|
444
|
-
_suggestedStatuses$le
|
|
452
|
+
_suggestedStatuses$le,
|
|
453
|
+
_suggestedStatuses$le2;
|
|
445
454
|
var _this$props = this.props,
|
|
446
455
|
isNew = _this$props.isNew,
|
|
447
456
|
focusStatusInput = _this$props.focusStatusInput,
|
|
@@ -451,6 +460,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
451
460
|
color = _this$state3.color,
|
|
452
461
|
text = _this$state3.text;
|
|
453
462
|
var suggestionsPatchEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions') && (0, _fg.fg)('platform_editor_status_popup_suggestions_patch_1');
|
|
463
|
+
var isUpdateStatusColorsEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_update_status_colors');
|
|
454
464
|
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_status_popup_suggestions') ? (0, _react2.jsx)("div", {
|
|
455
465
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
456
466
|
"data-suggested-status-list": true
|
|
@@ -481,13 +491,14 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
481
491
|
onColorHover: this.onColorHover,
|
|
482
492
|
onTextChanged: this.onTextChanged,
|
|
483
493
|
onEnter: this.onEnter,
|
|
494
|
+
palette: isUpdateStatusColorsEnabled ? 'extended' : 'default',
|
|
484
495
|
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
485
496
|
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
486
497
|
return (0, _react2.jsx)(_userIntent.UserIntentPopupWrapper, {
|
|
487
498
|
api: api,
|
|
488
499
|
userIntent: "statusPickerOpen"
|
|
489
500
|
}, (0, _react2.jsx)("div", {
|
|
490
|
-
css: [(0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
501
|
+
css: [(0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled && isUpdateStatusColorsEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled ? statusPickerWidthStylesOld : undefined, suggestionsPatchEnabled && isUpdateStatusColorsEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled && ((_suggestedStatuses$le2 = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le2 !== void 0 ? _suggestedStatuses$le2 : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStylesOld : undefined],
|
|
491
502
|
role: "none",
|
|
492
503
|
ref: this.setRef(setOutsideClickTargetRef),
|
|
493
504
|
onClick: this.handlePopupClick,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.normalizeStatusColorAttr = void 0;
|
|
7
|
+
var normalizeStatusColorAttr = exports.normalizeStatusColorAttr = function normalizeStatusColorAttr(color) {
|
|
8
|
+
return color.startsWith('#') ? color.toUpperCase() : color;
|
|
9
|
+
};
|
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import { statusMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
+
import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
|
|
5
6
|
import { statusToDOM } from './statusNodeSpec';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -60,9 +61,10 @@ export class StatusNodeView {
|
|
|
60
61
|
}
|
|
61
62
|
if (node.attrs.color !== this.node.attrs.color) {
|
|
62
63
|
var _this$box, _this$domElement2;
|
|
63
|
-
|
|
64
|
+
const dataColor = normalizeStatusColorAttr(node.attrs.color);
|
|
65
|
+
(_this$box = this.box) === null || _this$box === void 0 ? void 0 : _this$box.setAttribute('data-color', dataColor);
|
|
64
66
|
// Also update data-color on outer wrapper for parseDOM extraction when copying
|
|
65
|
-
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.setAttribute('data-color',
|
|
67
|
+
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.setAttribute('data-color', dataColor);
|
|
66
68
|
}
|
|
67
69
|
if (!node.attrs.text) {
|
|
68
70
|
this.setPlaceholder();
|
|
@@ -2,6 +2,7 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
+
import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
|
|
5
6
|
|
|
6
7
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
7
8
|
const isAndroidChromium = typeof window !== 'undefined' && /Version\/.* Chrome\/.*/u.test(window.navigator.userAgent);
|
|
@@ -13,6 +14,7 @@ export const statusToDOM = node => {
|
|
|
13
14
|
style,
|
|
14
15
|
localId
|
|
15
16
|
} = node.attrs;
|
|
17
|
+
const dataColor = normalizeStatusColorAttr(color);
|
|
16
18
|
const editorNodeWrapperAttrs = {
|
|
17
19
|
class: 'statusView-content-wrap inlineNodeView',
|
|
18
20
|
'data-testid': 'statusContainerView',
|
|
@@ -20,7 +22,7 @@ export const statusToDOM = node => {
|
|
|
20
22
|
localid: localId,
|
|
21
23
|
// Required for parseDOM to correctly parse status when NodeView DOM is copied directly
|
|
22
24
|
'data-node-type': 'status',
|
|
23
|
-
'data-color':
|
|
25
|
+
'data-color': dataColor,
|
|
24
26
|
'data-text': text // Text stored as attribute for parseDOM extraction
|
|
25
27
|
};
|
|
26
28
|
const statusElementAttrs = {
|
|
@@ -31,7 +33,7 @@ export const statusToDOM = node => {
|
|
|
31
33
|
} : {}),
|
|
32
34
|
class: 'status-lozenge-span',
|
|
33
35
|
'data-node-type': 'status',
|
|
34
|
-
'data-color':
|
|
36
|
+
'data-color': dataColor,
|
|
35
37
|
'data-style': style
|
|
36
38
|
};
|
|
37
39
|
const lozengeWrapperAttrs = {
|
|
@@ -73,15 +73,23 @@ const suggestedStatusesContainerStyles = css({
|
|
|
73
73
|
const STATUS_PICKER_FIT_HEIGHT = 288;
|
|
74
74
|
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
75
75
|
const MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
76
|
-
|
|
76
|
+
// ColorPalette: swatches per row * 32px slot + 16px inline margin.
|
|
77
|
+
const STATUS_PICKER_CONTENT_WIDTH = 208; // 6 * 32 + 16
|
|
78
|
+
const STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH = 176; // 5 * 32 + 16
|
|
77
79
|
const STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
78
|
-
const
|
|
80
|
+
const statusPickerWidthStylesOld = css({
|
|
79
81
|
width: `${STATUS_PICKER_CONTENT_WIDTH}px`
|
|
80
82
|
});
|
|
81
|
-
const
|
|
83
|
+
const statusPickerWidthStyles = css({
|
|
84
|
+
width: `${STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH}px`
|
|
85
|
+
});
|
|
86
|
+
const statusPickerWithScrollbarWidthStylesOld = css({
|
|
82
87
|
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
83
88
|
width: `${STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH}px`
|
|
84
89
|
});
|
|
90
|
+
const statusPickerWithScrollbarWidthStyles = css({
|
|
91
|
+
width: `${STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH}px`
|
|
92
|
+
});
|
|
85
93
|
|
|
86
94
|
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
87
95
|
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
@@ -413,7 +421,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
413
421
|
};
|
|
414
422
|
}
|
|
415
423
|
renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
416
|
-
var _suggestedStatuses$le;
|
|
424
|
+
var _suggestedStatuses$le, _suggestedStatuses$le2;
|
|
417
425
|
const {
|
|
418
426
|
isNew,
|
|
419
427
|
focusStatusInput,
|
|
@@ -425,6 +433,7 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
425
433
|
text
|
|
426
434
|
} = this.state;
|
|
427
435
|
const suggestionsPatchEnabled = isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
436
|
+
const isUpdateStatusColorsEnabled = isExperimentEnabled('platform_editor_update_status_colors');
|
|
428
437
|
const suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && isExperimentEnabled('platform_editor_status_popup_suggestions') ? jsx("div", {
|
|
429
438
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
430
439
|
"data-suggested-status-list": true
|
|
@@ -451,13 +460,14 @@ class StatusPickerWithIntl extends React.Component {
|
|
|
451
460
|
onColorHover: this.onColorHover,
|
|
452
461
|
onTextChanged: this.onTextChanged,
|
|
453
462
|
onEnter: this.onEnter,
|
|
463
|
+
palette: isUpdateStatusColorsEnabled ? 'extended' : 'default',
|
|
454
464
|
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
455
465
|
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
456
466
|
return jsx(UserIntentPopupWrapper, {
|
|
457
467
|
api: api,
|
|
458
468
|
userIntent: "statusPickerOpen"
|
|
459
469
|
}, jsx("div", {
|
|
460
|
-
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
470
|
+
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled && isUpdateStatusColorsEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled ? statusPickerWidthStylesOld : undefined, suggestionsPatchEnabled && isUpdateStatusColorsEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled && ((_suggestedStatuses$le2 = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le2 !== void 0 ? _suggestedStatuses$le2 : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStylesOld : undefined],
|
|
461
471
|
role: "none",
|
|
462
472
|
ref: this.setRef(setOutsideClickTargetRef),
|
|
463
473
|
onClick: this.handlePopupClick,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const normalizeStatusColorAttr = color => color.startsWith('#') ? color.toUpperCase() : color;
|
|
@@ -4,6 +4,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
import { statusMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
|
+
import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
|
|
7
8
|
import { statusToDOM } from './statusNodeSpec';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -66,9 +67,10 @@ export var StatusNodeView = /*#__PURE__*/function () {
|
|
|
66
67
|
}
|
|
67
68
|
if (node.attrs.color !== this.node.attrs.color) {
|
|
68
69
|
var _this$box, _this$domElement2;
|
|
69
|
-
|
|
70
|
+
var dataColor = normalizeStatusColorAttr(node.attrs.color);
|
|
71
|
+
(_this$box = this.box) === null || _this$box === void 0 || _this$box.setAttribute('data-color', dataColor);
|
|
70
72
|
// Also update data-color on outer wrapper for parseDOM extraction when copying
|
|
71
|
-
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color',
|
|
73
|
+
(_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color', dataColor);
|
|
72
74
|
}
|
|
73
75
|
if (!node.attrs.text) {
|
|
74
76
|
this.setPlaceholder();
|
|
@@ -5,6 +5,7 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
6
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
|
+
import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
|
|
8
9
|
|
|
9
10
|
// eg. Version/4.0 Chrome/95.0.4638.50
|
|
10
11
|
var isAndroidChromium = typeof window !== 'undefined' && /Version\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])* Chrome\/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*/.test(window.navigator.userAgent);
|
|
@@ -15,6 +16,7 @@ export var statusToDOM = function statusToDOM(node) {
|
|
|
15
16
|
color = _node$attrs.color,
|
|
16
17
|
style = _node$attrs.style,
|
|
17
18
|
localId = _node$attrs.localId;
|
|
19
|
+
var dataColor = normalizeStatusColorAttr(color);
|
|
18
20
|
var editorNodeWrapperAttrs = {
|
|
19
21
|
class: 'statusView-content-wrap inlineNodeView',
|
|
20
22
|
'data-testid': 'statusContainerView',
|
|
@@ -22,7 +24,7 @@ export var statusToDOM = function statusToDOM(node) {
|
|
|
22
24
|
localid: localId,
|
|
23
25
|
// Required for parseDOM to correctly parse status when NodeView DOM is copied directly
|
|
24
26
|
'data-node-type': 'status',
|
|
25
|
-
'data-color':
|
|
27
|
+
'data-color': dataColor,
|
|
26
28
|
'data-text': text // Text stored as attribute for parseDOM extraction
|
|
27
29
|
};
|
|
28
30
|
var statusElementAttrs = {
|
|
@@ -33,7 +35,7 @@ export var statusToDOM = function statusToDOM(node) {
|
|
|
33
35
|
} : {}),
|
|
34
36
|
class: 'status-lozenge-span',
|
|
35
37
|
'data-node-type': 'status',
|
|
36
|
-
'data-color':
|
|
38
|
+
'data-color': dataColor,
|
|
37
39
|
'data-style': style
|
|
38
40
|
};
|
|
39
41
|
var lozengeWrapperAttrs = {
|
|
@@ -80,15 +80,23 @@ var suggestedStatusesContainerStyles = css({
|
|
|
80
80
|
var STATUS_PICKER_FIT_HEIGHT = 288;
|
|
81
81
|
// Seven suggestions fit below the color palette before the content starts scrolling.
|
|
82
82
|
var MAX_SUGGESTIONS_WITHOUT_SCROLLBAR = 7;
|
|
83
|
-
|
|
83
|
+
// ColorPalette: swatches per row * 32px slot + 16px inline margin.
|
|
84
|
+
var STATUS_PICKER_CONTENT_WIDTH = 208; // 6 * 32 + 16
|
|
85
|
+
var STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH = 176; // 5 * 32 + 16
|
|
84
86
|
var STATUS_PICKER_SCROLLBAR_WIDTH = 16;
|
|
85
|
-
var
|
|
87
|
+
var statusPickerWidthStylesOld = css({
|
|
86
88
|
width: "".concat(STATUS_PICKER_CONTENT_WIDTH, "px")
|
|
87
89
|
});
|
|
88
|
-
var
|
|
90
|
+
var statusPickerWidthStyles = css({
|
|
91
|
+
width: "".concat(STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH, "px")
|
|
92
|
+
});
|
|
93
|
+
var statusPickerWithScrollbarWidthStylesOld = css({
|
|
89
94
|
// Reserve space for the native scrollbar without reducing the picker content width.
|
|
90
95
|
width: "".concat(STATUS_PICKER_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
91
96
|
});
|
|
97
|
+
var statusPickerWithScrollbarWidthStyles = css({
|
|
98
|
+
width: "".concat(STATUS_PICKER_TEN_COLOR_CONTENT_WIDTH + STATUS_PICKER_SCROLLBAR_WIDTH, "px")
|
|
99
|
+
});
|
|
92
100
|
|
|
93
101
|
// When cleaning up `platform_editor_status_popup_suggestions_patch_1`, merge this into
|
|
94
102
|
// `suggestedStatusesContainerStyles` and remove its conditional style array.
|
|
@@ -438,7 +446,8 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
438
446
|
key: "renderWithSetOutsideClickTargetRef",
|
|
439
447
|
value: function renderWithSetOutsideClickTargetRef(setOutsideClickTargetRef) {
|
|
440
448
|
var _this3 = this,
|
|
441
|
-
_suggestedStatuses$le
|
|
449
|
+
_suggestedStatuses$le,
|
|
450
|
+
_suggestedStatuses$le2;
|
|
442
451
|
var _this$props = this.props,
|
|
443
452
|
isNew = _this$props.isNew,
|
|
444
453
|
focusStatusInput = _this$props.focusStatusInput,
|
|
@@ -448,6 +457,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
448
457
|
color = _this$state3.color,
|
|
449
458
|
text = _this$state3.text;
|
|
450
459
|
var suggestionsPatchEnabled = isExperimentEnabled('platform_editor_status_popup_suggestions') && fg('platform_editor_status_popup_suggestions_patch_1');
|
|
460
|
+
var isUpdateStatusColorsEnabled = isExperimentEnabled('platform_editor_update_status_colors');
|
|
451
461
|
var suggestedStatusList = suggestedStatuses !== null && suggestedStatuses !== void 0 && suggestedStatuses.length && isExperimentEnabled('platform_editor_status_popup_suggestions') ? jsx("div", {
|
|
452
462
|
css: [suggestedStatusesContainerStyles, suggestionsPatchEnabled ? suggestedStatusesContainerPatchStyles : undefined],
|
|
453
463
|
"data-suggested-status-list": true
|
|
@@ -478,13 +488,14 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
|
|
|
478
488
|
onColorHover: this.onColorHover,
|
|
479
489
|
onTextChanged: this.onTextChanged,
|
|
480
490
|
onEnter: this.onEnter,
|
|
491
|
+
palette: isUpdateStatusColorsEnabled ? 'extended' : 'default',
|
|
481
492
|
scrollableContent: suggestionsPatchEnabled ? suggestedStatusList : undefined
|
|
482
493
|
}), suggestionsPatchEnabled ? null : suggestedStatusList);
|
|
483
494
|
return jsx(UserIntentPopupWrapper, {
|
|
484
495
|
api: api,
|
|
485
496
|
userIntent: "statusPickerOpen"
|
|
486
497
|
}, jsx("div", {
|
|
487
|
-
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined],
|
|
498
|
+
css: [fg('platform-dst-lozenge-tag-badge-visual-uplifts') ? pickerContainerStylesTeam26 : pickerContainerStyles, suggestionsPatchEnabled && isUpdateStatusColorsEnabled ? statusPickerWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled ? statusPickerWidthStylesOld : undefined, suggestionsPatchEnabled && isUpdateStatusColorsEnabled && ((_suggestedStatuses$le = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le !== void 0 ? _suggestedStatuses$le : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStyles : undefined, suggestionsPatchEnabled && !isUpdateStatusColorsEnabled && ((_suggestedStatuses$le2 = suggestedStatuses === null || suggestedStatuses === void 0 ? void 0 : suggestedStatuses.length) !== null && _suggestedStatuses$le2 !== void 0 ? _suggestedStatuses$le2 : 0) > MAX_SUGGESTIONS_WITHOUT_SCROLLBAR ? statusPickerWithScrollbarWidthStylesOld : undefined],
|
|
488
499
|
role: "none",
|
|
489
500
|
ref: this.setRef(setOutsideClickTargetRef),
|
|
490
501
|
onClick: this.handlePopupClick,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeStatusColorAttr: (color: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-status",
|
|
3
|
-
"version": "19.0.
|
|
3
|
+
"version": "19.0.4",
|
|
4
4
|
"description": "Status plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"@atlaskit/icon-lab": "^7.8.0",
|
|
38
38
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
40
|
-
"@atlaskit/status": "^5.
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
40
|
+
"@atlaskit/status": "^5.11.0",
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^192.0.0",
|
|
42
42
|
"@atlaskit/tokens": "^16.12.0",
|
|
43
43
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|