@atlaskit/editor-plugin-tasks-and-decisions 11.3.0 → 11.3.2

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-tasks-and-decisions
2
2
 
3
+ ## 11.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`aa4e1fcb89ca8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa4e1fcb89ca8) -
14
+ Added new `platform_editor_flexible_list_schema` experiment that independently enables ADF schema
15
+ and CSS rendering support for flexible lists, without creation behaviour. Updated schema node
16
+ selection, CSS rendering, ADF validation, and task list schema to use the new gate. Indent/outdent
17
+ behaviour remains on the existing `platform_editor_flexible_list_indentation` gate.
18
+ - Updated dependencies
19
+
3
20
  ## 11.3.0
4
21
 
5
22
  ### Minor Changes
@@ -22,7 +22,6 @@ var _model = require("@atlaskit/editor-prosemirror/model");
22
22
  var _state = require("@atlaskit/editor-prosemirror/state");
23
23
  var _transform = require("@atlaskit/editor-prosemirror/transform");
24
24
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
25
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
25
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
27
26
  var _pluginKey = require("./plugin-key");
28
27
  var _types = require("./types");
@@ -254,7 +253,7 @@ var subtreeHeight = exports.subtreeHeight = function subtreeHeight($from, $to, t
254
253
  // and get the max height from the current position to the
255
254
  // deepest leaf node
256
255
  var maxChildDepth = $from.depth;
257
- $from.doc.nodesBetween(blockRange.start, blockRange.end, function (descendent, relPos, parent) {
256
+ $from.doc.nodesBetween(blockRange.start, blockRange.end, function (descendent, relPos, _parent) {
258
257
  maxChildDepth = Math.max($from.doc.resolve(relPos).depth, maxChildDepth);
259
258
 
260
259
  // keep descending down the tree if we can
@@ -288,7 +287,7 @@ var isEmptyTaskDecision = exports.isEmptyTaskDecision = function isEmptyTaskDeci
288
287
  // If in an empty paragraph that's not at the doc level
289
288
  node.content.size === 0 && node.type === paragraph && $from.depth > 0 &&
290
289
  // and it's parent is a blockTaskItem with only this paragraph inside it
291
- $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1 && (0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_3');
290
+ $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1;
292
291
  return isEmptyTaskOrDecisionItem || isInEmptyBlockTaskItem;
293
292
  };
294
293
 
@@ -19,7 +19,6 @@ var _keymap = require("@atlaskit/editor-prosemirror/keymap");
19
19
  var _model = require("@atlaskit/editor-prosemirror/model");
20
20
  var _state2 = require("@atlaskit/editor-prosemirror/state");
21
21
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
22
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
22
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
23
  var _moveSelectedTaskListItems = require("./actions/move-selected-task-list-items");
25
24
  var _commands2 = require("./commands");
@@ -247,6 +246,7 @@ var backspace = function backspace(editorAnalyticsAPI) {
247
246
  })), ['taskList', 'decisionList']));
248
247
  };
