@atlaskit/editor-plugin-tasks-and-decisions 11.4.7 → 11.4.8

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.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e3da94ed988bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3da94ed988bc) -
8
+ Fix task list indentation producing two sibling taskLists when indenting an item that has a nested
9
+ sibling. When a selected (moved) item establishes a wrapper at a given depth, subsequent
10
+ unselected items at the same depth now merge into that wrapper rather than creating a separate
11
+ sibling taskList.
12
+ - Updated dependencies
13
+
3
14
  ## 11.4.7
4
15
 
5
16
  ### Patch Changes
@@ -42,10 +42,6 @@ function flattenTaskList(options) {
42
42
  // The root entry (depth -1) is special: its children become the content
43
43
  // of the outermost taskList directly (not wrapped in another taskList).
44
44
  // Entries at depth >= 0 each produce a nested taskList when popped.
45
- // listAttrs preserves the original parent's attributes when available.
46
- // sourceParentAttrs tracks the original parent taskList attrs of the items
47
- // in this entry, used to decide whether consecutive same-depth items
48
- // should share a wrapper or be separated.
49
45
 
50
46
  /**
51
47
  * Rebuilds a taskList tree from a flattened array of task items.
@@ -82,6 +78,7 @@ function rebuildTaskList(items, schema) {
82
78
  var stack = [{
83
79
  depth: -1,
84
80
  children: [],
81
+ hasSelectedItems: false,
85
82
  listAttrs: items[0].parentListAttrs,
86
83
  sourceParentAttrs: items[0].parentListAttrs
87
84
  }];
@@ -112,9 +109,12 @@ function rebuildTaskList(items, schema) {
112
109
  // separate wrappers (preserving original nesting). Selected (moved)
113
110
  // items always merge with whatever is already at the target depth,
114
111
  // since they're being placed into a new structural context.
112
+ // However, if the current entry already contains selected (moved) items,
113
+ // we do NOT split — the unselected sibling should join the same wrapper
114
+ // because the selected item established the new structural context.
115
115
  if (stack.length > 1 && stack[stack.length - 1].depth === targetDepth && !item.isSelected) {
116
116
  var top = stack[stack.length - 1];
117
- if (top.sourceParentAttrs !== item.parentListAttrs) {
117
+ if (top.sourceParentAttrs !== item.parentListAttrs && !top.hasSelectedItems) {
118
118
  var _popped2$listAttrs;
119
119
  var _popped2 = stack.pop();
120
120
  if (!_popped2) {
@@ -137,6 +137,7 @@ function rebuildTaskList(items, schema) {
137
137
  stack.push({
138
138
  depth: nextDepth,
139
139
  children: [],
140
+ hasSelectedItems: false,
140
141
  listAttrs: item.isSelected ? null : item.parentListAttrs,
141
142
  sourceParentAttrs: item.parentListAttrs
142
143
  });
@@ -146,17 +147,24 @@ function rebuildTaskList(items, schema) {
146
147
  if (targetDepth === 0) {
147
148
  // Depth 0 items go directly into the root taskList
148
149
  stack[0].children.push(item.node);
150
+ if (item.isSelected) {
151
+ stack[0].hasSelectedItems = true;
152
+ }
149
153
  } else {
150
154
  // Ensure there's a stack entry at depth targetDepth to hold this item
151
155
  if (stack[stack.length - 1].depth < targetDepth) {
152
156
  stack.push({
153
157
  depth: targetDepth,
154
158
  children: [],
159
+ hasSelectedItems: false,
155
160
  listAttrs: item.isSelected ? null : item.parentListAttrs,
156
161
  sourceParentAttrs: item.parentListAttrs
157
162
  });
158
163
  }
159
164
  stack[stack.length - 1].children.push(item.node);
165
+ if (item.isSelected) {
166
+ stack[stack.length - 1].hasSelectedItems = true;
167
+ }
160
168
  }
161
169
  }
162
170
 
@@ -29,10 +29,6 @@ export function flattenTaskList(options) {
29
29
  // The root entry (depth -1) is special: its children become the content
30
30
  // of the outermost taskList directly (not wrapped in another taskList).
31
31
  // Entries at depth >= 0 each produce a nested taskList when popped.
32
- // listAttrs preserves the original parent's attributes when available.
33
- // sourceParentAttrs tracks the original parent taskList attrs of the items
34
- // in this entry, used to decide whether consecutive same-depth items
35
- // should share a wrapper or be separated.
36
32
 
37
33
  /**
38
34
  * Rebuilds a taskList tree from a flattened array of task items.
@@ -71,6 +67,7 @@ export function rebuildTaskList(items, schema) {
71
67
  const stack = [{
72
68
  depth: -1,
73
69
  children: [],
70
+ hasSelectedItems: false,
74
71
  listAttrs: items[0].parentListAttrs,
75
72
  sourceParentAttrs: items[0].parentListAttrs
76
73
  }];
@@ -97,9 +94,12 @@ export function rebuildTaskList(items, schema) {
97
94
  // separate wrappers (preserving original nesting). Selected (moved)
98
95
  // items always merge with whatever is already at the target depth,
99
96
  // since they're being placed into a new structural context.
97
+ // However, if the current entry already contains selected (moved) items,
98
+ // we do NOT split — the unselected sibling should join the same wrapper
99
+ // because the selected item established the new structural context.
100
100
  if (stack.length > 1 && stack[stack.length - 1].depth === targetDepth && !item.isSelected) {
101
101
  const top = stack[stack.length - 1];
102
- if (top.sourceParentAttrs !== item.parentListAttrs) {
102
+ if (top.sourceParentAttrs !== item.parentListAttrs && !top.hasSelectedItems) {
103
103
  var _popped$listAttrs2;
104
104
  const popped = stack.pop();
105
105
  if (!popped) {
@@ -122,6 +122,7 @@ export function rebuildTaskList(items, schema) {
122
122
  stack.push({
123
123
  depth: nextDepth,
124
124
  children: [],
125
+ hasSelectedItems: false,
125
126
  listAttrs: item.isSelected ? null : item.parentListAttrs,
126
127
  sourceParentAttrs: item.parentListAttrs
127
128
  });
@@ -131,17 +132,24 @@ export function rebuildTaskList(items, schema) {
131
132
  if (targetDepth === 0) {
132
133
  // Depth 0 items go directly into the root taskList
133
134
  stack[0].children.push(item.node);
135
+ if (item.isSelected) {
136
+ stack[0].hasSelectedItems = true;
137
+ }
134
138
  } else {
135
139
  // Ensure there's a stack entry at depth targetDepth to hold this item
136
140
  if (stack[stack.length - 1].depth < targetDepth) {
137
141
  stack.push({
138
142
  depth: targetDepth,
139
143
  children: [],
144
+ hasSelectedItems: false,
140
145
  listAttrs: item.isSelected ? null : item.parentListAttrs,
141
146
  sourceParentAttrs: item.parentListAttrs
142
147
  });
143
148
  }
144
149
  stack[stack.length - 1].children.push(item.node);
150
+ if (item.isSelected) {
151
+ stack[stack.length - 1].hasSelectedItems = true;
152
+ }
145
153
  }
146
154
  }
147
155
 
@@ -35,10 +35,6 @@ export function flattenTaskList(options) {
35
35
  // The root entry (depth -1) is special: its children become the content
36
36
  // of the outermost taskList directly (not wrapped in another taskList).
37
37
  // Entries at depth >= 0 each produce a nested taskList when popped.
38
- // listAttrs preserves the original parent's attributes when available.
39
- // sourceParentAttrs tracks the original parent taskList attrs of the items
40
- // in this entry, used to decide whether consecutive same-depth items
41
- // should share a wrapper or be separated.
42
38
 
43
39
  /**
44
40
  * Rebuilds a taskList tree from a flattened array of task items.
@@ -75,6 +71,7 @@ export function rebuildTaskList(items, schema) {
75
71
  var stack = [{
76
72
  depth: -1,
77
73
  children: [],
74
+ hasSelectedItems: false,
78
75
  listAttrs: items[0].parentListAttrs,
79
76
  sourceParentAttrs: items[0].parentListAttrs
80
77
  }];
@@ -105,9 +102,12 @@ export function rebuildTaskList(items, schema) {
105
102
  // separate wrappers (preserving original nesting). Selected (moved)
106
103
  // items always merge with whatever is already at the target depth,
107
104
  // since they're being placed into a new structural context.
105
+ // However, if the current entry already contains selected (moved) items,
106
+ // we do NOT split — the unselected sibling should join the same wrapper
107
+ // because the selected item established the new structural context.
108
108
  if (stack.length > 1 && stack[stack.length - 1].depth === targetDepth && !item.isSelected) {
109
109
  var top = stack[stack.length - 1];
110
- if (top.sourceParentAttrs !== item.parentListAttrs) {
110
+ if (top.sourceParentAttrs !== item.parentListAttrs && !top.hasSelectedItems) {
111
111
  var _popped2$listAttrs;
112
112
  var _popped2 = stack.pop();
113
113
  if (!_popped2) {
@@ -130,6 +130,7 @@ export function rebuildTaskList(items, schema) {
130
130
  stack.push({
131
131
  depth: nextDepth,
132
132
  children: [],
133
+ hasSelectedItems: false,
133
134
  listAttrs: item.isSelected ? null : item.parentListAttrs,
134
135
  sourceParentAttrs: item.parentListAttrs
135
136
  });
@@ -139,17 +140,24 @@ export function rebuildTaskList(items, schema) {
139
140
  if (targetDepth === 0) {
140
141
  // Depth 0 items go directly into the root taskList
141
142
  stack[0].children.push(item.node);
143
+ if (item.isSelected) {
144
+ stack[0].hasSelectedItems = true;
145
+ }
142
146
  } else {
143
147
  // Ensure there's a stack entry at depth targetDepth to hold this item
144
148
  if (stack[stack.length - 1].depth < targetDepth) {
145
149
  stack.push({
146
150
  depth: targetDepth,
147
151
  children: [],
152
+ hasSelectedItems: false,
148
153
  listAttrs: item.isSelected ? null : item.parentListAttrs,
149
154
  sourceParentAttrs: item.parentListAttrs
150
155
  });
151
156
  }
152
157
  stack[stack.length - 1].children.push(item.node);
158
+ if (item.isSelected) {
159
+ stack[stack.length - 1].hasSelectedItems = true;
160
+ }
153
161
  }
154
162
  }
155
163
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-tasks-and-decisions",
3
- "version": "11.4.7",
3
+ "version": "11.4.8",
4
4
  "description": "Tasks and decisions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -49,14 +49,14 @@
49
49
  "@atlaskit/primitives": "^18.1.0",
50
50
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
51
51
  "@atlaskit/task-decision": "^19.3.0",
52
- "@atlaskit/tmp-editor-statsig": "^54.1.0",
52
+ "@atlaskit/tmp-editor-statsig": "^54.3.0",
53
53
  "@atlaskit/tokens": "^11.4.0",
54
54
  "@babel/runtime": "^7.0.0",
55
55
  "@compiled/react": "^0.20.0",
56
56
  "bind-event-listener": "^3.0.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^112.16.0",
59
+ "@atlaskit/editor-common": "^112.18.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"