@atlaskit/editor-plugin-list 3.9.9 → 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 +6 -0
- package/dist/cjs/listPlugin.js +3 -0
- package/dist/cjs/pm-plugins/actions/indent-list.js +4 -0
- 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 +6 -1
- package/dist/cjs/pm-plugins/commands/listBackspace.js +6 -0
- 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 +23 -4
- package/dist/cjs/pm-plugins/main.js +2 -0
- package/dist/cjs/pm-plugins/transforms.js +2 -0
- package/dist/es2019/listPlugin.js +2 -0
- 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-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 -3
- 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 +23 -4
- package/dist/es2019/pm-plugins/main.js +2 -0
- package/dist/es2019/pm-plugins/transforms.js +5 -3
- package/dist/esm/listPlugin.js +2 -0
- package/dist/esm/pm-plugins/actions/indent-list.js +4 -0
- 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 -1
- package/dist/esm/pm-plugins/commands/listBackspace.js +6 -0
- 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 +23 -4
- package/dist/esm/pm-plugins/main.js +2 -0
- package/dist/esm/pm-plugins/transforms.js +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/cjs/listPlugin.js
CHANGED
|
@@ -19,6 +19,9 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
|
19
19
|
var _main = require("./pm-plugins/main");
|
|
20
20
|
var _find = require("./pm-plugins/utils/find");
|
|
21
21
|
var _selection = require("./pm-plugins/utils/selection");
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
24
|
+
|
|
22
25
|
/*
|
|
23
26
|
Toolbar buttons to bullet and ordered list can be found in
|
|
24
27
|
packages/editor/editor-core/src/plugins/toolbar-lists-indentation/ui/Toolbar.tsx
|
|
@@ -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);
|
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--) {
|
|
@@ -225,6 +225,8 @@ function splitListItem(itemType) {
|
|
|
225
225
|
wrap = _model.Fragment.from($from.node(d).copy(wrap));
|
|
226
226
|
}
|
|
227
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
|
|
228
230
|
wrap = wrap.append(_model.Fragment.from(itemType.createAndFill()));
|
|
229
231
|
var tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new _model.Slice(wrap, keepItem ? 3 : 2, 2));
|
|
230
232
|
tr$1.setSelection(
|
|
@@ -252,7 +254,10 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
252
254
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
253
255
|
return false;
|
|
254
256
|
}
|
|
255
|
-
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;
|
|
256
261
|
if (previousListItemEmpty) {
|
|
257
262
|
var tr = state.tr;
|
|
258
263
|
if (dispatch) {
|
|
@@ -13,6 +13,8 @@ var _selection = require("../utils/selection");
|
|
|
13
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
|
|
14
14
|
|
|
15
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
|
|
16
18
|
var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head) {
|
|
17
19
|
/* CASE 2
|
|
18
20
|
* Initial Structure:
|
|
@@ -60,6 +62,8 @@ var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head)
|
|
|
60
62
|
};
|
|
61
63
|
|
|
62
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
|
|
63
67
|
var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head) {
|
|
64
68
|
/* CASE 3
|
|
65
69
|
* Initial Structure:
|
|
@@ -127,6 +131,8 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
|
|
|
127
131
|
};
|
|
128
132
|
|
|
129
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
|
|
130
136
|
var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head, $last) {
|
|
131
137
|
/* CASE 4
|
|
132
138
|
* Initial Structure:
|
|
@@ -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);
|
|
@@ -13,12 +13,31 @@ var _indentList = require("./commands/indent-list");
|
|
|
13
13
|
var _outdentList = require("./commands/outdent-list");
|
|
14
14
|
function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
15
15
|
var list = {};
|
|
16
|
-
(0, _keymaps.bindKeymapWithEditorCommand)(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(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
|
|
20
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
|
|
21
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
|
|
22
41
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.deleteKey.common, (0, _commands.deleteKeyCommand)(editorAnalyticsAPI), list);
|
|
23
42
|
|
|
24
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;
|
|
@@ -8,6 +8,8 @@ import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggl
|
|
|
8
8
|
import { indentList } from './pm-plugins/commands/indent-list';
|
|
9
9
|
import { outdentList } from './pm-plugins/commands/outdent-list';
|
|
10
10
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
11
13
|
import keymapPlugin from './pm-plugins/keymap';
|
|
12
14
|
import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
13
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);
|
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--) {
|
|
@@ -208,6 +208,8 @@ function splitListItem(itemType) {
|
|
|
208
208
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
209
209
|
}
|
|
210
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
|
|
211
213
|
wrap = wrap.append(Fragment.from(itemType.createAndFill()));
|
|
212
214
|
const tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));
|
|
213
215
|
tr$1.setSelection(
|
|
@@ -239,7 +241,10 @@ const deletePreviousEmptyListItem = (state, dispatch) => {
|
|
|
239
241
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
240
242
|
return false;
|
|
241
243
|
}
|
|
242
|
-
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;
|
|
243
248
|
if (previousListItemEmpty) {
|
|
244
249
|
const {
|
|
245
250
|
tr
|
|
@@ -264,7 +269,7 @@ const joinToPreviousListItem = (state, dispatch) => {
|
|
|
264
269
|
} = state.schema.nodes;
|
|
265
270
|
const isGapCursorShown = state.selection instanceof GapCursorSelection;
|
|
266
271
|
const $cutPos = isGapCursorShown ? state.doc.resolve($from.pos + 1) : $from;
|
|
267
|
-
|
|
272
|
+
const $cut = findCutBefore($cutPos);
|
|
268
273
|
if (!$cut) {
|
|
269
274
|
return false;
|
|
270
275
|
}
|
|
@@ -308,7 +313,7 @@ const joinToPreviousListItem = (state, dispatch) => {
|
|
|
308
313
|
|
|
309
314
|
// find out if there's now another list following and join them
|
|
310
315
|
// as in, [list, p, list] => [list with p, list], and we want [joined list]
|
|
311
|
-
|
|
316
|
+
const $postCut = tr.doc.resolve(tr.mapping.map($cut.pos + $cut.nodeAfter.nodeSize));
|
|
312
317
|
if ($postCut.nodeBefore && $postCut.nodeAfter && $postCut.nodeBefore.type === $postCut.nodeAfter.type && [bulletList, orderedList].indexOf($postCut.nodeBefore.type) > -1) {
|
|
313
318
|
tr = tr.join($postCut.pos);
|
|
314
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);
|
|
@@ -6,12 +6,31 @@ import { indentList as indentListCommand } from './commands/indent-list';
|
|
|
6
6
|
import { outdentList as outdentListCommand } from './commands/outdent-list';
|
|
7
7
|
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
8
8
|
const list = {};
|
|
9
|
-
bindKeymapWithEditorCommand(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
13
27
|
bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
30
|
bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
|
|
31
|
+
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
34
|
bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
|
|
16
35
|
|
|
17
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/listPlugin.js
CHANGED
|
@@ -8,6 +8,8 @@ import { toggleBulletList as toggleBulletListCommand, toggleOrderedList as toggl
|
|
|
8
8
|
import { indentList } from './pm-plugins/commands/indent-list';
|
|
9
9
|
import { outdentList as _outdentList } from './pm-plugins/commands/outdent-list';
|
|
10
10
|
import inputRulePlugin from './pm-plugins/input-rules';
|
|
11
|
+
// Ignored via go/ees005
|
|
12
|
+
// eslint-disable-next-line import/no-named-as-default
|
|
11
13
|
import keymapPlugin from './pm-plugins/keymap';
|
|
12
14
|
import { createPlugin, pluginKey as listPluginKey } from './pm-plugins/main';
|
|
13
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);
|
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--) {
|
|
@@ -218,6 +218,8 @@ function splitListItem(itemType) {
|
|
|
218
218
|
wrap = Fragment.from($from.node(d).copy(wrap));
|
|
219
219
|
}
|
|
220
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
|
|
221
223
|
wrap = wrap.append(Fragment.from(itemType.createAndFill()));
|
|
222
224
|
var tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new Slice(wrap, keepItem ? 3 : 2, 2));
|
|
223
225
|
tr$1.setSelection(
|
|
@@ -245,7 +247,10 @@ var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, di
|
|
|
245
247
|
if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
|
|
246
248
|
return false;
|
|
247
249
|
}
|
|
248
|
-
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;
|
|
249
254
|
if (previousListItemEmpty) {
|
|
250
255
|
var tr = state.tr;
|
|
251
256
|
if (dispatch) {
|
|
@@ -6,6 +6,8 @@ import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
|
6
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
|
|
7
7
|
|
|
8
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
|
|
9
11
|
var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head) {
|
|
10
12
|
/* CASE 2
|
|
11
13
|
* Initial Structure:
|
|
@@ -53,6 +55,8 @@ var listBackspaceCase2 = function listBackspaceCase2(tr, dispatch, $prev, $head)
|
|
|
53
55
|
};
|
|
54
56
|
|
|
55
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
|
|
56
60
|
var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head) {
|
|
57
61
|
/* CASE 3
|
|
58
62
|
* Initial Structure:
|
|
@@ -120,6 +124,8 @@ var listBackspaceCase3 = function listBackspaceCase3(tr, dispatch, $prev, $head)
|
|
|
120
124
|
};
|
|
121
125
|
|
|
122
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
|
|
123
129
|
var listBackspaceCase4 = function listBackspaceCase4(tr, dispatch, $prev, $head, $last) {
|
|
124
130
|
/* CASE 4
|
|
125
131
|
* Initial Structure:
|
|
@@ -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);
|
|
@@ -6,12 +6,31 @@ import { indentList as indentListCommand } from './commands/indent-list';
|
|
|
6
6
|
import { outdentList as outdentListCommand } from './commands/outdent-list';
|
|
7
7
|
export function keymapPlugin(featureFlags, editorAnalyticsAPI) {
|
|
8
8
|
var list = {};
|
|
9
|
-
bindKeymapWithEditorCommand(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
13
27
|
bindKeymapWithCommand(enter.common, enterKeyCommand(editorAnalyticsAPI)(), list);
|
|
28
|
+
// Ignored via go/ees005
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
14
30
|
bindKeymapWithCommand(backspace.common, backspaceKeyCommand(editorAnalyticsAPI)(), list);
|
|
31
|
+
|
|
32
|
+
// Ignored via go/ees005
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
34
|
bindKeymapWithCommand(deleteKey.common, deleteKeyCommand(editorAnalyticsAPI), list);
|
|
16
35
|
|
|
17
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;
|
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",
|