@atlaskit/editor-plugin-tasks-and-decisions 11.3.2 → 11.3.3
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 +8 -0
- package/dist/cjs/pm-plugins/actions/move-selected-task-list-items.js +8 -4
- package/dist/cjs/pm-plugins/task-list-indentation.js +9 -9
- package/dist/es2019/pm-plugins/actions/move-selected-task-list-items.js +9 -5
- package/dist/es2019/pm-plugins/task-list-indentation.js +9 -9
- package/dist/esm/pm-plugins/actions/move-selected-task-list-items.js +9 -5
- package/dist/esm/pm-plugins/task-list-indentation.js +9 -9
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 11.3.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9b33b26d69865`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9b33b26d69865) -
|
|
8
|
+
Narrow list replacement range during indent/outdent for collab-friendly cursor preservation
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 11.3.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -47,7 +47,7 @@ function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
47
47
|
// taskItem has inline content, so wrap in a paragraph.
|
|
48
48
|
// blockTaskItem already has paragraph children.
|
|
49
49
|
var blockTaskItem = s.nodes.blockTaskItem;
|
|
50
|
-
if (blockTaskItem
|
|
50
|
+
if (!!blockTaskItem && item.node.type === blockTaskItem) {
|
|
51
51
|
// blockTaskItem children are already paragraphs/extensions
|
|
52
52
|
var children = [];
|
|
53
53
|
item.node.forEach(function (child) {
|
|
@@ -64,15 +64,19 @@ function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
64
64
|
if (fragment.size === 0) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
// Narrow the replacement to the minimal changed range for collab-friendly
|
|
69
|
+
// cursor preservation on unaffected list items.
|
|
70
|
+
var narrowed = (0, _lists.narrowReplacementRange)(tr.doc, rootListStart, rootListEnd, fragment, contentStartOffsets);
|
|
71
|
+
tr.replaceWith(narrowed.start, narrowed.end, narrowed.fragment);
|
|
68
72
|
var _computeSelectionOffs = (0, _lists.computeSelectionOffsets)({
|
|
69
73
|
items: flattenedItems,
|
|
70
74
|
startIndex: startIndex,
|
|
71
75
|
endIndex: endIndex,
|
|
72
76
|
originalFrom: $from.pos,
|
|
73
77
|
originalTo: $to.pos,
|
|
74
|
-
contentStartOffsets:
|
|
75
|
-
rootListStart:
|
|
78
|
+
contentStartOffsets: narrowed.adjustedContentStartOffsets,
|
|
79
|
+
rootListStart: narrowed.start,
|
|
76
80
|
docSize: tr.doc.content.size
|
|
77
81
|
}),
|
|
78
82
|
from = _computeSelectionOffs.from,
|
|
@@ -38,6 +38,15 @@ function flattenTaskList(options) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
// Each stack entry collects children for a taskList at a given depth.
|
|
42
|
+
// The root entry (depth -1) is special: its children become the content
|
|
43
|
+
// of the outermost taskList directly (not wrapped in another taskList).
|
|
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
|
+
|
|
41
50
|
/**
|
|
42
51
|
* Rebuilds a taskList tree from a flattened array of task items.
|
|
43
52
|
* Uses a stack-based approach to create proper nesting.
|
|
@@ -69,15 +78,6 @@ function rebuildTaskList(items, schema) {
|
|
|
69
78
|
return null;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
// Each stack entry collects children for a taskList at a given depth.
|
|
73
|
-
// The root entry (depth -1) is special: its children become the content
|
|
74
|
-
// of the outermost taskList directly (not wrapped in another taskList).
|
|
75
|
-
// Entries at depth >= 0 each produce a nested taskList when popped.
|
|
76
|
-
// listAttrs preserves the original parent's attributes when available.
|
|
77
|
-
// sourceParentAttrs tracks the original parent taskList attrs of the items
|
|
78
|
-
// in this entry, used to decide whether consecutive same-depth items
|
|
79
|
-
// should share a wrapper or be separated.
|
|
80
|
-
|
|
81
81
|
// Start with the root level (depth -1 represents the root taskList wrapper)
|
|
82
82
|
var stack = [{
|
|
83
83
|
depth: -1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildReplacementFragment, computeSelectionOffsets, restoreSelection } from '@atlaskit/editor-common/lists';
|
|
1
|
+
import { buildReplacementFragment, computeSelectionOffsets, narrowReplacementRange, restoreSelection } from '@atlaskit/editor-common/lists';
|
|
2
2
|
import { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { flattenTaskList, rebuildTaskList } from '../task-list-indentation';
|
|
4
4
|
const MAX_TASK_LIST_DEPTH = 6;
|
|
@@ -54,7 +54,7 @@ export function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
54
54
|
const {
|
|
55
55
|
blockTaskItem
|
|
56
56
|
} = s.nodes;
|
|
57
|
-
if (blockTaskItem
|
|
57
|
+
if (!!blockTaskItem && item.node.type === blockTaskItem) {
|
|
58
58
|
// blockTaskItem children are already paragraphs/extensions
|
|
59
59
|
const children = [];
|
|
60
60
|
item.node.forEach(child => children.push(child));
|
|
@@ -67,7 +67,11 @@ export function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
67
67
|
if (fragment.size === 0) {
|
|
68
68
|
return null;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
// Narrow the replacement to the minimal changed range for collab-friendly
|
|
72
|
+
// cursor preservation on unaffected list items.
|
|
73
|
+
const narrowed = narrowReplacementRange(tr.doc, rootListStart, rootListEnd, fragment, contentStartOffsets);
|
|
74
|
+
tr.replaceWith(narrowed.start, narrowed.end, narrowed.fragment);
|
|
71
75
|
const {
|
|
72
76
|
from,
|
|
73
77
|
to
|
|
@@ -77,8 +81,8 @@ export function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
77
81
|
endIndex,
|
|
78
82
|
originalFrom: $from.pos,
|
|
79
83
|
originalTo: $to.pos,
|
|
80
|
-
contentStartOffsets,
|
|
81
|
-
rootListStart,
|
|
84
|
+
contentStartOffsets: narrowed.adjustedContentStartOffsets,
|
|
85
|
+
rootListStart: narrowed.start,
|
|
82
86
|
docSize: tr.doc.content.size
|
|
83
87
|
});
|
|
84
88
|
restoreSelection({
|
|
@@ -25,6 +25,15 @@ export function flattenTaskList(options) {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
// Each stack entry collects children for a taskList at a given depth.
|
|
29
|
+
// The root entry (depth -1) is special: its children become the content
|
|
30
|
+
// of the outermost taskList directly (not wrapped in another taskList).
|
|
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
|
+
|
|
28
37
|
/**
|
|
29
38
|
* Rebuilds a taskList tree from a flattened array of task items.
|
|
30
39
|
* Uses a stack-based approach to create proper nesting.
|
|
@@ -58,15 +67,6 @@ export function rebuildTaskList(items, schema) {
|
|
|
58
67
|
return null;
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
// Each stack entry collects children for a taskList at a given depth.
|
|
62
|
-
// The root entry (depth -1) is special: its children become the content
|
|
63
|
-
// of the outermost taskList directly (not wrapped in another taskList).
|
|
64
|
-
// Entries at depth >= 0 each produce a nested taskList when popped.
|
|
65
|
-
// listAttrs preserves the original parent's attributes when available.
|
|
66
|
-
// sourceParentAttrs tracks the original parent taskList attrs of the items
|
|
67
|
-
// in this entry, used to decide whether consecutive same-depth items
|
|
68
|
-
// should share a wrapper or be separated.
|
|
69
|
-
|
|
70
70
|
// Start with the root level (depth -1 represents the root taskList wrapper)
|
|
71
71
|
const stack = [{
|
|
72
72
|
depth: -1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildReplacementFragment, computeSelectionOffsets, restoreSelection } from '@atlaskit/editor-common/lists';
|
|
1
|
+
import { buildReplacementFragment, computeSelectionOffsets, narrowReplacementRange, restoreSelection } from '@atlaskit/editor-common/lists';
|
|
2
2
|
import { findFarthestParentNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { flattenTaskList, rebuildTaskList } from '../task-list-indentation';
|
|
4
4
|
var MAX_TASK_LIST_DEPTH = 6;
|
|
@@ -41,7 +41,7 @@ export function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
41
41
|
// taskItem has inline content, so wrap in a paragraph.
|
|
42
42
|
// blockTaskItem already has paragraph children.
|
|
43
43
|
var blockTaskItem = s.nodes.blockTaskItem;
|
|
44
|
-
if (blockTaskItem
|
|
44
|
+
if (!!blockTaskItem && item.node.type === blockTaskItem) {
|
|
45
45
|
// blockTaskItem children are already paragraphs/extensions
|
|
46
46
|
var children = [];
|
|
47
47
|
item.node.forEach(function (child) {
|
|
@@ -58,15 +58,19 @@ export function moveSelectedTaskListItems(tr, indentDelta) {
|
|
|
58
58
|
if (fragment.size === 0) {
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
// Narrow the replacement to the minimal changed range for collab-friendly
|
|
63
|
+
// cursor preservation on unaffected list items.
|
|
64
|
+
var narrowed = narrowReplacementRange(tr.doc, rootListStart, rootListEnd, fragment, contentStartOffsets);
|
|
65
|
+
tr.replaceWith(narrowed.start, narrowed.end, narrowed.fragment);
|
|
62
66
|
var _computeSelectionOffs = computeSelectionOffsets({
|
|
63
67
|
items: flattenedItems,
|
|
64
68
|
startIndex: startIndex,
|
|
65
69
|
endIndex: endIndex,
|
|
66
70
|
originalFrom: $from.pos,
|
|
67
71
|
originalTo: $to.pos,
|
|
68
|
-
contentStartOffsets:
|
|
69
|
-
rootListStart:
|
|
72
|
+
contentStartOffsets: narrowed.adjustedContentStartOffsets,
|
|
73
|
+
rootListStart: narrowed.start,
|
|
70
74
|
docSize: tr.doc.content.size
|
|
71
75
|
}),
|
|
72
76
|
from = _computeSelectionOffs.from,
|
|
@@ -31,6 +31,15 @@ export function flattenTaskList(options) {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
// Each stack entry collects children for a taskList at a given depth.
|
|
35
|
+
// The root entry (depth -1) is special: its children become the content
|
|
36
|
+
// of the outermost taskList directly (not wrapped in another taskList).
|
|
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
|
+
|
|
34
43
|
/**
|
|
35
44
|
* Rebuilds a taskList tree from a flattened array of task items.
|
|
36
45
|
* Uses a stack-based approach to create proper nesting.
|
|
@@ -62,15 +71,6 @@ export function rebuildTaskList(items, schema) {
|
|
|
62
71
|
return null;
|
|
63
72
|
}
|
|
64
73
|
|
|
65
|
-
// Each stack entry collects children for a taskList at a given depth.
|
|
66
|
-
// The root entry (depth -1) is special: its children become the content
|
|
67
|
-
// of the outermost taskList directly (not wrapped in another taskList).
|
|
68
|
-
// Entries at depth >= 0 each produce a nested taskList when popped.
|
|
69
|
-
// listAttrs preserves the original parent's attributes when available.
|
|
70
|
-
// sourceParentAttrs tracks the original parent taskList attrs of the items
|
|
71
|
-
// in this entry, used to decide whether consecutive same-depth items
|
|
72
|
-
// should share a wrapper or be separated.
|
|
73
|
-
|
|
74
74
|
// Start with the root level (depth -1 represents the root taskList wrapper)
|
|
75
75
|
var stack = [{
|
|
76
76
|
depth: -1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.3",
|
|
4
4
|
"description": "Tasks and decisions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"@atlaskit/heading": "^5.3.0",
|
|
47
47
|
"@atlaskit/icon": "^33.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
|
-
"@atlaskit/primitives": "^18.
|
|
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": "^
|
|
53
|
-
"@atlaskit/tokens": "^11.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^46.0.0",
|
|
53
|
+
"@atlaskit/tokens": "^11.2.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.9.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"
|