@atlaskit/editor-plugin-list 4.1.2 → 4.1.4
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 +18 -0
- package/dist/cjs/pm-plugins/actions/indent-list-items-selected.js +11 -3
- package/dist/cjs/pm-plugins/commands/index.js +5 -2
- package/dist/es2019/pm-plugins/actions/indent-list-items-selected.js +11 -3
- package/dist/es2019/pm-plugins/commands/index.js +5 -2
- package/dist/esm/pm-plugins/actions/indent-list-items-selected.js +11 -3
- package/dist/esm/pm-plugins/commands/index.js +5 -2
- package/package.json +12 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-list
|
|
2
2
|
|
|
3
|
+
## 4.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#125450](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/125450)
|
|
8
|
+
[`e3e99633b852e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3e99633b852e) -
|
|
9
|
+
[ux] ED-26944 fix indentation in list for non macro bodied extension
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.1.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#124104](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/124104)
|
|
17
|
+
[`a48ac34f66f25`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a48ac34f66f25) -
|
|
18
|
+
[ux] ED-26942 Modified editor-plugin-list backspace keymap handler to prevent it from deleting
|
|
19
|
+
extensions
|
|
20
|
+
|
|
3
21
|
## 4.1.2
|
|
4
22
|
|
|
5
23
|
### 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;
|
|
@@ -16,6 +16,7 @@ var _commands2 = require("@atlaskit/editor-prosemirror/commands");
|
|
|
16
16
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
17
17
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
18
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
19
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _conversions = require("../actions/conversions");
|
|
20
21
|
var _wrapAndJoinLists = require("../actions/wrap-and-join-lists");
|
|
21
22
|
var _transforms = require("../transforms");
|
|
@@ -254,10 +255,12 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
254
255
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
255
256
|
return false;
|
|
256
257
|
}
|
|
258
|
+
var nodeBeforeIsExtension =
|
|
259
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
260
|
+
(0, _platformFeatureFlags.fg)('platform_editor_nbm_backspace_fixes') && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.type.name === 'extension';
|
|
257
261
|
var previousListItemEmpty =
|
|
258
262
|
// Ignored via go/ees005
|
|
259
|
-
|
|
260
|
-
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
263
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.nodeSize <= 2 && !nodeBeforeIsExtension;
|
|
261
264
|
if (previousListItemEmpty) {
|
|
262
265
|
var tr = state.tr;
|
|
263
266
|
if (dispatch) {
|
|
@@ -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;
|
|
@@ -8,6 +8,7 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
8
8
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { findPositionOfNodeBefore, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { convertListType } from '../actions/conversions';
|
|
12
13
|
import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
13
14
|
import { liftFollowingList, liftNodeSelectionList, liftTextSelectionList } from '../transforms';
|
|
@@ -241,10 +242,12 @@ const deletePreviousEmptyListItem = (state, dispatch) => {
|
|
|
241
242
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
242
243
|
return false;
|
|
243
244
|
}
|
|
245
|
+
const nodeBeforeIsExtension =
|
|
246
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
247
|
+
fg('platform_editor_nbm_backspace_fixes') && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.type.name === 'extension';
|
|
244
248
|
const previousListItemEmpty =
|
|
245
249
|
// Ignored via go/ees005
|
|
246
|
-
|
|
247
|
-
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
250
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.nodeSize <= 2 && !nodeBeforeIsExtension;
|
|
248
251
|
if (previousListItemEmpty) {
|
|
249
252
|
const {
|
|
250
253
|
tr
|
|
@@ -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;
|
|
@@ -11,6 +11,7 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
11
11
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
12
12
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { findPositionOfNodeBefore, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { convertListType } from '../actions/conversions';
|
|
15
16
|
import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
16
17
|
import { liftFollowingList, liftNodeSelectionList, liftTextSelectionList } from '../transforms';
|
|
@@ -247,10 +248,12 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
247
248
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
248
249
|
return false;
|
|
249
250
|
}
|
|
251
|
+
var nodeBeforeIsExtension =
|
|
252
|
+
// eslint-disable-next-line @atlaskit/platform/no-preconditioning
|
|
253
|
+
fg('platform_editor_nbm_backspace_fixes') && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.type.name === 'extension';
|
|
250
254
|
var previousListItemEmpty =
|
|
251
255
|
// Ignored via go/ees005
|
|
252
|
-
|
|
253
|
-
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
256
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild && $cut.nodeBefore.firstChild.nodeSize <= 2 && !nodeBeforeIsExtension;
|
|
254
257
|
if (previousListItemEmpty) {
|
|
255
258
|
var tr = state.tr;
|
|
256
259
|
if (dispatch) {
|
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.4",
|
|
4
4
|
"description": "List plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
|
-
"@atlaskit/editor-common": "^102.
|
|
35
|
+
"@atlaskit/editor-common": "^102.5.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
39
40
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^3.6.0",
|
|
41
42
|
"@babel/runtime": "^7.0.0"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
@@ -82,6 +83,14 @@
|
|
|
82
83
|
]
|
|
83
84
|
}
|
|
84
85
|
},
|
|
86
|
+
"platform-feature-flags": {
|
|
87
|
+
"platform_editor_nbm_backspace_fixes": {
|
|
88
|
+
"type": "boolean"
|
|
89
|
+
},
|
|
90
|
+
"platform_editor_non_macros_list_indent_fix": {
|
|
91
|
+
"type": "boolean"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
85
94
|
"stricter": {
|
|
86
95
|
"no-unused-dependencies": {
|
|
87
96
|
"checkDevDependencies": true
|