@atlaskit/editor-plugin-tasks-and-decisions 10.1.8 → 10.1.9
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,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-tasks-and-decisions
|
|
2
2
|
|
|
3
|
+
## 10.1.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6431f5f6492ae`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6431f5f6492ae) -
|
|
8
|
+
Remove unused platform_editor_toolbar_aifc_ga_blockers feature gate
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 10.1.8
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
8
8
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var toggleTaskList = exports.toggleTaskList = function toggleTaskList() {
|
|
13
12
|
var targetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'paragraph';
|
|
14
13
|
return function (_ref) {
|
|
@@ -17,26 +16,24 @@ var toggleTaskList = exports.toggleTaskList = function toggleTaskList() {
|
|
|
17
16
|
var selection = tr.selection;
|
|
18
17
|
|
|
19
18
|
// Handle empty selection: insert a new task item
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})]);
|
|
19
|
+
var $from = selection.$from;
|
|
20
|
+
var isEmpty = $from.parent.content.size === 0;
|
|
21
|
+
if (isEmpty && nodes.taskList && nodes.taskItem) {
|
|
22
|
+
// Create an empty task list with one empty task item
|
|
23
|
+
var listLocalId = _adfSchema.uuid.generate();
|
|
24
|
+
var itemLocalId = _adfSchema.uuid.generate();
|
|
25
|
+
var emptyList = nodes.taskList.create({
|
|
26
|
+
localId: listLocalId
|
|
27
|
+
}, [nodes.taskItem.create({
|
|
28
|
+
localId: itemLocalId
|
|
29
|
+
})]);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
31
|
+
// Insert the empty list at the current selection
|
|
32
|
+
var insertTr = (0, _utils.safeInsert)(emptyList)(tr);
|
|
33
|
+
if (insertTr !== tr) {
|
|
34
|
+
// Set cursor inside the new task item
|
|
35
|
+
var insertPos = insertTr.selection.$from.pos;
|
|
36
|
+
return insertTr.setSelection(_state.TextSelection.near(insertTr.doc.resolve(insertPos)));
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
var _getFormattedNode = (0, _transforms.getFormattedNode)(tr),
|
|
@@ -2,7 +2,6 @@ import { uuid } from '@atlaskit/adf-schema';
|
|
|
2
2
|
import { transformBetweenListTypes, transformToTaskList, transformTaskListToBlockNodes, isBulletOrOrderedList, isTaskList, getFormattedNode } from '@atlaskit/editor-common/transforms';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
export const toggleTaskList = (targetType = 'paragraph') => ({
|
|
7
6
|
tr
|
|
8
7
|
}) => {
|
|
@@ -14,28 +13,26 @@ export const toggleTaskList = (targetType = 'paragraph') => ({
|
|
|
14
13
|
} = tr;
|
|
15
14
|
|
|
16
15
|
// Handle empty selection: insert a new task item
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})]);
|
|
16
|
+
const {
|
|
17
|
+
$from
|
|
18
|
+
} = selection;
|
|
19
|
+
const isEmpty = $from.parent.content.size === 0;
|
|
20
|
+
if (isEmpty && nodes.taskList && nodes.taskItem) {
|
|
21
|
+
// Create an empty task list with one empty task item
|
|
22
|
+
const listLocalId = uuid.generate();
|
|
23
|
+
const itemLocalId = uuid.generate();
|
|
24
|
+
const emptyList = nodes.taskList.create({
|
|
25
|
+
localId: listLocalId
|
|
26
|
+
}, [nodes.taskItem.create({
|
|
27
|
+
localId: itemLocalId
|
|
28
|
+
})]);
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
30
|
+
// Insert the empty list at the current selection
|
|
31
|
+
const insertTr = safeInsert(emptyList)(tr);
|
|
32
|
+
if (insertTr !== tr) {
|
|
33
|
+
// Set cursor inside the new task item
|
|
34
|
+
const insertPos = insertTr.selection.$from.pos;
|
|
35
|
+
return insertTr.setSelection(TextSelection.near(insertTr.doc.resolve(insertPos)));
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
38
|
const {
|
|
@@ -2,7 +2,6 @@ import { uuid } from '@atlaskit/adf-schema';
|
|
|
2
2
|
import { transformBetweenListTypes, transformToTaskList, transformTaskListToBlockNodes, isBulletOrOrderedList, isTaskList, getFormattedNode } from '@atlaskit/editor-common/transforms';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
export var toggleTaskList = function toggleTaskList() {
|
|
7
6
|
var targetType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'paragraph';
|
|
8
7
|
return function (_ref) {
|
|
@@ -11,26 +10,24 @@ export var toggleTaskList = function toggleTaskList() {
|
|
|
11
10
|
var selection = tr.selection;
|
|
12
11
|
|
|
13
12
|
// Handle empty selection: insert a new task item
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})]);
|
|
13
|
+
var $from = selection.$from;
|
|
14
|
+
var isEmpty = $from.parent.content.size === 0;
|
|
15
|
+
if (isEmpty && nodes.taskList && nodes.taskItem) {
|
|
16
|
+
// Create an empty task list with one empty task item
|
|
17
|
+
var listLocalId = uuid.generate();
|
|
18
|
+
var itemLocalId = uuid.generate();
|
|
19
|
+
var emptyList = nodes.taskList.create({
|
|
20
|
+
localId: listLocalId
|
|
21
|
+
}, [nodes.taskItem.create({
|
|
22
|
+
localId: itemLocalId
|
|
23
|
+
})]);
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
25
|
+
// Insert the empty list at the current selection
|
|
26
|
+
var insertTr = safeInsert(emptyList)(tr);
|
|
27
|
+
if (insertTr !== tr) {
|
|
28
|
+
// Set cursor inside the new task item
|
|
29
|
+
var insertPos = insertTr.selection.$from.pos;
|
|
30
|
+
return insertTr.setSelection(TextSelection.near(insertTr.doc.resolve(insertPos)));
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
var _getFormattedNode = getFormattedNode(tr),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-tasks-and-decisions",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.9",
|
|
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.2.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^20.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^20.3.0",
|
|
53
53
|
"@atlaskit/tokens": "^11.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@compiled/react": "^0.18.6",
|
|
@@ -106,9 +106,6 @@
|
|
|
106
106
|
},
|
|
107
107
|
"platform_editor_blocktaskitem_patch_3": {
|
|
108
108
|
"type": "boolean"
|
|
109
|
-
},
|
|
110
|
-
"platform_editor_toolbar_aifc_ga_blockers": {
|
|
111
|
-
"type": "boolean"
|
|
112
109
|
}
|
|
113
110
|
}
|
|
114
111
|
}
|