@atlaskit/editor-plugin-tasks-and-decisions 6.4.0 → 6.4.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,18 @@
1
1
  # @atlaskit/editor-plugin-tasks-and-decisions
2
2
 
3
+ ## 6.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`417545848d2bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/417545848d2bf) -
8
+ [EDITOR-1153] Make sure that Tab works for range selections for `blockTaskItem`
9
+
10
+ ## 6.4.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 6.4.0
4
17
 
5
18
  ### Minor Changes
@@ -7,6 +7,7 @@ exports.wrapSelectionInTaskList = exports.liftSelection = exports.joinAtCut = vo
7
7
  var _commands = require("@atlaskit/editor-common/commands");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _model = require("@atlaskit/editor-prosemirror/model");
10
+ var _state = require("@atlaskit/editor-prosemirror/state");
10
11
  var _transform = require("@atlaskit/editor-prosemirror/transform");
11
12
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
13
  var _helpers = require("./helpers");
@@ -67,12 +68,18 @@ var wrapSelectionInTaskList = exports.wrapSelectionInTaskList = function wrapSel
67
68
  return true;
68
69
  }
69
70
  var blockRange = (0, _helpers.getBlockRange)($from, $to);
70
- if (blockTaskItem) {
71
- if (isBlockTaskItem && blockTaskItemNode) {
71
+ if (blockTaskItem && isBlockTaskItem && blockTaskItemNode) {
72
+ var startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
73
+ if (state.selection instanceof _state.TextSelection && state.selection.$to !== state.selection.$from) {
74
+ var lastNode = $to.node($to.depth);
75
+ var endOfNodeInBlockTaskItem = state.doc.resolve($to.start() + lastNode.nodeSize - 1);
76
+ if (lastNode.type === taskItem) {
77
+ blockRange = new _model.NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
78
+ }
79
+ } else {
72
80
  // Get the Resolved $from and $to of the node nested inside the blockTaskItem
73
- var startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
74
- var endOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start + blockTaskItemNode.node.nodeSize - 1);
75
- blockRange = new _model.NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
81
+ var _endOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start + blockTaskItemNode.node.nodeSize - 1);
82
+ blockRange = new _model.NodeRange(startOfNodeInBlockTaskItem, _endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
76
83
  }
77
84
  }
78
85
  if (!blockRange) {
@@ -1,6 +1,7 @@
1
1
  import { findCutBefore } from '@atlaskit/editor-common/commands';
2
2
  import { findFarthestParentNode } from '@atlaskit/editor-common/utils';
3
3
  import { NodeRange } from '@atlaskit/editor-prosemirror/model';
4
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
5
  import { findWrapping, ReplaceAroundStep } from '@atlaskit/editor-prosemirror/transform';
5
6
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
7
  import { getBlockRange, isActionOrDecisionItem, isActionOrDecisionList, liftBlock, subtreeHeight } from './helpers';
@@ -63,10 +64,16 @@ export const wrapSelectionInTaskList = (state, dispatch) => {
63
64
  return true;
64
65
  }
65
66
  let blockRange = getBlockRange($from, $to);
66
- if (blockTaskItem) {
67
- if (isBlockTaskItem && blockTaskItemNode) {
67
+ if (blockTaskItem && isBlockTaskItem && blockTaskItemNode) {
68
+ const startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
69
+ if (state.selection instanceof TextSelection && state.selection.$to !== state.selection.$from) {
70
+ const lastNode = $to.node($to.depth);
71
+ const endOfNodeInBlockTaskItem = state.doc.resolve($to.start() + lastNode.nodeSize - 1);
72
+ if (lastNode.type === taskItem) {
73
+ blockRange = new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
74
+ }
75
+ } else {
68
76
  // Get the Resolved $from and $to of the node nested inside the blockTaskItem
69
- const startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
70
77
  const endOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start + blockTaskItemNode.node.nodeSize - 1);
71
78
  blockRange = new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
72
79
  }
@@ -1,6 +1,7 @@
1
1
  import { findCutBefore } from '@atlaskit/editor-common/commands';
2
2
  import { findFarthestParentNode } from '@atlaskit/editor-common/utils';
3
3
  import { NodeRange } from '@atlaskit/editor-prosemirror/model';
4
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
5
  import { findWrapping, ReplaceAroundStep } from '@atlaskit/editor-prosemirror/transform';
5
6
  import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
7
  import { getBlockRange, isActionOrDecisionItem, isActionOrDecisionList, liftBlock, subtreeHeight } from './helpers';
@@ -61,12 +62,18 @@ export var wrapSelectionInTaskList = function wrapSelectionInTaskList(state, dis
61
62
  return true;
62
63
  }
63
64
  var blockRange = getBlockRange($from, $to);
64
- if (blockTaskItem) {
65
- if (isBlockTaskItem && blockTaskItemNode) {
65
+ if (blockTaskItem && isBlockTaskItem && blockTaskItemNode) {
66
+ var startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
67
+ if (state.selection instanceof TextSelection && state.selection.$to !== state.selection.$from) {
68
+ var lastNode = $to.node($to.depth);
69
+ var endOfNodeInBlockTaskItem = state.doc.resolve($to.start() + lastNode.nodeSize - 1);
70
+ if (lastNode.type === taskItem) {
71
+ blockRange = new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
72
+ }
73
+ } else {
66
74
  // Get the Resolved $from and $to of the node nested inside the blockTaskItem
67
- var startOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start);
68
- var endOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start + blockTaskItemNode.node.nodeSize - 1);
69
- blockRange = new NodeRange(startOfNodeInBlockTaskItem, endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
75
+ var _endOfNodeInBlockTaskItem = state.doc.resolve(blockTaskItemNode.start + blockTaskItemNode.node.nodeSize - 1);
76
+ blockRange = new NodeRange(startOfNodeInBlockTaskItem, _endOfNodeInBlockTaskItem, blockTaskItemNode.depth - 1);
70
77
  }
71
78
  }
72
79
  if (!blockRange) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
44
44
  "@atlaskit/editor-shared-styles": "^3.6.0",
45
45
  "@atlaskit/heading": "^5.2.0",
46
- "@atlaskit/icon": "^27.12.0",
46
+ "@atlaskit/icon": "^28.0.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/popup": "^4.3.0",
49
49
  "@atlaskit/primitives": "^14.11.0",
@@ -56,7 +56,7 @@
56
56
  "bind-event-listener": "^3.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^107.26.0",
59
+ "@atlaskit/editor-common": "^107.27.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
62
  "react-intl-next": "npm:react-intl@^5.18.1"