@atlaskit/editor-core 187.8.7 → 187.8.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 +7 -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/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/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/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/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/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
|
@@ -13,11 +13,10 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
15
15
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
|
-
var _commands2 = require("../../../utils/commands");
|
|
17
16
|
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
18
17
|
var _analytics = require("../../analytics");
|
|
19
|
-
var
|
|
20
|
-
var
|
|
18
|
+
var _commands2 = require("../commands");
|
|
19
|
+
var _commands3 = require("./commands");
|
|
21
20
|
var _helpers = require("./helpers");
|
|
22
21
|
var _utils3 = require("../utils");
|
|
23
22
|
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; }
|
|
@@ -46,7 +45,7 @@ var actionDecisionFollowsOrNothing = function actionDecisionFollowsOrNothing($po
|
|
|
46
45
|
};
|
|
47
46
|
var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispatch) {
|
|
48
47
|
// only run if selection is at end of text, and inside a task or decision item
|
|
49
|
-
if (!(0,
|
|
48
|
+
if (!(0, _utils2.isEmptySelectionAtEnd)(state) || !(0, _helpers.isInsideTaskOrDecisionItem)(state) || !dispatch) {
|
|
50
49
|
return false;
|
|
51
50
|
}
|
|
52
51
|
// look for the node after this current one
|
|
@@ -67,7 +66,7 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
|
|
|
67
66
|
if (!parentList) {
|
|
68
67
|
if ($next.parent.type === paragraph) {
|
|
69
68
|
// try to join paragraph and taskList when backspacing
|
|
70
|
-
return (0,
|
|
69
|
+
return (0, _commands3.joinAtCut)($next.doc.resolve($next.pos))(state, dispatch);
|
|
71
70
|
}
|
|
72
71
|
// If the item we are joining is a list
|
|
73
72
|
if ($next.parent.type === bulletList || $next.parent.type === orderedList) {
|
|
@@ -97,13 +96,13 @@ var joinTaskDecisionFollowing = function joinTaskDecisionFollowing(state, dispat
|
|
|
97
96
|
};
|
|
98
97
|
var getUnindentCommand = function getUnindentCommand() {
|
|
99
98
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
100
|
-
return (0, _utils2.
|
|
99
|
+
return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
|
|
101
100
|
var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
|
|
102
101
|
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
|
|
103
102
|
if (!curIndentLevel || curIndentLevel === 1) {
|
|
104
103
|
return false;
|
|
105
104
|
}
|
|
106
|
-
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _commands.autoJoin)(
|
|
105
|
+
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.OUTDENT, inputMethod))((0, _commands.autoJoin)(_commands3.liftSelection, ['taskList']))(state, dispatch);
|
|
107
106
|
});
|
|
108
107
|
};
|
|
109
108
|
|
|
@@ -124,13 +123,13 @@ var shouldLetTabThroughInTable = function shouldLetTabThroughInTable(state) {
|
|
|
124
123
|
};
|
|
125
124
|
var getIndentCommand = function getIndentCommand() {
|
|
126
125
|
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
127
|
-
return (0, _utils2.
|
|
126
|
+
return (0, _utils2.filterCommand)(_helpers.isInsideTask, function (state, dispatch) {
|
|
128
127
|
var normalizedSelection = (0, _utils3.normalizeTaskItemsSelection)(state.selection);
|
|
129
128
|
var curIndentLevel = (0, _helpers.getCurrentIndentLevel)(normalizedSelection);
|
|
130
129
|
if (!curIndentLevel || curIndentLevel >= 6) {
|
|
131
130
|
return true;
|
|
132
131
|
}
|
|
133
|
-
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _commands.autoJoin)(
|
|
132
|
+
return (0, _analytics.withAnalytics)(indentationAnalytics(curIndentLevel, _analytics.INDENT_DIRECTION.INDENT, inputMethod))((0, _commands.autoJoin)(_commands3.wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
134
133
|
});
|
|
135
134
|
};
|
|
136
135
|
exports.getIndentCommand = getIndentCommand;
|
|
@@ -165,9 +164,9 @@ var backspaceFrom = function backspaceFrom($from) {
|
|
|
165
164
|
return false;
|
|
166
165
|
};
|
|
167
166
|
};
|
|
168
|
-
var backspace = (0, _utils2.
|
|
169
|
-
return (0,
|
|
170
|
-
}, (0, _utils2.
|
|
167
|
+
var backspace = (0, _utils2.filterCommand)(_utils2.isEmptySelectionAtStart, (0, _commands.autoJoin)((0, _commands.chainCommands)(function (state, dispatch) {
|
|
168
|
+
return (0, _commands3.joinAtCut)(state.selection.$from)(state, dispatch);
|
|
169
|
+
}, (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, function (state, dispatch) {
|
|
171
170
|
return backspaceFrom(state.selection.$from)(state, dispatch);
|
|
172
171
|
})), ['taskList', 'decisionList']));
|
|
173
172
|
var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTaskDecisionFollowing(state, dispatch) {
|
|
@@ -179,7 +178,7 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
|
|
|
179
178
|
tr = state.tr;
|
|
180
179
|
|
|
181
180
|
// only run if cursor is at the end of the node
|
|
182
|
-
if (!(0,
|
|
181
|
+
if (!(0, _utils2.isEmptySelectionAtEnd)(state) || !dispatch) {
|
|
183
182
|
return false;
|
|
184
183
|
}
|
|
185
184
|
|
|
@@ -213,7 +212,7 @@ var unindentTaskOrUnwrapTaskDecisionFollowing = function unindentTaskOrUnwrapTas
|
|
|
213
212
|
}
|
|
214
213
|
return false;
|
|
215
214
|
};
|
|
216
|
-
var deleteForwards = (0, _commands.autoJoin)((0, _commands.chainCommands)((0,
|
|
215
|
+
var deleteForwards = (0, _commands.autoJoin)((0, _commands.chainCommands)((0, _utils2.deleteEmptyParagraphAndMoveBlockUp)(_helpers.isActionOrDecisionList), joinTaskDecisionFollowing, unindentTaskOrUnwrapTaskDecisionFollowing), ['taskList', 'decisionList']);
|
|
217
216
|
var splitListItemWith = function splitListItemWith(tr, content, $from, setSelection) {
|
|
218
217
|
var origDoc = tr.doc;
|
|
219
218
|
|
|
@@ -279,7 +278,7 @@ var splitListItem = function splitListItem(state, dispatch) {
|
|
|
279
278
|
}
|
|
280
279
|
return false;
|
|
281
280
|
};
|
|
282
|
-
var enter = (0, _utils2.
|
|
281
|
+
var enter = (0, _utils2.filterCommand)(_helpers.isInsideTaskOrDecisionItem, (0, _commands.chainCommands)((0, _utils2.filterCommand)(_helpers.isEmptyTaskDecision, (0, _commands.chainCommands)(getUnindentCommand(), splitListItem)), function (state, dispatch) {
|
|
283
282
|
var selection = state.selection,
|
|
284
283
|
schema = state.schema;
|
|
285
284
|
var taskItem = schema.nodes.taskItem;
|
|
@@ -308,7 +307,7 @@ var enter = (0, _utils2.filterCommands)(_helpers.isInsideTaskOrDecisionItem, (0,
|
|
|
308
307
|
}
|
|
309
308
|
}]);
|
|
310
309
|
};
|
|
311
|
-
var insertTr = (0,
|
|
310
|
+
var insertTr = (0, _commands2.insertTaskDecisionWithAnalytics)(state, listType, _analytics.INPUT_METHOD.KEYBOARD, addItem);
|
|
312
311
|
if (insertTr && dispatch) {
|
|
313
312
|
insertTr.scrollIntoView();
|
|
314
313
|
dispatch(insertTr);
|
|
@@ -317,12 +316,12 @@ var enter = (0, _utils2.filterCommands)(_helpers.isInsideTaskOrDecisionItem, (0,
|
|
|
317
316
|
}));
|
|
318
317
|
function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
319
318
|
var indentHandlers = {
|
|
320
|
-
'Shift-Tab': (0, _utils2.
|
|
319
|
+
'Shift-Tab': (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
321
320
|
return !shouldLetTabThroughInTable(state);
|
|
322
321
|
}], function (state, dispatch) {
|
|
323
322
|
return getUnindentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
324
323
|
}),
|
|
325
|
-
Tab: (0, _utils2.
|
|
324
|
+
Tab: (0, _utils2.filterCommand)([_helpers.isInsideTaskOrDecisionItem, function (state) {
|
|
326
325
|
return !shouldLetTabThroughInTable(state);
|
|
327
326
|
}], function (state, dispatch) {
|
|
328
327
|
return getIndentCommand(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
@@ -11,6 +11,7 @@ var _utils2 = require("@atlaskit/editor-common/utils");
|
|
|
11
11
|
var _selection = require("../../list/utils/selection");
|
|
12
12
|
var _helpers = require("../../tasks-and-decisions/pm-plugins/helpers");
|
|
13
13
|
var _commands = require("../../indentation/commands");
|
|
14
|
+
var _lists = require("@atlaskit/editor-common/lists");
|
|
14
15
|
var pluginKey = new _state.PluginKey('indentationButtonsPlugin');
|
|
15
16
|
exports.pluginKey = pluginKey;
|
|
16
17
|
function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation) {
|
|
@@ -27,7 +28,7 @@ function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndenta
|
|
|
27
28
|
// Check for lists before paragraphs and headings in case
|
|
28
29
|
// the selection is in a list nested in a layout column.
|
|
29
30
|
if ((0, _selection.isInsideListItem)(editorState)) {
|
|
30
|
-
var _getListItemAttribute = (0,
|
|
31
|
+
var _getListItemAttribute = (0, _lists.getListItemAttributes)(selection.$head),
|
|
31
32
|
indentLevel = _getListItemAttribute.indentLevel,
|
|
32
33
|
itemIndex = _getListItemAttribute.itemIndex;
|
|
33
34
|
return {
|
|
@@ -1,30 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.deleteEmptyParagraphAndMoveBlockUp = void 0;
|
|
8
6
|
exports.findCutBefore = findCutBefore;
|
|
9
|
-
exports.withScrollIntoView = exports.
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
|
+
exports.withScrollIntoView = exports.selectNode = exports.isNthParentOfType = exports.isFirstChildOfParent = void 0;
|
|
11
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
9
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
13
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
-
var isEmptySelectionAtStart = function isEmptySelectionAtStart(state) {
|
|
15
|
-
var _state$selection = state.selection,
|
|
16
|
-
empty = _state$selection.empty,
|
|
17
|
-
$from = _state$selection.$from;
|
|
18
|
-
return empty && ($from.parentOffset === 0 || state.selection instanceof _selection.GapCursorSelection);
|
|
19
|
-
};
|
|
20
|
-
exports.isEmptySelectionAtStart = isEmptySelectionAtStart;
|
|
21
|
-
var isEmptySelectionAtEnd = function isEmptySelectionAtEnd(state) {
|
|
22
|
-
var _state$selection2 = state.selection,
|
|
23
|
-
empty = _state$selection2.empty,
|
|
24
|
-
$from = _state$selection2.$from;
|
|
25
|
-
return empty && ($from.end() === $from.pos || state.selection instanceof _selection.GapCursorSelection);
|
|
26
|
-
};
|
|
27
|
-
exports.isEmptySelectionAtEnd = isEmptySelectionAtEnd;
|
|
28
10
|
var isFirstChildOfParent = function isFirstChildOfParent(state) {
|
|
29
11
|
var $from = state.selection.$from;
|
|
30
12
|
return $from.depth > 1 ? state.selection instanceof _selection.GapCursorSelection && $from.parentOffset === 0 || $from.index($from.depth - 1) === 0 : true;
|
|
@@ -81,46 +63,6 @@ var withScrollIntoView = function withScrollIntoView(command) {
|
|
|
81
63
|
}, view);
|
|
82
64
|
};
|
|
83
65
|
};
|
|
84
|
-
exports.withScrollIntoView = withScrollIntoView;
|
|
85
|
-
/**
|
|
86
|
-
* Walk forwards from a position until we encounter the (inside) start of
|
|
87
|
-
* the next node, or reach the end of the document.
|
|
88
|
-
*
|
|
89
|
-
* @param $startPos Position to start walking from.
|
|
90
|
-
*/
|
|
91
|
-
var walkNextNode = function walkNextNode($startPos) {
|
|
92
|
-
var $pos = $startPos;
|
|
93
|
-
|
|
94
|
-
// invariant 1: don't walk past the end of the document
|
|
95
|
-
// invariant 2: we are at the beginning or
|
|
96
|
-
// we haven't walked to the start of *any* node
|
|
97
|
-
// parentOffset includes textOffset.
|
|
98
|
-
while ($pos.pos < $pos.doc.nodeSize - 2 && ($pos.pos === $startPos.pos || $pos.parentOffset > 0)) {
|
|
99
|
-
$pos = $pos.doc.resolve($pos.pos + 1);
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
$pos: $pos,
|
|
103
|
-
foundNode: $pos.pos < $pos.doc.nodeSize - 2
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Walk backwards from a position until we encounter the (inside) end of
|
|
109
|
-
* the previous node, or reach the start of the document.
|
|
110
|
-
*
|
|
111
|
-
* @param $startPos Position to start walking from.
|
|
112
|
-
*/
|
|
113
|
-
exports.walkNextNode = walkNextNode;
|
|
114
|
-
var walkPrevNode = function walkPrevNode($startPos) {
|
|
115
|
-
var $pos = $startPos;
|
|
116
|
-
while ($pos.pos > 0 && ($pos.pos === $startPos.pos || $pos.parentOffset < $pos.parent.nodeSize - 2)) {
|
|
117
|
-
$pos = $pos.doc.resolve($pos.pos - 1);
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
$pos: $pos,
|
|
121
|
-
foundNode: $pos.pos > 0
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
66
|
|
|
125
67
|
/**
|
|
126
68
|
* Insert content, delete a range and create a new selection
|
|
@@ -131,23 +73,7 @@ var walkPrevNode = function walkPrevNode($startPos) {
|
|
|
131
73
|
* @param insertions content to insert at the specified position
|
|
132
74
|
* @param deletions the ranges to delete
|
|
133
75
|
*/
|
|
134
|
-
exports.
|
|
135
|
-
var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
|
|
136
|
-
insertions.forEach(function (contentInsert) {
|
|
137
|
-
var _contentInsert = (0, _slicedToArray2.default)(contentInsert, 2),
|
|
138
|
-
content = _contentInsert[0],
|
|
139
|
-
pos = _contentInsert[1];
|
|
140
|
-
tr.insert(tr.mapping.map(pos), content);
|
|
141
|
-
});
|
|
142
|
-
deletions.forEach(function (deleteRange) {
|
|
143
|
-
var _deleteRange = (0, _slicedToArray2.default)(deleteRange, 2),
|
|
144
|
-
firstPos = _deleteRange[0],
|
|
145
|
-
lastPos = _deleteRange[1];
|
|
146
|
-
tr.delete(tr.mapping.map(firstPos), tr.mapping.map(lastPos));
|
|
147
|
-
});
|
|
148
|
-
tr.setSelection(new _state.TextSelection(getSelectionResolvedPos(tr)));
|
|
149
|
-
};
|
|
150
|
-
exports.insertContentDeleteRange = insertContentDeleteRange;
|
|
76
|
+
exports.withScrollIntoView = withScrollIntoView;
|
|
151
77
|
var selectNode = function selectNode(pos) {
|
|
152
78
|
return function (state, dispatch) {
|
|
153
79
|
if (dispatch) {
|
|
@@ -156,36 +82,4 @@ var selectNode = function selectNode(pos) {
|
|
|
156
82
|
return true;
|
|
157
83
|
};
|
|
158
84
|
};
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* If the selection is empty, is inside a paragraph node and `canNextNodeMoveUp` is true then delete current paragraph
|
|
162
|
-
* and move the node below it up. The selection will be retained, to be placed in the moved node.
|
|
163
|
-
*
|
|
164
|
-
* @param canNextNodeMoveUp check if node directly after the selection is able to be brought up to selection
|
|
165
|
-
* @returns PM Command
|
|
166
|
-
*/
|
|
167
|
-
exports.selectNode = selectNode;
|
|
168
|
-
var deleteEmptyParagraphAndMoveBlockUp = function deleteEmptyParagraphAndMoveBlockUp(canNextNodeMoveUp) {
|
|
169
|
-
return function (state, dispatch, view) {
|
|
170
|
-
var _state$selection3 = state.selection,
|
|
171
|
-
_state$selection3$$fr = _state$selection3.$from,
|
|
172
|
-
pos = _state$selection3$$fr.pos,
|
|
173
|
-
parent = _state$selection3$$fr.parent,
|
|
174
|
-
$head = _state$selection3.$head,
|
|
175
|
-
empty = _state$selection3.empty,
|
|
176
|
-
tr = state.tr,
|
|
177
|
-
doc = state.doc;
|
|
178
|
-
var _walkNextNode = walkNextNode($head),
|
|
179
|
-
$pos = _walkNextNode.$pos;
|
|
180
|
-
var nextPMNode = doc.nodeAt($pos.pos - 1);
|
|
181
|
-
if (empty && nextPMNode && canNextNodeMoveUp(nextPMNode) && (0, _utils.isEmptyParagraph)(parent) && view !== null && view !== void 0 && view.endOfTextblock('right')) {
|
|
182
|
-
tr.deleteRange(pos - 1, pos + 1);
|
|
183
|
-
if (dispatch) {
|
|
184
|
-
dispatch(tr);
|
|
185
|
-
}
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
return false;
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
exports.deleteEmptyParagraphAndMoveBlockUp = deleteEmptyParagraphAndMoveBlockUp;
|
|
85
|
+
exports.selectNode = selectNode;
|
|
@@ -9,7 +9,6 @@ exports.getChangedNodes = getChangedNodes;
|
|
|
9
9
|
exports.getChangedNodesIn = getChangedNodesIn;
|
|
10
10
|
exports.getChildBreakoutModes = getChildBreakoutModes;
|
|
11
11
|
exports.getNodesCount = getNodesCount;
|
|
12
|
-
exports.hasVisibleContent = hasVisibleContent;
|
|
13
12
|
exports.isInEmptyLine = isInEmptyLine;
|
|
14
13
|
exports.isNodeEmpty = isNodeEmpty;
|
|
15
14
|
exports.isSelectionEndOfParagraph = void 0;
|
|
@@ -17,32 +16,8 @@ exports.nodesBetweenChanged = nodesBetweenChanged;
|
|
|
17
16
|
exports.processRawFragmentValue = processRawFragmentValue;
|
|
18
17
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
18
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
19
|
var _nodeWidth = require("./node-width");
|
|
22
|
-
|
|
23
|
-
* Returns false if node contains only empty inline nodes and hardBreaks.
|
|
24
|
-
*/
|
|
25
|
-
function hasVisibleContent(node) {
|
|
26
|
-
var isInlineNodeHasVisibleContent = function isInlineNodeHasVisibleContent(inlineNode) {
|
|
27
|
-
return inlineNode.isText ? !!inlineNode.textContent.trim() : inlineNode.type.name !== 'hardBreak';
|
|
28
|
-
};
|
|
29
|
-
if (node.isInline) {
|
|
30
|
-
return isInlineNodeHasVisibleContent(node);
|
|
31
|
-
} else if (node.isBlock && (node.isLeaf || node.isAtom)) {
|
|
32
|
-
return true;
|
|
33
|
-
} else if (!node.childCount) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
for (var _index = 0; _index < node.childCount; _index++) {
|
|
37
|
-
var child = node.child(_index);
|
|
38
|
-
var invisibleNodeTypes = ['paragraph', 'text', 'hardBreak'];
|
|
39
|
-
if (!invisibleNodeTypes.includes(child.type.name) || hasVisibleContent(child)) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
20
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
46
21
|
/**
|
|
47
22
|
* Checks if a node has any content. Ignores node that only contain empty block nodes.
|
|
48
23
|
*/
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -30,12 +30,6 @@ Object.defineProperty(exports, "getNodesCount", {
|
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
exports.hasOpenEnd = void 0;
|
|
33
|
-
Object.defineProperty(exports, "hasVisibleContent", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function get() {
|
|
36
|
-
return _document.hasVisibleContent;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
33
|
Object.defineProperty(exports, "insideTable", {
|
|
40
34
|
enumerable: true,
|
|
41
35
|
get: function get() {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = "@atlaskit/editor-core";
|
|
8
8
|
exports.name = name;
|
|
9
|
-
var version = "187.8.
|
|
9
|
+
var version = "187.8.10";
|
|
10
10
|
exports.version = version;
|
|
11
11
|
var nextMajorVersion = function nextMajorVersion() {
|
|
12
12
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { INPUT_METHOD, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } f
|
|
|
42
42
|
export { setKeyboardHeight, setMobilePaddingTop, setIsExpanded } from './plugins/mobile-dimensions/commands';
|
|
43
43
|
|
|
44
44
|
// Used in editor-test-helpers and mobile bridge
|
|
45
|
-
export { setTextSelection, dedupe, getNodesCount, measurements
|
|
45
|
+
export { setTextSelection, dedupe, getNodesCount, measurements } from './utils';
|
|
46
46
|
export { getListCommands } from './utils/list-commands';
|
|
47
47
|
export { ReactEditorView, BaseReactEditorView } from './create-editor';
|
|
48
48
|
export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import {
|
|
4
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { isSelectionEndOfParagraph } from '../../../utils';
|
|
6
6
|
export const newlinePreserveMarksKey = new PluginKey('newlinePreserveMarksPlugin');
|
|
7
7
|
const isSelectionAligned = state => !!state.selection.$to.parent.marks.find(m => m.type === state.schema.marks.alignment);
|
|
@@ -5,7 +5,7 @@ import * as commands from '../../../commands';
|
|
|
5
5
|
import * as blockTypes from '../types';
|
|
6
6
|
import { keymap } from '../../../utils/keymap';
|
|
7
7
|
import { cleanUpAtTheStartOfDocument, deleteAndMoveCursor, deleteBlockContent, insertBlockTypesWithAnalytics } from '../commands';
|
|
8
|
-
import { deleteEmptyParagraphAndMoveBlockUp } from '
|
|
8
|
+
import { deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { INPUT_METHOD } from '../../analytics';
|
|
10
10
|
import { isNodeAWrappingBlockNode } from '../utils';
|
|
11
11
|
const backspace = chainCommands(cleanUpAtTheStartOfDocument, deleteBlockContent(isNodeAWrappingBlockNode), deleteAndMoveCursor);
|
|
@@ -3,7 +3,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
4
|
import { setTextSelection } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { getCursor } from '../../../utils';
|
|
6
|
-
import {
|
|
6
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isCursorBeforeClosingCharacter, isClosingCharacter } from '../ide-ux/paired-character-handling';
|
|
8
8
|
import { getAutoClosingBracketInfo, shouldAutoCloseBracket } from '../ide-ux/bracket-handling';
|
|
9
9
|
import { getAutoClosingQuoteInfo, shouldAutoCloseQuote } from '../ide-ux/quote-handling';
|
|
@@ -3,7 +3,7 @@ import { TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
import {
|
|
6
|
+
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { createSelectionClickHandler } from '../../selection/utils';
|
|
8
8
|
import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from '../actions';
|
|
9
9
|
import { pluginKey } from './plugin-key';
|
|
@@ -2,8 +2,8 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { findWrapping } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isEmptyParagraph, isListNode } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { joinSiblingLists } from '@atlaskit/editor-common/lists';
|
|
7
7
|
import { findFirstParentListNode } from '../utils/find';
|
|
8
8
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
9
9
|
export function convertListType({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
4
4
|
import { findFirstParentListItemNode } from '../utils/find';
|
|
5
|
-
import {
|
|
5
|
+
import { isListItemNode, isListNode } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
7
7
|
export const indentListItemsSelected = tr => {
|
|
8
8
|
const originalSelection = tr.selection;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LIST_TEXT_SCENARIOS } from '../../analytics';
|
|
2
|
-
import { isParagraphNode, isListNode, isListItemNode } from '
|
|
2
|
+
import { isParagraphNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
4
4
|
import { joinParagrapWithList, joinSiblingListItems, joinNestedListWithParentListItem, joinListItemWithParentNestedList, joinListItemWithParagraph } from './join-list-items-scenarios';
|
|
5
5
|
export const calcJoinListScenario = (walkNode, $head) => {
|
package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-list-item-with-paragraph.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange, isListNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import { isListNode } from '../../utils/node';
|
|
4
3
|
// Case for when a users selection is at the end of a paragraph, the paragraph
|
|
5
4
|
// is followed by a list, and they delete forward
|
|
6
5
|
export const joinListItemWithParagraph = ({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of greater indentation
|
|
4
4
|
export const joinListItemWithParentNestedList = ({
|
|
5
5
|
tr,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
2
|
-
import { isListNode } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
3
3
|
//Case for two adjacent list items with the first being of lower indentation
|
|
4
4
|
export const joinNestedListWithParentListItem = ({
|
|
5
5
|
tr,
|
package/dist/es2019/plugins/list/actions/join-list-items-scenarios/join-paragraph-with-list.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { insertContentDeleteRange } from '
|
|
1
|
+
import { insertContentDeleteRange } from '@atlaskit/editor-common/utils';
|
|
2
2
|
//Case for two adjacent nodes with the first being a list item and the last being a paragraph
|
|
3
3
|
export const joinParagrapWithList = ({
|
|
4
4
|
tr,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Selection, TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { NodeRange, Slice, Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { liftTarget, ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
|
-
import { getOrderFromOrderedListNode } from '@atlaskit/editor-common/utils';
|
|
5
|
-
import {
|
|
4
|
+
import { getOrderFromOrderedListNode, isListNode, isListItemNode } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { joinSiblingLists, JoinDirection, normalizeListItemsSelection } from '@atlaskit/editor-common/lists';
|
|
6
6
|
import { findFirstParentListItemNode, findRootParentListNode } from '../utils/find';
|
|
7
|
-
import {
|
|
7
|
+
import { createListNodeRange } from '../utils/selection';
|
|
8
8
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
9
9
|
import { storeRestartListsAttributes, getRestartListsAttributes } from '../utils/analytics';
|
|
10
10
|
import { OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, Slice, NodeRange } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { ReplaceAroundStep, findWrapping, canSplit } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import { autoJoinTr } from '
|
|
3
|
+
import { autoJoinTr } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
5
5
|
import { isWrappingPossible } from '../utils/selection';
|
|
6
6
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import { hasValidListIndentationLevel } from '
|
|
2
|
+
import { hasValidListIndentationLevel, getListItemAttributes, getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
3
3
|
import { indentListItemsSelected as indentListAction } from '../actions/indent-list-items-selected';
|
|
4
|
-
import { isBulletList } from '
|
|
4
|
+
import { isBulletList } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { findFirstParentListNode } from '../utils/find';
|
|
6
6
|
import { MAX_NESTED_LIST_INDENTATION } from '../types';
|
|
7
|
-
import { isInsideListItem, isInsideTableCell
|
|
8
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
7
|
+
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
9
8
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
10
9
|
export const indentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => {
|
|
11
10
|
return function (state, dispatch) {
|
|
@@ -2,22 +2,21 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import * as baseCommand from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { findPositionOfNodeBefore, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
|
-
import { hasVisibleContent } from '
|
|
6
|
-
import {
|
|
7
|
-
import { filterCommands as filter } from '@atlaskit/editor-common/utils';
|
|
5
|
+
import { filterCommand as filter, hasVisibleContent, isEmptySelectionAtStart } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { isFirstChildOfParent, findCutBefore } from '../../../utils/commands';
|
|
8
7
|
import { sanitiseMarksInSelection } from '../../../utils';
|
|
8
|
+
import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
9
9
|
import { liftFollowingList, liftTextSelectionList, liftNodeSelectionList } from '../transforms';
|
|
10
10
|
import { GapCursorSelection } from '../../selection/gap-cursor-selection';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { isInsideListItem, canJoinToPreviousListItem, selectionContainsList } from '../utils/selection';
|
|
13
|
-
import { getCommonListAnalyticsAttributes } from '../utils/analytics';
|
|
14
13
|
import { listBackspace } from './listBackspace';
|
|
15
14
|
import { joinListItemForward } from './join-list-item-forward';
|
|
16
15
|
import { convertListType } from '../actions/conversions';
|
|
17
16
|
import { wrapInListAndJoin } from '../actions/wrap-and-join-lists';
|
|
18
17
|
import { outdentList } from './outdent-list';
|
|
19
18
|
import { indentList } from './indent-list';
|
|
20
|
-
import { moveTargetIntoList } from '
|
|
19
|
+
import { moveTargetIntoList } from '@atlaskit/editor-common/lists';
|
|
21
20
|
export { outdentList, indentList };
|
|
22
21
|
export const enterKeyCommand = editorAnalyticsAPI => featureFlags => (state, dispatch) => {
|
|
23
22
|
const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEmptySelectionAtEnd, walkNextNode } from '
|
|
1
|
+
import { isEmptySelectionAtEnd, walkNextNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import { calcJoinListScenario } from '../actions/join-list-items-forward';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode } from '
|
|
1
|
+
import { insertContentDeleteRange, isEmptySelectionAtStart, walkPrevNode, isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, DELETE_DIRECTION, LIST_TEXT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
|
-
import { isListNode, isParagraphNode } from '@atlaskit/editor-common/utils';
|
|
5
4
|
import { isPosInsideList, isPosInsideParagraph } from '../utils/selection';
|
|
6
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
|
|
7
6
|
//Case for two adjacent list items of the same indentation
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { getCommonListAnalyticsAttributes } from '@atlaskit/editor-common/lists';
|
|
1
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, OUTDENT_SCENARIOS } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { isInsideListItem, isInsideTableCell } from '../utils/selection';
|
|
3
|
-
import { isBulletList } from '
|
|
4
|
+
import { isBulletList } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { findFirstParentListNode } from '../utils/find';
|
|
5
|
-
import {
|
|
6
|
+
import { getRestartListsAttributes } from '../utils/analytics';
|
|
6
7
|
import { outdentListItemsSelected as outdentListAction } from '../actions/outdent-list-items-selected';
|
|
7
8
|
import { closeHistory } from '@atlaskit/editor-prosemirror/history';
|
|
8
9
|
export const outdentList = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD, featureFlags) => {
|
|
@@ -3,7 +3,7 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import { isWrappingPossible } from '../utils/selection';
|
|
6
|
-
import { isListNode } from '
|
|
6
|
+
import { isListNode } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
8
8
|
import { setGapCursorSelection } from '../../../utils';
|
|
9
9
|
import { Side } from '@atlaskit/editor-common/selection';
|