@atlaskit/editor-plugin-list 3.9.8 → 3.9.10
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 +12 -0
- package/dist/cjs/listPlugin.js +7 -2
- package/dist/cjs/pm-plugins/actions/indent-list.js +4 -0
- package/dist/cjs/pm-plugins/actions/join-list-items-forward.js +10 -6
- package/dist/cjs/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +2 -0
- package/dist/cjs/pm-plugins/actions/merge-lists.js +7 -0
- package/dist/cjs/pm-plugins/actions/wrap-and-join-lists.js +4 -0
- package/dist/cjs/pm-plugins/commands/index.js +7 -16
- package/dist/cjs/pm-plugins/commands/listBackspace.js +7 -2
- package/dist/cjs/pm-plugins/input-rules/index.js +5 -0
- package/dist/cjs/pm-plugins/input-rules/wrapping-join-rule.js +4 -1
- package/dist/cjs/pm-plugins/keymap.js +25 -4
- package/dist/cjs/pm-plugins/main.js +2 -0
- package/dist/cjs/pm-plugins/transforms.js +2 -0
- package/dist/es2019/index.js +3 -0
- package/dist/es2019/listPlugin.js +5 -1
- package/dist/es2019/pm-plugins/actions/conversions.js +1 -1
- package/dist/es2019/pm-plugins/actions/indent-list.js +4 -0
- package/dist/es2019/pm-plugins/actions/join-list-items-forward.js +5 -1
- package/dist/es2019/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +2 -0
- package/dist/es2019/pm-plugins/actions/merge-lists.js +7 -0
- package/dist/es2019/pm-plugins/actions/outdent-list-items-selected.js +2 -2
- package/dist/es2019/pm-plugins/actions/wrap-and-join-lists.js +6 -2
- package/dist/es2019/pm-plugins/commands/index.js +8 -5
- package/dist/es2019/pm-plugins/commands/listBackspace.js +7 -1
- package/dist/es2019/pm-plugins/commands/outdent-list.js +1 -1
- package/dist/es2019/pm-plugins/input-rules/create-list-input-rule.js +1 -1
- package/dist/es2019/pm-plugins/input-rules/index.js +5 -0
- package/dist/es2019/pm-plugins/input-rules/wrapping-join-rule.js +4 -1
- package/dist/es2019/pm-plugins/keymap.js +26 -5
- package/dist/es2019/pm-plugins/main.js +2 -0
- package/dist/es2019/pm-plugins/transforms.js +5 -3
- package/dist/esm/index.js +3 -0
- package/dist/esm/listPlugin.js +5 -1
- package/dist/esm/pm-plugins/actions/indent-list.js +4 -0
- package/dist/esm/pm-plugins/actions/join-list-items-forward.js +5 -1
- package/dist/esm/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +2 -0
- package/dist/esm/pm-plugins/actions/merge-lists.js +7 -0
- package/dist/esm/pm-plugins/actions/wrap-and-join-lists.js +4 -0
- package/dist/esm/pm-plugins/commands/index.js +6 -3
- package/dist/esm/pm-plugins/commands/listBackspace.js +7 -2
- package/dist/esm/pm-plugins/input-rules/index.js +5 -0
- package/dist/esm/pm-plugins/input-rules/wrapping-join-rule.js +4 -1
- package/dist/esm/pm-plugins/keymap.js +26 -5
- package/dist/esm/pm-plugins/main.js +2 -0
- package/dist/esm/pm-plugins/transforms.js +2 -0
- package/dist/types/pm-plugins/commands/index.d.ts +0 -3
- package/dist/types-ts4.5/pm-plugins/commands/index.d.ts +0 -3
- package/package.json +2 -2
- package/dist/cjs/pm-plugins/actions/join-list-items-scenarios/index.js +0 -40
- package/dist/es2019/pm-plugins/actions/join-list-items-scenarios/index.js +0 -5
- package/dist/esm/pm-plugins/actions/join-list-items-scenarios/index.js +0 -5
- package/dist/types/pm-plugins/actions/join-list-items-scenarios/index.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/actions/join-list-items-scenarios/index.d.ts +0 -5
package/CHANGELOG.md
CHANGED
package/dist/cjs/listPlugin.js
CHANGED
|
@@ -12,11 +12,16 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
14
14
|
var _commands = require("./pm-plugins/commands");
|
|
15
|
+
var _indentList = require("./pm-plugins/commands/indent-list");
|
|
16
|
+
var _outdentList2 = require("./pm-plugins/commands/outdent-list");
|
|
15
17
|
var _inputRules = _interopRequireDefault(require("./pm-plugins/input-rules"));
|
|
16
18
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
17
19
|
var _main = require("./pm-plugins/main");
|
|
18
20
|
var _find = require("./pm-plugins/utils/find");
|
|
19
21
|
var _selection = require("./pm-plugins/utils/selection");
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
24
|
+
|
|
20
25
|
/*
|
|
21
26
|
Toolbar buttons to bullet and ordered list can be found in
|
|
22
27
|
packages/editor/editor-core/src/plugins/toolbar-lists-indentation/ui/Toolbar.tsx
|
|
@@ -39,9 +44,9 @@ var listPlugin = exports.listPlugin = function listPlugin(_ref) {
|
|
|
39
44
|
findRootParentListNode: _find.findRootParentListNode
|
|
40
45
|
},
|
|
41
46
|
commands: {
|
|
42
|
-
indentList: (0,
|
|
47
|
+
indentList: (0, _indentList.indentList)(editorAnalyticsAPI),
|
|
43
48
|
outdentList: function outdentList(inputMethod) {
|
|
44
|
-
return (0,
|
|
49
|
+
return (0, _outdentList2.outdentList)(editorAnalyticsAPI)(inputMethod);
|
|
45
50
|
},
|
|
46
51
|
toggleOrderedList: (0, _commands.toggleOrderedList)(editorAnalyticsAPI),
|
|
47
52
|
toggleBulletList: (0, _commands.toggleBulletList)(editorAnalyticsAPI)
|
|
@@ -39,6 +39,10 @@ var indentList = exports.indentList = function indentList(tr) {
|
|
|
39
39
|
// nest it under the current level
|
|
40
40
|
var isPreviousListNested = previousListItem.lastChild && ['bulletList', 'orderedList'].includes(previousListItem.lastChild.type.name);
|
|
41
41
|
var inner = _model.Fragment.from(isPreviousListNested ? listItem.create() : undefined);
|
|
42
|
+
// Ignored via go/ees005
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
44
|
+
// Ignored via go/ees005
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
42
46
|
var nextListNodeType = isPreviousListNested ? previousListItem.lastChild.type : parent.type;
|
|
43
47
|
var nextListNodeContent = _model.Fragment.from(nextListNodeType.create(null, inner));
|
|
44
48
|
var slice = new _model.Slice(_model.Fragment.from(listItem.create(null, nextListNodeContent)), isPreviousListNested ? 3 : 1, 0);
|
|
@@ -7,7 +7,11 @@ exports.calcJoinListScenario = void 0;
|
|
|
7
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _selection = require("../utils/selection");
|
|
10
|
-
var
|
|
10
|
+
var _joinListItemWithParagraph = require("./join-list-items-scenarios/join-list-item-with-paragraph");
|
|
11
|
+
var _joinListItemWithParentNestedList = require("./join-list-items-scenarios/join-list-item-with-parent-nested-list");
|
|
12
|
+
var _joinNestedListWithParentListItem = require("./join-list-items-scenarios/join-nested-list-with-parent-list-item");
|
|
13
|
+
var _joinParagraphWithList = require("./join-list-items-scenarios/join-paragraph-with-list");
|
|
14
|
+
var _joinSiblingListItems = require("./join-list-items-scenarios/join-sibling-list-items");
|
|
11
15
|
var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
12
16
|
var $next = walkNode.$pos,
|
|
13
17
|
nextFoundNode = walkNode.foundNode;
|
|
@@ -21,13 +25,13 @@ var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListS
|
|
|
21
25
|
var nextInList = (0, _selection.isPosInsideList)($next);
|
|
22
26
|
var nextInParagraph = (0, _selection.isPosInsideParagraph)($next);
|
|
23
27
|
if (!headInList && headInParagraph && nextInList) {
|
|
24
|
-
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_LIST_ITEM_WITH_PARAGRAPH,
|
|
28
|
+
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_LIST_ITEM_WITH_PARAGRAPH, _joinListItemWithParagraph.joinListItemWithParagraph];
|
|
25
29
|
}
|
|
26
30
|
if (!nextFoundNode || !headInList || !headInParagraph || !headInLastNonListChild) {
|
|
27
31
|
return false;
|
|
28
32
|
}
|
|
29
33
|
if (!nextInList && nextInParagraph) {
|
|
30
|
-
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_PARAGRAPH_WITH_LIST,
|
|
34
|
+
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_PARAGRAPH_WITH_LIST, _joinParagraphWithList.joinParagrapWithList];
|
|
31
35
|
}
|
|
32
36
|
if (!nextInList) {
|
|
33
37
|
return false;
|
|
@@ -41,7 +45,7 @@ var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListS
|
|
|
41
45
|
//Redundant check but the linter complains otherwise
|
|
42
46
|
nextNodeAfterListItem && (0, _utils.isParagraphNode)(nextNodeAfter.firstChild);
|
|
43
47
|
if (!nextInListItem && nextListItemHasFirstChildParagraph) {
|
|
44
|
-
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT,
|
|
48
|
+
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, _joinNestedListWithParentListItem.joinNestedListWithParentListItem];
|
|
45
49
|
}
|
|
46
50
|
if (!nextInListItem) {
|
|
47
51
|
return false;
|
|
@@ -52,7 +56,7 @@ var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListS
|
|
|
52
56
|
return false;
|
|
53
57
|
}
|
|
54
58
|
if (nextParentSiblingOfHeadParent) {
|
|
55
|
-
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_SIBLINGS,
|
|
59
|
+
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_SIBLINGS, _joinSiblingListItems.joinSiblingListItems];
|
|
56
60
|
}
|
|
57
|
-
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_PARENT_SIBLING_TO_PARENT_CHILD,
|
|
61
|
+
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_PARENT_SIBLING_TO_PARENT_CHILD, _joinListItemWithParentNestedList.joinListItemWithParentNestedList];
|
|
58
62
|
};
|
package/dist/cjs/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -43,6 +43,8 @@ var joinListItemWithParagraph = exports.joinListItemWithParagraph = function joi
|
|
|
43
43
|
|
|
44
44
|
// For first list items that have a paragraph and a list
|
|
45
45
|
if (firstListItemContainsParagraphAndNestedList) {
|
|
46
|
+
// Ignored via go/ees005
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
46
48
|
var firstListItemNestedList = _model.Fragment.from(lastChildOfFirstListItem.content);
|
|
47
49
|
insertions.push([firstListItemNestedList, tr.mapping.map($next.pos)]);
|
|
48
50
|
}
|
|
@@ -12,6 +12,9 @@ function mergeNextListAtPosition(_ref) {
|
|
|
12
12
|
if (!(0, _utils.isListNode)(listNodeAtPosition)) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
18
|
var listPositionResolved = tr.doc.resolve(listPosition + listNodeAtPosition.nodeSize);
|
|
16
19
|
var pos = listPositionResolved.pos,
|
|
17
20
|
nodeAfter = listPositionResolved.nodeAfter,
|
|
@@ -20,7 +23,11 @@ function mergeNextListAtPosition(_ref) {
|
|
|
20
23
|
return;
|
|
21
24
|
}
|
|
22
25
|
if ((nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type.name) !== (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name)) {
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
28
|
var previousListPosition = pos - nodeBefore.nodeSize;
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
31
|
tr.setNodeMarkup(previousListPosition, nodeAfter.type);
|
|
25
32
|
}
|
|
26
33
|
tr.join(pos);
|
|
@@ -60,6 +60,8 @@ function wrapInList(listType, attrs) {
|
|
|
60
60
|
}
|
|
61
61
|
doJoin = true;
|
|
62
62
|
}
|
|
63
|
+
// Ignored via go/ees005
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
63
65
|
var wrap = (0, _transform.findWrapping)(outerRange, listType, attrs, range);
|
|
64
66
|
if (!wrap) {
|
|
65
67
|
return false;
|
|
@@ -74,6 +76,8 @@ function wrapInList(listType, attrs) {
|
|
|
74
76
|
*
|
|
75
77
|
* Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L91-L112
|
|
76
78
|
*/
|
|
79
|
+
// Ignored via go/ees005
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
77
81
|
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
|
|
78
82
|
var content = _model.Fragment.empty;
|
|
79
83
|
for (var i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -4,20 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.enterKeyCommand = exports.deleteKeyCommand = exports.backspaceKeyCommand = void 0;
|
|
8
|
-
Object.defineProperty(exports, "indentList", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _indentList.indentList;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "outdentList", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return _outdentList.outdentList;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
exports.toggleOrderedList = exports.toggleList = exports.toggleBulletList = exports.rootListDepth = void 0;
|
|
7
|
+
exports.toggleOrderedList = exports.toggleList = exports.toggleBulletList = exports.rootListDepth = exports.enterKeyCommand = exports.deleteKeyCommand = exports.backspaceKeyCommand = void 0;
|
|
21
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
23
10
|
var _commands = require("@atlaskit/editor-common/commands");
|
|
@@ -34,7 +21,6 @@ var _wrapAndJoinLists = require("../actions/wrap-and-join-lists");
|
|
|
34
21
|
var _transforms = require("../transforms");
|
|
35
22
|
var _mark = require("../utils/mark");
|
|
36
23
|
var _selection2 = require("../utils/selection");
|
|
37
|
-
var _indentList = require("./indent-list");
|
|
38
24
|
var _isFirstChildOfParent = require("./isFirstChildOfParent");
|
|
39
25
|
var _joinListItemForward = require("./join-list-item-forward");
|
|
40
26
|
var _listBackspace = require("./listBackspace");
|
|
@@ -239,6 +225,8 @@ function splitListItem(itemType) {
|
|
|
239
225
|
wrap = _model.Fragment.from($from.node(d).copy(wrap));
|
|
240
226
|
}
|
|
241
227
|
// Add a second list item with an empty default start node
|
|
228
|
+
// Ignored via go/ees005
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
242
230
|
wrap = wrap.append(_model.Fragment.from(itemType.createAndFill()));
|
|
243
231
|
var tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new _model.Slice(wrap, keepItem ? 3 : 2, 2));
|
|
244
232
|
tr$1.setSelection(
|
|
@@ -266,7 +254,10 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
266
254
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
267
255
|
return false;
|
|
268
256
|
}
|
|
269
|
-
var previousListItemEmpty =
|
|
257
|
+
var previousListItemEmpty =
|
|
258
|
+
// Ignored via go/ees005
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
260
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
270
261
|
if (previousListItemEmpty) {
|
|
271
262
|
var tr = state.tr;
|
|
272
263
|
if (dispatch) {
|
|
@@ -10,10 +10,11 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
12
12
|
var _selection = require("../utils/selection");
|
|
13
|
-
var _BACKSPACE_COMMANDS;
|
|
14
13
|
//Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
|
|
15
14
|
|
|
16
15
|
//Case for two adjacent list items of the same indentation
|
|
16
|
+
// Ignored via go/ees005
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
18
|
var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head) {
|
|
18
19
|
/* CASE 2
|
|
19
20
|
* Initial Structure:
|
|
@@ -61,6 +62,8 @@ var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head)
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
//Case for two adjacent list items with the first being of lower indentation
|
|
65
|
+
// Ignored via go/ees005
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
64
67
|
var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head) {
|
|
65
68
|
/* CASE 3
|
|
66
69
|
* Initial Structure:
|
|
@@ -128,6 +131,8 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
|
|
|
128
131
|
};
|
|
129
132
|
|
|
130
133
|
//Case for two adjacent list items with the first being of greater indentation
|
|
134
|
+
// Ignored via go/ees005
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
131
136
|
var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head, $last) {
|
|
132
137
|
/* CASE 4
|
|
133
138
|
* Initial Structure:
|
|
@@ -209,7 +214,7 @@ var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head,
|
|
|
209
214
|
}
|
|
210
215
|
return true;
|
|
211
216
|
};
|
|
212
|
-
var BACKSPACE_COMMANDS = (
|
|
217
|
+
var BACKSPACE_COMMANDS = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _analytics.LIST_TEXT_SCENARIOS.JOIN_SIBLINGS, listBackspaceCase2), _analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, listBackspaceCase3), _analytics.LIST_TEXT_SCENARIOS.JOIN_TO_SIBLING_DESCENDANT, listBackspaceCase4);
|
|
213
218
|
var calcJoinListScenario = exports.calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
|
|
214
219
|
var $prev = walkNode.$pos,
|
|
215
220
|
prevFoundNode = walkNode.foundNode;
|
|
@@ -17,11 +17,16 @@ function inputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
17
17
|
// Using UTF instead of • character
|
|
18
18
|
// because of issue where product converted the
|
|
19
19
|
// character into an escaped version.
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
20
22
|
expression: /^\s*([\*\-\u2022]) $/,
|
|
21
23
|
listType: bulletList,
|
|
22
24
|
editorAnalyticsApi: editorAnalyticsApi
|
|
23
25
|
}));
|
|
24
26
|
}
|
|
27
|
+
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
25
30
|
var expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
|
|
26
31
|
if (orderedList) {
|
|
27
32
|
rules.push((0, _createListInputRule.createRuleForListType)({
|
|
@@ -15,7 +15,10 @@ var createWrappingJoinRule = exports.createWrappingJoinRule = function createWra
|
|
|
15
15
|
nodeType = _ref.nodeType,
|
|
16
16
|
getAttrs = _ref.getAttrs,
|
|
17
17
|
joinPredicate = _ref.joinPredicate;
|
|
18
|
-
var handler = function handler(state, match, start, end
|
|
18
|
+
var handler = function handler(state, match, start, end
|
|
19
|
+
// Ignored via go/ees005
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
|
+
) {
|
|
19
22
|
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
20
23
|
var tr = state.tr;
|
|
21
24
|
var fixedStart = Math.max(start, 1);
|
|
@@ -9,14 +9,35 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
9
9
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
10
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
11
11
|
var _commands = require("./commands");
|
|
12
|
+
var _indentList = require("./commands/indent-list");
|
|
13
|
+
var _outdentList = require("./commands/outdent-list");
|
|
12
14
|
function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
13
15
|
var list = {};
|
|
14
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
(0, _keymaps.
|
|
16
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleOrderedList), (0, _commands.toggleList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, 'orderedList'), list);
|
|
20
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
(0, _keymaps.findShortcutByKeymap)(_keymaps.toggleBulletList), (0, _commands.toggleList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, 'bulletList'), list);
|
|
24
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
|
+
_keymaps.indentList.common, (0, _indentList.indentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
28
|
+
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
31
|
+
_keymaps.outdentList.common, (0, _outdentList.outdentList)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18
34
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.enter.common, (0, _commands.enterKeyCommand)(editorAnalyticsAPI)(), list);
|
|
35
|
+
// Ignored via go/ees005
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
37
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.backspaceKeyCommand)(editorAnalyticsAPI)(), list);
|
|
38
|
+
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
41
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, (0, _commands.deleteKeyCommand)(editorAnalyticsAPI), list);
|
|
21
42
|
|
|
22
43
|
// This shortcut is Mac only
|
|
@@ -133,6 +133,8 @@ var createPlugin = exports.createPlugin = function createPlugin(eventDispatch, f
|
|
|
133
133
|
},
|
|
134
134
|
handleClick: function handleClick(view, pos, event) {
|
|
135
135
|
var state = view.state;
|
|
136
|
+
// Ignored via go/ees005
|
|
137
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
136
138
|
if (['LI', 'UL'].includes((event === null || event === void 0 ? void 0 : event.target).tagName)) {
|
|
137
139
|
var _nodeAtPos$firstChild;
|
|
138
140
|
var nodeAtPos = state.tr.doc.nodeAt(pos);
|
|
@@ -30,6 +30,8 @@ function liftListItem(selection, tr) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Function will lift list item following selection to level-1.
|
|
33
|
+
// Ignored via go/ees005
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
33
35
|
function liftFollowingList(from, to, rootListDepth, tr) {
|
|
34
36
|
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
35
37
|
var lifted = false;
|
package/dist/es2019/index.js
CHANGED
|
@@ -4,8 +4,12 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
-
import {
|
|
7
|
+
import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
|
|
8
|
+
import { indentList } from './pm-plugins/commands/indent-list';
|
|
9
|
+
import { outdentList } from './pm-plugins/commands/outdent-list';
|
|
8
10
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
9
13
|
import keymapPlugin from './pm-plugins/keymap';
|
|
10
14
|
import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
11
15
|
import { findRootParentListNode } from './pm-plugins/utils/find';
|
|
@@ -35,6 +35,10 @@ export const indentList = tr => {
|
|
|
35
35
|
// nest it under the current level
|
|
36
36
|
const isPreviousListNested = previousListItem.lastChild && ['bulletList', 'orderedList'].includes(previousListItem.lastChild.type.name);
|
|
37
37
|
const inner = Fragment.from(isPreviousListNested ? listItem.create() : undefined);
|
|
38
|
+
// Ignored via go/ees005
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
42
|
const nextListNodeType = isPreviousListNested ? previousListItem.lastChild.type : parent.type;
|
|
39
43
|
const nextListNodeContent = Fragment.from(nextListNodeType.create(null, inner));
|
|
40
44
|
const slice = new Slice(Fragment.from(listItem.create(null, nextListNodeContent)), isPreviousListNested ? 3 : 1, 0);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { isListItemNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
4
|
-
import { joinListItemWithParagraph
|
|
4
|
+
import { joinListItemWithParagraph } from './join-list-items-scenarios/join-list-item-with-paragraph';
|
|
5
|
+
import { joinListItemWithParentNestedList } from './join-list-items-scenarios/join-list-item-with-parent-nested-list';
|
|
6
|
+
import { joinNestedListWithParentListItem } from './join-list-items-scenarios/join-nested-list-with-parent-list-item';
|
|
7
|
+
import { joinParagrapWithList } from './join-list-items-scenarios/join-paragraph-with-list';
|
|
8
|
+
import { joinSiblingListItems } from './join-list-items-scenarios/join-sibling-list-items';
|
|
5
9
|
export const calcJoinListScenario = (walkNode, $head) => {
|
|
6
10
|
const {
|
|
7
11
|
$pos: $next,
|
package/dist/es2019/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -36,6 +36,8 @@ export const joinListItemWithParagraph = ({
|
|
|
36
36
|
|
|
37
37
|
// For first list items that have a paragraph and a list
|
|
38
38
|
if (firstListItemContainsParagraphAndNestedList) {
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
41
|
const firstListItemNestedList = Fragment.from(lastChildOfFirstListItem.content);
|
|
40
42
|
insertions.push([firstListItemNestedList, tr.mapping.map($next.pos)]);
|
|
41
43
|
}
|
|
@@ -7,6 +7,9 @@ export function mergeNextListAtPosition({
|
|
|
7
7
|
if (!isListNode(listNodeAtPosition)) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10
13
|
const listPositionResolved = tr.doc.resolve(listPosition + listNodeAtPosition.nodeSize);
|
|
11
14
|
const {
|
|
12
15
|
pos,
|
|
@@ -17,7 +20,11 @@ export function mergeNextListAtPosition({
|
|
|
17
20
|
return;
|
|
18
21
|
}
|
|
19
22
|
if ((nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type.name) !== (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name)) {
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
25
|
const previousListPosition = pos - nodeBefore.nodeSize;
|
|
26
|
+
// Ignored via go/ees005
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
21
28
|
tr.setNodeMarkup(previousListPosition, nodeAfter.type);
|
|
22
29
|
}
|
|
23
30
|
tr.join(pos);
|
|
@@ -200,7 +200,7 @@ const extractListItemsRangeFromList = ({
|
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
const nextList = list.copy(Fragment.empty);
|
|
204
204
|
let nextListStartNumber;
|
|
205
205
|
// if splitting a numbered list, keep the splitted item
|
|
206
206
|
// counter as the start of the next (second half) list (instead
|
|
@@ -267,7 +267,7 @@ const extractListItemsRangeFromList = ({
|
|
|
267
267
|
const findPreviousListItemSibling = $pos => {
|
|
268
268
|
const doc = $pos.doc;
|
|
269
269
|
const isPositionListItem = isListNode($pos.node());
|
|
270
|
-
|
|
270
|
+
const listItemPosition = $pos;
|
|
271
271
|
if (!isPositionListItem) {
|
|
272
272
|
const listItem = findFirstParentListItemNode($pos);
|
|
273
273
|
if (!listItem) {
|
|
@@ -46,14 +46,16 @@ export function wrapInList(listType, attrs) {
|
|
|
46
46
|
if ($from.index(range.depth - 1) === 0) {
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
const $insert = tr.doc.resolve(range.start - 2);
|
|
50
50
|
outerRange = new NodeRange($insert, $insert, range.depth);
|
|
51
51
|
if (range.endIndex < range.parent.childCount) {
|
|
52
52
|
range = new NodeRange($from, tr.doc.resolve($to.end(range.depth)), range.depth);
|
|
53
53
|
}
|
|
54
54
|
doJoin = true;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
// Ignored via go/ees005
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
58
|
+
const wrap = findWrapping(outerRange, listType, attrs, range);
|
|
57
59
|
if (!wrap) {
|
|
58
60
|
return false;
|
|
59
61
|
}
|
|
@@ -67,6 +69,8 @@ export function wrapInList(listType, attrs) {
|
|
|
67
69
|
*
|
|
68
70
|
* Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L91-L112
|
|
69
71
|
*/
|
|
72
|
+
// Ignored via go/ees005
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
74
|
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
|
|
71
75
|
let content = Fragment.empty;
|
|
72
76
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -13,12 +13,10 @@ import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
|
13
13
|
import { liftFollowingList, liftNodeSelectionList, liftTextSelectionList } from '../transforms';
|
|
14
14
|
import { sanitiseMarksInSelection } from '../utils/mark';
|
|
15
15
|
import { canJoinToPreviousListItem, isInsideListItem, selectionContainsList } from '../utils/selection';
|
|
16
|
-
import { indentList } from './indent-list';
|
|
17
16
|
import { isFirstChildOfParent } from './isFirstChildOfParent';
|
|
18
17
|
import { joinListItemForward } from './join-list-item-forward';
|
|
19
18
|
import { listBackspace } from './listBackspace';
|
|
20
19
|
import { outdentList } from './outdent-list';
|
|
21
|
-
export { outdentList, indentList };
|
|
22
20
|
export const enterKeyCommand = editorAnalyticsAPI => () => (state, dispatch) => {
|
|
23
21
|
const {
|
|
24
22
|
selection
|
|
@@ -210,6 +208,8 @@ function splitListItem(itemType) {
|
|
|
210
208
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
211
209
|
}
|
|
212
210
|
// Add a second list item with an empty default start node
|
|
211
|
+
// Ignored via go/ees005
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
213
213
|
wrap = wrap.append(Fragment.from(itemType.createAndFill()));
|
|
214
214
|
const tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));
|
|
215
215
|
tr$1.setSelection(
|
|
@@ -241,7 +241,10 @@ const deletePreviousEmptyListItem = (state, dispatch) => {
|
|
|
241
241
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
242
242
|
return false;
|
|
243
243
|
}
|
|
244
|
-
const previousListItemEmpty =
|
|
244
|
+
const previousListItemEmpty =
|
|
245
|
+
// Ignored via go/ees005
|
|
246
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
247
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
245
248
|
if (previousListItemEmpty) {
|
|
246
249
|
const {
|
|
247
250
|
tr
|
|
@@ -266,7 +269,7 @@ const joinToPreviousListItem = (state, dispatch) => {
|
|
|
266
269
|
} = state.schema.nodes;
|
|
267
270
|
const isGapCursorShown = state.selection instanceof GapCursorSelection;
|
|
268
271
|
const $cutPos = isGapCursorShown ? state.doc.resolve($from.pos + 1) : $from;
|
|
269
|
-
|
|
272
|
+
const $cut = findCutBefore($cutPos);
|
|
270
273
|
if (!$cut) {
|
|
271
274
|
return false;
|
|
272
275
|
}
|
|
@@ -310,7 +313,7 @@ const joinToPreviousListItem = (state, dispatch) => {
|
|
|
310
313
|
|
|
311
314
|
// find out if there's now another list following and join them
|
|
312
315
|
// as in, [list, p, list] => [list with p, list], and we want [joined list]
|
|
313
|
-
|
|
316
|
+
const $postCut = tr.doc.resolve(tr.mapping.map($cut.pos + $cut.nodeAfter.nodeSize));
|
|
314
317
|
if ($postCut.nodeBefore && $postCut.nodeAfter && $postCut.nodeBefore.type === $postCut.nodeAfter.type && [bulletList, orderedList].indexOf($postCut.nodeBefore.type) > -1) {
|
|
315
318
|
tr = tr.join($postCut.pos);
|
|
316
319
|
}
|
|
@@ -5,6 +5,8 @@ import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
|
5
5
|
//Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
|
|
6
6
|
|
|
7
7
|
//Case for two adjacent list items of the same indentation
|
|
8
|
+
// Ignored via go/ees005
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
8
10
|
const listBackspaceCase2 = (tr, dispatch, $prev, $head) => {
|
|
9
11
|
/* CASE 2
|
|
10
12
|
* Initial Structure:
|
|
@@ -50,6 +52,8 @@ const listBackspaceCase2 = (tr, dispatch, $prev, $head) => {
|
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
//Case for two adjacent list items with the first being of lower indentation
|
|
55
|
+
// Ignored via go/ees005
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
53
57
|
const listBackspaceCase3 = (tr, dispatch, $prev, $head) => {
|
|
54
58
|
/* CASE 3
|
|
55
59
|
* Initial Structure:
|
|
@@ -115,6 +119,8 @@ const listBackspaceCase3 = (tr, dispatch, $prev, $head) => {
|
|
|
115
119
|
};
|
|
116
120
|
|
|
117
121
|
//Case for two adjacent list items with the first being of greater indentation
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
118
124
|
const listBackspaceCase4 = (tr, dispatch, $prev, $head, $last) => {
|
|
119
125
|
/* CASE 4
|
|
120
126
|
* Initial Structure:
|
|
@@ -226,7 +232,7 @@ export const calcJoinListScenario = (walkNode, $head, tr) => {
|
|
|
226
232
|
let $last = tr.doc.resolve($prev.pos);
|
|
227
233
|
let lastFoundNode;
|
|
228
234
|
do {
|
|
229
|
-
|
|
235
|
+
const walkNode = walkPrevNode($last);
|
|
230
236
|
$last = walkNode.$pos;
|
|
231
237
|
lastFoundNode = walkNode.foundNode;
|
|
232
238
|
} while (lastFoundNode && !$last.parent.isTextblock);
|
|
@@ -26,7 +26,7 @@ export const outdentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEY
|
|
|
26
26
|
// Save the history, so it could undo/revert to the same state before the outdent, see https://product-fabric.atlassian.net/browse/ED-14753
|
|
27
27
|
closeHistory(tr);
|
|
28
28
|
const actionSubjectId = isBulletList(parentListNode.node) ? ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
29
|
-
|
|
29
|
+
const customTr = tr;
|
|
30
30
|
outdentListAction(customTr);
|
|
31
31
|
if (!customTr || !customTr.docChanged) {
|
|
32
32
|
// Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
|
|
@@ -14,11 +14,16 @@ export default function inputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
14
14
|
// Using UTF instead of • character
|
|
15
15
|
// because of issue where product converted the
|
|
16
16
|
// character into an escaped version.
|
|
17
|
+
// Ignored via go/ees005
|
|
18
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
17
19
|
expression: /^\s*([\*\-\u2022]) $/,
|
|
18
20
|
listType: bulletList,
|
|
19
21
|
editorAnalyticsApi
|
|
20
22
|
}));
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
22
27
|
const expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
|
|
23
28
|
if (orderedList) {
|
|
24
29
|
rules.push(createRuleForListType({
|
|
@@ -11,7 +11,10 @@ export const createWrappingJoinRule = ({
|
|
|
11
11
|
getAttrs,
|
|
12
12
|
joinPredicate
|
|
13
13
|
}) => {
|
|
14
|
-
const handler = (state, match, start, end
|
|
14
|
+
const handler = (state, match, start, end
|
|
15
|
+
// Ignored via go/ees005
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
17
|
+
) => {
|
|
15
18
|
const attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
16
19
|
const tr = state.tr;
|
|
17
20
|
const fixedStart = Math.max(start, 1);
|
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { backspace, bindKeymapWithCommand, bindKeymapWithEditorCommand, deleteKey, enter, findKeyMapForBrowser, findShortcutByKeymap, forwardDelete, indentList, outdentList, toggleBulletList, toggleOrderedList } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { backspaceKeyCommand, deleteKeyCommand, enterKeyCommand,
|
|
4
|
+
import { backspaceKeyCommand, deleteKeyCommand, enterKeyCommand, toggleList } from './commands';
|
|
5
|
+
import { indentList as indentListCommand } from './commands/indent-list';
|
|
6
|
+
import { outdentList as outdentListCommand } from './commands/outdent-list';
|
|
5
7
|
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
6
8
|
const list = {};
|
|
7
|
-
bindKeymapWithEditorCommand(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
bindKeymapWithEditorCommand(
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
|
+
findShortcutByKeymap(toggleOrderedList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'orderedList'), list);
|
|
13
|
+
bindKeymapWithEditorCommand(
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
+
findShortcutByKeymap(toggleBulletList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'bulletList'), list);
|
|
17
|
+
bindKeymapWithEditorCommand(
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
indentList.common, indentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
21
|
+
bindKeymapWithEditorCommand(
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
|
+
outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11
27
|
bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
30
|
bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
|
|
31
|
+
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
34
|
bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
|
|
14
35
|
|
|
15
36
|
// This shortcut is Mac only
|
|
@@ -125,6 +125,8 @@ export const createPlugin = (eventDispatch, featureFlags) => {
|
|
|
125
125
|
const {
|
|
126
126
|
state
|
|
127
127
|
} = view;
|
|
128
|
+
// Ignored via go/ees005
|
|
129
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
128
130
|
if (['LI', 'UL'].includes((event === null || event === void 0 ? void 0 : event.target).tagName)) {
|
|
129
131
|
var _nodeAtPos$firstChild;
|
|
130
132
|
const nodeAtPos = state.tr.doc.nodeAt(pos);
|
|
@@ -3,7 +3,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { liftTarget, ReplaceAroundStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { getListLiftTarget } from './utils/indentation';
|
|
5
5
|
function liftListItem(selection, tr) {
|
|
6
|
-
|
|
6
|
+
const {
|
|
7
7
|
$from,
|
|
8
8
|
$to
|
|
9
9
|
} = selection;
|
|
@@ -12,8 +12,8 @@ function liftListItem(selection, tr) {
|
|
|
12
12
|
if (!range || range.depth < 2 || $from.node(range.depth - 1).type !== nodeType) {
|
|
13
13
|
return tr;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const end = range.end;
|
|
16
|
+
const endOfList = $to.end(range.depth);
|
|
17
17
|
if (end < endOfList) {
|
|
18
18
|
tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(nodeType.create(undefined, range.parent.copy())), 1, 0), 1, true));
|
|
19
19
|
range = new NodeRange(tr.doc.resolve($from.pos), tr.doc.resolve(endOfList), range.depth);
|
|
@@ -22,6 +22,8 @@ function liftListItem(selection, tr) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Function will lift list item following selection to level-1.
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
27
|
export function liftFollowingList(from, to, rootListDepth, tr) {
|
|
26
28
|
const {
|
|
27
29
|
listItem
|
package/dist/esm/index.js
CHANGED
package/dist/esm/listPlugin.js
CHANGED
|
@@ -4,8 +4,12 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } f
|
|
|
4
4
|
import { toggleBulletList, toggleOrderedList, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
5
5
|
import { listMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconList, IconListNumber } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
-
import {
|
|
7
|
+
import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggleOrderedListCommand } from './pm-plugins/commands';
|
|
8
|
+
import { indentList } from './pm-plugins/commands/indent-list';
|
|
9
|
+
import { outdentList as _outdentList } from './pm-plugins/commands/outdent-list';
|
|
8
10
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
9
13
|
import keymapPlugin from './pm-plugins/keymap';
|
|
10
14
|
import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
11
15
|
import { findRootParentListNode } from './pm-plugins/utils/find';
|
|
@@ -34,6 +34,10 @@ export var indentList = function indentList(tr) {
|
|
|
34
34
|
// nest it under the current level
|
|
35
35
|
var isPreviousListNested = previousListItem.lastChild && ['bulletList', 'orderedList'].includes(previousListItem.lastChild.type.name);
|
|
36
36
|
var inner = Fragment.from(isPreviousListNested ? listItem.create() : undefined);
|
|
37
|
+
// Ignored via go/ees005
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
|
+
// Ignored via go/ees005
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
41
|
var nextListNodeType = isPreviousListNested ? previousListItem.lastChild.type : parent.type;
|
|
38
42
|
var nextListNodeContent = Fragment.from(nextListNodeType.create(null, inner));
|
|
39
43
|
var slice = new Slice(Fragment.from(listItem.create(null, nextListNodeContent)), isPreviousListNested ? 3 : 1, 0);
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { isListItemNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
4
|
-
import { joinListItemWithParagraph
|
|
4
|
+
import { joinListItemWithParagraph } from './join-list-items-scenarios/join-list-item-with-paragraph';
|
|
5
|
+
import { joinListItemWithParentNestedList } from './join-list-items-scenarios/join-list-item-with-parent-nested-list';
|
|
6
|
+
import { joinNestedListWithParentListItem } from './join-list-items-scenarios/join-nested-list-with-parent-list-item';
|
|
7
|
+
import { joinParagrapWithList } from './join-list-items-scenarios/join-paragraph-with-list';
|
|
8
|
+
import { joinSiblingListItems } from './join-list-items-scenarios/join-sibling-list-items';
|
|
5
9
|
export var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
6
10
|
var $next = walkNode.$pos,
|
|
7
11
|
nextFoundNode = walkNode.foundNode;
|
package/dist/esm/pm-plugins/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -37,6 +37,8 @@ export var joinListItemWithParagraph = function joinListItemWithParagraph(_ref)
|
|
|
37
37
|
|
|
38
38
|
// For first list items that have a paragraph and a list
|
|
39
39
|
if (firstListItemContainsParagraphAndNestedList) {
|
|
40
|
+
// Ignored via go/ees005
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
42
|
var firstListItemNestedList = Fragment.from(lastChildOfFirstListItem.content);
|
|
41
43
|
insertions.push([firstListItemNestedList, tr.mapping.map($next.pos)]);
|
|
42
44
|
}
|
|
@@ -6,6 +6,9 @@ export function mergeNextListAtPosition(_ref) {
|
|
|
6
6
|
if (!isListNode(listNodeAtPosition)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9
12
|
var listPositionResolved = tr.doc.resolve(listPosition + listNodeAtPosition.nodeSize);
|
|
10
13
|
var pos = listPositionResolved.pos,
|
|
11
14
|
nodeAfter = listPositionResolved.nodeAfter,
|
|
@@ -14,7 +17,11 @@ export function mergeNextListAtPosition(_ref) {
|
|
|
14
17
|
return;
|
|
15
18
|
}
|
|
16
19
|
if ((nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type.name) !== (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name)) {
|
|
20
|
+
// Ignored via go/ees005
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
17
22
|
var previousListPosition = pos - nodeBefore.nodeSize;
|
|
23
|
+
// Ignored via go/ees005
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
18
25
|
tr.setNodeMarkup(previousListPosition, nodeAfter.type);
|
|
19
26
|
}
|
|
20
27
|
tr.join(pos);
|
|
@@ -54,6 +54,8 @@ export function wrapInList(listType, attrs) {
|
|
|
54
54
|
}
|
|
55
55
|
doJoin = true;
|
|
56
56
|
}
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
57
59
|
var wrap = findWrapping(outerRange, listType, attrs, range);
|
|
58
60
|
if (!wrap) {
|
|
59
61
|
return false;
|
|
@@ -68,6 +70,8 @@ export function wrapInList(listType, attrs) {
|
|
|
68
70
|
*
|
|
69
71
|
* Adapted from https://github.com/ProseMirror/prosemirror-schema-list/blob/master/src/schema-list.js#L91-L112
|
|
70
72
|
*/
|
|
73
|
+
// Ignored via go/ees005
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
71
75
|
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
|
|
72
76
|
var content = Fragment.empty;
|
|
73
77
|
for (var i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -16,12 +16,10 @@ import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
|
16
16
|
import { liftFollowingList, liftNodeSelectionList, liftTextSelectionList } from '../transforms';
|
|
17
17
|
import { sanitiseMarksInSelection } from '../utils/mark';
|
|
18
18
|
import { canJoinToPreviousListItem, isInsideListItem, selectionContainsList } from '../utils/selection';
|
|
19
|
-
import { indentList } from './indent-list';
|
|
20
19
|
import { isFirstChildOfParent } from './isFirstChildOfParent';
|
|
21
20
|
import { joinListItemForward } from './join-list-item-forward';
|
|
22
21
|
import { listBackspace } from './listBackspace';
|
|
23
22
|
import { outdentList } from './outdent-list';
|
|
24
|
-
export { outdentList, indentList };
|
|
25
23
|
export var enterKeyCommand = function enterKeyCommand(editorAnalyticsAPI) {
|
|
26
24
|
return function () {
|
|
27
25
|
return function (state, dispatch) {
|
|
@@ -220,6 +218,8 @@ function splitListItem(itemType) {
|
|
|
220
218
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
221
219
|
}
|
|
222
220
|
// Add a second list item with an empty default start node
|
|
221
|
+
// Ignored via go/ees005
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
223
223
|
wrap = wrap.append(Fragment.from(itemType.createAndFill()));
|
|
224
224
|
var tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));
|
|
225
225
|
tr$1.setSelection(
|
|
@@ -247,7 +247,10 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
247
247
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
248
248
|
return false;
|
|
249
249
|
}
|
|
250
|
-
var previousListItemEmpty =
|
|
250
|
+
var previousListItemEmpty =
|
|
251
|
+
// Ignored via go/ees005
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
253
|
+
$cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
|
|
251
254
|
if (previousListItemEmpty) {
|
|
252
255
|
var tr = state.tr;
|
|
253
256
|
if (dispatch) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
var _BACKSPACE_COMMANDS;
|
|
3
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, DELETE_DIRECTION, EVENT_TYPE, INPUT_METHOD, LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import { insertContentDeleteRange, isEmptySelectionAtStart, isListNode, isParagraphNode, walkPrevNode } from '@atlaskit/editor-common/utils';
|
|
5
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -7,6 +6,8 @@ import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
|
7
6
|
//Cases below refer to the cases found in this document: https://product-fabric.atlassian.net/wiki/spaces/E/pages/1146954996/List+Backspace+and+Delete+Behaviour
|
|
8
7
|
|
|
9
8
|
//Case for two adjacent list items of the same indentation
|
|
9
|
+
// Ignored via go/ees005
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
10
11
|
var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head) {
|
|
11
12
|
/* CASE 2
|
|
12
13
|
* Initial Structure:
|
|
@@ -54,6 +55,8 @@ var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head)
|
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
//Case for two adjacent list items with the first being of lower indentation
|
|
58
|
+
// Ignored via go/ees005
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
57
60
|
var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head) {
|
|
58
61
|
/* CASE 3
|
|
59
62
|
* Initial Structure:
|
|
@@ -121,6 +124,8 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
|
|
|
121
124
|
};
|
|
122
125
|
|
|
123
126
|
//Case for two adjacent list items with the first being of greater indentation
|
|
127
|
+
// Ignored via go/ees005
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
124
129
|
var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head, $last) {
|
|
125
130
|
/* CASE 4
|
|
126
131
|
* Initial Structure:
|
|
@@ -202,7 +207,7 @@ var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head,
|
|
|
202
207
|
}
|
|
203
208
|
return true;
|
|
204
209
|
};
|
|
205
|
-
var BACKSPACE_COMMANDS = (
|
|
210
|
+
var BACKSPACE_COMMANDS = _defineProperty(_defineProperty(_defineProperty({}, LIST_TEXT_SCENARIOS.JOIN_SIBLINGS, listBackspaceCase2), LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, listBackspaceCase3), LIST_TEXT_SCENARIOS.JOIN_TO_SIBLING_DESCENDANT, listBackspaceCase4);
|
|
206
211
|
export var calcJoinListScenario = function calcJoinListScenario(walkNode, $head, tr) {
|
|
207
212
|
var $prev = walkNode.$pos,
|
|
208
213
|
prevFoundNode = walkNode.foundNode;
|
|
@@ -11,11 +11,16 @@ export default function inputRulePlugin(schema, editorAnalyticsApi) {
|
|
|
11
11
|
// Using UTF instead of • character
|
|
12
12
|
// because of issue where product converted the
|
|
13
13
|
// character into an escaped version.
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
14
16
|
expression: /^\s*([\*\-\u2022]) $/,
|
|
15
17
|
listType: bulletList,
|
|
16
18
|
editorAnalyticsApi: editorAnalyticsApi
|
|
17
19
|
}));
|
|
18
20
|
}
|
|
21
|
+
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
19
24
|
var expression = /((^[1-9]{1}[0-9]{0,2})|^(0))[\.\)] $/;
|
|
20
25
|
if (orderedList) {
|
|
21
26
|
rules.push(createRuleForListType({
|
|
@@ -10,7 +10,10 @@ export var createWrappingJoinRule = function createWrappingJoinRule(_ref) {
|
|
|
10
10
|
nodeType = _ref.nodeType,
|
|
11
11
|
getAttrs = _ref.getAttrs,
|
|
12
12
|
joinPredicate = _ref.joinPredicate;
|
|
13
|
-
var handler = function handler(state, match, start, end
|
|
13
|
+
var handler = function handler(state, match, start, end
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
16
|
+
) {
|
|
14
17
|
var attrs = (getAttrs instanceof Function ? getAttrs(match) : getAttrs) || {};
|
|
15
18
|
var tr = state.tr;
|
|
16
19
|
var fixedStart = Math.max(start, 1);
|
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { backspace, bindKeymapWithCommand, bindKeymapWithEditorCommand, deleteKey, enter, findKeyMapForBrowser, findShortcutByKeymap, forwardDelete, indentList, outdentList, toggleBulletList, toggleOrderedList } from '@atlaskit/editor-common/keymaps';
|
|
3
3
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { backspaceKeyCommand, deleteKeyCommand, enterKeyCommand,
|
|
4
|
+
import { backspaceKeyCommand, deleteKeyCommand, enterKeyCommand, toggleList } from './commands';
|
|
5
|
+
import { indentList as indentListCommand } from './commands/indent-list';
|
|
6
|
+
import { outdentList as outdentListCommand } from './commands/outdent-list';
|
|
5
7
|
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
6
8
|
var list = {};
|
|
7
|
-
bindKeymapWithEditorCommand(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
bindKeymapWithEditorCommand(
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
|
+
findShortcutByKeymap(toggleOrderedList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'orderedList'), list);
|
|
13
|
+
bindKeymapWithEditorCommand(
|
|
14
|
+
// Ignored via go/ees005
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
16
|
+
findShortcutByKeymap(toggleBulletList), toggleList(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD, 'bulletList'), list);
|
|
17
|
+
bindKeymapWithEditorCommand(
|
|
18
|
+
// Ignored via go/ees005
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
+
indentList.common, indentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
21
|
+
bindKeymapWithEditorCommand(
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
|
+
outdentList.common, outdentListCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11
27
|
bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
12
30
|
bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
|
|
31
|
+
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
34
|
bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
|
|
14
35
|
|
|
15
36
|
// This shortcut is Mac only
|
|
@@ -126,6 +126,8 @@ export var createPlugin = function createPlugin(eventDispatch, featureFlags) {
|
|
|
126
126
|
},
|
|
127
127
|
handleClick: function handleClick(view, pos, event) {
|
|
128
128
|
var state = view.state;
|
|
129
|
+
// Ignored via go/ees005
|
|
130
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
129
131
|
if (['LI', 'UL'].includes((event === null || event === void 0 ? void 0 : event.target).tagName)) {
|
|
130
132
|
var _nodeAtPos$firstChild;
|
|
131
133
|
var nodeAtPos = state.tr.doc.nodeAt(pos);
|
|
@@ -22,6 +22,8 @@ function liftListItem(selection, tr) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Function will lift list item following selection to level-1.
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
27
|
export function liftFollowingList(from, to, rootListDepth, tr) {
|
|
26
28
|
var listItem = tr.doc.type.schema.nodes.listItem;
|
|
27
29
|
var lifted = false;
|
|
@@ -2,9 +2,6 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { NodeType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { indentList } from './indent-list';
|
|
6
|
-
import { outdentList } from './outdent-list';
|
|
7
|
-
export { outdentList, indentList };
|
|
8
5
|
export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
9
6
|
export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
|
|
10
7
|
export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
|
|
@@ -2,9 +2,6 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { Command, EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { NodeType, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import { indentList } from './indent-list';
|
|
6
|
-
import { outdentList } from './outdent-list';
|
|
7
|
-
export { outdentList, indentList };
|
|
8
5
|
export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR | INPUT_METHOD.FLOATING_TB;
|
|
9
6
|
export declare const enterKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
|
|
10
7
|
export declare const backspaceKeyCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => () => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-list",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.10",
|
|
4
4
|
"description": "List plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
35
|
+
"@atlaskit/editor-common": "^98.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "joinListItemWithParagraph", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _joinListItemWithParagraph.joinListItemWithParagraph;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "joinListItemWithParentNestedList", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _joinListItemWithParentNestedList.joinListItemWithParentNestedList;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "joinNestedListWithParentListItem", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _joinNestedListWithParentListItem.joinNestedListWithParentListItem;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "joinParagrapWithList", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _joinParagraphWithList.joinParagrapWithList;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "joinSiblingListItems", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _joinSiblingListItems.joinSiblingListItems;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var _joinParagraphWithList = require("./join-paragraph-with-list");
|
|
37
|
-
var _joinSiblingListItems = require("./join-sibling-list-items");
|
|
38
|
-
var _joinNestedListWithParentListItem = require("./join-nested-list-with-parent-list-item");
|
|
39
|
-
var _joinListItemWithParentNestedList = require("./join-list-item-with-parent-nested-list");
|
|
40
|
-
var _joinListItemWithParagraph = require("./join-list-item-with-paragraph");
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { joinParagrapWithList } from './join-paragraph-with-list';
|
|
2
|
-
export { joinSiblingListItems } from './join-sibling-list-items';
|
|
3
|
-
export { joinNestedListWithParentListItem } from './join-nested-list-with-parent-list-item';
|
|
4
|
-
export { joinListItemWithParentNestedList } from './join-list-item-with-parent-nested-list';
|
|
5
|
-
export { joinListItemWithParagraph } from './join-list-item-with-paragraph';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { joinParagrapWithList } from './join-paragraph-with-list';
|
|
2
|
-
export { joinSiblingListItems } from './join-sibling-list-items';
|
|
3
|
-
export { joinNestedListWithParentListItem } from './join-nested-list-with-parent-list-item';
|
|
4
|
-
export { joinListItemWithParentNestedList } from './join-list-item-with-parent-nested-list';
|
|
5
|
-
export { joinListItemWithParagraph } from './join-list-item-with-paragraph';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { joinParagrapWithList } from './join-paragraph-with-list';
|
|
2
|
-
export { joinSiblingListItems } from './join-sibling-list-items';
|
|
3
|
-
export { joinNestedListWithParentListItem } from './join-nested-list-with-parent-list-item';
|
|
4
|
-
export { joinListItemWithParentNestedList } from './join-list-item-with-parent-nested-list';
|
|
5
|
-
export { joinListItemWithParagraph } from './join-list-item-with-paragraph';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { joinParagrapWithList } from './join-paragraph-with-list';
|
|
2
|
-
export { joinSiblingListItems } from './join-sibling-list-items';
|
|
3
|
-
export { joinNestedListWithParentListItem } from './join-nested-list-with-parent-list-item';
|
|
4
|
-
export { joinListItemWithParentNestedList } from './join-list-item-with-parent-nested-list';
|
|
5
|
-
export { joinListItemWithParagraph } from './join-list-item-with-paragraph';
|