249
248
  var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTaskDecisionFollowing(state, dispatch) {
249
+ var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
250
250
  var $from = state.selection.$from,
251
251
  _state$schema$nodes4 = state.schema.nodes,
252
252
  taskList = _state$schema$nodes4.taskList,
@@ -255,128 +255,92 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
255
255
  blockTaskItem = _state$schema$nodes4.blockTaskItem,
256
256
  taskItem = _state$schema$nodes4.taskItem,
257
257
  tr = state.tr;
258
- if ((0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_3')) {
259
- var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
260
- // only run if cursor is at the end of the node
261
- if (!(0, _utils.isEmptySelectionAtEnd)(state) || !dispatch) {
262
- return false;
263
- }
264
258
 
265
- // look for the node after this current one
266
- var $next = (0, _helpers.walkOut)($from);
259
+ // only run if cursor is at the end of the node
260
+ if (!(0, _utils.isEmptySelectionAtEnd)(state) || !dispatch) {
261
+ return false;
262
+ }
267
263
 
268
- // this is a top-level node it wont have $next.before()
269
- if (!$next.parent || $next.parent.type === doc) {
270
- return false;
271
- }
264
+ // look for the node after this current one
265
+ var $next = (0, _helpers.walkOut)($from);
272
266
 
273
- // get resolved position of parent
274
- var $parentPos = $from.doc.resolve($from.start($from.depth - 1));
275
- var currentNode = $from.node();
276
- var parentNode = $parentPos.node();
267
+ // this is a top-level node it wont have $next.before()
268
+ if (!$next.parent || $next.parent.type === doc) {
269
+ return false;
270
+ }
277
271
 
278
- // if current position isn't an action or decision item, return false
279
- if (!(0, _helpers.isActionOrDecisionItem)(currentNode) && !(0, _helpers.isActionOrDecisionItem)(parentNode)) {
280
- return false;
281
- }
282
- var resultOfCurrentFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($next);
283
- var isCurrentEmptyBlockTaskItem = false;
284
- if (resultOfCurrentFindBlockTaskItem) {
285
- var _blockTaskItemNode$fi;
286
- var blockTaskItemNode = resultOfCurrentFindBlockTaskItem.blockTaskItemNode;
287
- isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
288
- }
289
- var isEmptyActionOrDecisionItem = currentNode && (0, _helpers.isActionOrDecisionItem)(currentNode) && currentNode.childCount === 0;
272
+ // get resolved position of parent
273
+ var $parentPos = $from.doc.resolve($from.start($from.depth - 1));
274
+ var currentNode = $from.node();
275
+ var parentNode = $parentPos.node();
290
276
 
291
- // If empty item, use default handler
292
- if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
293
- return false;
294
- }
277
+ // if current position isn't an action or decision item, return false
278
+ if (!(0, _helpers.isActionOrDecisionItem)(currentNode) && !(0, _helpers.isActionOrDecisionItem)(parentNode)) {
279
+ return false;
280
+ }
281
+ var resultOfCurrentFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($next);
282
+ var isCurrentEmptyBlockTaskItem = false;
283
+ if (resultOfCurrentFindBlockTaskItem) {
284
+ var _blockTaskItemNode$fi;
285
+ var blockTaskItemNode = resultOfCurrentFindBlockTaskItem.blockTaskItemNode;
286
+ isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
287
+ }
288
+ var isEmptyActionOrDecisionItem = currentNode && (0, _helpers.isActionOrDecisionItem)(currentNode) && currentNode.childCount === 0;
295
289
 
296
- // Check if next node is a blockTaskItem paragraph
297
- var resultOfNextFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($next);
298
- var isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
290
+ // If empty item, use default handler
291
+ if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
292
+ return false;
293
+ }
299
294
 
300
- // if nested, just unindent
301
- if ($next.node($next.depth - 2).type === taskList ||
302
- // this is for the case when we are on a non-nested item and next one is nested
303
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
304
- (0, _helpers.liftBlock)(tr, $next, $next);
305
- dispatch(tr);
306
- return true;
307
- }
308
- var isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 || (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 || (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 || (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 || (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 || (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
309
-
310
- // if next node is of same type or compatible type, remove the node wrapping and create paragraph
311
- if (!(0, _helpers.isTable)($next.nodeAfter) && (0, _helpers.isActionOrDecisionItem)($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
312
- // only forward delete if the node is same type or compatible
313
- $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
314
- if (dispatch) {
315
- // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
316
- // So we reduce the depth by 1 to get to the blockTaskItem node content
317
- var taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
318
- var slice;
319
- try {
320
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
321
-
322
- // might be end of document after
323
- var _tr2 = splitListItemWith(state.tr, slice, $next, false);
324
- dispatch(_tr2);
325
- return true;
326
- } catch (_unused2) {
327
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
328
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
329
- // So if the selection is in a blockTaskItem, just pass the content as is
330
- if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
331
- var _$next$node$firstChil;
332
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
333
- slice = Array.from(taskContent.content);
334
- var $splitPos = $next;
335
- if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
336
- // set $next to the resolved position of inside the textblock
337
- $splitPos = $next.doc.resolve($next.pos + 1);
338
- }
339
- var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
340
- dispatch(_tr3);
341
- return true;
295
+ // Check if next node is a blockTaskItem paragraph
296
+ var resultOfNextFindBlockTaskItem = (0, _utils3.findBlockTaskItem)($next);
297
+ var isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
298
+
299
+ // if nested, just unindent
300
+ if ($next.node($next.depth - 2).type === taskList ||
301
+ // this is for the case when we are on a non-nested item and next one is nested
302
+ $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
303
+ (0, _helpers.liftBlock)(tr, $next, $next);
304
+ dispatch(tr);
305
+ return true;
306
+ }
307
+ var isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 || (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 || (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 || (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 || (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 || (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
308
+
309
+ // if next node is of same type or compatible type, remove the node wrapping and create paragraph
310
+ if (!(0, _helpers.isTable)($next.nodeAfter) && (0, _helpers.isActionOrDecisionItem)($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
311
+ // only forward delete if the node is same type or compatible
312
+ $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
313
+ if (dispatch) {
314
+ // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
315
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
316
+ var taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
317
+ var slice;
318
+ try {
319
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
320
+
321
+ // might be end of document after
322
+ var _tr2 = splitListItemWith(state.tr, slice, $next, false);
323
+ dispatch(_tr2);
324
+ return true;
325
+ } catch (_unused2) {
326
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
327
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
328
+ // So if the selection is in a blockTaskItem, just pass the content as is
329
+ if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
330
+ var _$next$node$firstChil;
331
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
332
+ slice = Array.from(taskContent.content);
333
+ var $splitPos = $next;
334
+ if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
335
+ // set $next to the resolved position of inside the textblock
336
+ $splitPos = $next.doc.resolve($next.pos + 1);
342
337
  }
338
+ var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
339
+ dispatch(_tr3);
340
+ return true;
343
341
  }
344
342
  }
345
343
  }
346
- } else {
347
- // only run if cursor is at the end of the node
348
- if (!(0, _utils.isEmptySelectionAtEnd)(state) || !dispatch) {
349
- return false;
350
- }
351
-
352
- // look for the node after this current one
353
- var _$next = (0, _helpers.walkOut)($from);
354
-
355
- // this is a top-level node it wont have $next.before()
356
- if (!_$next.parent || _$next.parent.type === doc) {
357
- return false;
358
- }
359
-
360
- // if nested, just unindent
361
- if (_$next.node(_$next.depth - 2).type === taskList ||
362
- // this is for the case when we are on a non-nested item and next one is nested
363
- _$next.node(_$next.depth - 1).type === taskList && _$next.parent.type === taskList) {
364
- (0, _helpers.liftBlock)(tr, _$next, _$next);
365
- dispatch(tr);
366
- return true;
367
- }
368
-
369
- // if next node is of same type, remove the node wrapping and create paragraph
370
- if (!(0, _helpers.isTable)(_$next.nodeAfter) && (0, _helpers.isActionOrDecisionItem)($from.parent) && actionDecisionFollowsOrNothing($from) &&
371
- // only forward delete if the node is same type
372
- _$next.node().type.name === $from.node().type.name) {
373
- var _taskContent = state.doc.slice(_$next.start(), _$next.end()).content;
374
-
375
- // might be end of document after
376
- var _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : [];
377
- dispatch(splitListItemWith(tr, _slice, _$next, false));
378
- return true;
379
- }
380
344
  }
381
345
  return false;
382
346
  };
@@ -430,7 +394,7 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
430
394
  if (result) {
431
395
  var blockTaskItemNode = result.blockTaskItemNode,
432
396
  hasParagraph = result.hasParagraph;
433
- hasBlockTaskItem = (0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_3') && !!blockTaskItemNode;
397
+ hasBlockTaskItem = !!blockTaskItemNode;
434
398
  if (blockTaskItemNode) {
435
399
  var _$oldAfter$nodeAfter, _$posPreviousSibling$;
436
400
  // If the case there is a paragraph in the block task item we need to
@@ -476,9 +440,7 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
476
440
  if (shouldSplit && !isNestedActionInsideLists) {
477
441
  // this only splits a node to delete it, so we probably don't need a random uuid
478
442
  // but generate one anyway for correctness
479
- tr = tr.split($from.pos,
480
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
481
- (0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_3') && hasBlockTaskItem ? 0 : 1, [{
443
+ tr = tr.split($from.pos, hasBlockTaskItem ? 0 : 1, [{
482
444
  type: $from.parent.type,
483
445
  attrs: {
484
446
  localId: _adfSchema.uuid.generate()
@@ -545,17 +507,15 @@ var splitListItem = function splitListItem(state, dispatch) {
545
507
  paragraph = _state$schema$nodes5.paragraph;
546
508
  if (actionDecisionFollowsOrNothing($from)) {
547
509
  if (dispatch) {
548
- if ((0, _platformFeatureFlags.fg)('platform_editor_blocktaskitem_patch_3')) {
549
- // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
550
- var nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
551
- if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
552
- if ($from.parent.type === taskItem) {
553
- var nodeSize = $from.parent.nodeSize;
554
- tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
555
- tr.insert($from.pos, paragraph.createChecked());
556
- dispatch(tr);
557
- return true;
558
- }
510
+ // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
511
+ var nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
512
+ if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
513
+ if ($from.parent.type === taskItem) {
514
+ var nodeSize = $from.parent.nodeSize;
515
+ tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
516
+ tr.insert($from.pos, paragraph.createChecked());
517
+ dispatch(tr);
518
+ return true;
559
519
  }
560
520
  }
561
521
  if ((0, _utils2.hasParentNodeOfType)(listItem)(tr.selection)) {
@@ -176,7 +176,7 @@ var tasksAndDecisionsPlugin = exports.tasksAndDecisionsPlugin = function tasksAn
176
176
  node: (0, _decisionItem.decisionItemSpecWithFixedToDOM)()
177
177
  }, {
178
178
  name: 'taskList',
179
- node: (0, _expValEquals.expValEquals)('platform_editor_flexible_list_indentation', 'isEnabled', true) ? _adfSchema.taskListWithFlexibleFirstChildStage0 : _adfSchema.taskList
179
+ node: (0, _expValEquals.expValEquals)('platform_editor_flexible_list_schema', 'isEnabled', true) ? _adfSchema.taskListWithFlexibleFirstChildStage0 : _adfSchema.taskList
180
180
  }, {
181
181
  name: 'taskItem',
182
182
  node: (0, _taskItemNodeSpec.taskItemNodeSpec)()
@@ -171,7 +171,7 @@ var RequestToEditPopup = exports.RequestToEditPopup = function RequestToEditPopu
171
171
  }), /*#__PURE__*/React.createElement("div", {
172
172
  className: (0, _runtime.ax)(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
173
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)
174
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
175
175
  , {
176
176
  onClick: function onClick() {
177
177
  var _api$analytics2;
@@ -123,7 +123,7 @@ var TaskItemWithProviders = exports.default = /*#__PURE__*/function (_Component)
123
123
  objectId = _ref.objectId;
124
124
  var userContext = objectId ? 'edit' : 'new';
125
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)
126
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
127
127
  , {
128
128
  data: {
129
129
  userContext: userContext
@@ -4,7 +4,6 @@ import { NodeRange } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
6
6
  import { findParentNodeClosestToPos, findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
8
  import { stateKey } from './plugin-key';
10
9
  import { ACTIONS } from './types';
@@ -242,7 +241,7 @@ export const subtreeHeight = ($from, $to, types) => {
242
241
  // and get the max height from the current position to the
243
242
  // deepest leaf node
244
243
  let maxChildDepth = $from.depth;
245
- $from.doc.nodesBetween(blockRange.start, blockRange.end, (descendent, relPos, parent) => {
244
+ $from.doc.nodesBetween(blockRange.start, blockRange.end, (descendent, relPos, _parent) => {
246
245
  maxChildDepth = Math.max($from.doc.resolve(relPos).depth, maxChildDepth);
247
246
 
248
247
  // keep descending down the tree if we can
@@ -281,7 +280,7 @@ export const isEmptyTaskDecision = state => {
281
280
  // If in an empty paragraph that's not at the doc level
282
281
  node.content.size === 0 && node.type === paragraph && $from.depth > 0 &&
283
282
  // and it's parent is a blockTaskItem with only this paragraph inside it
284
- $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1 && fg('platform_editor_blocktaskitem_patch_3');
283
+ $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1;
285
284
  return isEmptyTaskOrDecisionItem || isInEmptyBlockTaskItem;
286
285
  };
287
286
 
@@ -10,7 +10,6 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
10
10
  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
- import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
15
14
  import { moveSelectedTaskListItems } from './actions/move-selected-task-list-items';
16
15
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
@@ -215,6 +214,7 @@ const backspaceFrom = editorAnalyticsAPI => $from => (state, dispatch) => {
215
214
  };
216
215
  const backspace = editorAnalyticsAPI => filter(isEmptySelectionAtStart, autoJoin(chainCommands((state, dispatch) => joinAtCut(state.selection.$from)(state, dispatch), filter(isInsideTaskOrDecisionItem, (state, dispatch) => backspaceFrom(editorAnalyticsAPI)(state.selection.$from)(state, dispatch))), ['taskList', 'decisionList']));
217
216
  const unindentTaskOrUnwrapTaskDecisionFollowing = (state, dispatch) => {
217
+ var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
218
218
  const {
219
219
  selection: {
220
220
  $from
@@ -230,130 +230,94 @@ const unindentTaskOrUnwrapTaskDecisionFollowing = (state, dispatch) => {
230
230
  },
231
231
  tr
232
232
  } = state;
233
- if (fg('platform_editor_blocktaskitem_patch_3')) {
234
- var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
235
- // only run if cursor is at the end of the node
236
- if (!isEmptySelectionAtEnd(state) || !dispatch) {
237
- return false;
238
- }
239
233
 
240
- // look for the node after this current one
241
- const $next = walkOut($from);
234
+ // only run if cursor is at the end of the node
235
+ if (!isEmptySelectionAtEnd(state) || !dispatch) {
236
+ return false;
237
+ }
242
238
 
243
- // this is a top-level node it wont have $next.before()
244
- if (!$next.parent || $next.parent.type === doc) {
245
- return false;
246
- }
239
+ // look for the node after this current one
240
+ const $next = walkOut($from);
247
241
 
248
- // get resolved position of parent
249
- const $parentPos = $from.doc.resolve($from.start($from.depth - 1));
250
- const currentNode = $from.node();
251
- const parentNode = $parentPos.node();
242
+ // this is a top-level node it wont have $next.before()
243
+ if (!$next.parent || $next.parent.type === doc) {
244
+ return false;
245
+ }
252
246
 
253
- // if current position isn't an action or decision item, return false
254
- if (!isActionOrDecisionItem(currentNode) && !isActionOrDecisionItem(parentNode)) {
255
- return false;
256
- }
257
- const resultOfCurrentFindBlockTaskItem = findBlockTaskItem($next);
258
- let isCurrentEmptyBlockTaskItem = false;
259
- if (resultOfCurrentFindBlockTaskItem) {
260
- var _blockTaskItemNode$fi;
261
- const {
262
- blockTaskItemNode
263
- } = resultOfCurrentFindBlockTaskItem;
264
- isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
265
- }
266
- const isEmptyActionOrDecisionItem = currentNode && isActionOrDecisionItem(currentNode) && currentNode.childCount === 0;
247
+ // get resolved position of parent
248
+ const $parentPos = $from.doc.resolve($from.start($from.depth - 1));
249
+ const currentNode = $from.node();
250
+ const parentNode = $parentPos.node();
267
251
 
268
- // If empty item, use default handler
269
- if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
270
- return false;
271
- }
252
+ // if current position isn't an action or decision item, return false
253
+ if (!isActionOrDecisionItem(currentNode) && !isActionOrDecisionItem(parentNode)) {
254
+ return false;
255
+ }
256
+ const resultOfCurrentFindBlockTaskItem = findBlockTaskItem($next);
257
+ let isCurrentEmptyBlockTaskItem = false;
258
+ if (resultOfCurrentFindBlockTaskItem) {
259
+ var _blockTaskItemNode$fi;
260
+ const {
261
+ blockTaskItemNode
262
+ } = resultOfCurrentFindBlockTaskItem;
263
+ isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
264
+ }
265
+ const isEmptyActionOrDecisionItem = currentNode && isActionOrDecisionItem(currentNode) && currentNode.childCount === 0;
266
+
267
+ // If empty item, use default handler
268
+ if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
269
+ return false;
270
+ }
272
271
 
273
- // Check if next node is a blockTaskItem paragraph
274
- const resultOfNextFindBlockTaskItem = findBlockTaskItem($next);
275
- const isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
272
+ // Check if next node is a blockTaskItem paragraph
273
+ const resultOfNextFindBlockTaskItem = findBlockTaskItem($next);
274
+ const isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
276
275
 
277
- // if nested, just unindent
278
- if ($next.node($next.depth - 2).type === taskList ||
279
- // this is for the case when we are on a non-nested item and next one is nested
280
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
281
- liftBlock(tr, $next, $next);
282
- dispatch(tr);
283
- return true;
284
- }
285
- const isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 ? void 0 : (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 ? void 0 : (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 ? void 0 : (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 ? void 0 : (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 ? void 0 : (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
286
-
287
- // if next node is of same type or compatible type, remove the node wrapping and create paragraph
288
- if (!isTable($next.nodeAfter) && isActionOrDecisionItem($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
289
- // only forward delete if the node is same type or compatible
290
- $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
291
- if (dispatch) {
292
- // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
293
- // So we reduce the depth by 1 to get to the blockTaskItem node content
294
- const taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
295
- let slice;
296
- try {
297
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
298
-
299
- // might be end of document after
300
- const tr = splitListItemWith(state.tr, slice, $next, false);
276
+ // if nested, just unindent
277
+ if ($next.node($next.depth - 2).type === taskList ||
278
+ // this is for the case when we are on a non-nested item and next one is nested
279
+ $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
280
+ liftBlock(tr, $next, $next);
281
+ dispatch(tr);
282
+ return true;
283
+ }
284
+ const isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 ? void 0 : (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 ? void 0 : (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 ? void 0 : (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 ? void 0 : (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 ? void 0 : (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
285
+
286
+ // if next node is of same type or compatible type, remove the node wrapping and create paragraph
287
+ if (!isTable($next.nodeAfter) && isActionOrDecisionItem($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
288
+ // only forward delete if the node is same type or compatible
289
+ $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
290
+ if (dispatch) {
291
+ // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
292
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
293
+ const taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
294
+ let slice;
295
+ try {
296
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
297
+
298
+ // might be end of document after
299
+ const tr = splitListItemWith(state.tr, slice, $next, false);
300
+ dispatch(tr);
301
+ return true;
302
+ } catch {
303
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
304
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
305
+ // So if the selection is in a blockTaskItem, just pass the content as is
306
+ if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
307
+ var _$next$node$firstChil;
308
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
309
+ slice = Array.from(taskContent.content);
310
+ let $splitPos = $next;
311
+ if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
312
+ // set $next to the resolved position of inside the textblock
313
+ $splitPos = $next.doc.resolve($next.pos + 1);
314
+ }
315
+ const tr = splitListItemWith(state.tr, slice, $splitPos, false);
301
316
  dispatch(tr);
302
317
  return true;
303
- } catch {
304
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
305
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
306
- // So if the selection is in a blockTaskItem, just pass the content as is
307
- if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
308
- var _$next$node$firstChil;
309
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
310
- slice = Array.from(taskContent.content);
311
- let $splitPos = $next;
312
- if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
313
- // set $next to the resolved position of inside the textblock
314
- $splitPos = $next.doc.resolve($next.pos + 1);
315
- }
316
- const tr = splitListItemWith(state.tr, slice, $splitPos, false);
317
- dispatch(tr);
318
- return true;
319
- }
320
318
  }
321
319
  }
322
320
  }
323
- } else {
324
- // only run if cursor is at the end of the node
325
- if (!isEmptySelectionAtEnd(state) || !dispatch) {
326
- return false;
327
- }
328
-
329
- // look for the node after this current one
330
- const $next = walkOut($from);
331
-
332
- // this is a top-level node it wont have $next.before()
333
- if (!$next.parent || $next.parent.type === doc) {
334
- return false;
335
- }
336
-
337
- // if nested, just unindent
338
- if ($next.node($next.depth - 2).type === taskList ||
339
- // this is for the case when we are on a non-nested item and next one is nested
340
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
341
- liftBlock(tr, $next, $next);
342
- dispatch(tr);
343
- return true;
344
- }
345
-
346
- // if next node is of same type, remove the node wrapping and create paragraph
347
- if (!isTable($next.nodeAfter) && isActionOrDecisionItem($from.parent) && actionDecisionFollowsOrNothing($from) &&
348
- // only forward delete if the node is same type
349
- $next.node().type.name === $from.node().type.name) {
350
- const taskContent = state.doc.slice($next.start(), $next.end()).content;
351
-
352
- // might be end of document after
353
- const slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : [];
354
- dispatch(splitListItemWith(tr, slice, $next, false));
355
- return true;
356
- }
357
321
  }
358
322
  return false;
359
323
  };
@@ -410,7 +374,7 @@ const splitListItemWith = (tr, content, $from, setSelection) => {
410
374
  blockTaskItemNode,
411
375
  hasParagraph
412
376
  } = result;
413
- hasBlockTaskItem = fg('platform_editor_blocktaskitem_patch_3') && !!blockTaskItemNode;
377
+ hasBlockTaskItem = !!blockTaskItemNode;
414
378
  if (blockTaskItemNode) {
415
379
  var _$oldAfter$nodeAfter, _$posPreviousSibling$;
416
380
  // If the case there is a paragraph in the block task item we need to
@@ -456,9 +420,7 @@ const splitListItemWith = (tr, content, $from, setSelection) => {
456
420
  if (shouldSplit && !isNestedActionInsideLists) {
457
421
  // this only splits a node to delete it, so we probably don't need a random uuid
458
422
  // but generate one anyway for correctness
459
- tr = tr.split($from.pos,
460
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
461
- fg('platform_editor_blocktaskitem_patch_3') && hasBlockTaskItem ? 0 : 1, [{
423
+ tr = tr.split($from.pos, hasBlockTaskItem ? 0 : 1, [{
462
424
  type: $from.parent.type,
463
425
  attrs: {
464
426
  localId: uuid.generate()
@@ -530,17 +492,15 @@ const splitListItem = (state, dispatch) => {
530
492
  } = state.schema.nodes;
531
493
  if (actionDecisionFollowsOrNothing($from)) {
532
494
  if (dispatch) {
533
- if (fg('platform_editor_blocktaskitem_patch_3')) {
534
- // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
535
- const nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
536
- if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
537
- if ($from.parent.type === taskItem) {
538
- const nodeSize = $from.parent.nodeSize;
539
- tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
540
- tr.insert($from.pos, paragraph.createChecked());
541
- dispatch(tr);
542
- return true;
543
- }
495
+ // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
496
+ const nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
497
+ if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
498
+ if ($from.parent.type === taskItem) {
499
+ const nodeSize = $from.parent.nodeSize;
500
+ tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
501
+ tr.insert($from.pos, paragraph.createChecked());
502
+ dispatch(tr);
503
+ return true;
544
504
  }
545
505
  }
546
506
  if (hasParentNodeOfType(listItem)(tr.selection)) {
@@ -164,7 +164,7 @@ export const tasksAndDecisionsPlugin = ({
164
164
  node: decisionItemSpecWithFixedToDOM()
165
165
  }, {
166
166
  name: 'taskList',
167
- node: expValEquals('platform_editor_flexible_list_indentation', 'isEnabled', true) ? taskListWithFlexibleFirstChildStage0 : taskList
167
+ node: expValEquals('platform_editor_flexible_list_schema', 'isEnabled', true) ? taskListWithFlexibleFirstChildStage0 : taskList
168
168
  }, {
169
169
  name: 'taskItem',
170
170
  node: taskItemNodeSpec()
@@ -156,7 +156,7 @@ export const RequestToEditPopup = ({
156
156
  }), /*#__PURE__*/React.createElement("div", {
157
157
  className: ax(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
158
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)
159
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
160
160
  , {
161
161
  onClick: () => {
162
162
  var _api$analytics2;
@@ -62,7 +62,7 @@ export default class TaskItemWithProviders extends Component {
62
62
  } = this.state.resolvedContextProvider || {};
63
63
  const userContext = objectId ? 'edit' : 'new';
64
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)
65
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
66
66
  , {
67
67
  data: {
68
68
  userContext
@@ -4,7 +4,6 @@ import { NodeRange } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { liftTarget } from '@atlaskit/editor-prosemirror/transform';
6
6
  import { findParentNodeClosestToPos, findParentNodeOfTypeClosestToPos, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
8
  import { stateKey } from './plugin-key';
10
9
  import { ACTIONS } from './types';
@@ -236,7 +235,7 @@ export var subtreeHeight = function subtreeHeight($from, $to, types) {
236
235
  // and get the max height from the current position to the
237
236
  // deepest leaf node
238
237
  var maxChildDepth = $from.depth;
239
- $from.doc.nodesBetween(blockRange.start, blockRange.end, function (descendent, relPos, parent) {
238
+ $from.doc.nodesBetween(blockRange.start, blockRange.end, function (descendent, relPos, _parent) {
240
239
  maxChildDepth = Math.max($from.doc.resolve(relPos).depth, maxChildDepth);
241
240
 
242
241
  // keep descending down the tree if we can
@@ -270,7 +269,7 @@ export var isEmptyTaskDecision = function isEmptyTaskDecision(state) {
270
269
  // If in an empty paragraph that's not at the doc level
271
270
  node.content.size === 0 && node.type === paragraph && $from.depth > 0 &&
272
271
  // and it's parent is a blockTaskItem with only this paragraph inside it
273
- $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1 && fg('platform_editor_blocktaskitem_patch_3');
272
+ $from.node($from.depth - 1).type === blockTaskItem && $from.node($from.depth - 1).childCount === 1;
274
273
  return isEmptyTaskOrDecisionItem || isInEmptyBlockTaskItem;
275
274
  };
276
275
 
@@ -13,7 +13,6 @@ import { keymap } from '@atlaskit/editor-prosemirror/keymap';
13
13
  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
- import { fg } from '@atlaskit/platform-feature-flags';
17
16
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
17
  import { moveSelectedTaskListItems } from './actions/move-selected-task-list-items';
19
18
  import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
@@ -239,6 +238,7 @@ var backspace = function backspace(editorAnalyticsAPI) {
239
238
  })), ['taskList', 'decisionList']));
240
239
  };
241
240
  var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTaskDecisionFollowing(state, dispatch) {
241
+ var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
242
242
  var $from = state.selection.$from,
243
243
  _state$schema$nodes4 = state.schema.nodes,
244
244
  taskList = _state$schema$nodes4.taskList,
@@ -247,128 +247,92 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
247
247
  blockTaskItem = _state$schema$nodes4.blockTaskItem,
248
248
  taskItem = _state$schema$nodes4.taskItem,
249
249
  tr = state.tr;
250
- if (fg('platform_editor_blocktaskitem_patch_3')) {
251
- var _$next$node, _$from$node, _$next$node2, _$from$node2, _$next$node3;
252
- // only run if cursor is at the end of the node
253
- if (!isEmptySelectionAtEnd(state) || !dispatch) {
254
- return false;
255
- }
256
250
 
257
- // look for the node after this current one
258
- var $next = walkOut($from);
251
+ // only run if cursor is at the end of the node
252
+ if (!isEmptySelectionAtEnd(state) || !dispatch) {
253
+ return false;
254
+ }
259
255
 
260
- // this is a top-level node it wont have $next.before()
261
- if (!$next.parent || $next.parent.type === doc) {
262
- return false;
263
- }
256
+ // look for the node after this current one
257
+ var $next = walkOut($from);
264
258
 
265
- // get resolved position of parent
266
- var $parentPos = $from.doc.resolve($from.start($from.depth - 1));
267
- var currentNode = $from.node();
268
- var parentNode = $parentPos.node();
259
+ // this is a top-level node it wont have $next.before()
260
+ if (!$next.parent || $next.parent.type === doc) {
261
+ return false;
262
+ }
269
263
 
270
- // if current position isn't an action or decision item, return false
271
- if (!isActionOrDecisionItem(currentNode) && !isActionOrDecisionItem(parentNode)) {
272
- return false;
273
- }
274
- var resultOfCurrentFindBlockTaskItem = findBlockTaskItem($next);
275
- var isCurrentEmptyBlockTaskItem = false;
276
- if (resultOfCurrentFindBlockTaskItem) {
277
- var _blockTaskItemNode$fi;
278
- var blockTaskItemNode = resultOfCurrentFindBlockTaskItem.blockTaskItemNode;
279
- isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
280
- }
281
- var isEmptyActionOrDecisionItem = currentNode && isActionOrDecisionItem(currentNode) && currentNode.childCount === 0;
264
+ // get resolved position of parent
265
+ var $parentPos = $from.doc.resolve($from.start($from.depth - 1));
266
+ var currentNode = $from.node();
267
+ var parentNode = $parentPos.node();
282
268
 
283
- // If empty item, use default handler
284
- if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
285
- return false;
286
- }
269
+ // if current position isn't an action or decision item, return false
270
+ if (!isActionOrDecisionItem(currentNode) && !isActionOrDecisionItem(parentNode)) {
271
+ return false;
272
+ }
273
+ var resultOfCurrentFindBlockTaskItem = findBlockTaskItem($next);
274
+ var isCurrentEmptyBlockTaskItem = false;
275
+ if (resultOfCurrentFindBlockTaskItem) {
276
+ var _blockTaskItemNode$fi;
277
+ var blockTaskItemNode = resultOfCurrentFindBlockTaskItem.blockTaskItemNode;
278
+ isCurrentEmptyBlockTaskItem = blockTaskItem && blockTaskItemNode && blockTaskItemNode.childCount === 1 && ((_blockTaskItemNode$fi = blockTaskItemNode.firstChild) === null || _blockTaskItemNode$fi === void 0 ? void 0 : _blockTaskItemNode$fi.type) === paragraph && blockTaskItemNode.firstChild.childCount === 0;
279
+ }
280
+ var isEmptyActionOrDecisionItem = currentNode && isActionOrDecisionItem(currentNode) && currentNode.childCount === 0;
287
281
 
288
- // Check if next node is a blockTaskItem paragraph
289
- var resultOfNextFindBlockTaskItem = findBlockTaskItem($next);
290
- var isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
282
+ // If empty item, use default handler
283
+ if (isEmptyActionOrDecisionItem || isCurrentEmptyBlockTaskItem) {
284
+ return false;
285
+ }
291
286
 
292
- // if nested, just unindent
293
- if ($next.node($next.depth - 2).type === taskList ||
294
- // this is for the case when we are on a non-nested item and next one is nested
295
- $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
296
- liftBlock(tr, $next, $next);
297
- dispatch(tr);
298
- return true;
299
- }
300
- var isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 || (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 || (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 || (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 || (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 || (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
301
-
302
- // if next node is of same type or compatible type, remove the node wrapping and create paragraph
303
- if (!isTable($next.nodeAfter) && isActionOrDecisionItem($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
304
- // only forward delete if the node is same type or compatible
305
- $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
306
- if (dispatch) {
307
- // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
308
- // So we reduce the depth by 1 to get to the blockTaskItem node content
309
- var taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
310
- var slice;
311
- try {
312
- slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
313
-
314
- // might be end of document after
315
- var _tr2 = splitListItemWith(state.tr, slice, $next, false);
316
- dispatch(_tr2);
317
- return true;
318
- } catch (_unused2) {
319
- // If there's an error creating a paragraph, check if we are in a blockTaskItem
320
- // Block task item's can have non-text content that cannot be wrapped in a paragraph
321
- // So if the selection is in a blockTaskItem, just pass the content as is
322
- if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
323
- var _$next$node$firstChil;
324
- // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
325
- slice = Array.from(taskContent.content);
326
- var $splitPos = $next;
327
- if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
328
- // set $next to the resolved position of inside the textblock
329
- $splitPos = $next.doc.resolve($next.pos + 1);
330
- }
331
- var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
332
- dispatch(_tr3);
333
- return true;
287
+ // Check if next node is a blockTaskItem paragraph
288
+ var resultOfNextFindBlockTaskItem = findBlockTaskItem($next);
289
+ var isNextInBlockTaskItemParagraph = resultOfNextFindBlockTaskItem && (resultOfNextFindBlockTaskItem === null || resultOfNextFindBlockTaskItem === void 0 ? void 0 : resultOfNextFindBlockTaskItem.hasParagraph);
290
+
291
+ // if nested, just unindent
292
+ if ($next.node($next.depth - 2).type === taskList ||
293
+ // this is for the case when we are on a non-nested item and next one is nested
294
+ $next.node($next.depth - 1).type === taskList && $next.parent.type === taskList) {
295
+ liftBlock(tr, $next, $next);
296
+ dispatch(tr);
297
+ return true;
298
+ }
299
+ var isNextCompatibleWithBlockTaskItem = blockTaskItem && (($next === null || $next === void 0 || (_$next$node = $next.node()) === null || _$next$node === void 0 ? void 0 : _$next$node.type) === taskItem && ($from === null || $from === void 0 || (_$from$node = $from.node()) === null || _$from$node === void 0 ? void 0 : _$from$node.type) === blockTaskItem || ($next === null || $next === void 0 || (_$next$node2 = $next.node()) === null || _$next$node2 === void 0 ? void 0 : _$next$node2.type) === blockTaskItem && ($from === null || $from === void 0 || (_$from$node2 = $from.node()) === null || _$from$node2 === void 0 ? void 0 : _$from$node2.type) === taskItem || [taskItem, blockTaskItem].includes($next === null || $next === void 0 || (_$next$node3 = $next.node()) === null || _$next$node3 === void 0 ? void 0 : _$next$node3.type) && resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode);
300
+
301
+ // if next node is of same type or compatible type, remove the node wrapping and create paragraph
302
+ if (!isTable($next.nodeAfter) && isActionOrDecisionItem($from.parent) || resultOfCurrentFindBlockTaskItem && resultOfCurrentFindBlockTaskItem.blockTaskItemNode && actionDecisionFollowsOrNothing($from) && (
303
+ // only forward delete if the node is same type or compatible
304
+ $next.node().type.name === $from.node().type.name || isNextCompatibleWithBlockTaskItem)) {
305
+ if (dispatch) {
306
+ // If next node is in a blockTaskItem paragraph, we need to get the content of the whole blockTaskItem
307
+ // So we reduce the depth by 1 to get to the blockTaskItem node content
308
+ var taskContent = isNextInBlockTaskItemParagraph ? state.doc.slice($next.start($next.depth - 1), $next.end($next.depth - 1)).content : state.doc.slice($next.start(), $next.end()).content;
309
+ var slice;
310
+ try {
311
+ slice = taskContent.size ? paragraph.createChecked(undefined, taskContent) : paragraph.createChecked();
312
+
313
+ // might be end of document after
314
+ var _tr2 = splitListItemWith(state.tr, slice, $next, false);
315
+ dispatch(_tr2);
316
+ return true;
317
+ } catch (_unused2) {
318
+ // If there's an error creating a paragraph, check if we are in a blockTaskItem
319
+ // Block task item's can have non-text content that cannot be wrapped in a paragraph
320
+ // So if the selection is in a blockTaskItem, just pass the content as is
321
+ if (resultOfNextFindBlockTaskItem && resultOfNextFindBlockTaskItem.blockTaskItemNode) {
322
+ var _$next$node$firstChil;
323
+ // Create an array from the fragment to pass into splitListItemWith, as the `content` property is readonly
324
+ slice = Array.from(taskContent.content);
325
+ var $splitPos = $next;
326
+ if ((_$next$node$firstChil = $next.node().firstChild) !== null && _$next$node$firstChil !== void 0 && _$next$node$firstChil.isTextblock) {
327
+ // set $next to the resolved position of inside the textblock
328
+ $splitPos = $next.doc.resolve($next.pos + 1);
334
329
  }
330
+ var _tr3 = splitListItemWith(state.tr, slice, $splitPos, false);
331
+ dispatch(_tr3);
332
+ return true;
335
333
  }
336
334
  }
337
335
  }
338
- } else {
339
- // only run if cursor is at the end of the node
340
- if (!isEmptySelectionAtEnd(state) || !dispatch) {
341
- return false;
342
- }
343
-
344
- // look for the node after this current one
345
- var _$next = walkOut($from);
346
-
347
- // this is a top-level node it wont have $next.before()
348
- if (!_$next.parent || _$next.parent.type === doc) {
349
- return false;
350
- }
351
-
352
- // if nested, just unindent
353
- if (_$next.node(_$next.depth - 2).type === taskList ||
354
- // this is for the case when we are on a non-nested item and next one is nested
355
- _$next.node(_$next.depth - 1).type === taskList && _$next.parent.type === taskList) {
356
- liftBlock(tr, _$next, _$next);
357
- dispatch(tr);
358
- return true;
359
- }
360
-
361
- // if next node is of same type, remove the node wrapping and create paragraph
362
- if (!isTable(_$next.nodeAfter) && isActionOrDecisionItem($from.parent) && actionDecisionFollowsOrNothing($from) &&
363
- // only forward delete if the node is same type
364
- _$next.node().type.name === $from.node().type.name) {
365
- var _taskContent = state.doc.slice(_$next.start(), _$next.end()).content;
366
-
367
- // might be end of document after
368
- var _slice = _taskContent.size ? paragraph.createChecked(undefined, _taskContent) : [];
369
- dispatch(splitListItemWith(tr, _slice, _$next, false));
370
- return true;
371
- }
372
336
  }
373
337
  return false;
374
338
  };
@@ -422,7 +386,7 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
422
386
  if (result) {
423
387
  var blockTaskItemNode = result.blockTaskItemNode,
424
388
  hasParagraph = result.hasParagraph;
425
- hasBlockTaskItem = fg('platform_editor_blocktaskitem_patch_3') && !!blockTaskItemNode;
389
+ hasBlockTaskItem = !!blockTaskItemNode;
426
390
  if (blockTaskItemNode) {
427
391
  var _$oldAfter$nodeAfter, _$posPreviousSibling$;
428
392
  // If the case there is a paragraph in the block task item we need to
@@ -468,9 +432,7 @@ var splitListItemWith = function splitListItemWith(tr, content, $from, setSelect
468
432
  if (shouldSplit && !isNestedActionInsideLists) {
469
433
  // this only splits a node to delete it, so we probably don't need a random uuid
470
434
  // but generate one anyway for correctness
471
- tr = tr.split($from.pos,
472
- // eslint-disable-next-line @atlaskit/platform/no-preconditioning
473
- fg('platform_editor_blocktaskitem_patch_3') && hasBlockTaskItem ? 0 : 1, [{
435
+ tr = tr.split($from.pos, hasBlockTaskItem ? 0 : 1, [{
474
436
  type: $from.parent.type,
475
437
  attrs: {
476
438
  localId: uuid.generate()
@@ -537,17 +499,15 @@ var splitListItem = function splitListItem(state, dispatch) {
537
499
  paragraph = _state$schema$nodes5.paragraph;
538
500
  if (actionDecisionFollowsOrNothing($from)) {
539
501
  if (dispatch) {
540
- if (fg('platform_editor_blocktaskitem_patch_3')) {
541
- // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
542
- var nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
543
- if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
544
- if ($from.parent.type === taskItem) {
545
- var nodeSize = $from.parent.nodeSize;
546
- tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
547
- tr.insert($from.pos, paragraph.createChecked());
548
- dispatch(tr);
549
- return true;
550
- }
502
+ // If previous node is a blockTaskItem we just want to delete the existing node and replace it with a paragraph
503
+ var nodeBefore = state.doc.resolve($from.pos - 1).nodeBefore;
504
+ if (blockTaskItem && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) === blockTaskItem) {
505
+ if ($from.parent.type === taskItem) {
506
+ var nodeSize = $from.parent.nodeSize;
507
+ tr.delete($from.pos - Math.floor(nodeSize / 2), $from.pos + Math.ceil(nodeSize / 2));
508
+ tr.insert($from.pos, paragraph.createChecked());
509
+ dispatch(tr);
510
+ return true;
551
511
  }
552
512
  }
553
513
  if (hasParentNodeOfType(listItem)(tr.selection)) {
@@ -167,7 +167,7 @@ export var tasksAndDecisionsPlugin = function tasksAndDecisionsPlugin(_ref3) {
167
167
  node: decisionItemSpecWithFixedToDOM()
168
168
  }, {
169
169
  name: 'taskList',
170
- node: expValEquals('platform_editor_flexible_list_indentation', 'isEnabled', true) ? taskListWithFlexibleFirstChildStage0 : taskList
170
+ node: expValEquals('platform_editor_flexible_list_schema', 'isEnabled', true) ? taskListWithFlexibleFirstChildStage0 : taskList
171
171
  }, {
172
172
  name: 'taskItem',
173
173
  node: taskItemNodeSpec()
@@ -162,7 +162,7 @@ export var RequestToEditPopup = function RequestToEditPopup(_ref2) {
162
162
  }), /*#__PURE__*/React.createElement("div", {
163
163
  className: ax(["_19pku2gc _otyru2gc _18u0u2gc _2hwxu2gc _1e0c1o8l _1bsbyh40 _4t3iyh40 _bfhk16e3", "_2rko1rr0"])
164
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)
165
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
166
166
  , {
167
167
  onClick: function onClick() {
168
168
  var _api$analytics2;
@@ -114,7 +114,7 @@ var TaskItemWithProviders = /*#__PURE__*/function (_Component) {
114
114
  objectId = _ref.objectId;
115
115
  var userContext = objectId ? 'edit' : 'new';
116
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)
117
+ // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
118
118
  , {
119
119
  data: {
120
120
  userContext: userContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
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": "^44.1.0",
52
+ "@atlaskit/tmp-editor-statsig": "^45.0.0",
53
53
  "@atlaskit/tokens": "^11.1.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.20.0",
@@ -104,9 +104,6 @@
104
104
  "platform_editor_element_browser_analytic": {
105
105
  "type": "boolean"
106
106
  },
107
- "platform_editor_blocktaskitem_patch_3": {
108
- "type": "boolean"
109
- },
110
107
  "platform_editor_block_menu_v2_patch_3": {
111
108
  "type": "boolean"
112
109
  },