@atlaskit/editor-plugin-tasks-and-decisions 11.1.7 → 11.2.0

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,16 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 11.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b50791532c24a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b50791532c24a) -
8
+ [FFCLEANUP-79900] Remove experiment editor_refactor_backspace_task_and_decisions
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 11.1.7
4
15
 
5
16
  ### Patch Changes
@@ -20,7 +20,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
22
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
23
  var _commands2 = require("./commands");
25
24
  var _helpers = require("./helpers");
26
25
  var _insertCommands = require("./insert-commands");
@@ -147,100 +146,61 @@ var getIndentCommand = exports.getIndentCommand = function getIndentCommand(edit
147
146
  var backspaceFrom = function backspaceFrom(editorAnalyticsAPI) {
148
147
  return function ($from) {
149
148
  return function (state, dispatch) {
149
+ var _nodeBefore$firstChil, _nodeBefore$firstChil2;
150
150
  var _state$schema$nodes3 = state.schema.nodes,
151
151
  taskList = _state$schema$nodes3.taskList,
152
152
  blockTaskItem = _state$schema$nodes3.blockTaskItem,
153
153
  paragraph = _state$schema$nodes3.paragraph;
154
- if ((0, _expValEquals.expValEquals)('editor_refactor_backspace_task_and_decisions', 'isEnabled', true)) {
155
- var _nodeBefore$firstChil, _nodeBefore$firstChil2;
156
- // Check if selection is inside a blockTaskItem paragraph
157
- var resultOfFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($from);
158
- var isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
159
-
160
- // Get the node before the current position
161
- var beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
162
- var nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
163
-
164
- // Check if the node before is an empty task item
165
- var isEmptyActionOrDecisionItem = nodeBefore && (0, _helpers.isActionOrDecisionItem)(nodeBefore) && nodeBefore.content.size === 0;
166
- var isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 || (_nodeBefore$firstChil2 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : _nodeBefore$firstChil2.size) === 0;
167
-
168
- // previous was empty, just delete backwards
169
- if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
170
- return false;
171
- }
172
154
 
173
- // If nested in a taskList, unindent
174
- var depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
175
- var depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
176
- var parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
177
- if ($from.node(parentDepth).type === taskList) {
178
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
179
- }
155
+ // Check if selection is inside a blockTaskItem paragraph
156
+ var resultOfFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($from);
157
+ var isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
180
158
 
181
- // If at the end of an item, unwrap contents into a paragraph
182
- // we achieve this by slicing the content out, and replacing
183
- if (actionDecisionFollowsOrNothing($from)) {
184
- if (dispatch) {
185
- // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
186
- // So we reduce the depth by 1 to get to the blockTaskItem node content
187
- var taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
188
- var slice;
189
- try {
190
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
191
- // might be end of document after
192
- var tr = splitListItemWith(state.tr, slice, $from, true);
193
- dispatch(tr);
194
- return true;
195
- } catch (_unused) {
196
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
197
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
198
- // So if the selection is in a blockTaskItem, just pass the content as is
199
- if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
200
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
201
- slice = Array.from(taskContent.content);
202
- var _tr = splitListItemWith(state.tr, slice, $from, true);
203
- dispatch(_tr);
204
- return true;
205
- }
206
- }
207
- }
208
- }
209
- } else {
210
- // previous was empty, just delete backwards
211
- var taskBefore = $from.doc.resolve($from.before());
212
- if (taskBefore.nodeBefore && (0, _helpers.isActionOrDecisionItem)(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
213
- return false;
214
- }
159
+ // Get the node before the current position
160
+ var beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
161
+ var nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
215
162
 
216
- // if nested, just unindent
217
- if ($from.node($from.depth - 2).type === taskList) {
218
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
219
- }
163
+ // Check if the node before is an empty task item
164
+ var isEmptyActionOrDecisionItem = nodeBefore && (0, _helpers.isActionOrDecisionItem)(nodeBefore) && nodeBefore.content.size === 0;
165
+ var isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 || (_nodeBefore$firstChil2 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : _nodeBefore$firstChil2.size) === 0;
166
+
167
+ // previous was empty, just delete backwards
168
+ if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
169
+ return false;
170
+ }
220
171
 
221
- // If at the end of an item, unwrap contents into a paragraph
222
- // we achieve this by slicing the content out, and replacing
223
- if (actionDecisionFollowsOrNothing($from)) {
224
- if (dispatch) {
225
- var _taskContent = state.doc.slice($from.start(), $from.end()).content;
226
- var _slice;
227
- try {
228
- _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : paragraph.createChecked();
229
-
230
- // might be end of document after
231
- var _tr2 = splitListItemWith(state.tr, _slice, $from, true);
232
- dispatch(_tr2);
172
+ // If nested in a taskList, unindent
173
+ var depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
174
+ var depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
175
+ var parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
176
+ if ($from.node(parentDepth).type === taskList) {
177
+ return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
178
+ }
179
+
180
+ // If at the end of an item, unwrap contents into a paragraph
181
+ // we achieve this by slicing the content out, and replacing
182
+ if (actionDecisionFollowsOrNothing($from)) {
183
+ if (dispatch) {
184
+ // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
185
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
186
+ var taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
187
+ var slice;
188
+ try {
189
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
190
+ // might be end of document after
191
+ var tr = splitListItemWith(state.tr, slice, $from, true);
192
+ dispatch(tr);
193
+ return true;
194
+ } catch (_unused) {
195
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
196
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
197
+ // So if the selection is in a blockTaskItem, just pass the content as is
198
+ if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
199
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
200
+ slice = Array.from(taskContent.content);
201
+ var _tr = splitListItemWith(state.tr, slice, $from, true);
202
+ dispatch(_tr);
233
203
  return true;
234
- } catch (_unused2) {
235
- // If there's an error creating a paragraph, then just pass the content as is
236
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
237
- if (blockTaskItem) {
238
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
239
- _slice = Array.from(_taskContent.content);
240
- var _tr3 = splitListItemWith(state.tr, _slice, $from, true);
241
- dispatch(_tr3);
242
- return true;
243
- }
244
204
  }
245
205
  }
246
206
  }
@@ -330,10 +290,10 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
330
290
  slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
331
291
 
332
292
  // might be end of document after
333
- var _tr4 = splitListItemWith(state.tr, slice, $next, false);
334
- dispatch(_tr4);
293
+ var _tr2 = splitListItemWith(state.tr, slice, $next, false);
294
+ dispatch(_tr2);
335
295
  return true;
336
- } catch (_unused3) {
296
+ } catch (_unused2) {
337
297
  // If there's an error creating a paragraph, check if we are in a blockTaskItem
338
298
  // Block task item's can have non-text content that cannot be wrapped in a paragraph
339
299
  // So if the selection is in a blockTaskItem, just pass the content as is
@@ -346,8 +306,8 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
346
306
  // set $next to the resolved position of inside the textblock
347
307
  $splitPos = $next.doc.resolve($next.pos + 1);
348
308
  }
349
- var _tr5 = splitListItemWith(state.tr, slice, $splitPos, false);
350
- dispatch(_tr5);
309
+ var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
310
+ dispatch(_tr3);
351
311
  return true;
352
312
  }
353
313
  }
@@ -380,11 +340,11 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
380
340
  if (!(0, _helpers.isTable)(_$next.nodeAfter) && (0, _helpers.isActionOrDecisionItem)($from.parent) && actionDecisionFollowsOrNothing($from) &&
381
341
  // only forward delete if the node is same type
382
342
  _$next.node().type.name === $from.node().type.name) {
383
- var _taskContent2 = state.doc.slice(_$next.start(), _$next.end()).content;
343
+ var _taskContent = state.doc.slice(_$next.start(), _$next.end()).content;
384
344
 
385
345
  // might be end of document after
386
- var _slice2 = _taskContent2.size ? paragraph.createChecked(undefined, _taskContent2) : [];
387
- dispatch(splitListItemWith(tr, _slice2, _$next, false));
346
+ var _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : [];
347
+ dispatch(splitListItemWith(tr, _slice, _$next, false));
388
348
  return true;
389
349
  }
390
350
  }
@@ -170,7 +170,9 @@ var RequestToEditPopup = exports.RequestToEditPopup = function RequestToEditPopu
170
170
  onClick: onHandleEdit
171
171
  }), /*#__PURE__*/React.createElement("div", {
172
172
  className: (0, _runtime.ax)(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
173
- }), /*#__PURE__*/React.createElement(_compiled.Box, null, /*#__PURE__*/React.createElement(_compiled.Pressable, {
173
+ }), /*#__PURE__*/React.createElement(_compiled.Box, null, /*#__PURE__*/React.createElement(_compiled.Pressable
174
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
175
+ , {
174
176
  onClick: function onClick() {
175
177
  var _api$analytics2;
176
178
  return onHandleDismiss(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
@@ -89,6 +89,7 @@ var TaskItemWithProviders = exports.default = /*#__PURE__*/function (_Component)
89
89
  case 8:
90
90
  _context.prev = 8;
91
91
  _context.t0 = _context["catch"](1);
92
+ // eslint-disable-line no-unused-vars
92
93
  if (this.mounted) {
93
94
  this.setState({
94
95
  resolvedContextProvider: undefined
@@ -116,12 +117,14 @@ var TaskItemWithProviders = exports.default = /*#__PURE__*/function (_Component)
116
117
  key: "render",
117
118
  value: function render() {
118
119
  var _this$props = this.props,
119
- contextIdentifierProvider = _this$props.contextIdentifierProvider,
120
+ _contextIdentifierProvider = _this$props.contextIdentifierProvider,
120
121
  otherProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
121
122
  var _ref = this.state.resolvedContextProvider || {},
122
123
  objectId = _ref.objectId;
123
124
  var userContext = objectId ? 'edit' : 'new';
124
- return /*#__PURE__*/_react.default.createElement(_analyticsNamespacedContext.FabricElementsAnalyticsContext, {
125
+ return /*#__PURE__*/_react.default.createElement(_analyticsNamespacedContext.FabricElementsAnalyticsContext
126
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
127
+ , {
125
128
  data: {
126
129
  userContext: userContext
127
130
  }
@@ -11,7 +11,6 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
11
11
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
12
12
  import { findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
14
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
16
15
  import { findFirstParentListNode, getBlockRange, getCurrentIndentLevel, getTaskItemIndex, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInFirstTextblockOfBlockTaskItem, isInLastTextblockOfBlockTaskItem, isInsideDecision, isInsideTask, isInsideTaskOrDecisionItem, isTable, liftBlock, walkOut } from './helpers';
17
16
  import { insertTaskDecisionWithAnalytics } from './insert-commands';
@@ -122,101 +121,62 @@ export const getIndentCommand = editorAnalyticsAPI => (inputMethod = INPUT_METHO
122
121
  return withAnalytics(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
123
122
  });
124
123
  const backspaceFrom = editorAnalyticsAPI => $from => (state, dispatch) => {
124
+ var _nodeBefore$firstChil, _nodeBefore$firstChil2, _nodeBefore$firstChil3;
125
125
  const {
126
126
  taskList,
127
127
  blockTaskItem,
128
128
  paragraph
129
129
  } = state.schema.nodes;
130
- if (expValEquals('editor_refactor_backspace_task_and_decisions', 'isEnabled', true)) {
131
- var _nodeBefore$firstChil, _nodeBefore$firstChil2, _nodeBefore$firstChil3;
132
- // Check if selection is inside a blockTaskItem paragraph
133
- const resultOfFindBlockTaskItem = findBlockTaskItem($from);
134
- const isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
135
-
136
- // Get the node before the current position
137
- const beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
138
- const nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
139
-
140
- // Check if the node before is an empty task item
141
- const isEmptyActionOrDecisionItem = nodeBefore && isActionOrDecisionItem(nodeBefore) && nodeBefore.content.size === 0;
142
- const isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 ? void 0 : (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : (_nodeBefore$firstChil3 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil3 === void 0 ? void 0 : _nodeBefore$firstChil3.size) === 0;
143
-
144
- // previous was empty, just delete backwards
145
- if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
146
- return false;
147
- }
148
130
 
149
- // If nested in a taskList, unindent
150
- const depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
151
- const depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
152
- const parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
153
- if ($from.node(parentDepth).type === taskList) {
154
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
155
- }
131
+ // Check if selection is inside a blockTaskItem paragraph
132
+ const resultOfFindBlockTaskItem = findBlockTaskItem($from);
133
+ const isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
156
134
 
157
- // If at the end of an item, unwrap contents into a paragraph
158
- // we achieve this by slicing the content out, and replacing
159
- if (actionDecisionFollowsOrNothing($from)) {
160
- if (dispatch) {
161
- // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
162
- // So we reduce the depth by 1 to get to the blockTaskItem node content
163
- const taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
164
- let slice;
165
- try {
166
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
167
- // might be end of document after
168
- const tr = splitListItemWith(state.tr, slice, $from, true);
169
- dispatch(tr);
170
- return true;
171
- } catch {
172
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
173
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
174
- // So if the selection is in a blockTaskItem, just pass the content as is
175
- if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
176
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
177
- slice = Array.from(taskContent.content);
178
- const tr = splitListItemWith(state.tr, slice, $from, true);
179
- dispatch(tr);
180
- return true;
181
- }
182
- }
183
- }
184
- }
185
- } else {
186
- // previous was empty, just delete backwards
187
- const taskBefore = $from.doc.resolve($from.before());
188
- if (taskBefore.nodeBefore && isActionOrDecisionItem(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
189
- return false;
190
- }
135
+ // Get the node before the current position
136
+ const beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
137
+ const nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
191
138
 
192
- // if nested, just unindent
193
- if ($from.node($from.depth - 2).type === taskList) {
194
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
195
- }
139
+ // Check if the node before is an empty task item
140
+ const isEmptyActionOrDecisionItem = nodeBefore && isActionOrDecisionItem(nodeBefore) && nodeBefore.content.size === 0;
141
+ const isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 ? void 0 : (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : (_nodeBefore$firstChil3 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil3 === void 0 ? void 0 : _nodeBefore$firstChil3.size) === 0;
196
142
 
197
- // If at the end of an item, unwrap contents into a paragraph
198
- // we achieve this by slicing the content out, and replacing
199
- if (actionDecisionFollowsOrNothing($from)) {
200
- if (dispatch) {
201
- const taskContent = state.doc.slice($from.start(), $from.end()).content;
202
- let slice;
203
- try {
204
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
143
+ // previous was empty, just delete backwards
144
+ if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
145
+ return false;
146
+ }
205
147
 
206
- // might be end of document after
148
+ // If nested in a taskList, unindent
149
+ const depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
150
+ const depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
151
+ const parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
152
+ if ($from.node(parentDepth).type === taskList) {
153
+ return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
154
+ }
155
+
156
+ // If at the end of an item, unwrap contents into a paragraph
157
+ // we achieve this by slicing the content out, and replacing
158
+ if (actionDecisionFollowsOrNothing($from)) {
159
+ if (dispatch) {
160
+ // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
161
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
162
+ const taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
163
+ let slice;
164
+ try {
165
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
166
+ // might be end of document after
167
+ const tr = splitListItemWith(state.tr, slice, $from, true);
168
+ dispatch(tr);
169
+ return true;
170
+ } catch {
171
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
172
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
173
+ // So if the selection is in a blockTaskItem, just pass the content as is
174
+ if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
175
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
176
+ slice = Array.from(taskContent.content);
207
177
  const tr = splitListItemWith(state.tr, slice, $from, true);
208
178
  dispatch(tr);
209
179
  return true;
210
- } catch {
211
- // If there's an error creating a paragraph, then just pass the content as is
212
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
213
- if (blockTaskItem) {
214
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
215
- slice = Array.from(taskContent.content);
216
- const tr = splitListItemWith(state.tr, slice, $from, true);
217
- dispatch(tr);
218
- return true;
219
- }
220
180
  }
221
181
  }
222
182
  }
@@ -155,7 +155,9 @@ export const RequestToEditPopup = ({
155
155
  onClick: onHandleEdit
156
156
  }), /*#__PURE__*/React.createElement("div", {
157
157
  className: ax(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
158
- }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
158
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable
159
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
160
+ , {
159
161
  onClick: () => {
160
162
  var _api$analytics2;
161
163
  return onHandleDismiss(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
@@ -39,6 +39,7 @@ export default class TaskItemWithProviders extends Component {
39
39
  });
40
40
  }
41
41
  } catch (err) {
42
+ // eslint-disable-line no-unused-vars
42
43
  if (this.mounted) {
43
44
  this.setState({
44
45
  resolvedContextProvider: undefined
@@ -53,14 +54,16 @@ export default class TaskItemWithProviders extends Component {
53
54
  }
54
55
  render() {
55
56
  const {
56
- contextIdentifierProvider,
57
+ contextIdentifierProvider: _contextIdentifierProvider,
57
58
  ...otherProps
58
59
  } = this.props;
59
60
  const {
60
61
  objectId
61
62
  } = this.state.resolvedContextProvider || {};
62
63
  const userContext = objectId ? 'edit' : 'new';
63
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
64
+ return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext
65
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
66
+ , {
64
67
  data: {
65
68
  userContext
66
69
  }
@@ -14,7 +14,6 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
14
14
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
15
15
  import { findParentNodeOfType, findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
16
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
17
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
19
18
  import { findFirstParentListNode, getBlockRange, getCurrentIndentLevel, getTaskItemIndex, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInFirstTextblockOfBlockTaskItem, isInLastTextblockOfBlockTaskItem, isInsideDecision, isInsideTask, isInsideTaskOrDecisionItem, isTable, liftBlock, walkOut } from './helpers';
20
19
  import { insertTaskDecisionWithAnalytics } from './insert-commands';
@@ -139,100 +138,61 @@ export var getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
139
138
  var backspaceFrom = function backspaceFrom(editorAnalyticsAPI) {
140
139
  return function ($from) {
141
140
  return function (state, dispatch) {
141
+ var _nodeBefore$firstChil, _nodeBefore$firstChil2;
142
142
  var _state$schema$nodes3 = state.schema.nodes,
143
143
  taskList = _state$schema$nodes3.taskList,
144
144
  blockTaskItem = _state$schema$nodes3.blockTaskItem,
145
145
  paragraph = _state$schema$nodes3.paragraph;
146
- if (expValEquals('editor_refactor_backspace_task_and_decisions', 'isEnabled', true)) {
147
- var _nodeBefore$firstChil, _nodeBefore$firstChil2;
148
- // Check if selection is inside a blockTaskItem paragraph
149
- var resultOfFindBlockTaskItem = findBlockTaskItem($from);
150
- var isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
151
-
152
- // Get the node before the current position
153
- var beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
154
- var nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
155
-
156
- // Check if the node before is an empty task item
157
- var isEmptyActionOrDecisionItem = nodeBefore && isActionOrDecisionItem(nodeBefore) && nodeBefore.content.size === 0;
158
- var isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 || (_nodeBefore$firstChil2 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : _nodeBefore$firstChil2.size) === 0;
159
-
160
- // previous was empty, just delete backwards
161
- if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
162
- return false;
163
- }
164
146
 
165
- // If nested in a taskList, unindent
166
- var depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
167
- var depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
168
- var parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
169
- if ($from.node(parentDepth).type === taskList) {
170
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
171
- }
147
+ // Check if selection is inside a blockTaskItem paragraph
148
+ var resultOfFindBlockTaskItem = findBlockTaskItem($from);
149
+ var isInBlockTaskItemParagraph = resultOfFindBlockTaskItem && (resultOfFindBlockTaskItem === null || resultOfFindBlockTaskItem === void 0 ? void 0 : resultOfFindBlockTaskItem.hasParagraph);
172
150
 
173
- // If at the end of an item, unwrap contents into a paragraph
174
- // we achieve this by slicing the content out, and replacing
175
- if (actionDecisionFollowsOrNothing($from)) {
176
- if (dispatch) {
177
- // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
178
- // So we reduce the depth by 1 to get to the blockTaskItem node content
179
- var taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
180
- var slice;
181
- try {
182
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
183
- // might be end of document after
184
- var tr = splitListItemWith(state.tr, slice, $from, true);
185
- dispatch(tr);
186
- return true;
187
- } catch (_unused) {
188
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
189
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
190
- // So if the selection is in a blockTaskItem, just pass the content as is
191
- if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
192
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
193
- slice = Array.from(taskContent.content);
194
- var _tr = splitListItemWith(state.tr, slice, $from, true);
195
- dispatch(_tr);
196
- return true;
197
- }
198
- }
199
- }
200
- }
201
- } else {
202
- // previous was empty, just delete backwards
203
- var taskBefore = $from.doc.resolve($from.before());
204
- if (taskBefore.nodeBefore && isActionOrDecisionItem(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
205
- return false;
206
- }
151
+ // Get the node before the current position
152
+ var beforePos = isInBlockTaskItemParagraph ? $from.before() - 1 : $from.before();
153
+ var nodeBefore = $from.doc.resolve(beforePos).nodeBefore;
207
154
 
208
- // if nested, just unindent
209
- if ($from.node($from.depth - 2).type === taskList) {
210
- return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
211
- }
155
+ // Check if the node before is an empty task item
156
+ var isEmptyActionOrDecisionItem = nodeBefore && isActionOrDecisionItem(nodeBefore) && nodeBefore.content.size === 0;
157
+ var isEmptyBlockTaskItem = blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil = nodeBefore.firstChild) === null || _nodeBefore$firstChil === void 0 ? void 0 : _nodeBefore$firstChil.type) === paragraph && (nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$firstChil2 = nodeBefore.firstChild) === null || _nodeBefore$firstChil2 === void 0 || (_nodeBefore$firstChil2 = _nodeBefore$firstChil2.content) === null || _nodeBefore$firstChil2 === void 0 ? void 0 : _nodeBefore$firstChil2.size) === 0;
158
+
159
+ // previous was empty, just delete backwards
160
+ if (isEmptyActionOrDecisionItem || isEmptyBlockTaskItem) {
161
+ return false;
162
+ }
212
163
 
213
- // If at the end of an item, unwrap contents into a paragraph
214
- // we achieve this by slicing the content out, and replacing
215
- if (actionDecisionFollowsOrNothing($from)) {
216
- if (dispatch) {
217
- var _taskContent = state.doc.slice($from.start(), $from.end()).content;
218
- var _slice;
219
- try {
220
- _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : paragraph.createChecked();
221
-
222
- // might be end of document after
223
- var _tr2 = splitListItemWith(state.tr, _slice, $from, true);
224
- dispatch(_tr2);
164
+ // If nested in a taskList, unindent
165
+ var depthFromSelectionToBlockTaskItem = isInBlockTaskItemParagraph ? 2 : 1;
166
+ var depthFromSelectionToNestedTaskList = depthFromSelectionToBlockTaskItem + 1;
167
+ var parentDepth = $from.depth - depthFromSelectionToNestedTaskList;
168
+ if ($from.node(parentDepth).type === taskList) {
169
+ return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
170
+ }
171
+
172
+ // If at the end of an item, unwrap contents into a paragraph
173
+ // we achieve this by slicing the content out, and replacing
174
+ if (actionDecisionFollowsOrNothing($from)) {
175
+ if (dispatch) {
176
+ // If we are in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
177
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
178
+ var taskContent = isInBlockTaskItemParagraph ? state.doc.slice($from.start($from.depth - 1), $from.end($from.depth - 1)).content : state.doc.slice($from.start(), $from.end()).content;
179
+ var slice;
180
+ try {
181
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
182
+ // might be end of document after
183
+ var tr = splitListItemWith(state.tr, slice, $from, true);
184
+ dispatch(tr);
185
+ return true;
186
+ } catch (_unused) {
187
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
188
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
189
+ // So if the selection is in a blockTaskItem, just pass the content as is
190
+ if (resultOfFindBlockTaskItem && resultOfFindBlockTaskItem.blockTaskItemNode) {
191
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
192
+ slice = Array.from(taskContent.content);
193
+ var _tr = splitListItemWith(state.tr, slice, $from, true);
194
+ dispatch(_tr);
225
195
  return true;
226
- } catch (_unused2) {
227
- // If there's an error creating a paragraph, then just pass the content as is
228
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
229
- if (blockTaskItem) {
230
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
231
- _slice = Array.from(_taskContent.content);
232
- var _tr3 = splitListItemWith(state.tr, _slice, $from, true);
233
- dispatch(_tr3);
234
- return true;
235
- }
236
196
  }
237
197
  }
238
198
  }
@@ -322,10 +282,10 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
322
282
  slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
323
283
 
324
284
  // might be end of document after
325
- var _tr4 = splitListItemWith(state.tr, slice, $next, false);
326
- dispatch(_tr4);
285
+ var _tr2 = splitListItemWith(state.tr, slice, $next, false);
286
+ dispatch(_tr2);
327
287
  return true;
328
- } catch (_unused3) {
288
+ } catch (_unused2) {
329
289
  // If there's an error creating a paragraph, check if we are in a blockTaskItem
330
290
  // Block task item's can have non-text content that cannot be wrapped in a paragraph
331
291
  // So if the selection is in a blockTaskItem, just pass the content as is
@@ -338,8 +298,8 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
338
298
  // set $next to the resolved position of inside the textblock
339
299
  $splitPos = $next.doc.resolve($next.pos + 1);
340
300
  }
341
- var _tr5 = splitListItemWith(state.tr, slice, $splitPos, false);
342
- dispatch(_tr5);
301
+ var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
302
+ dispatch(_tr3);
343
303
  return true;
344
304
  }
345
305
  }
@@ -372,11 +332,11 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
372
332
  if (!isTable(_$next.nodeAfter) && isActionOrDecisionItem($from.parent) && actionDecisionFollowsOrNothing($from) &&
373
333
  // only forward delete if the node is same type
374
334
  _$next.node().type.name === $from.node().type.name) {
375
- var _taskContent2 = state.doc.slice(_$next.start(), _$next.end()).content;
335
+ var _taskContent = state.doc.slice(_$next.start(), _$next.end()).content;
376
336
 
377
337
  // might be end of document after
378
- var _slice2 = _taskContent2.size ? paragraph.createChecked(undefined, _taskContent2) : [];
379
- dispatch(splitListItemWith(tr, _slice2, _$next, false));
338
+ var _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : [];
339
+ dispatch(splitListItemWith(tr, _slice, _$next, false));
380
340
  return true;
381
341
  }
382
342
  }
@@ -161,7 +161,9 @@ export var RequestToEditPopup = function RequestToEditPopup(_ref2) {
161
161
  onClick: onHandleEdit
162
162
  }), /*#__PURE__*/React.createElement("div", {
163
163
  className: ax(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
164
- }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable, {
164
+ }), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Pressable
165
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
166
+ , {
165
167
  onClick: function onClick() {
166
168
  var _api$analytics2;
167
169
  return onHandleDismiss(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
@@ -80,6 +80,7 @@ var TaskItemWithProviders = /*#__PURE__*/function (_Component) {
80
80
  case 8:
81
81
  _context.prev = 8;
82
82
  _context.t0 = _context["catch"](1);
83
+ // eslint-disable-line no-unused-vars
83
84
  if (this.mounted) {
84
85
  this.setState({
85
86
  resolvedContextProvider: undefined
@@ -107,12 +108,14 @@ var TaskItemWithProviders = /*#__PURE__*/function (_Component) {
107
108
  key: "render",
108
109
  value: function render() {
109
110
  var _this$props = this.props,
110
- contextIdentifierProvider = _this$props.contextIdentifierProvider,
111
+ _contextIdentifierProvider = _this$props.contextIdentifierProvider,
111
112
  otherProps = _objectWithoutProperties(_this$props, _excluded);
112
113
  var _ref = this.state.resolvedContextProvider || {},
113
114
  objectId = _ref.objectId;
114
115
  var userContext = objectId ? 'edit' : 'new';
115
- return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext, {
116
+ return /*#__PURE__*/React.createElement(FabricElementsAnalyticsContext
117
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
118
+ , {
116
119
  data: {
117
120
  userContext: userContext
118
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "11.1.7",
3
+ "version": "11.2.0",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/primitives": "^18.0.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
51
51
  "@atlaskit/task-decision": "^19.3.0",
52
- "@atlaskit/tmp-editor-statsig": "^43.0.0",
52
+ "@atlaskit/tmp-editor-statsig": "^44.0.0",
53
53
  "@atlaskit/tokens": "^11.1.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.20.0",