@atlaskit/editor-core 187.8.7 → 187.8.11
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 +14 -0
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/cjs/plugins/block-type/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/code-block/pm-plugins/ide-ux.js +5 -5
- package/dist/cjs/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/list/actions/conversions.js +5 -5
- package/dist/cjs/plugins/list/actions/indent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/join-list-items-forward.js +6 -6
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +6 -7
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +3 -4
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +2 -2
- package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +2 -2
- package/dist/cjs/plugins/list/actions/merge-lists.js +3 -3
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +11 -11
- package/dist/cjs/plugins/list/actions/wrap-and-join-lists.js +2 -2
- package/dist/cjs/plugins/list/commands/indent-list.js +6 -7
- package/dist/cjs/plugins/list/commands/index.js +8 -10
- package/dist/cjs/plugins/list/commands/join-list-item-forward.js +5 -5
- package/dist/cjs/plugins/list/commands/listBackspace.js +13 -14
- package/dist/cjs/plugins/list/commands/outdent-list.js +4 -3
- package/dist/cjs/plugins/list/pm-plugins/main.js +5 -6
- package/dist/cjs/plugins/list/utils/analytics.js +1 -35
- package/dist/cjs/plugins/list/utils/indentation.js +2 -20
- package/dist/cjs/plugins/list/utils/node.js +2 -106
- package/dist/cjs/plugins/list/utils/selection.js +3 -54
- package/dist/cjs/plugins/tasks-and-decisions/commands.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +17 -18
- package/dist/cjs/plugins/text-formatting/index.js +23 -21
- package/dist/cjs/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
- package/dist/cjs/plugins/text-formatting/pm-plugins/smart-input-rule.js +28 -33
- package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/cjs/utils/commands.js +3 -109
- package/dist/cjs/utils/document.js +1 -26
- package/dist/cjs/utils/index.js +0 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/es2019/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/es2019/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/es2019/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/actions/conversions.js +2 -2
- package/dist/es2019/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/es2019/plugins/list/actions/merge-lists.js +1 -1
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/es2019/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/es2019/plugins/list/commands/indent-list.js +3 -4
- package/dist/es2019/plugins/list/commands/index.js +4 -5
- package/dist/es2019/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/es2019/plugins/list/commands/listBackspace.js +1 -2
- package/dist/es2019/plugins/list/commands/outdent-list.js +3 -2
- package/dist/es2019/plugins/list/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/list/utils/analytics.js +0 -36
- package/dist/es2019/plugins/list/utils/indentation.js +0 -18
- package/dist/es2019/plugins/list/utils/node.js +3 -89
- package/dist/es2019/plugins/list/utils/selection.js +1 -52
- package/dist/es2019/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/es2019/plugins/text-formatting/index.js +15 -10
- package/dist/es2019/plugins/text-formatting/pm-plugins/input-rule.js +20 -18
- package/dist/es2019/plugins/text-formatting/pm-plugins/smart-input-rule.js +11 -12
- package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/es2019/utils/commands.js +2 -102
- package/dist/es2019/utils/document.js +1 -26
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/base/pm-plugins/newline-preserve-marks.js +1 -1
- package/dist/esm/plugins/block-type/pm-plugins/keymap.js +1 -1
- package/dist/esm/plugins/code-block/pm-plugins/ide-ux.js +1 -1
- package/dist/esm/plugins/layout/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/actions/conversions.js +2 -2
- package/dist/esm/plugins/list/actions/indent-list-items-selected.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-forward.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +1 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +2 -2
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js +1 -1
- package/dist/esm/plugins/list/actions/join-list-items-scenarios/join-sibling-list-items.js +1 -1
- package/dist/esm/plugins/list/actions/merge-lists.js +1 -1
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +3 -3
- package/dist/esm/plugins/list/actions/wrap-and-join-lists.js +1 -1
- package/dist/esm/plugins/list/commands/indent-list.js +3 -4
- package/dist/esm/plugins/list/commands/index.js +4 -5
- package/dist/esm/plugins/list/commands/join-list-item-forward.js +1 -1
- package/dist/esm/plugins/list/commands/listBackspace.js +1 -2
- package/dist/esm/plugins/list/commands/outdent-list.js +3 -2
- package/dist/esm/plugins/list/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/list/utils/analytics.js +0 -32
- package/dist/esm/plugins/list/utils/indentation.js +0 -17
- package/dist/esm/plugins/list/utils/node.js +3 -81
- package/dist/esm/plugins/list/utils/selection.js +3 -51
- package/dist/esm/plugins/tasks-and-decisions/commands.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +1 -2
- package/dist/esm/plugins/text-formatting/index.js +23 -21
- package/dist/esm/plugins/text-formatting/pm-plugins/input-rule.js +48 -54
- package/dist/esm/plugins/text-formatting/pm-plugins/smart-input-rule.js +26 -31
- package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +2 -1
- package/dist/esm/utils/commands.js +2 -100
- package/dist/esm/utils/document.js +1 -26
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types/plugins/list/commands/index.d.ts +2 -1
- package/dist/types/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types/plugins/list/utils/node.d.ts +2 -17
- package/dist/types/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
- package/dist/types/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
- package/dist/types/utils/commands.d.ts +3 -32
- package/dist/types/utils/document.d.ts +0 -4
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/actions/join-list-items-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/indent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/commands/join-list-item-forward.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/listBackspace.d.ts +1 -1
- package/dist/types-ts4.5/plugins/list/commands/outdent-list.d.ts +2 -1
- package/dist/types-ts4.5/plugins/list/utils/analytics.d.ts +2 -4
- package/dist/types-ts4.5/plugins/list/utils/indentation.d.ts +0 -5
- package/dist/types-ts4.5/plugins/list/utils/node.d.ts +2 -17
- package/dist/types-ts4.5/plugins/list/utils/selection.d.ts +1 -12
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/input-rule.d.ts +2 -1
- package/dist/types-ts4.5/plugins/text-formatting/pm-plugins/smart-input-rule.d.ts +2 -2
- package/dist/types-ts4.5/utils/commands.d.ts +3 -38
- package/dist/types-ts4.5/utils/document.d.ts +0 -4
- package/dist/types-ts4.5/utils/index.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +0 -3
- package/tmp/api-report-tmp.d.ts +0 -3
- package/dist/cjs/plugins/list/utils/replace-content.js +0 -24
- package/dist/cjs/utils/prosemirror/autojoin.js +0 -68
- package/dist/es2019/plugins/list/utils/replace-content.js +0 -18
- package/dist/es2019/utils/prosemirror/autojoin.js +0 -57
- package/dist/esm/plugins/list/utils/replace-content.js +0 -17
- package/dist/esm/utils/prosemirror/autojoin.js +0 -63
- package/dist/types/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types/utils/prosemirror/autojoin.d.ts +0 -13
- package/dist/types-ts4.5/plugins/list/utils/replace-content.d.ts +0 -8
- package/dist/types-ts4.5/utils/prosemirror/autojoin.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 187.8.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2b54c3b0d24`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b54c3b0d24) - [ED-19203] Decouple text-formatting plugin and editor-core
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 187.8.10
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`d8c1bcdc71a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d8c1bcdc71a) - ED-19217 decoupled lists related util functions from editor-core
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 187.8.7
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -287,12 +287,6 @@ Object.defineProperty(exports, "getNodesCount", {
|
|
|
287
287
|
return _utils.getNodesCount;
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
|
-
Object.defineProperty(exports, "hasVisibleContent", {
|
|
291
|
-
enumerable: true,
|
|
292
|
-
get: function get() {
|
|
293
|
-
return _utils.hasVisibleContent;
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
290
|
Object.defineProperty(exports, "historyPluginKey", {
|
|
297
291
|
enumerable: true,
|
|
298
292
|
get: function get() {
|
|
@@ -27,7 +27,7 @@ var _default = function _default() {
|
|
|
27
27
|
key: newlinePreserveMarksKey,
|
|
28
28
|
props: {
|
|
29
29
|
handleKeyDown: (0, _keymap.keydownHandler)({
|
|
30
|
-
Enter: (0, _utils.
|
|
30
|
+
Enter: (0, _utils.filterCommand)([_utils2.isSelectionEndOfParagraph, isSelectionAligned], splitBlockPreservingMarks)
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -12,13 +12,13 @@ var commands = _interopRequireWildcard(require("../../../commands"));
|
|
|
12
12
|
var blockTypes = _interopRequireWildcard(require("../types"));
|
|
13
13
|
var _keymap = require("../../../utils/keymap");
|
|
14
14
|
var _commands3 = require("../commands");
|
|
15
|
-
var
|
|
15
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
16
|
var _analytics = require("../../analytics");
|
|
17
|
-
var
|
|
17
|
+
var _utils2 = require("../utils");
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
var backspace = (0, _commands.chainCommands)(_commands3.cleanUpAtTheStartOfDocument, (0, _commands3.deleteBlockContent)(
|
|
21
|
-
var del = (0, _commands.chainCommands)((0,
|
|
20
|
+
var backspace = (0, _commands.chainCommands)(_commands3.cleanUpAtTheStartOfDocument, (0, _commands3.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _commands3.deleteAndMoveCursor);
|
|
21
|
+
var del = (0, _commands.chainCommands)((0, _utils.deleteEmptyParagraphAndMoveBlockUp)(_utils2.isNodeAWrappingBlockNode), (0, _commands3.deleteBlockContent)(_utils2.isNodeAWrappingBlockNode), _commands3.deleteAndMoveCursor);
|
|
22
22
|
function keymapPlugin(schema, featureFlags, editorAnalyticsApi) {
|
|
23
23
|
var list = {};
|
|
24
24
|
keymaps.bindKeymapWithCommand(keymaps.insertNewLine.common, commands.insertNewLineWithAnalytics, list);
|
|
@@ -95,10 +95,10 @@ var _default = new _safePlugin.SafePlugin({
|
|
|
95
95
|
}
|
|
96
96
|
return false;
|
|
97
97
|
},
|
|
98
|
-
Enter: (0, _utils3.
|
|
99
|
-
'Mod-]': (0, _utils3.
|
|
100
|
-
'Mod-[': (0, _utils3.
|
|
101
|
-
Tab: (0, _utils3.
|
|
98
|
+
Enter: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.insertNewlineWithIndent),
|
|
99
|
+
'Mod-]': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.indent),
|
|
100
|
+
'Mod-[': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
|
|
101
|
+
Tab: (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, function (state, dispatch) {
|
|
102
102
|
if (!dispatch) {
|
|
103
103
|
return false;
|
|
104
104
|
}
|
|
@@ -107,7 +107,7 @@ var _default = new _safePlugin.SafePlugin({
|
|
|
107
107
|
}
|
|
108
108
|
return (0, _commands.indent)(state, dispatch);
|
|
109
109
|
}),
|
|
110
|
-
'Shift-Tab': (0, _utils3.
|
|
110
|
+
'Shift-Tab': (0, _utils3.filterCommand)(_lineHandling.isSelectionEntirelyInsideCodeBlock, _commands.outdent),
|
|
111
111
|
'Mod-a': function ModA(state, dispatch) {
|
|
112
112
|
if ((0, _lineHandling.isSelectionEntirelyInsideCodeBlock)(state)) {
|
|
113
113
|
var _state$selection = state.selection,
|
|
@@ -96,7 +96,7 @@ var _default = function _default(options) {
|
|
|
96
96
|
return undefined;
|
|
97
97
|
},
|
|
98
98
|
handleKeyDown: (0, _keymap.keydownHandler)({
|
|
99
|
-
Tab: (0, _utils2.
|
|
99
|
+
Tab: (0, _utils2.filterCommand)(isWholeSelectionInsideLayoutColumn, moveCursorToNextColumn)
|
|
100
100
|
}),
|
|
101
101
|
handleClickOn: (0, _utils3.createSelectionClickHandler)(['layoutColumn'], function (target) {
|
|
102
102
|
return target.hasAttribute('data-layout-section') || target.hasAttribute('data-layout-column');
|
|
@@ -8,8 +8,8 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
9
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
10
10
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
11
|
-
var _node = require("../utils/node");
|
|
12
11
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
12
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
13
13
|
var _find = require("../utils/find");
|
|
14
14
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
15
15
|
function convertListType(_ref) {
|
|
@@ -25,7 +25,7 @@ function convertListType(_ref) {
|
|
|
25
25
|
var nodeSize = ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.nodeSize) || 1;
|
|
26
26
|
listRange = $from.blockRange($from.doc.resolve($from.pos + nodeSize));
|
|
27
27
|
} else {
|
|
28
|
-
listRange = $from.blockRange($to,
|
|
28
|
+
listRange = $from.blockRange($to, _utils2.isListNode);
|
|
29
29
|
}
|
|
30
30
|
if (listRange) {
|
|
31
31
|
return convertSelectedList({
|
|
@@ -52,7 +52,7 @@ function convertListType(_ref) {
|
|
|
52
52
|
var resolvedPosition = doc.resolve(position);
|
|
53
53
|
var currentChild = parentNode.child(i);
|
|
54
54
|
var currentNodeRange = resolvedPosition.blockRange(tr.doc.resolve(position + currentChild.nodeSize));
|
|
55
|
-
if (currentNodeRange && !(0,
|
|
55
|
+
if (currentNodeRange && !(0, _utils2.isListNode)(currentChild) && !(0, _transform.findWrapping)(currentNodeRange, nextListNodeType)) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -84,7 +84,7 @@ function convertListType(_ref) {
|
|
|
84
84
|
nextListNodeType: nextListNodeType
|
|
85
85
|
});
|
|
86
86
|
if (tr.docChanged) {
|
|
87
|
-
(0,
|
|
87
|
+
(0, _lists.joinSiblingLists)({
|
|
88
88
|
tr: tr,
|
|
89
89
|
forceListType: nextListNodeType
|
|
90
90
|
});
|
|
@@ -115,7 +115,7 @@ var convertSelectedList = function convertSelectedList(_ref2) {
|
|
|
115
115
|
|
|
116
116
|
// use those positions to get the closest parent list nodes
|
|
117
117
|
nodePositions.reduce(function (acc, pos) {
|
|
118
|
-
var closestParentListNode = (0, _utils.findParentNodeClosestToPos)(tr.doc.resolve(pos),
|
|
118
|
+
var closestParentListNode = (0, _utils.findParentNodeClosestToPos)(tr.doc.resolve(pos), _utils2.isListNode);
|
|
119
119
|
if (!closestParentListNode) {
|
|
120
120
|
return acc;
|
|
121
121
|
}
|
|
@@ -8,13 +8,13 @@ exports.indentListItemsSelected = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
|
-
var
|
|
11
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
12
12
|
var _find = require("../utils/find");
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _selection = require("@atlaskit/editor-common/selection");
|
|
15
15
|
var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
16
16
|
var originalSelection = tr.selection;
|
|
17
|
-
var normalizedSelection = (0,
|
|
17
|
+
var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
|
|
18
18
|
selection: originalSelection,
|
|
19
19
|
doc: tr.doc
|
|
20
20
|
});
|
|
@@ -38,17 +38,17 @@ var indentListItemsSelected = function indentListItemsSelected(tr) {
|
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
var positionListItemPosition = resolvedPos.posAtIndex(listItemIndex - 1);
|
|
40
40
|
var previousListItem = tr.doc.nodeAt(positionListItemPosition);
|
|
41
|
-
if (!previousListItem || !(0,
|
|
41
|
+
if (!previousListItem || !(0, _utils.isListItemNode)(previousListItem)) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
if ((0,
|
|
44
|
+
if ((0, _utils.isListItemNode)(previousListItem) && listItemIndex === 0) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
var listItemSelectedCommonParent = range.parent;
|
|
48
|
-
var previousNestedList = (0,
|
|
48
|
+
var previousNestedList = (0, _utils.isListNode)(previousListItem.lastChild) ? previousListItem.lastChild : null;
|
|
49
49
|
var listNodeType = previousNestedList ? previousNestedList.type : listItemSelectedCommonParent.type;
|
|
50
50
|
var nestedList = listItemsSelected.to.node.lastChild;
|
|
51
|
-
var nestedItemsOffset = nestedList && (0,
|
|
51
|
+
var nestedItemsOffset = nestedList && (0, _utils.isListNode)(nestedList) ? nestedList.nodeSize : 0;
|
|
52
52
|
var from = listItemsSelected.from.pos;
|
|
53
53
|
var to = listItemsSelected.to.pos + listItemsSelected.to.node.nodeSize - nestedItemsOffset;
|
|
54
54
|
var _createIndentedListIt = createIndentedListItemsSlice({
|
|
@@ -83,7 +83,7 @@ var calculateRange = function calculateRange(_ref) {
|
|
|
83
83
|
var selection = _ref.selection;
|
|
84
84
|
var $from = selection.$from,
|
|
85
85
|
$to = selection.$to;
|
|
86
|
-
var range = $from.blockRange($to,
|
|
86
|
+
var range = $from.blockRange($to, _utils.isListNode);
|
|
87
87
|
if (!range) {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
@@ -97,9 +97,9 @@ var calculateNewSelection = function calculateNewSelection(_ref2) {
|
|
|
97
97
|
var offset = hasPreviousNestedList ? 2 : 0;
|
|
98
98
|
var $from = normalizedSelection.$from,
|
|
99
99
|
$to = normalizedSelection.$to;
|
|
100
|
-
if (normalizedSelection instanceof
|
|
100
|
+
if (normalizedSelection instanceof _selection.GapCursorSelection) {
|
|
101
101
|
var _nextSelectionFrom = tr.doc.resolve($from.pos - offset);
|
|
102
|
-
return new
|
|
102
|
+
return new _selection.GapCursorSelection(_nextSelectionFrom, normalizedSelection.side);
|
|
103
103
|
}
|
|
104
104
|
if (originalSelection instanceof _state.NodeSelection) {
|
|
105
105
|
return _state.NodeSelection.create(tr.doc, $from.pos - offset);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.calcJoinListScenario = void 0;
|
|
7
7
|
var _analytics = require("../../analytics");
|
|
8
|
-
var
|
|
8
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
9
|
var _selection = require("../utils/selection");
|
|
10
10
|
var _joinListItemsScenarios = require("./join-list-items-scenarios");
|
|
11
11
|
var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
@@ -17,7 +17,7 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
|
17
17
|
var headInParagraph = (0, _selection.isPosInsideParagraph)($head);
|
|
18
18
|
var headInLastNonListChild = headGrandParent && headGrandParent.lastChild && (headGrandParent.lastChild === headParent || headGrandParent.childCount > 1 && headGrandParent.child(headGrandParent.childCount - 2) === headParent &&
|
|
19
19
|
//find the second last child if a list item may be the last child
|
|
20
|
-
(0,
|
|
20
|
+
(0, _utils.isListNode)(headGrandParent.lastChild));
|
|
21
21
|
var nextInList = (0, _selection.isPosInsideList)($next);
|
|
22
22
|
var nextInParagraph = (0, _selection.isPosInsideParagraph)($next);
|
|
23
23
|
if (!headInList && headInParagraph && nextInList) {
|
|
@@ -35,11 +35,11 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
|
35
35
|
var nextNodeAfter = $next.nodeAfter;
|
|
36
36
|
var nextGrandParent = $next.node(-1);
|
|
37
37
|
var headGreatGrandParent = $head.node(-2);
|
|
38
|
-
var nextInListItem = (0,
|
|
39
|
-
var nextNodeAfterListItem = (0,
|
|
38
|
+
var nextInListItem = (0, _utils.isListItemNode)($next.parent);
|
|
39
|
+
var nextNodeAfterListItem = (0, _utils.isListItemNode)(nextNodeAfter);
|
|
40
40
|
var nextListItemHasFirstChildParagraph = nextNodeAfter &&
|
|
41
41
|
//Redundant check but the linter complains otherwise
|
|
42
|
-
nextNodeAfterListItem && (0,
|
|
42
|
+
nextNodeAfterListItem && (0, _utils.isParagraphNode)(nextNodeAfter.firstChild);
|
|
43
43
|
if (!nextInListItem && nextListItemHasFirstChildParagraph) {
|
|
44
44
|
return [_analytics.LIST_TEXT_SCENARIOS.JOIN_DESCENDANT_TO_PARENT, _joinListItemsScenarios.joinNestedListWithParentListItem];
|
|
45
45
|
}
|
|
@@ -47,7 +47,7 @@ var calcJoinListScenario = function calcJoinListScenario(walkNode, $head) {
|
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
var nextParentSiblingOfHeadParent = nextGrandParent && nextGrandParent === headGreatGrandParent;
|
|
50
|
-
var nextNodeAfterIsParagraph = (0,
|
|
50
|
+
var nextNodeAfterIsParagraph = (0, _utils.isParagraphNode)(nextNodeAfter);
|
|
51
51
|
if (!nextNodeAfterIsParagraph) {
|
|
52
52
|
return false;
|
|
53
53
|
}
|
package/dist/cjs/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinListItemWithParagraph = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
|
-
var _node = require("../../utils/node");
|
|
10
9
|
// Case for when a users selection is at the end of a paragraph, the paragraph
|
|
11
10
|
// is followed by a list, and they delete forward
|
|
12
11
|
var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
@@ -15,7 +14,7 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
|
15
14
|
$head = _ref.$head;
|
|
16
15
|
// For empty paragraphs before a list
|
|
17
16
|
if ($head.parent.content.size < 1) {
|
|
18
|
-
(0,
|
|
17
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
19
18
|
return tr.doc.resolve($head.pos);
|
|
20
19
|
}, [], [[$head.pos - 1, $head.pos]]);
|
|
21
20
|
return true;
|
|
@@ -33,7 +32,7 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
|
33
32
|
var lastChildOfFirstListItem = firstListItem.lastChild;
|
|
34
33
|
var firstGrandchildOfFirstListItem = firstChildNodeOfFirstListItem.firstChild;
|
|
35
34
|
var firstListItemHasOneChildWithNoNestedLists = hasSingleChild(firstListItem) && firstChildNodeOfFirstListItem.childCount < 2 && $next.nodeAfter;
|
|
36
|
-
var firstListItemContainsParagraphAndNestedList = !hasSingleChild(firstListItem) && lastChildOfFirstListItem && (0,
|
|
35
|
+
var firstListItemContainsParagraphAndNestedList = !hasSingleChild(firstListItem) && lastChildOfFirstListItem && (0, _utils.isListNode)(lastChildOfFirstListItem);
|
|
37
36
|
var insertions = [];
|
|
38
37
|
var deletions = [];
|
|
39
38
|
|
|
@@ -53,7 +52,7 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
|
53
52
|
deletions.push([tr.mapping.map($next.pos), tr.mapping.map($next.pos + firstListItem.nodeSize - 1)]);
|
|
54
53
|
var firstListItemText = _model.Fragment.from(firstChildNodeOfFirstListItem.content);
|
|
55
54
|
insertions.push([firstListItemText, paragraphPosition]);
|
|
56
|
-
(0,
|
|
55
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
57
56
|
return tr.doc.resolve($head.pos);
|
|
58
57
|
}, insertions, deletions);
|
|
59
58
|
return true;
|
|
@@ -63,7 +62,7 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
|
63
62
|
if (firstListItem.childCount > 1) {
|
|
64
63
|
insertions.push([_model.Fragment.from(firstChildNodeOfFirstListItem.content), paragraphPosition]);
|
|
65
64
|
deletions.push([tr.mapping.map($next.pos + 1), tr.mapping.map($next.pos + firstChildNodeOfFirstListItem.nodeSize + 1)]);
|
|
66
|
-
(0,
|
|
65
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
67
66
|
return tr.doc.resolve($head.pos);
|
|
68
67
|
}, insertions, deletions);
|
|
69
68
|
return true;
|
|
@@ -78,7 +77,7 @@ var joinListItemWithParagraph = function joinListItemWithParagraph(_ref) {
|
|
|
78
77
|
var nodeSizeOfFirstChild = firstChildNodeOfFirstListItem.nodeSize;
|
|
79
78
|
deletions.push([tr.mapping.map($next.pos), tr.mapping.map($next.pos + 2 + nodeSizeOfFirstChild)]);
|
|
80
79
|
}
|
|
81
|
-
(0,
|
|
80
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
82
81
|
return tr.doc.resolve($head.pos);
|
|
83
82
|
}, insertions, deletions);
|
|
84
83
|
return true;
|
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinListItemWithParentNestedList = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _node = require("../../utils/node");
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
8
|
//Case for two adjacent list items with the first being of greater indentation
|
|
10
9
|
var joinListItemWithParentNestedList = function joinListItemWithParentNestedList(_ref) {
|
|
11
10
|
var tr = _ref.tr,
|
|
@@ -70,7 +69,7 @@ var joinListItemWithParentNestedList = function joinListItemWithParentNestedList
|
|
|
70
69
|
var beforeListItemK = $next.before();
|
|
71
70
|
var afterListItemB = $next.before();
|
|
72
71
|
var afterListItemK = $next.after();
|
|
73
|
-
var containsChildrenO = (0,
|
|
72
|
+
var containsChildrenO = (0, _utils.isListNode)(listItemK.lastChild);
|
|
74
73
|
var textInsertPos = $head.pos;
|
|
75
74
|
var childrenMInsertPos = $head.pos + 1;
|
|
76
75
|
var childrenOInsertPos = afterListItemB - 2;
|
|
@@ -78,7 +77,7 @@ var joinListItemWithParentNestedList = function joinListItemWithParentNestedList
|
|
|
78
77
|
var childrenMContent = containsChildrenO ? listItemK.content.cut(listItemK.firstChild.nodeSize, listItemK.nodeSize - listItemK.lastChild.nodeSize - 2 //Get the position before
|
|
79
78
|
) : listItemK.content.cut(listItemK.firstChild.nodeSize);
|
|
80
79
|
var childrenOContent = listItemK.lastChild.content;
|
|
81
|
-
(0,
|
|
80
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
82
81
|
return tr.doc.resolve(textInsertPos);
|
|
83
82
|
}, containsChildrenO ? [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos], [childrenOContent, childrenOInsertPos]] : [[textContent, textInsertPos], [childrenMContent, childrenMInsertPos]], [[beforeListItemK, afterListItemK]]);
|
|
84
83
|
return true;
|
|
@@ -4,8 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinNestedListWithParentListItem = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _node = require("../../utils/node");
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
8
|
//Case for two adjacent list items with the first being of lower indentation
|
|
10
9
|
var joinNestedListWithParentListItem = function joinNestedListWithParentListItem(_ref) {
|
|
11
10
|
var tr = _ref.tr,
|
|
@@ -62,7 +61,7 @@ var joinNestedListWithParentListItem = function joinNestedListWithParentListItem
|
|
|
62
61
|
var afterListE = $next.after();
|
|
63
62
|
var afterListItemF = tr.doc.resolve($next.pos + 1).after(); //List must always have at least one listItem
|
|
64
63
|
|
|
65
|
-
var containsChildrenJ = (0,
|
|
64
|
+
var containsChildrenJ = (0, _utils.isListNode)(listItemF.lastChild);
|
|
66
65
|
var shouldRemoveListE = listE.childCount === 1 && !containsChildrenJ; //Assures no Children J and K
|
|
67
66
|
|
|
68
67
|
var textInsertPos = $head.pos;
|
|
@@ -72,7 +71,7 @@ var joinNestedListWithParentListItem = function joinNestedListWithParentListItem
|
|
|
72
71
|
var childrenHContent = containsChildrenJ ? listItemF.content.cut(paragraphG.nodeSize, listItemF.nodeSize - listItemF.lastChild.nodeSize - 2) : listItemF.content.cut(paragraphG.nodeSize); //If Children J doesn't exist then Children H will include the last node
|
|
73
72
|
var childrenJContent = listItemF.lastChild.content; //Will be invalid if there are no Children J but it will be unused
|
|
74
73
|
|
|
75
|
-
(0,
|
|
74
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
76
75
|
return tr.doc.resolve(textInsertPos);
|
|
77
76
|
}, containsChildrenJ ? [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos], [childrenJContent, childrenJInsertPos]] : [[textContent, textInsertPos], [childrenHContent, childrenHInsertPos]], [shouldRemoveListE ? [beforeListE, afterListE] : [beforeListItemF, afterListItemF]]);
|
|
78
77
|
return true;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinParagrapWithList = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
8
|
//Case for two adjacent nodes with the first being a list item and the last being a paragraph
|
|
9
9
|
var joinParagrapWithList = function joinParagrapWithList(_ref) {
|
|
10
10
|
var tr = _ref.tr,
|
|
@@ -37,7 +37,7 @@ var joinParagrapWithList = function joinParagrapWithList(_ref) {
|
|
|
37
37
|
var afterParagraphE = $next.after();
|
|
38
38
|
var textInsertPos = $head.pos;
|
|
39
39
|
var textContent = paragraphE.content;
|
|
40
|
-
(0,
|
|
40
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
41
41
|
return tr.doc.resolve(textInsertPos);
|
|
42
42
|
}, [[textContent, textInsertPos]], [[beforeParagraphE, afterParagraphE]]);
|
|
43
43
|
return true;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.joinSiblingListItems = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
8
|
//Case for two adjacent list items of the same indentation
|
|
9
9
|
var joinSiblingListItems = function joinSiblingListItems(_ref) {
|
|
10
10
|
var tr = _ref.tr,
|
|
@@ -48,7 +48,7 @@ var joinSiblingListItems = function joinSiblingListItems(_ref) {
|
|
|
48
48
|
var childrenGInsertPos = endListItemB;
|
|
49
49
|
var textContent = paragraphF.content;
|
|
50
50
|
var childrenGContent = listItemE.content.cut(paragraphF.nodeSize);
|
|
51
|
-
(0,
|
|
51
|
+
(0, _utils.insertContentDeleteRange)(tr, function (tr) {
|
|
52
52
|
return tr.doc.resolve(textInsertPos);
|
|
53
53
|
}, [[textContent, textInsertPos], [childrenGContent, childrenGInsertPos]], [[beforeListItemE, afterListItemE]]);
|
|
54
54
|
return true;
|
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mergeNextListAtPosition = mergeNextListAtPosition;
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
8
8
|
function mergeNextListAtPosition(_ref) {
|
|
9
9
|
var tr = _ref.tr,
|
|
10
10
|
listPosition = _ref.listPosition;
|
|
11
11
|
var listNodeAtPosition = tr.doc.nodeAt(listPosition);
|
|
12
|
-
if (!(0,
|
|
12
|
+
if (!(0, _utils.isListNode)(listNodeAtPosition)) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
var listPositionResolved = tr.doc.resolve(listPosition + listNodeAtPosition.nodeSize);
|
|
16
16
|
var pos = listPositionResolved.pos,
|
|
17
17
|
nodeAfter = listPositionResolved.nodeAfter,
|
|
18
18
|
nodeBefore = listPositionResolved.nodeBefore;
|
|
19
|
-
if (!(0,
|
|
19
|
+
if (!(0, _utils.isListNode)(nodeBefore) || !(0, _utils.isListNode)(nodeAfter)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
if ((nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type.name) !== (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type.name)) {
|
|
@@ -10,7 +10,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
|
-
var
|
|
13
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
14
14
|
var _find = require("../utils/find");
|
|
15
15
|
var _selection = require("../utils/selection");
|
|
16
16
|
var _gapCursorSelection = require("../../selection/gap-cursor-selection");
|
|
@@ -20,7 +20,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
var outdentListItemsSelected = function outdentListItemsSelected(tr, state, featureFlags) {
|
|
22
22
|
var originalSelection = tr.selection;
|
|
23
|
-
var normalizedSelection = (0,
|
|
23
|
+
var normalizedSelection = (0, _lists.normalizeListItemsSelection)({
|
|
24
24
|
selection: tr.selection,
|
|
25
25
|
doc: tr.doc
|
|
26
26
|
});
|
|
@@ -28,7 +28,7 @@ var outdentListItemsSelected = function outdentListItemsSelected(tr, state, feat
|
|
|
28
28
|
if (!rootList) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
var commonList = normalizedSelection.$from.blockRange(rootList,
|
|
31
|
+
var commonList = normalizedSelection.$from.blockRange(rootList, _utils.isListNode);
|
|
32
32
|
if (!commonList) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -40,11 +40,11 @@ var outdentListItemsSelected = function outdentListItemsSelected(tr, state, feat
|
|
|
40
40
|
nodeRanges.forEach(function (range) {
|
|
41
41
|
var $from = tr.doc.resolve(tr.mapping.map(range.from));
|
|
42
42
|
var $to = tr.doc.resolve(tr.mapping.map(range.to));
|
|
43
|
-
var mappedRange = $from.blockRange($to,
|
|
43
|
+
var mappedRange = $from.blockRange($to, _utils.isListNode);
|
|
44
44
|
if (!mappedRange) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if ((0,
|
|
47
|
+
if ((0, _utils.isListItemNode)($from.node(mappedRange.depth - 1))) {
|
|
48
48
|
outdentRangeToParentList({
|
|
49
49
|
tr: tr,
|
|
50
50
|
range: mappedRange
|
|
@@ -70,9 +70,9 @@ var outdentListItemsSelected = function outdentListItemsSelected(tr, state, feat
|
|
|
70
70
|
hasNormalizedFromPositionLiftedOut: hasNormalizedFromPositionLiftedOut
|
|
71
71
|
});
|
|
72
72
|
tr.setSelection(nextSelection);
|
|
73
|
-
(0,
|
|
73
|
+
(0, _lists.joinSiblingLists)({
|
|
74
74
|
tr: tr,
|
|
75
|
-
direction:
|
|
75
|
+
direction: _lists.JoinDirection.RIGHT
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
exports.outdentListItemsSelected = outdentListItemsSelected;
|
|
@@ -139,11 +139,11 @@ var splitRangeSelection = function splitRangeSelection(selection) {
|
|
|
139
139
|
var previousListItem = findPreviousListItemSibling($to);
|
|
140
140
|
while (previousListItem && previousListItem.pos >= lastListItem.pos && previousListItem.pos >= commonListRange.start) {
|
|
141
141
|
var node = doc.nodeAt(previousListItem.pos);
|
|
142
|
-
if (!node || !(0,
|
|
142
|
+
if (!node || !(0, _utils.isListItemNode)(node)) {
|
|
143
143
|
return [];
|
|
144
144
|
}
|
|
145
145
|
var offset = 0;
|
|
146
|
-
if (node && node.lastChild && (0,
|
|
146
|
+
if (node && node.lastChild && (0, _utils.isListNode)(node.lastChild)) {
|
|
147
147
|
offset = node.lastChild.nodeSize;
|
|
148
148
|
}
|
|
149
149
|
var start = previousListItem.pos + 1;
|
|
@@ -192,7 +192,7 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
|
|
|
192
192
|
if (isAtTop) {
|
|
193
193
|
for (var _i = 0; _i < listItemContent.childCount; _i++) {
|
|
194
194
|
var child = listItemContent.child(_i);
|
|
195
|
-
if (child && (0,
|
|
195
|
+
if (child && (0, _utils.isListNode)(child) && child.type !== list.type) {
|
|
196
196
|
var newNestedList = list.type.create(null, child.content);
|
|
197
197
|
listItemContent = listItemContent.replaceChild(_i, newNestedList);
|
|
198
198
|
}
|
|
@@ -269,7 +269,7 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
|
|
|
269
269
|
};
|
|
270
270
|
var findPreviousListItemSibling = function findPreviousListItemSibling($pos) {
|
|
271
271
|
var doc = $pos.doc;
|
|
272
|
-
var isPositionListItem = (0,
|
|
272
|
+
var isPositionListItem = (0, _utils.isListNode)($pos.node());
|
|
273
273
|
var listItemPosition = $pos;
|
|
274
274
|
if (!isPositionListItem) {
|
|
275
275
|
var listItem = (0, _find.findFirstParentListItemNode)($pos);
|
|
@@ -7,7 +7,7 @@ exports.wrapInList = wrapInList;
|
|
|
7
7
|
exports.wrapInListAndJoin = wrapInListAndJoin;
|
|
8
8
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
9
9
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
10
|
-
var
|
|
10
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _gapCursorSelection = require("../../selection/gap-cursor-selection");
|
|
12
12
|
var _selection = require("../utils/selection");
|
|
13
13
|
/**
|
|
@@ -16,7 +16,7 @@ var _selection = require("../utils/selection");
|
|
|
16
16
|
*/
|
|
17
17
|
function wrapInListAndJoin(nodeType, tr) {
|
|
18
18
|
wrapInList(nodeType)(tr);
|
|
19
|
-
(0,
|
|
19
|
+
(0, _utils.autoJoinTr)(tr, function (before, after) {
|
|
20
20
|
return before.type === after.type && before.type === nodeType;
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -7,13 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.indentList = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
-
var
|
|
10
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
11
11
|
var _indentListItemsSelected = require("../actions/indent-list-items-selected");
|
|
12
|
-
var
|
|
12
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _find = require("../utils/find");
|
|
14
14
|
var _types = require("../types");
|
|
15
15
|
var _selection = require("../utils/selection");
|
|
16
|
-
var _analytics2 = require("../utils/analytics");
|
|
17
16
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
18
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -31,7 +30,7 @@ var indentList = function indentList(editorAnalyticsAPI) {
|
|
|
31
30
|
|
|
32
31
|
// Save the history, so it could undo/revert to the same state before the indent, see https://product-fabric.atlassian.net/browse/ED-14753
|
|
33
32
|
(0, _history.closeHistory)(tr);
|
|
34
|
-
var firstListItemSelectedAttributes = (0,
|
|
33
|
+
var firstListItemSelectedAttributes = (0, _lists.getListItemAttributes)($from);
|
|
35
34
|
var parentListNode = (0, _find.findFirstParentListNode)($from);
|
|
36
35
|
if (!parentListNode || firstListItemSelectedAttributes && firstListItemSelectedAttributes.indentLevel === 0 && firstListItemSelectedAttributes.itemIndex === 0) {
|
|
37
36
|
if ((0, _selection.isInsideTableCell)(state)) {
|
|
@@ -43,9 +42,9 @@ var indentList = function indentList(editorAnalyticsAPI) {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
var currentListNode = parentListNode.node;
|
|
46
|
-
var actionSubjectId = (0,
|
|
45
|
+
var actionSubjectId = (0, _utils.isBulletList)(currentListNode) ? _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_BULLET : _analytics.ACTION_SUBJECT_ID.FORMAT_LIST_NUMBER;
|
|
47
46
|
(0, _indentListItemsSelected.indentListItemsSelected)(tr);
|
|
48
|
-
var maximimunNestedLevelReached = !(0,
|
|
47
|
+
var maximimunNestedLevelReached = !(0, _lists.hasValidListIndentationLevel)({
|
|
49
48
|
tr: tr,
|
|
50
49
|
maxIndentation: _types.MAX_NESTED_LIST_INDENTATION
|
|
51
50
|
});
|
|
@@ -58,7 +57,7 @@ var indentList = function indentList(editorAnalyticsAPI) {
|
|
|
58
57
|
actionSubject: _analytics.ACTION_SUBJECT.LIST,
|
|
59
58
|
actionSubjectId: actionSubjectId,
|
|
60
59
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
61
|
-
attributes: _objectSpread(_objectSpread({}, (0,
|
|
60
|
+
attributes: _objectSpread(_objectSpread({}, (0, _lists.getCommonListAnalyticsAttributes)(state)), {}, {
|
|
62
61
|
inputMethod: inputMethod
|
|
63
62
|
})
|
|
64
63
|
})(tr);
|