@atlaskit/editor-plugin-expand 3.2.11 → 3.2.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,14 @@
1
1
  # @atlaskit/editor-plugin-expand
2
2
 
3
+ ## 3.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159403](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159403)
8
+ [`8db235c23c369`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8db235c23c369) -
9
+ ENGHEALTH-28082:Added aria label to expand button
10
+ - Updated dependencies
11
+
3
12
  ## 3.2.11
4
13
 
5
14
  ### Patch Changes
@@ -78,7 +78,7 @@ var updateExpandTitle = exports.updateExpandTitle = function updateExpandTitle(_
78
78
  var node = state.doc.nodeAt(pos);
79
79
  if (node && node.type === nodeType && dispatch) {
80
80
  var tr = state.tr;
81
- if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence')) {
81
+ if (__livePage) {
82
82
  tr.step(new _steps.SetAttrsStep(pos, _objectSpread(_objectSpread({}, node.attrs), {}, {
83
83
  title: title
84
84
  })));
@@ -102,7 +102,7 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
102
102
  if (node && node.type === nodeType && dispatch) {
103
103
  var tr = state.tr;
104
104
  var isExpandedNext = !node.attrs.__expanded;
105
- if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence')) {
105
+ if (__livePage) {
106
106
  tr.step(new _steps.SetAttrsStep(pos, _objectSpread(_objectSpread({}, node.attrs), {}, {
107
107
  __expanded: isExpandedNext
108
108
  })));
@@ -115,7 +115,7 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
115
115
  // If we're going to collapse the expand and our cursor is currently inside
116
116
  // Move to a right gap cursor, if the toolbar is interacted (or an API),
117
117
  // it will insert below rather than inside (which will be invisible).
118
- if (__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && (0, _transforms.findExpand)(state)) {
118
+ if (__livePage ? isExpandedNext === true : isExpandedNext === false && (0, _transforms.findExpand)(state)) {
119
119
  tr.setSelection(new _selection.GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), _selection.Side.RIGHT));
120
120
  }
121
121
 
@@ -127,7 +127,7 @@ var toggleExpandExpanded = exports.toggleExpandExpanded = function toggleExpandE
127
127
  attributes: {
128
128
  platform: _analytics.PLATFORMS.WEB,
129
129
  mode: _analytics.MODE.EDITOR,
130
- expanded: __livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !isExpandedNext : isExpandedNext
130
+ expanded: __livePage ? !isExpandedNext : isExpandedNext
131
131
  },
132
132
  eventType: _analytics.EVENT_TYPE.TRACK
133
133
  };
@@ -19,7 +19,6 @@ var _utils = require("@atlaskit/editor-common/utils");
19
19
  var _history = require("@atlaskit/editor-prosemirror/history");
20
20
  var _model = require("@atlaskit/editor-prosemirror/model");
21
21
  var _state = require("@atlaskit/editor-prosemirror/state");
22
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
22
  var _commands = require("../commands");
24
23
  var _ExpandIconButton = require("../ui/ExpandIconButton");
25
24
  function buildExpandClassName(type, expanded) {
@@ -28,7 +27,7 @@ function buildExpandClassName(type, expanded) {
28
27
  var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
29
28
  return ['div', {
30
29
  // prettier-ignore
31
- 'class': buildExpandClassName(node.type.name, __livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
30
+ 'class': buildExpandClassName(node.type.name, __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
32
31
  'data-node-type': node.type.name,
33
32
  'data-title': node.attrs.title
34
33
  }, ['div', {
@@ -272,7 +271,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
272
271
  }
273
272
  });
274
273
  (0, _defineProperty2.default)(this, "isCollapsed", function () {
275
- if (_this.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence')) {
274
+ if (_this.__livePage) {
276
275
  return _this.node.attrs.__expanded;
277
276
  }
278
277
  return !_this.node.attrs.__expanded;
@@ -402,7 +401,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
402
401
  return;
403
402
  });
404
403
  (0, _defineProperty2.default)(this, "getContentEditable", function (node) {
405
- var contentEditable = _this.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
404
+ var contentEditable = _this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
406
405
  if (_this.api && _this.api.editorDisabled) {
407
406
  var _this$api$editorDisab;
408
407
  return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
@@ -495,7 +494,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
495
494
  return /*#__PURE__*/_react.default.createElement(_ExpandIconButton.ExpandIconButton, {
496
495
  intl: intl,
497
496
  allowInteractiveExpand: _this3.allowInteractiveExpand,
498
- expanded: _this3.__livePage && (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
497
+ expanded: _this3.__livePage ? !__expanded : __expanded
499
498
  });
500
499
  }, this.icon, this.renderKey);
501
500
  }
@@ -11,7 +11,6 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
12
12
  var _state = require("@atlaskit/editor-prosemirror/state");
13
13
  var _utils2 = require("@atlaskit/editor-tables/utils");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _commands = require("../commands");
16
15
  var isExpandNode = function isExpandNode(node) {
17
16
  return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
@@ -92,9 +91,7 @@ function expandKeymap(api, options) {
92
91
  var selection = state.selection,
93
92
  schema = state.schema;
94
93
  var nodeBefore = selection.$from.nodeBefore;
95
- if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
96
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
97
- (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
94
+ if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
98
95
  var _$from = selection.$from;
99
96
  return (0, _commands.focusTitle)(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
100
97
  }
@@ -118,9 +115,7 @@ function expandKeymap(api, options) {
118
115
  var expandBefore = (0, _transforms.findExpand)(state, sel);
119
116
  if (sel && expandBefore) {
120
117
  // moving cursor from outside of an expand to the title when it is collapsed
121
- if (
122
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
123
- (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
118
+ if (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
124
119
  return (0, _commands.focusTitle)(expandBefore.start)(state, dispatch, editorView);
125
120
  }
126
121
  // moving cursor from outside of an expand to the content when it is expanded
@@ -144,9 +139,7 @@ function expandKeymap(api, options) {
144
139
  nestedExpand = _state$schema$nodes.nestedExpand;
145
140
  var selection = state.selection;
146
141
  var nodeAfter = selection.$from.nodeAfter;
147
- if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
148
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
149
- (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
142
+ if (selection instanceof _selection.GapCursorSelection && selection.side === _selection.Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
150
143
  var $from = selection.$from;
151
144
  return (0, _commands.focusTitle)($from.pos + 1)(state, dispatch, editorView);
152
145
  }
@@ -179,9 +172,7 @@ function expandKeymap(api, options) {
179
172
  // @see ED-7977
180
173
  var sel = _state.Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
181
174
  var expandBefore = (0, _transforms.findExpand)(state, sel);
182
- if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
183
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
184
- (0, _platformFeatureFlags.fg)('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
175
+ if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
185
176
  return (0, _commands.focusTitle)(expandBefore.start)(state, dispatch, editorView);
186
177
  }
187
178
  return false;
@@ -61,7 +61,8 @@ var withTooltip = exports.withTooltip = function withTooltip(WrapperComponent) {
61
61
  };
62
62
  var CustomButton = exports.CustomButton = function CustomButton(props) {
63
63
  var allowInteractiveExpand = props.allowInteractiveExpand,
64
- expanded = props.expanded;
64
+ expanded = props.expanded,
65
+ intl = props.intl;
65
66
  var useTheme = (0, _react.useCallback)(
66
67
  // Ignored via go/ees005
67
68
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -79,6 +80,8 @@ var CustomButton = exports.CustomButton = function CustomButton(props) {
79
80
  })
80
81
  }, rest);
81
82
  }, [props]);
83
+ var label = expanded ? _ui.expandMessages.collapseNode : _ui.expandMessages.expandNode;
84
+ var labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
82
85
  return (0, _react2.jsx)(_customThemeButton.default, {
83
86
  appearance: "subtle"
84
87
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -90,6 +93,7 @@ var CustomButton = exports.CustomButton = function CustomButton(props) {
90
93
  }),
91
94
  shouldFitContainer: true,
92
95
  theme: useTheme,
96
+ "aria-label": labelIntl,
93
97
  "aria-expanded": expanded,
94
98
  isDisabled: !allowInteractiveExpand
95
99
  });
@@ -63,6 +63,10 @@ var ExpandButtonInner = exports.ExpandButtonInner = function ExpandButtonInner(p
63
63
  })
64
64
  }, rest);
65
65
  }, [props]);
66
+ var intl = props.intl,
67
+ expanded = props.expanded;
68
+ var label = expanded ? _ui.expandMessages.collapseNode : _ui.expandMessages.expandNode;
69
+ var labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
66
70
  return (0, _react2.jsx)(_customThemeButton.default, {
67
71
  appearance: "subtle"
68
72
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -74,6 +78,7 @@ var ExpandButtonInner = exports.ExpandButtonInner = function ExpandButtonInner(p
74
78
  }),
75
79
  shouldFitContainer: true,
76
80
  theme: useTheme,
81
+ "aria-label": labelIntl,
77
82
  "aria-expanded": props.expanded,
78
83
  isDisabled: !props.allowInteractiveExpand
79
84
  });
@@ -62,7 +62,7 @@ export const updateExpandTitle = ({
62
62
  const {
63
63
  tr
64
64
  } = state;
65
- if (__livePage && fg('platform.editor.live-pages-expand-divergence')) {
65
+ if (__livePage) {
66
66
  tr.step(new SetAttrsStep(pos, {
67
67
  ...node.attrs,
68
68
  title
@@ -89,7 +89,7 @@ export const toggleExpandExpanded = ({
89
89
  tr
90
90
  } = state;
91
91
  const isExpandedNext = !node.attrs.__expanded;
92
- if (__livePage && fg('platform.editor.live-pages-expand-divergence')) {
92
+ if (__livePage) {
93
93
  tr.step(new SetAttrsStep(pos, {
94
94
  ...node.attrs,
95
95
  __expanded: isExpandedNext
@@ -104,7 +104,7 @@ export const toggleExpandExpanded = ({
104
104
  // If we're going to collapse the expand and our cursor is currently inside
105
105
  // Move to a right gap cursor, if the toolbar is interacted (or an API),
106
106
  // it will insert below rather than inside (which will be invisible).
107
- if (__livePage && fg('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && findExpand(state)) {
107
+ if (__livePage ? isExpandedNext === true : isExpandedNext === false && findExpand(state)) {
108
108
  tr.setSelection(new GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), Side.RIGHT));
109
109
  }
110
110
 
@@ -116,7 +116,7 @@ export const toggleExpandExpanded = ({
116
116
  attributes: {
117
117
  platform: PLATFORMS.WEB,
118
118
  mode: MODE.EDITOR,
119
- expanded: __livePage && fg('platform.editor.live-pages-expand-divergence') ? !isExpandedNext : isExpandedNext
119
+ expanded: __livePage ? !isExpandedNext : isExpandedNext
120
120
  },
121
121
  eventType: EVENT_TYPE.TRACK
122
122
  };
@@ -9,7 +9,6 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
9
9
  import { redo, undo } from '@atlaskit/editor-prosemirror/history';
10
10
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
11
11
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
12
- import { fg } from '@atlaskit/platform-feature-flags';
13
12
  import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
14
13
  import { ExpandIconButton } from '../ui/ExpandIconButton';
15
14
  function buildExpandClassName(type, expanded) {
@@ -17,7 +16,7 @@ function buildExpandClassName(type, expanded) {
17
16
  }
18
17
  const toDOM = (node, __livePage, intl, titleReadOnly, contentEditable) => ['div', {
19
18
  // prettier-ignore
20
- 'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
19
+ 'class': buildExpandClassName(node.type.name, __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
21
20
  'data-node-type': node.type.name,
22
21
  'data-title': node.attrs.title
23
22
  }, ['div', {
@@ -263,7 +262,7 @@ export class ExpandNodeView {
263
262
  }
264
263
  });
265
264
  _defineProperty(this, "isCollapsed", () => {
266
- if (this.__livePage && fg('platform.editor.live-pages-expand-divergence')) {
265
+ if (this.__livePage) {
267
266
  return this.node.attrs.__expanded;
268
267
  }
269
268
  return !this.node.attrs.__expanded;
@@ -403,7 +402,7 @@ export class ExpandNodeView {
403
402
  return;
404
403
  });
405
404
  _defineProperty(this, "getContentEditable", node => {
406
- const contentEditable = this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
405
+ const contentEditable = this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
407
406
  if (this.api && this.api.editorDisabled) {
408
407
  var _this$api$editorDisab;
409
408
  return !((_this$api$editorDisab = this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
@@ -491,7 +490,7 @@ export class ExpandNodeView {
491
490
  this.nodeViewPortalProviderAPI.render(() => /*#__PURE__*/React.createElement(ExpandIconButton, {
492
491
  intl: intl,
493
492
  allowInteractiveExpand: this.allowInteractiveExpand,
494
- expanded: this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
493
+ expanded: this.__livePage ? !__expanded : __expanded
495
494
  }), this.icon, this.renderKey);
496
495
  }
497
496
  stopEvent(event) {
@@ -5,7 +5,6 @@ import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/uti
5
5
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { isInTable } from '@atlaskit/editor-tables/utils';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { deleteExpand, focusIcon, focusTitle } from '../commands';
10
9
  const isExpandNode = node => {
11
10
  return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
@@ -98,9 +97,7 @@ export function expandKeymap(api, options) {
98
97
  const {
99
98
  nodeBefore
100
99
  } = selection.$from;
101
- if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
102
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
103
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
100
+ if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
104
101
  const {
105
102
  $from
106
103
  } = selection;
@@ -128,9 +125,7 @@ export function expandKeymap(api, options) {
128
125
  const expandBefore = findExpand(state, sel);
129
126
  if (sel && expandBefore) {
130
127
  // moving cursor from outside of an expand to the title when it is collapsed
131
- if (
132
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
133
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
128
+ if (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
134
129
  return focusTitle(expandBefore.start)(state, dispatch, editorView);
135
130
  }
136
131
  // moving cursor from outside of an expand to the content when it is expanded
@@ -159,9 +154,7 @@ export function expandKeymap(api, options) {
159
154
  const {
160
155
  nodeAfter
161
156
  } = selection.$from;
162
- if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
163
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
164
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
157
+ if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
165
158
  const {
166
159
  $from
167
160
  } = selection;
@@ -203,9 +196,7 @@ export function expandKeymap(api, options) {
203
196
  // @see ED-7977
204
197
  const sel = Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
205
198
  const expandBefore = findExpand(state, sel);
206
- if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
207
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
208
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
199
+ if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
209
200
  return focusTitle(expandBefore.start)(state, dispatch, editorView);
210
201
  }
211
202
  return false;
@@ -40,7 +40,8 @@ export const withTooltip = WrapperComponent => {
40
40
  export const CustomButton = props => {
41
41
  const {
42
42
  allowInteractiveExpand,
43
- expanded
43
+ expanded,
44
+ intl
44
45
  } = props;
45
46
  const useTheme = useCallback(
46
47
  // Ignored via go/ees005
@@ -62,6 +63,8 @@ export const CustomButton = props => {
62
63
  ...rest
63
64
  };
64
65
  }, [props]);
66
+ const label = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
67
+ const labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
65
68
  return jsx(Button, {
66
69
  appearance: "subtle"
67
70
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -73,6 +76,7 @@ export const CustomButton = props => {
73
76
  }),
74
77
  shouldFitContainer: true,
75
78
  theme: useTheme,
79
+ "aria-label": labelIntl,
76
80
  "aria-expanded": expanded,
77
81
  isDisabled: !allowInteractiveExpand
78
82
  });
@@ -52,6 +52,12 @@ export const ExpandButtonInner = props => {
52
52
  ...rest
53
53
  };
54
54
  }, [props]);
55
+ const {
56
+ intl,
57
+ expanded
58
+ } = props;
59
+ const label = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
60
+ const labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
55
61
  return jsx(Button, {
56
62
  appearance: "subtle"
57
63
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -63,6 +69,7 @@ export const ExpandButtonInner = props => {
63
69
  }),
64
70
  shouldFitContainer: true,
65
71
  theme: useTheme,
72
+ "aria-label": labelIntl,
66
73
  "aria-expanded": props.expanded,
67
74
  isDisabled: !props.allowInteractiveExpand
68
75
  });
@@ -71,7 +71,7 @@ export var updateExpandTitle = function updateExpandTitle(_ref) {
71
71
  var node = state.doc.nodeAt(pos);
72
72
  if (node && node.type === nodeType && dispatch) {
73
73
  var tr = state.tr;
74
- if (__livePage && fg('platform.editor.live-pages-expand-divergence')) {
74
+ if (__livePage) {
75
75
  tr.step(new SetAttrsStep(pos, _objectSpread(_objectSpread({}, node.attrs), {}, {
76
76
  title: title
77
77
  })));
@@ -95,7 +95,7 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref2) {
95
95
  if (node && node.type === nodeType && dispatch) {
96
96
  var tr = state.tr;
97
97
  var isExpandedNext = !node.attrs.__expanded;
98
- if (__livePage && fg('platform.editor.live-pages-expand-divergence')) {
98
+ if (__livePage) {
99
99
  tr.step(new SetAttrsStep(pos, _objectSpread(_objectSpread({}, node.attrs), {}, {
100
100
  __expanded: isExpandedNext
101
101
  })));
@@ -108,7 +108,7 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref2) {
108
108
  // If we're going to collapse the expand and our cursor is currently inside
109
109
  // Move to a right gap cursor, if the toolbar is interacted (or an API),
110
110
  // it will insert below rather than inside (which will be invisible).
111
- if (__livePage && fg('platform.editor.live-pages-expand-divergence') ? isExpandedNext === true : isExpandedNext === false && findExpand(state)) {
111
+ if (__livePage ? isExpandedNext === true : isExpandedNext === false && findExpand(state)) {
112
112
  tr.setSelection(new GapCursorSelection(tr.doc.resolve(pos + node.nodeSize), Side.RIGHT));
113
113
  }
114
114
 
@@ -120,7 +120,7 @@ export var toggleExpandExpanded = function toggleExpandExpanded(_ref2) {
120
120
  attributes: {
121
121
  platform: PLATFORMS.WEB,
122
122
  mode: MODE.EDITOR,
123
- expanded: __livePage && fg('platform.editor.live-pages-expand-divergence') ? !isExpandedNext : isExpandedNext
123
+ expanded: __livePage ? !isExpandedNext : isExpandedNext
124
124
  },
125
125
  eventType: EVENT_TYPE.TRACK
126
126
  };
@@ -11,7 +11,6 @@ import { closestElement, isEmptyNode } from '@atlaskit/editor-common/utils';
11
11
  import { redo, undo } from '@atlaskit/editor-prosemirror/history';
12
12
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
13
13
  import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { deleteExpandAtPos, setSelectionInsideExpand, toggleExpandExpanded, updateExpandTitle } from '../commands';
16
15
  import { ExpandIconButton } from '../ui/ExpandIconButton';
17
16
  function buildExpandClassName(type, expanded) {
@@ -20,7 +19,7 @@ function buildExpandClassName(type, expanded) {
20
19
  var toDOM = function toDOM(node, __livePage, intl, titleReadOnly, contentEditable) {
21
20
  return ['div', {
22
21
  // prettier-ignore
23
- 'class': buildExpandClassName(node.type.name, __livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded),
22
+ 'class': buildExpandClassName(node.type.name, __livePage ? !node.attrs.__expanded : node.attrs.__expanded),
24
23
  'data-node-type': node.type.name,
25
24
  'data-title': node.attrs.title
26
25
  }, ['div', {
@@ -264,7 +263,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
264
263
  }
265
264
  });
266
265
  _defineProperty(this, "isCollapsed", function () {
267
- if (_this.__livePage && fg('platform.editor.live-pages-expand-divergence')) {
266
+ if (_this.__livePage) {
268
267
  return _this.node.attrs.__expanded;
269
268
  }
270
269
  return !_this.node.attrs.__expanded;
@@ -394,7 +393,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
394
393
  return;
395
394
  });
396
395
  _defineProperty(this, "getContentEditable", function (node) {
397
- var contentEditable = _this.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !node.attrs.__expanded : node.attrs.__expanded;
396
+ var contentEditable = _this.__livePage ? !node.attrs.__expanded : node.attrs.__expanded;
398
397
  if (_this.api && _this.api.editorDisabled) {
399
398
  var _this$api$editorDisab;
400
399
  return !((_this$api$editorDisab = _this.api.editorDisabled.sharedState.currentState()) !== null && _this$api$editorDisab !== void 0 && _this$api$editorDisab.editorDisabled) && contentEditable;
@@ -487,7 +486,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
487
486
  return /*#__PURE__*/React.createElement(ExpandIconButton, {
488
487
  intl: intl,
489
488
  allowInteractiveExpand: _this3.allowInteractiveExpand,
490
- expanded: _this3.__livePage && fg('platform.editor.live-pages-expand-divergence') ? !__expanded : __expanded
489
+ expanded: _this3.__livePage ? !__expanded : __expanded
491
490
  });
492
491
  }, this.icon, this.renderKey);
493
492
  }
@@ -5,7 +5,6 @@ import { isEmptyNode, isPositionNearTableRow } from '@atlaskit/editor-common/uti
5
5
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
6
6
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { isInTable } from '@atlaskit/editor-tables/utils';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { deleteExpand, focusIcon, focusTitle } from '../commands';
10
9
  var isExpandNode = function isExpandNode(node) {
11
10
  return (node === null || node === void 0 ? void 0 : node.type.name) === 'expand' || (node === null || node === void 0 ? void 0 : node.type.name) === 'nestedExpand';
@@ -86,9 +85,7 @@ export function expandKeymap(api, options) {
86
85
  var selection = state.selection,
87
86
  schema = state.schema;
88
87
  var nodeBefore = selection.$from.nodeBefore;
89
- if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (
90
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
91
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
88
+ if (selection instanceof GapCursorSelection && selection.side === Side.RIGHT && nodeBefore && (nodeBefore.type === schema.nodes.expand || nodeBefore.type === schema.nodes.nestedExpand) && (options.__livePage ? nodeBefore.attrs.__expanded : !nodeBefore.attrs.__expanded)) {
92
89
  var _$from = selection.$from;
93
90
  return focusTitle(Math.max(_$from.pos - 1, 0))(state, dispatch, editorView);
94
91
  }
@@ -112,9 +109,7 @@ export function expandKeymap(api, options) {
112
109
  var expandBefore = findExpand(state, sel);
113
110
  if (sel && expandBefore) {
114
111
  // moving cursor from outside of an expand to the title when it is collapsed
115
- if (
116
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
117
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
112
+ if (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded) {
118
113
  return focusTitle(expandBefore.start)(state, dispatch, editorView);
119
114
  }
120
115
  // moving cursor from outside of an expand to the content when it is expanded
@@ -138,9 +133,7 @@ export function expandKeymap(api, options) {
138
133
  nestedExpand = _state$schema$nodes.nestedExpand;
139
134
  var selection = state.selection;
140
135
  var nodeAfter = selection.$from.nodeAfter;
141
- if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (
142
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
143
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
136
+ if (selection instanceof GapCursorSelection && selection.side === Side.LEFT && nodeAfter && (nodeAfter.type === expand || nodeAfter.type === nestedExpand) && (options.__livePage ? nodeAfter.attrs.__expanded : !nodeAfter.attrs.__expanded)) {
144
137
  var $from = selection.$from;
145
138
  return focusTitle($from.pos + 1)(state, dispatch, editorView);
146
139
  }
@@ -173,9 +166,7 @@ export function expandKeymap(api, options) {
173
166
  // @see ED-7977
174
167
  var sel = Selection.findFrom(state.doc.resolve(Math.max(selection.$from.pos - 1, 0)), -1);
175
168
  var expandBefore = findExpand(state, sel);
176
- if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (
177
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
178
- fg('platform.editor.live-pages-expand-divergence') && options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
169
+ if (expandBefore && (expandBefore.node.type === expand || expandBefore.node.type === nestedExpand) && (options.__livePage ? expandBefore.node.attrs.__expanded : !expandBefore.node.attrs.__expanded)) {
179
170
  return focusTitle(expandBefore.start)(state, dispatch, editorView);
180
171
  }
181
172
  return false;
@@ -54,7 +54,8 @@ export var withTooltip = function withTooltip(WrapperComponent) {
54
54
  };
55
55
  export var CustomButton = function CustomButton(props) {
56
56
  var allowInteractiveExpand = props.allowInteractiveExpand,
57
- expanded = props.expanded;
57
+ expanded = props.expanded,
58
+ intl = props.intl;
58
59
  var useTheme = useCallback(
59
60
  // Ignored via go/ees005
60
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -72,6 +73,8 @@ export var CustomButton = function CustomButton(props) {
72
73
  })
73
74
  }, rest);
74
75
  }, [props]);
76
+ var label = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
77
+ var labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
75
78
  return jsx(Button, {
76
79
  appearance: "subtle"
77
80
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -83,6 +86,7 @@ export var CustomButton = function CustomButton(props) {
83
86
  }),
84
87
  shouldFitContainer: true,
85
88
  theme: useTheme,
89
+ "aria-label": labelIntl,
86
90
  "aria-expanded": expanded,
87
91
  isDisabled: !allowInteractiveExpand
88
92
  });
@@ -54,6 +54,10 @@ export var ExpandButtonInner = function ExpandButtonInner(props) {
54
54
  })
55
55
  }, rest);
56
56
  }, [props]);
57
+ var intl = props.intl,
58
+ expanded = props.expanded;
59
+ var label = expanded ? expandMessages.collapseNode : expandMessages.expandNode;
60
+ var labelIntl = intl ? intl.formatMessage(label) : label.defaultMessage;
57
61
  return jsx(Button, {
58
62
  appearance: "subtle"
59
63
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -65,6 +69,7 @@ export var ExpandButtonInner = function ExpandButtonInner(props) {
65
69
  }),
66
70
  shouldFitContainer: true,
67
71
  theme: useTheme,
72
+ "aria-label": labelIntl,
68
73
  "aria-expanded": props.expanded,
69
74
  isDisabled: !props.allowInteractiveExpand
70
75
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-expand",
3
- "version": "3.2.11",
3
+ "version": "3.2.12",
4
4
  "description": "Expand plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,21 +34,21 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/adf-schema": "^47.6.0",
37
- "@atlaskit/button": "^23.0.0",
38
- "@atlaskit/editor-common": "^105.0.0",
39
- "@atlaskit/editor-plugin-analytics": "^2.2.0",
37
+ "@atlaskit/button": "^23.2.0",
38
+ "@atlaskit/editor-common": "^105.8.0",
39
+ "@atlaskit/editor-plugin-analytics": "^2.3.0",
40
40
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
41
41
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
42
42
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
43
43
  "@atlaskit/editor-plugin-selection": "^2.2.0",
44
- "@atlaskit/editor-plugin-selection-marker": "^2.3.0",
44
+ "@atlaskit/editor-plugin-selection-marker": "^2.4.0",
45
45
  "@atlaskit/editor-prosemirror": "7.0.0",
46
46
  "@atlaskit/editor-shared-styles": "^3.4.0",
47
47
  "@atlaskit/editor-tables": "^2.9.0",
48
- "@atlaskit/icon": "^26.0.0",
48
+ "@atlaskit/icon": "^26.1.0",
49
49
  "@atlaskit/platform-feature-flags": "^1.1.0",
50
- "@atlaskit/tmp-editor-statsig": "^4.19.0",
51
- "@atlaskit/tokens": "^4.8.0",
50
+ "@atlaskit/tmp-editor-statsig": "^4.24.0",
51
+ "@atlaskit/tokens": "^4.9.0",
52
52
  "@atlaskit/tooltip": "^20.0.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1",
@@ -65,8 +65,8 @@
65
65
  "@atlaskit/editor-plugin-content-insertion": "^2.1.0",
66
66
  "@atlaskit/editor-plugin-guideline": "^2.0.0",
67
67
  "@atlaskit/editor-plugin-quick-insert": "^2.5.0",
68
- "@atlaskit/editor-plugin-table": "^10.9.0",
69
- "@atlaskit/editor-plugin-type-ahead": "^2.6.0",
68
+ "@atlaskit/editor-plugin-table": "^10.10.0",
69
+ "@atlaskit/editor-plugin-type-ahead": "^2.7.0",
70
70
  "@atlaskit/editor-plugin-width": "^3.0.0",
71
71
  "@testing-library/react": "^13.4.0",
72
72
  "react-test-renderer": "^18.2.0",
@@ -106,9 +106,6 @@
106
106
  }
107
107
  },
108
108
  "platform-feature-flags": {
109
- "platform.editor.live-pages-expand-divergence": {
110
- "type": "boolean"
111
- },
112
109
  "platform-editor-single-player-expand": {
113
110
  "type": "boolean"
114
111
  },