@atlaskit/editor-plugin-status 31.0.8 → 31.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-status
2
2
 
3
+ ## 31.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 31.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [`12017af1f8a8e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/12017af1f8a8e) -
14
+ Reduce redundant StatusNodeView text and opacity updates behind the
15
+ platform_editor_improve_inp_batch_2 experiment.
16
+ - Updated dependencies
17
+
3
18
  ## 31.0.8
4
19
 
5
20
  ### Patch Changes
@@ -10,6 +10,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _status = require("@atlaskit/editor-common/messages/status");
12
12
  var _model = require("@atlaskit/editor-prosemirror/model");
13
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
13
14
  var _fg = require("@atlaskit/platform-feature-flags/fg");
14
15
  var _normalizeStatusColor = require("../utils/normalizeStatusColor");
15
16
  var _statusNodeSpec = require("./statusNodeSpec");
@@ -62,11 +63,17 @@ var StatusNodeView = exports.StatusNodeView = /*#__PURE__*/function () {
62
63
  if (node.type !== this.node.type) {
63
64
  return false;
64
65
  }
66
+ var wasEmpty = !this.node.attrs.text;
67
+ var isEmpty = !node.attrs.text;
65
68
  if (this.textContainer && node.attrs.text !== this.node.attrs.text) {
66
- var _this$domElement;
67
- this.textContainer.textContent = node.attrs.text;
69
+ var _this$domElement, _node$attrs$text;
70
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_2') || !isEmpty) {
71
+ this.textContainer.textContent = node.attrs.text;
72
+ }
68
73
  // Also update data-text on outer wrapper for parseDOM extraction when copying
69
- (_this$domElement = this.domElement) === null || _this$domElement === void 0 || _this$domElement.setAttribute('data-text', node.attrs.text);
74
+ (_this$domElement = this.domElement) === null || _this$domElement === void 0 || _this$domElement.setAttribute('data-text',
75
+ // Avoid serialising a null text attr as the literal string "null"
76
+ (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_2') ? (_node$attrs$text = node.attrs.text) !== null && _node$attrs$text !== void 0 ? _node$attrs$text : '' : node.attrs.text);
70
77
  }
71
78
  if (this.textContainer && node.attrs.style !== this.node.attrs.style && (0, _fg.fg)('platform-dst-lozenge-tag-badge-visual-uplifts')) {
72
79
  this.textContainer.style.textTransform = node.attrs.style !== 'mixedCase' ? 'uppercase' : '';
@@ -78,11 +85,22 @@ var StatusNodeView = exports.StatusNodeView = /*#__PURE__*/function () {
78
85
  // Also update data-color on outer wrapper for parseDOM extraction when copying
79
86
  (_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color', dataColor);
80
87
  }
81
- if (!node.attrs.text) {
82
- this.setPlaceholder();
83
- }
84
- if (node.attrs.text && this.domElement) {
85
- this.domElement.style.setProperty('opacity', '1');
88
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_improve_inp_batch_2')) {
89
+ if (wasEmpty !== isEmpty) {
90
+ if (isEmpty) {
91
+ this.setPlaceholder();
92
+ } else {
93
+ var _this$domElement3;
94
+ (_this$domElement3 = this.domElement) === null || _this$domElement3 === void 0 || _this$domElement3.style.setProperty('opacity', '1');
95
+ }
96
+ }
97
+ } else {
98
+ if (!node.attrs.text) {
99
+ this.setPlaceholder();
100
+ }
101
+ if (node.attrs.text && this.domElement) {
102
+ this.domElement.style.setProperty('opacity', '1');
103
+ }
86
104
  }
87
105
  this.node = node;
88
106
  return true;
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { messages } from '@atlaskit/editor-common/messages/status';
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import { fg } from '@atlaskit/platform-feature-flags/fg';
5
6
  import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
6
7
  import { statusToDOM } from './statusNodeSpec';
@@ -50,11 +51,17 @@ export class StatusNodeView {
50
51
  if (node.type !== this.node.type) {
51
52
  return false;
52
53
  }
54
+ const wasEmpty = !this.node.attrs.text;
55
+ const isEmpty = !node.attrs.text;
53
56
  if (this.textContainer && node.attrs.text !== this.node.attrs.text) {
54
- var _this$domElement;
55
- this.textContainer.textContent = node.attrs.text;
57
+ var _this$domElement, _node$attrs$text;
58
+ if (!isExperimentEnabled('platform_editor_improve_inp_batch_2') || !isEmpty) {
59
+ this.textContainer.textContent = node.attrs.text;
60
+ }
56
61
  // Also update data-text on outer wrapper for parseDOM extraction when copying
57
- (_this$domElement = this.domElement) === null || _this$domElement === void 0 ? void 0 : _this$domElement.setAttribute('data-text', node.attrs.text);
62
+ (_this$domElement = this.domElement) === null || _this$domElement === void 0 ? void 0 : _this$domElement.setAttribute('data-text',
63
+ // Avoid serialising a null text attr as the literal string "null"
64
+ isExperimentEnabled('platform_editor_improve_inp_batch_2') ? (_node$attrs$text = node.attrs.text) !== null && _node$attrs$text !== void 0 ? _node$attrs$text : '' : node.attrs.text);
58
65
  }
59
66
  if (this.textContainer && node.attrs.style !== this.node.attrs.style && fg('platform-dst-lozenge-tag-badge-visual-uplifts')) {
60
67
  this.textContainer.style.textTransform = node.attrs.style !== 'mixedCase' ? 'uppercase' : '';
@@ -66,11 +73,22 @@ export class StatusNodeView {
66
73
  // Also update data-color on outer wrapper for parseDOM extraction when copying
67
74
  (_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.setAttribute('data-color', dataColor);
68
75
  }
69
- if (!node.attrs.text) {
70
- this.setPlaceholder();
71
- }
72
- if (node.attrs.text && this.domElement) {
73
- this.domElement.style.setProperty('opacity', '1');
76
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_2')) {
77
+ if (wasEmpty !== isEmpty) {
78
+ if (isEmpty) {
79
+ this.setPlaceholder();
80
+ } else {
81
+ var _this$domElement3;
82
+ (_this$domElement3 = this.domElement) === null || _this$domElement3 === void 0 ? void 0 : _this$domElement3.style.setProperty('opacity', '1');
83
+ }
84
+ }
85
+ } else {
86
+ if (!node.attrs.text) {
87
+ this.setPlaceholder();
88
+ }
89
+ if (node.attrs.text && this.domElement) {
90
+ this.domElement.style.setProperty('opacity', '1');
91
+ }
74
92
  }
75
93
  this.node = node;
76
94
  return true;
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import { messages } from '@atlaskit/editor-common/messages/status';
5
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
6
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
7
  import { fg } from '@atlaskit/platform-feature-flags/fg';
7
8
  import { normalizeStatusColorAttr } from '../utils/normalizeStatusColor';
8
9
  import { statusToDOM } from './statusNodeSpec';
@@ -56,11 +57,17 @@ export var StatusNodeView = /*#__PURE__*/function () {
56
57
  if (node.type !== this.node.type) {
57
58
  return false;
58
59
  }
60
+ var wasEmpty = !this.node.attrs.text;
61
+ var isEmpty = !node.attrs.text;
59
62
  if (this.textContainer && node.attrs.text !== this.node.attrs.text) {
60
- var _this$domElement;
61
- this.textContainer.textContent = node.attrs.text;
63
+ var _this$domElement, _node$attrs$text;
64
+ if (!isExperimentEnabled('platform_editor_improve_inp_batch_2') || !isEmpty) {
65
+ this.textContainer.textContent = node.attrs.text;
66
+ }
62
67
  // Also update data-text on outer wrapper for parseDOM extraction when copying
63
- (_this$domElement = this.domElement) === null || _this$domElement === void 0 || _this$domElement.setAttribute('data-text', node.attrs.text);
68
+ (_this$domElement = this.domElement) === null || _this$domElement === void 0 || _this$domElement.setAttribute('data-text',
69
+ // Avoid serialising a null text attr as the literal string "null"
70
+ isExperimentEnabled('platform_editor_improve_inp_batch_2') ? (_node$attrs$text = node.attrs.text) !== null && _node$attrs$text !== void 0 ? _node$attrs$text : '' : node.attrs.text);
64
71
  }
65
72
  if (this.textContainer && node.attrs.style !== this.node.attrs.style && fg('platform-dst-lozenge-tag-badge-visual-uplifts')) {
66
73
  this.textContainer.style.textTransform = node.attrs.style !== 'mixedCase' ? 'uppercase' : '';
@@ -72,11 +79,22 @@ export var StatusNodeView = /*#__PURE__*/function () {
72
79
  // Also update data-color on outer wrapper for parseDOM extraction when copying
73
80
  (_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 || _this$domElement2.setAttribute('data-color', dataColor);
74
81
  }
75
- if (!node.attrs.text) {
76
- this.setPlaceholder();
77
- }
78
- if (node.attrs.text && this.domElement) {
79
- this.domElement.style.setProperty('opacity', '1');
82
+ if (isExperimentEnabled('platform_editor_improve_inp_batch_2')) {
83
+ if (wasEmpty !== isEmpty) {
84
+ if (isEmpty) {
85
+ this.setPlaceholder();
86
+ } else {
87
+ var _this$domElement3;
88
+ (_this$domElement3 = this.domElement) === null || _this$domElement3 === void 0 || _this$domElement3.style.setProperty('opacity', '1');
89
+ }
90
+ }
91
+ } else {
92
+ if (!node.attrs.text) {
93
+ this.setPlaceholder();
94
+ }
95
+ if (node.attrs.text && this.domElement) {
96
+ this.domElement.style.setProperty('opacity', '1');
97
+ }
80
98
  }
81
99
  this.node = node;
82
100
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-status",
3
- "version": "31.0.8",
3
+ "version": "31.0.10",
4
4
  "description": "Status plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,20 +38,20 @@
38
38
  "@atlaskit/platform-feature-experiments": "^0.3.0",
39
39
  "@atlaskit/platform-feature-flags": "^2.2.0",
40
40
  "@atlaskit/status": "^5.15.0",
41
- "@atlaskit/tmp-editor-statsig": "^253.0.0",
41
+ "@atlaskit/tmp-editor-statsig": "^254.0.0",
42
42
  "@atlaskit/tokens": "^20.9.0",
43
43
  "@atlaskit/visually-hidden": "^4.4.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1"
46
46
  },
47
47
  "peerDependencies": {
48
- "@atlaskit/editor-common": "^134.5.0",
48
+ "@atlaskit/editor-common": "^134.7.0",
49
49
  "react": "^18.2.0 || ^19.2.0",
50
50
  "react-dom": "^18.2.0 || ^19.2.0",
51
51
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@atlaskit/editor-common": "^134.5.0",
54
+ "@atlaskit/editor-common": "^134.7.0",
55
55
  "react": "^19.2.0",
56
56
  "react-dom": "^19.2.0",
57
57
  "react-intl": "^7.0.0"