@atlaskit/editor-plugin-list 4.1.3 → 4.1.5
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,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-list
|
|
2
2
|
|
|
3
|
+
## 4.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 4.1.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#125450](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/125450)
|
|
14
|
+
[`e3e99633b852e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3e99633b852e) -
|
|
15
|
+
[ux] ED-26944 fix indentation in list for non macro bodied extension
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.1.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -11,8 +11,10 @@ var _selection = require("@atlaskit/editor-common/selection");
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _find = require("../utils/find");
|
|
15
16
|
var indentListItemsSelected = exports.indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
17
|
+
var _currentListItem$cont;
|
|
16
18
|
var originalSelection = tr.selection;
|
|
17
19
|
var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
|
|
18
20
|
selection: originalSelection,
|
|
@@ -37,7 +39,11 @@ var indentListItemsSelected = exports.indentListItemsSelected = function indentL
|
|
|
37
39
|
var listItemIndex = resolvedPos.index();
|
|
38
40
|
// @ts-ignore
|
|
39
41
|
var positionListItemPosition = resolvedPos.posAtIndex(listItemIndex - 1);
|
|
42
|
+
var currentListItemPosition = resolvedPos.posAtIndex(listItemIndex);
|
|
40
43
|
var previousListItem = tr.doc.nodeAt(positionListItemPosition);
|
|
44
|
+
var currentListItem = tr.doc.nodeAt(currentListItemPosition);
|
|
45
|
+
var currentListItemContent = currentListItem === null || currentListItem === void 0 || (_currentListItem$cont = currentListItem.content) === null || _currentListItem$cont === void 0 ? void 0 : _currentListItem$cont.content;
|
|
46
|
+
var hasLastItemExtension = currentListItemContent !== undefined && (currentListItemContent === null || currentListItemContent === void 0 ? void 0 : currentListItemContent.length) > 0 ? currentListItemContent[currentListItemContent.length - 1].type.name === 'extension' : false;
|
|
41
47
|
if (!previousListItem || !(0, _utils.isListItemNode)(previousListItem)) {
|
|
42
48
|
return null;
|
|
43
49
|
}
|
|
@@ -56,7 +62,8 @@ var indentListItemsSelected = exports.indentListItemsSelected = function indentL
|
|
|
56
62
|
listNodeType: listNodeType,
|
|
57
63
|
range: range,
|
|
58
64
|
from: from,
|
|
59
|
-
to: to
|
|
65
|
+
to: to,
|
|
66
|
+
hasLastItemExtension: hasLastItemExtension
|
|
60
67
|
}),
|
|
61
68
|
_createIndentedListIt2 = (0, _slicedToArray2.default)(_createIndentedListIt, 2),
|
|
62
69
|
sliceSelected = _createIndentedListIt2[0],
|
|
@@ -114,8 +121,9 @@ var createIndentedListItemsSlice = function createIndentedListItemsSlice(_ref3)
|
|
|
114
121
|
from = _ref3.from,
|
|
115
122
|
to = _ref3.to,
|
|
116
123
|
listNodeType = _ref3.listNodeType,
|
|
117
|
-
range = _ref3.range
|
|
118
|
-
|
|
124
|
+
range = _ref3.range,
|
|
125
|
+
hasLastItemExtension = _ref3.hasLastItemExtension;
|
|
126
|
+
var listItemsSlice = tr.doc.slice(from, hasLastItemExtension && (0, _platformFeatureFlags.fg)('platform_editor_non_macros_list_indent_fix') ? to : to - 2);
|
|
119
127
|
var listFragment = _model.Fragment.from(listNodeType.create(null, listItemsSlice.content));
|
|
120
128
|
var nonSelectedListItemsSlice = tr.doc.slice(to, range.end - 2);
|
|
121
129
|
var openStart = tr.doc.slice(from - 1, range.end).openStart;
|
|
@@ -3,8 +3,10 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
3
3
|
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { findFirstParentListItemNode } from '../utils/find';
|
|
7
8
|
export const indentListItemsSelected = tr => {
|
|
9
|
+
var _currentListItem$cont;
|
|
8
10
|
const originalSelection = tr.selection;
|
|
9
11
|
const normalizedSelection = normalizeListItemsSelection({
|
|
10
12
|
selection: originalSelection,
|
|
@@ -31,7 +33,11 @@ export const indentListItemsSelected = tr => {
|
|
|
31
33
|
const listItemIndex = resolvedPos.index();
|
|
32
34
|
// @ts-ignore
|
|
33
35
|
const positionListItemPosition = resolvedPos.posAtIndex(listItemIndex - 1);
|
|
36
|
+
const currentListItemPosition = resolvedPos.posAtIndex(listItemIndex);
|
|
34
37
|
const previousListItem = tr.doc.nodeAt(positionListItemPosition);
|
|
38
|
+
const currentListItem = tr.doc.nodeAt(currentListItemPosition);
|
|
39
|
+
const currentListItemContent = currentListItem === null || currentListItem === void 0 ? void 0 : (_currentListItem$cont = currentListItem.content) === null || _currentListItem$cont === void 0 ? void 0 : _currentListItem$cont.content;
|
|
40
|
+
const hasLastItemExtension = currentListItemContent !== undefined && (currentListItemContent === null || currentListItemContent === void 0 ? void 0 : currentListItemContent.length) > 0 ? currentListItemContent[currentListItemContent.length - 1].type.name === 'extension' : false;
|
|
35
41
|
if (!previousListItem || !isListItemNode(previousListItem)) {
|
|
36
42
|
return null;
|
|
37
43
|
}
|
|
@@ -50,7 +56,8 @@ export const indentListItemsSelected = tr => {
|
|
|
50
56
|
listNodeType,
|
|
51
57
|
range,
|
|
52
58
|
from,
|
|
53
|
-
to
|
|
59
|
+
to,
|
|
60
|
+
hasLastItemExtension
|
|
54
61
|
});
|
|
55
62
|
const hasPreviousNestedList = Boolean(previousNestedList);
|
|
56
63
|
const start = from - 1;
|
|
@@ -113,9 +120,10 @@ const createIndentedListItemsSlice = ({
|
|
|
113
120
|
from,
|
|
114
121
|
to,
|
|
115
122
|
listNodeType,
|
|
116
|
-
range
|
|
123
|
+
range,
|
|
124
|
+
hasLastItemExtension
|
|
117
125
|
}) => {
|
|
118
|
-
const listItemsSlice = tr.doc.slice(from, to - 2);
|
|
126
|
+
const listItemsSlice = tr.doc.slice(from, hasLastItemExtension && fg('platform_editor_non_macros_list_indent_fix') ? to : to - 2);
|
|
119
127
|
const listFragment = Fragment.from(listNodeType.create(null, listItemsSlice.content));
|
|
120
128
|
const nonSelectedListItemsSlice = tr.doc.slice(to, range.end - 2);
|
|
121
129
|
const openStart = tr.doc.slice(from - 1, range.end).openStart;
|
|
@@ -4,8 +4,10 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
|
4
4
|
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { findFirstParentListItemNode } from '../utils/find';
|
|
8
9
|
export var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
10
|
+
var _currentListItem$cont;
|
|
9
11
|
var originalSelection = tr.selection;
|
|
10
12
|
var normalizedSelection = normalizeListItemsSelection({
|
|
11
13
|
selection: originalSelection,
|
|
@@ -30,7 +32,11 @@ export var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
|
30
32
|
var listItemIndex = resolvedPos.index();
|
|
31
33
|
// @ts-ignore
|
|
32
34
|
var positionListItemPosition = resolvedPos.posAtIndex(listItemIndex - 1);
|
|
35
|
+
var currentListItemPosition = resolvedPos.posAtIndex(listItemIndex);
|
|
33
36
|
var previousListItem = tr.doc.nodeAt(positionListItemPosition);
|
|
37
|
+
var currentListItem = tr.doc.nodeAt(currentListItemPosition);
|
|
38
|
+
var currentListItemContent = currentListItem === null || currentListItem === void 0 || (_currentListItem$cont = currentListItem.content) === null || _currentListItem$cont === void 0 ? void 0 : _currentListItem$cont.content;
|
|
39
|
+
var hasLastItemExtension = currentListItemContent !== undefined && (currentListItemContent === null || currentListItemContent === void 0 ? void 0 : currentListItemContent.length) > 0 ? currentListItemContent[currentListItemContent.length - 1].type.name === 'extension' : false;
|
|
34
40
|
if (!previousListItem || !isListItemNode(previousListItem)) {
|
|
35
41
|
return null;
|
|
36
42
|
}
|
|
@@ -49,7 +55,8 @@ export var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
|
49
55
|
listNodeType: listNodeType,
|
|
50
56
|
range: range,
|
|
51
57
|
from: from,
|
|
52
|
-
to: to
|
|
58
|
+
to: to,
|
|
59
|
+
hasLastItemExtension: hasLastItemExtension
|
|
53
60
|
}),
|
|
54
61
|
_createIndentedListIt2 = _slicedToArray(_createIndentedListIt, 2),
|
|
55
62
|
sliceSelected = _createIndentedListIt2[0],
|
|
@@ -107,8 +114,9 @@ var createIndentedListItemsSlice = function createIndentedListItemsSlice(_ref3)
|
|
|
107
114
|
from = _ref3.from,
|
|
108
115
|
to = _ref3.to,
|
|
109
116
|
listNodeType = _ref3.listNodeType,
|
|
110
|
-
range = _ref3.range
|
|
111
|
-
|
|
117
|
+
range = _ref3.range,
|
|
118
|
+
hasLastItemExtension = _ref3.hasLastItemExtension;
|
|
119
|
+
var listItemsSlice = tr.doc.slice(from, hasLastItemExtension && fg('platform_editor_non_macros_list_indent_fix') ? to : to - 2);
|
|
112
120
|
var listFragment = Fragment.from(listNodeType.create(null, listItemsSlice.content));
|
|
113
121
|
var nonSelectedListItemsSlice = tr.doc.slice(to, range.end - 2);
|
|
114
122
|
var openStart = tr.doc.slice(from - 1, range.end).openStart;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-list",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.5",
|
|
4
4
|
"description": "List plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
36
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
35
|
+
"@atlaskit/editor-common": "^102.8.0",
|
|
36
|
+
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
40
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^4.0.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
@@ -86,6 +86,9 @@
|
|
|
86
86
|
"platform-feature-flags": {
|
|
87
87
|
"platform_editor_nbm_backspace_fixes": {
|
|
88
88
|
"type": "boolean"
|
|
89
|
+
},
|
|
90
|
+
"platform_editor_non_macros_list_indent_fix": {
|
|
91
|
+
"type": "boolean"
|
|
89
92
|
}
|
|
90
93
|
},
|
|
91
94
|
"stricter": {
|