@atlaskit/editor-plugin-status 3.1.10 → 3.1.12

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,22 @@
1
1
  # @atlaskit/editor-plugin-status
2
2
 
3
+ ## 3.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#148210](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148210)
8
+ [`10eb0681e9681`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/10eb0681e9681) -
9
+ fix SSR issues
10
+
11
+ ## 3.1.11
12
+
13
+ ### Patch Changes
14
+
15
+ - [#146371](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146371)
16
+ [`9540ed4b36027`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9540ed4b36027) -
17
+ [A11Y-9995] Add label to Status editor popup
18
+ - Updated dependencies
19
+
3
20
  ## 3.1.10
4
21
 
5
22
  ### Patch Changes
@@ -9,50 +9,36 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _messages = require("@atlaskit/editor-common/messages");
12
- var _monitoring = require("@atlaskit/editor-common/monitoring");
13
12
  var _model = require("@atlaskit/editor-prosemirror/model");
14
13
  var _statusNodeSpec = require("./statusNodeSpec");
15
14
  var StatusNodeView = exports.StatusNodeView = /*#__PURE__*/function () {
16
15
  function StatusNodeView(node, intl) {
17
16
  (0, _classCallCheck2.default)(this, StatusNodeView);
18
- (0, _defineProperty2.default)(this, "dom", document.createElement('div'));
19
17
  (0, _defineProperty2.default)(this, "box", null);
20
18
  (0, _defineProperty2.default)(this, "textContainer", null);
21
19
  this.node = node;
22
20
  this.intl = intl;
23
- try {
24
- var spec = (0, _statusNodeSpec.statusToDOM)(node);
25
- var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, spec),
26
- dom = _DOMSerializer$render.dom;
27
- if (!(dom instanceof HTMLElement)) {
28
- throw new Error('DOMSerializer.renderSpec() did not return HTMLElement');
29
- }
30
- this.dom = dom;
31
- this.box = this.dom.querySelector('.status-lozenge-span');
32
- this.textContainer = this.dom.querySelector('.lozenge-text');
33
- if (!node.attrs.text) {
34
- this.setPlaceholder();
35
- }
36
- } catch (error) {
37
- StatusNodeView.logError(error instanceof Error ? error : new Error('Unknown error on StatusNodeView constructor'));
38
- this.renderFallback();
21
+ var spec = (0, _statusNodeSpec.statusToDOM)(node);
22
+ var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, spec),
23
+ dom = _DOMSerializer$render.dom;
24
+ this.dom = dom;
25
+ this.domElement = dom instanceof HTMLElement ? dom : undefined;
26
+ if (this.domElement) {
27
+ this.box = this.domElement.querySelector('.status-lozenge-span');
28
+ this.textContainer = this.domElement.querySelector('.lozenge-text');
29
+ }
30
+ if (!node.attrs.text) {
31
+ this.setPlaceholder();
39
32
  }
40
33
  }
41
34
  return (0, _createClass2.default)(StatusNodeView, [{
42
35
  key: "setPlaceholder",
43
36
  value: function setPlaceholder() {
44
- if (this.textContainer) {
37
+ if (this.textContainer && this.domElement) {
45
38
  this.textContainer.textContent = this.intl.formatMessage(_messages.statusMessages.placeholder);
46
- this.dom.style.setProperty('opacity', '0.5');
39
+ this.domElement.style.setProperty('opacity', '0.5');
47
40
  }
48
41
  }
49
- }, {
50
- key: "renderFallback",
51
- value: function renderFallback() {
52
- var fallbackElement = document.createElement('span');
53
- fallbackElement.innerText = this.node.attrs.text;
54
- this.dom.appendChild(fallbackElement);
55
- }
56
42
  }, {
57
43
  key: "update",
58
44
  value: function update(node) {
@@ -69,18 +55,11 @@ var StatusNodeView = exports.StatusNodeView = /*#__PURE__*/function () {
69
55
  if (!node.attrs.text) {
70
56
  this.setPlaceholder();
71
57
  }
72
- if (node.attrs.text) {
73
- this.dom.style.setProperty('opacity', '1');
58
+ if (node.attrs.text && this.domElement) {
59
+ this.domElement.style.setProperty('opacity', '1');
74
60
  }
75
61
  this.node = node;
76
62
  return true;
77
63
  }
78
- }], [{
79
- key: "logError",
80
- value: function logError(error) {
81
- void (0, _monitoring.logException)(error, {
82
- location: 'editor-plugin-status/StatusNodeView'
83
- });
84
- }
85
64
  }]);
86
65
  }();
@@ -230,6 +230,7 @@ var statusToDOM = exports.statusToDOM = function statusToDOM(node) {
230
230
  class: 'statusView-content-wrap inlineNodeView',
231
231
  'data-testid': 'statusContainerView',
232
232
  'data-prosemirror-node-view-type': 'vanilla',
233
+ 'data-prosemirror-node-name': 'status',
233
234
  'local-id': localId
234
235
  };
235
236
  var statusElementAttrs = {
@@ -330,6 +330,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
330
330
  return null;
331
331
  }
332
332
  return target && (0, _react2.jsx)(PopupWithListeners, {
333
+ ariaLabel: (0, _platformFeatureFlags.fg)('editor_a11y_aria_label_removal_popup') ? intl.formatMessage(_messages.statusMessages.statusEditorLabel) : undefined,
333
334
  target: target,
334
335
  offset: [0, 8],
335
336
  handleClickOutside: this.handleClickOutside,
@@ -1,50 +1,33 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { statusMessages as messages } from '@atlaskit/editor-common/messages';
3
- import { logException } from '@atlaskit/editor-common/monitoring';
4
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
4
  import { statusToDOM } from './statusNodeSpec';
6
5
  export class StatusNodeView {
7
- static logError(error) {
8
- void logException(error, {
9
- location: 'editor-plugin-status/StatusNodeView'
10
- });
11
- }
12
6
  constructor(node, intl) {
13
- _defineProperty(this, "dom", document.createElement('div'));
14
7
  _defineProperty(this, "box", null);
15
8
  _defineProperty(this, "textContainer", null);
16
9
  this.node = node;
17
10
  this.intl = intl;
18
- try {
19
- const spec = statusToDOM(node);
20
- const {
21
- dom
22
- } = DOMSerializer.renderSpec(document, spec);
23
- if (!(dom instanceof HTMLElement)) {
24
- throw new Error('DOMSerializer.renderSpec() did not return HTMLElement');
25
- }
26
- this.dom = dom;
27
- this.box = this.dom.querySelector('.status-lozenge-span');
28
- this.textContainer = this.dom.querySelector('.lozenge-text');
29
- if (!node.attrs.text) {
30
- this.setPlaceholder();
31
- }
32
- } catch (error) {
33
- StatusNodeView.logError(error instanceof Error ? error : new Error('Unknown error on StatusNodeView constructor'));
34
- this.renderFallback();
11
+ const spec = statusToDOM(node);
12
+ const {
13
+ dom
14
+ } = DOMSerializer.renderSpec(document, spec);
15
+ this.dom = dom;
16
+ this.domElement = dom instanceof HTMLElement ? dom : undefined;
17
+ if (this.domElement) {
18
+ this.box = this.domElement.querySelector('.status-lozenge-span');
19
+ this.textContainer = this.domElement.querySelector('.lozenge-text');
20
+ }
21
+ if (!node.attrs.text) {
22
+ this.setPlaceholder();
35
23
  }
36
24
  }
37
25
  setPlaceholder() {
38
- if (this.textContainer) {
26
+ if (this.textContainer && this.domElement) {
39
27
  this.textContainer.textContent = this.intl.formatMessage(messages.placeholder);
40
- this.dom.style.setProperty('opacity', '0.5');
28
+ this.domElement.style.setProperty('opacity', '0.5');
41
29
  }
42
30
  }
43
- renderFallback() {
44
- const fallbackElement = document.createElement('span');
45
- fallbackElement.innerText = this.node.attrs.text;
46
- this.dom.appendChild(fallbackElement);
47
- }
48
31
  update(node) {
49
32
  if (node.type !== this.node.type) {
50
33
  return false;
@@ -59,8 +42,8 @@ export class StatusNodeView {
59
42
  if (!node.attrs.text) {
60
43
  this.setPlaceholder();
61
44
  }
62
- if (node.attrs.text) {
63
- this.dom.style.setProperty('opacity', '1');
45
+ if (node.attrs.text && this.domElement) {
46
+ this.domElement.style.setProperty('opacity', '1');
64
47
  }
65
48
  this.node = node;
66
49
  return true;
@@ -226,6 +226,7 @@ export const statusToDOM = node => {
226
226
  class: 'statusView-content-wrap inlineNodeView',
227
227
  'data-testid': 'statusContainerView',
228
228
  'data-prosemirror-node-view-type': 'vanilla',
229
+ 'data-prosemirror-node-name': 'status',
229
230
  'local-id': localId
230
231
  };
231
232
  const statusElementAttrs = {
@@ -304,6 +304,7 @@ class StatusPickerWithIntl extends React.Component {
304
304
  return null;
305
305
  }
306
306
  return target && jsx(PopupWithListeners, {
307
+ ariaLabel: fg('editor_a11y_aria_label_removal_popup') ? intl.formatMessage(messages.statusEditorLabel) : undefined,
307
308
  target: target,
308
309
  offset: [0, 8],
309
310
  handleClickOutside: this.handleClickOutside,
@@ -2,50 +2,36 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import { statusMessages as messages } from '@atlaskit/editor-common/messages';
5
- import { logException } from '@atlaskit/editor-common/monitoring';
6
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
7
6
  import { statusToDOM } from './statusNodeSpec';
8
7
  export var StatusNodeView = /*#__PURE__*/function () {
9
8
  function StatusNodeView(node, intl) {
10
9
  _classCallCheck(this, StatusNodeView);
11
- _defineProperty(this, "dom", document.createElement('div'));
12
10
  _defineProperty(this, "box", null);
13
11
  _defineProperty(this, "textContainer", null);
14
12
  this.node = node;
15
13
  this.intl = intl;
16
- try {
17
- var spec = statusToDOM(node);
18
- var _DOMSerializer$render = DOMSerializer.renderSpec(document, spec),
19
- dom = _DOMSerializer$render.dom;
20
- if (!(dom instanceof HTMLElement)) {
21
- throw new Error('DOMSerializer.renderSpec() did not return HTMLElement');
22
- }
23
- this.dom = dom;
24
- this.box = this.dom.querySelector('.status-lozenge-span');
25
- this.textContainer = this.dom.querySelector('.lozenge-text');
26
- if (!node.attrs.text) {
27
- this.setPlaceholder();
28
- }
29
- } catch (error) {
30
- StatusNodeView.logError(error instanceof Error ? error : new Error('Unknown error on StatusNodeView constructor'));
31
- this.renderFallback();
14
+ var spec = statusToDOM(node);
15
+ var _DOMSerializer$render = DOMSerializer.renderSpec(document, spec),
16
+ dom = _DOMSerializer$render.dom;
17
+ this.dom = dom;
18
+ this.domElement = dom instanceof HTMLElement ? dom : undefined;
19
+ if (this.domElement) {
20
+ this.box = this.domElement.querySelector('.status-lozenge-span');
21
+ this.textContainer = this.domElement.querySelector('.lozenge-text');
22
+ }
23
+ if (!node.attrs.text) {
24
+ this.setPlaceholder();
32
25
  }
33
26
  }
34
27
  return _createClass(StatusNodeView, [{
35
28
  key: "setPlaceholder",
36
29
  value: function setPlaceholder() {
37
- if (this.textContainer) {
30
+ if (this.textContainer && this.domElement) {
38
31
  this.textContainer.textContent = this.intl.formatMessage(messages.placeholder);
39
- this.dom.style.setProperty('opacity', '0.5');
32
+ this.domElement.style.setProperty('opacity', '0.5');
40
33
  }
41
34
  }
42
- }, {
43
- key: "renderFallback",
44
- value: function renderFallback() {
45
- var fallbackElement = document.createElement('span');
46
- fallbackElement.innerText = this.node.attrs.text;
47
- this.dom.appendChild(fallbackElement);
48
- }
49
35
  }, {
50
36
  key: "update",
51
37
  value: function update(node) {
@@ -62,18 +48,11 @@ export var StatusNodeView = /*#__PURE__*/function () {
62
48
  if (!node.attrs.text) {
63
49
  this.setPlaceholder();
64
50
  }
65
- if (node.attrs.text) {
66
- this.dom.style.setProperty('opacity', '1');
51
+ if (node.attrs.text && this.domElement) {
52
+ this.domElement.style.setProperty('opacity', '1');
67
53
  }
68
54
  this.node = node;
69
55
  return true;
70
56
  }
71
- }], [{
72
- key: "logError",
73
- value: function logError(error) {
74
- void logException(error, {
75
- location: 'editor-plugin-status/StatusNodeView'
76
- });
77
- }
78
57
  }]);
79
58
  }();
@@ -223,6 +223,7 @@ export var statusToDOM = function statusToDOM(node) {
223
223
  class: 'statusView-content-wrap inlineNodeView',
224
224
  'data-testid': 'statusContainerView',
225
225
  'data-prosemirror-node-view-type': 'vanilla',
226
+ 'data-prosemirror-node-name': 'status',
226
227
  'local-id': localId
227
228
  };
228
229
  var statusElementAttrs = {
@@ -327,6 +327,7 @@ var StatusPickerWithIntl = /*#__PURE__*/function (_React$Component) {
327
327
  return null;
328
328
  }
329
329
  return target && jsx(PopupWithListeners, {
330
+ ariaLabel: fg('editor_a11y_aria_label_removal_popup') ? intl.formatMessage(messages.statusEditorLabel) : undefined,
330
331
  target: target,
331
332
  offset: [0, 8],
332
333
  handleClickOutside: this.handleClickOutside,
@@ -2,14 +2,13 @@ import { IntlShape } from 'react-intl-next';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  export declare class StatusNodeView implements NodeView {
5
- dom: HTMLElement;
5
+ dom: Node;
6
+ domElement: HTMLElement | undefined;
6
7
  private box;
7
8
  private textContainer;
8
9
  private node;
9
10
  private intl;
10
- private static logError;
11
11
  constructor(node: PMNode, intl: IntlShape);
12
12
  private setPlaceholder;
13
- private renderFallback;
14
13
  update(node: PMNode): boolean;
15
14
  }
@@ -2,14 +2,13 @@ import { IntlShape } from 'react-intl-next';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  export declare class StatusNodeView implements NodeView {
5
- dom: HTMLElement;
5
+ dom: Node;
6
+ domElement: HTMLElement | undefined;
6
7
  private box;
7
8
  private textContainer;
8
9
  private node;
9
10
  private intl;
10
- private static logError;
11
11
  constructor(node: PMNode, intl: IntlShape);
12
12
  private setPlaceholder;
13
- private renderFallback;
14
13
  update(node: PMNode): boolean;
15
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-status",
3
- "version": "3.1.10",
3
+ "version": "3.1.12",
4
4
  "description": "Status plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,16 +35,16 @@
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
37
  "@atlaskit/analytics-next": "^11.0.0",
38
- "@atlaskit/editor-common": "^103.4.0",
38
+ "@atlaskit/editor-common": "^103.22.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/editor-shared-styles": "^3.4.0",
42
- "@atlaskit/icon": "^25.5.0",
42
+ "@atlaskit/icon": "^25.6.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/status": "^3.0.0",
45
45
  "@atlaskit/theme": "^18.0.0",
46
- "@atlaskit/tmp-editor-statsig": "^4.6.0",
47
- "@atlaskit/tokens": "^4.7.0",
46
+ "@atlaskit/tmp-editor-statsig": "^4.15.0",
47
+ "@atlaskit/tokens": "^4.8.0",
48
48
  "@atlaskit/visually-hidden": "^3.0.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "@emotion/react": "^11.7.1"
@@ -55,9 +55,9 @@
55
55
  "react-intl-next": "npm:react-intl@^5.18.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@af/visual-regression": "^1.3.0",
59
- "@atlaskit/ssr": "^0.4.0",
60
- "@atlaskit/visual-regression": "^0.10.0",
58
+ "@af/visual-regression": "workspace:^",
59
+ "@atlaskit/ssr": "workspace:^",
60
+ "@atlaskit/visual-regression": "workspace:^",
61
61
  "@testing-library/react": "^13.4.0",
62
62
  "raf-stub": "^2.0.1",
63
63
  "typescript": "~5.4.2"
@@ -111,6 +111,9 @@
111
111
  "visual-refresh_drop_5": {
112
112
  "type": "boolean"
113
113
  },
114
+ "editor_a11y_aria_label_removal_popup": {
115
+ "type": "boolean"
116
+ },
114
117
  "platform-lozenge-custom-letterspacing": {
115
118
  "type": "boolean"
116
119
  }