@atlaskit/editor-plugin-tasks-and-decisions 11.4.6 → 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 +20 -0
- package/dist/cjs/pm-plugins/keymaps.js +13 -1
- package/dist/cjs/pm-plugins/task-list-indentation.js +13 -5
- package/dist/es2019/pm-plugins/keymaps.js +15 -1
- package/dist/es2019/pm-plugins/task-list-indentation.js +13 -5
- package/dist/esm/pm-plugins/keymaps.js +13 -1
- package/dist/esm/pm-plugins/task-list-indentation.js +13 -5
- package/dist/types/nodeviews/TaskItemNodeView.d.ts +1 -2
- package/dist/types-ts4.5/nodeviews/TaskItemNodeView.d.ts +1 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
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
|
+
|
|
14
|
+
## 11.4.7
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`3e18e5bea1aa1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3e18e5bea1aa1) -
|
|
19
|
+
Fixed cursor placement when pressing Enter at the start of a nested task item. Fixed extra spacing
|
|
20
|
+
on nested task lists when flexible list indentation is enabled.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 11.4.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -606,7 +606,19 @@ var enter = function enter(editorAnalyticsAPI, getContextIdentifier) {
|
|
|
606
606
|
return tr.insert(blockTaskItemNode.pos, newTaskItem);
|
|
607
607
|
}
|
|
608
608
|
// Current position will point to text node, but we want to insert above the taskItem node
|
|
609
|
-
|
|
609
|
+
var insertPos = $from.pos - 1;
|
|
610
|
+
tr.insert(insertPos, newTask);
|
|
611
|
+
// Place cursor on the newly inserted empty task item above
|
|
612
|
+
// when nested inside another taskList.
|
|
613
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_flexible_list_indentation', 'isEnabled', true)) {
|
|
614
|
+
var taskListType = schema.nodes.taskList;
|
|
615
|
+
var parentTaskList = $from.node($from.depth - 1);
|
|
616
|
+
var grandparent = $from.depth >= 3 ? $from.node($from.depth - 2) : null;
|
|
617
|
+
if ((parentTaskList === null || parentTaskList === void 0 ? void 0 : parentTaskList.type) === taskListType && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === taskListType) {
|
|
618
|
+
tr.setSelection(_state2.TextSelection.create(tr.doc, insertPos + 1));
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return tr;
|
|
610
622
|
}
|
|
611
623
|
}
|
|
612
624
|
/**
|
|
@@ -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
|
|
|
@@ -601,7 +601,21 @@ const enter = (editorAnalyticsAPI, getContextIdentifier) => filter(isInsideTaskO
|
|
|
601
601
|
return tr.insert(blockTaskItemNode.pos, newTaskItem);
|
|
602
602
|
}
|
|
603
603
|
// Current position will point to text node, but we want to insert above the taskItem node
|
|
604
|
-
|
|
604
|
+
const insertPos = $from.pos - 1;
|
|
605
|
+
tr.insert(insertPos, newTask);
|
|
606
|
+
// Place cursor on the newly inserted empty task item above
|
|
607
|
+
// when nested inside another taskList.
|
|
608
|
+
if (expValEquals('platform_editor_flexible_list_indentation', 'isEnabled', true)) {
|
|
609
|
+
const {
|
|
610
|
+
taskList: taskListType
|
|
611
|
+
} = schema.nodes;
|
|
612
|
+
const parentTaskList = $from.node($from.depth - 1);
|
|
613
|
+
const grandparent = $from.depth >= 3 ? $from.node($from.depth - 2) : null;
|
|
614
|
+
if ((parentTaskList === null || parentTaskList === void 0 ? void 0 : parentTaskList.type) === taskListType && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === taskListType) {
|
|
615
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return tr;
|
|
605
619
|
}
|
|
606
620
|
}
|
|
607
621
|
/**
|
|
@@ -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
|
|
|
@@ -598,7 +598,19 @@ var enter = function enter(editorAnalyticsAPI, getContextIdentifier) {
|
|
|
598
598
|
return tr.insert(blockTaskItemNode.pos, newTaskItem);
|
|
599
599
|
}
|
|
600
600
|
// Current position will point to text node, but we want to insert above the taskItem node
|
|
601
|
-
|
|
601
|
+
var insertPos = $from.pos - 1;
|
|
602
|
+
tr.insert(insertPos, newTask);
|
|
603
|
+
// Place cursor on the newly inserted empty task item above
|
|
604
|
+
// when nested inside another taskList.
|
|
605
|
+
if (expValEquals('platform_editor_flexible_list_indentation', 'isEnabled', true)) {
|
|
606
|
+
var taskListType = schema.nodes.taskList;
|
|
607
|
+
var parentTaskList = $from.node($from.depth - 1);
|
|
608
|
+
var grandparent = $from.depth >= 3 ? $from.node($from.depth - 2) : null;
|
|
609
|
+
if ((parentTaskList === null || parentTaskList === void 0 ? void 0 : parentTaskList.type) === taskListType && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === taskListType) {
|
|
610
|
+
tr.setSelection(TextSelection.create(tr.doc, insertPos + 1));
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return tr;
|
|
602
614
|
}
|
|
603
615
|
}
|
|
604
616
|
/**
|
|
@@ -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
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { ExtractInjectionAPI, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
|
|
7
6
|
interface TaskItemNodeViewOptions {
|
|
8
7
|
api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { ExtractInjectionAPI, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
6
5
|
import type { TasksAndDecisionsPlugin } from '../tasksAndDecisionsPluginType';
|
|
7
6
|
interface TaskItemNodeViewOptions {
|
|
8
7
|
api: ExtractInjectionAPI<TasksAndDecisionsPlugin> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "11.4.
|
|
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.
|
|
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.
|
|
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"
|