@titaui/pc 1.10.41 → 1.10.43

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.
Files changed (104) hide show
  1. package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +18 -3
  2. package/lib/components/upload/index.js +2 -4
  3. package/lib/index.js +0 -8
  4. package/package.json +2 -20
  5. package/lib/components/rich-editor/basic/schema.js +0 -47
  6. package/lib/components/rich-editor/consts/events.js +0 -12
  7. package/lib/components/rich-editor/enums.js +0 -42
  8. package/lib/components/rich-editor/index.js +0 -58
  9. package/lib/components/rich-editor/keymap.js +0 -119
  10. package/lib/components/rich-editor/keymaps/index.js +0 -241
  11. package/lib/components/rich-editor/models/controller.js +0 -18
  12. package/lib/components/rich-editor/models/editor.js +0 -47
  13. package/lib/components/rich-editor/models/plugin.js +0 -20
  14. package/lib/components/rich-editor/models/schema.js +0 -121
  15. package/lib/components/rich-editor/plugins/block/block-quote/commond.js +0 -27
  16. package/lib/components/rich-editor/plugins/block/block-quote/index.js +0 -126
  17. package/lib/components/rich-editor/plugins/block/heading/commonds.js +0 -31
  18. package/lib/components/rich-editor/plugins/block/heading/index.js +0 -188
  19. package/lib/components/rich-editor/plugins/block/index.js +0 -57
  20. package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +0 -172
  21. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +0 -163
  22. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +0 -59
  23. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +0 -74
  24. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +0 -45
  25. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -104
  26. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -92
  27. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -89
  28. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -48
  29. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -61
  30. package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +0 -34
  31. package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +0 -289
  32. package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +0 -180
  33. package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +0 -328
  34. package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +0 -60
  35. package/lib/components/rich-editor/plugins/block/lists/commond/index.js +0 -396
  36. package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +0 -45
  37. package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +0 -302
  38. package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +0 -43
  39. package/lib/components/rich-editor/plugins/block/lists/index.js +0 -222
  40. package/lib/components/rich-editor/plugins/block/lists/messages.js +0 -38
  41. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +0 -152
  42. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +0 -33
  43. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +0 -94
  44. package/lib/components/rich-editor/plugins/block/lists/styles.js +0 -15
  45. package/lib/components/rich-editor/plugins/block/lists/transforms.js +0 -347
  46. package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +0 -48
  47. package/lib/components/rich-editor/plugins/block/lists/utils/find.js +0 -126
  48. package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +0 -87
  49. package/lib/components/rich-editor/plugins/block/lists/utils/node.js +0 -144
  50. package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +0 -31
  51. package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +0 -201
  52. package/lib/components/rich-editor/plugins/block/lists/utils.js +0 -52
  53. package/lib/components/rich-editor/plugins/block/paragraph/index.js +0 -91
  54. package/lib/components/rich-editor/plugins/core/index.js +0 -90
  55. package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +0 -67
  56. package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +0 -29
  57. package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +0 -80
  58. package/lib/components/rich-editor/plugins/extension/alignment/commond.js +0 -24
  59. package/lib/components/rich-editor/plugins/extension/alignment/index.js +0 -111
  60. package/lib/components/rich-editor/plugins/extension/alignment/utils.js +0 -19
  61. package/lib/components/rich-editor/plugins/extension/index.js +0 -18
  62. package/lib/components/rich-editor/plugins/index.js +0 -44
  63. package/lib/components/rich-editor/plugins/inline/color/commond.js +0 -128
  64. package/lib/components/rich-editor/plugins/inline/color/consts.js +0 -43
  65. package/lib/components/rich-editor/plugins/inline/color/index.css +0 -61
  66. package/lib/components/rich-editor/plugins/inline/color/index.js +0 -209
  67. package/lib/components/rich-editor/plugins/inline/color/selector.js +0 -250
  68. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +0 -147
  69. package/lib/components/rich-editor/plugins/inline/em/index.js +0 -93
  70. package/lib/components/rich-editor/plugins/inline/index.js +0 -83
  71. package/lib/components/rich-editor/plugins/inline/link/commands.js +0 -256
  72. package/lib/components/rich-editor/plugins/inline/link/index.js +0 -149
  73. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +0 -77
  74. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +0 -293
  75. package/lib/components/rich-editor/plugins/inline/link/ui/index.css +0 -79
  76. package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +0 -148
  77. package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +0 -88
  78. package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +0 -117
  79. package/lib/components/rich-editor/plugins/inline/link/utils.js +0 -33
  80. package/lib/components/rich-editor/plugins/inline/strong/index.js +0 -137
  81. package/lib/components/rich-editor/plugins/inline/under-line/index.js +0 -145
  82. package/lib/components/rich-editor/plugins/util.js +0 -281
  83. package/lib/components/rich-editor/react/reactNodeView.js +0 -383
  84. package/lib/components/rich-editor/react/uiProvider.js +0 -185
  85. package/lib/components/rich-editor/schemas/basic.js +0 -309
  86. package/lib/components/rich-editor/schemas/index.js +0 -19
  87. package/lib/components/rich-editor/schemas/list.js +0 -342
  88. package/lib/components/rich-editor/types/commond.js +0 -5
  89. package/lib/components/rich-editor/types/index.js +0 -18
  90. package/lib/components/rich-editor/ui/Popup/index.js +0 -247
  91. package/lib/components/rich-editor/ui/Popup/utils.js +0 -399
  92. package/lib/components/rich-editor/ui/editor/index.css +0 -144
  93. package/lib/components/rich-editor/ui/editor/index.js +0 -143
  94. package/lib/components/rich-editor/ui/normal-toolbar/index.css +0 -29
  95. package/lib/components/rich-editor/ui/normal-toolbar/index.js +0 -109
  96. package/lib/components/rich-editor/utils/browser.js +0 -35
  97. package/lib/components/rich-editor/utils/commands.js +0 -266
  98. package/lib/components/rich-editor/utils/document.js +0 -160
  99. package/lib/components/rich-editor/utils/event.js +0 -79
  100. package/lib/components/rich-editor/utils/helpers.js +0 -16
  101. package/lib/components/rich-editor/utils/mark.js +0 -168
  102. package/lib/components/rich-editor/utils/slice.js +0 -85
  103. package/lib/components/rich-editor/utils/toolbar.js +0 -228
  104. package/yarn-error.log +0 -22184
@@ -1,396 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.enterKeyCommand = exports.deleteKeyCommand = exports.backspaceKeyCommand = void 0;
9
- Object.defineProperty(exports, "indentList", {
10
- enumerable: true,
11
- get: function get() {
12
- return _indentList.indentList;
13
- }
14
- });
15
- exports.insertContentDeleteRange = void 0;
16
- Object.defineProperty(exports, "outdentList", {
17
- enumerable: true,
18
- get: function get() {
19
- return _outdentList.outdentList;
20
- }
21
- });
22
- exports.rootListDepth = void 0;
23
- exports.toggleBulletList = toggleBulletList;
24
- exports.toggleList = toggleList;
25
- exports.toggleOrderedList = toggleOrderedList;
26
-
27
- var _prosemirrorModel = require("prosemirror-model");
28
-
29
- var _prosemirrorState = require("prosemirror-state");
30
-
31
- var baseCommand = _interopRequireWildcard(require("prosemirror-commands"));
32
-
33
- var _prosemirrorUtils = require("prosemirror-utils");
34
-
35
- var _document = require("../../../../utils/document");
36
-
37
- var _commands = require("../../../../utils/commands");
38
-
39
- var _mark = require("../../../../utils/mark");
40
-
41
- var _transforms = require("../transforms");
42
-
43
- var _selection = require("../utils/selection");
44
-
45
- var _listBackspace = require("./listBackspace");
46
-
47
- var _joinListItemForward = require("./join-list-item-forward");
48
-
49
- var _conversions = require("../actions/conversions");
50
-
51
- var _wrapAndJoinLists = require("../actions/wrap-and-join-lists");
52
-
53
- var _outdentList = require("./outdent-list");
54
-
55
- var _indentList = require("./indent-list");
56
-
57
- var _replaceContent = require("../utils/replace-content");
58
-
59
- 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); }
60
-
61
- 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; }
62
-
63
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
64
-
65
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
66
-
67
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
68
-
69
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
70
-
71
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
72
-
73
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
74
-
75
- // export type InputMethod = INPUT_METHOD.KEYBOARD | INPUT_METHOD.TOOLBAR;
76
-
77
- /**
78
- * Implementation taken and modified for our needs from PM
79
- * @param itemType Node
80
- * Splits the list items, specific implementation take from PM
81
- */
82
- function splitListItem(itemType) {
83
- return function (state, dispatch) {
84
- var ref = state.selection;
85
- var $from = ref.$from;
86
- var $to = ref.$to;
87
- var node = ref.node;
88
-
89
- if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
90
- return false;
91
- }
92
-
93
- var grandParent = $from.node(-1);
94
-
95
- if (grandParent.type !== itemType) {
96
- return false;
97
- }
98
- /** --> The following line changed from the original PM implementation to allow list additions with multiple paragraphs */
99
-
100
-
101
- if (grandParent.content.content.length <= 1 && $from.parent.content.size === 0 && !(grandParent.content.size === 0)) {
102
- // In an empty block. If this is a nested list, the wrapping
103
- // list item should be split. Otherwise, bail out and let next
104
- // command handle lifting.
105
- if ($from.depth === 2 || $from.node(-3).type !== itemType || $from.index(-2) !== $from.node(-2).childCount - 1) {
106
- return false;
107
- }
108
-
109
- if (dispatch) {
110
- var wrap = _prosemirrorModel.Fragment.empty;
111
- var keepItem = $from.index(-1) > 0; // Build a fragment containing empty versions of the structure
112
- // from the outer list item to the parent node of the cursor
113
-
114
- for (var d = $from.depth - (keepItem ? 1 : 2); d >= $from.depth - 3; d -= 1) {
115
- wrap = _prosemirrorModel.Fragment.from($from.node(d).copy(wrap));
116
- } // Add a second list item with an empty default start node
117
-
118
-
119
- wrap = wrap.append(_prosemirrorModel.Fragment.from(itemType.createAndFill()));
120
- var tr$1 = state.tr.replace($from.before(keepItem ? undefined : -1), $from.after(-3), new _prosemirrorModel.Slice(wrap, keepItem ? 3 : 2, 2));
121
- tr$1.setSelection(state.selection.constructor.near(tr$1.doc.resolve($from.pos + (keepItem ? 3 : 2))));
122
- dispatch(tr$1.scrollIntoView());
123
- }
124
-
125
- return true;
126
- }
127
-
128
- var nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : undefined;
129
- var tr = state.tr["delete"]($from.pos, $to.pos);
130
- var types = nextType && [undefined, {
131
- type: nextType
132
- }];
133
-
134
- if (dispatch) {
135
- dispatch(tr.split($from.pos, 2, types).scrollIntoView());
136
- }
137
-
138
- return true;
139
- };
140
- }
141
-
142
- var deletePreviousEmptyListItem = function deletePreviousEmptyListItem(state, dispatch) {
143
- var $from = state.selection.$from;
144
- var listItem = state.schema.nodes.listItem;
145
- var $cut = (0, _commands.findCutBefore)($from);
146
-
147
- if (!$cut || !$cut.nodeBefore || !($cut.nodeBefore.type === listItem)) {
148
- return false;
149
- }
150
-
151
- var previousListItemEmpty = $cut.nodeBefore.childCount === 1 && $cut.nodeBefore.firstChild.nodeSize <= 2;
152
-
153
- if (previousListItemEmpty) {
154
- var tr = state.tr;
155
-
156
- if (dispatch) {
157
- dispatch(tr["delete"]($cut.pos - $cut.nodeBefore.nodeSize, $from.pos).scrollIntoView());
158
- }
159
-
160
- return true;
161
- }
162
-
163
- return false;
164
- };
165
-
166
- var enterKeyCommand = function enterKeyCommand(state, dispatch) {
167
- var selection = state.selection;
168
-
169
- if (selection.empty) {
170
- var $from = selection.$from;
171
- var _state$schema$nodes = state.schema.nodes,
172
- listItem = _state$schema$nodes.listItem,
173
- codeBlock = _state$schema$nodes.codeBlock;
174
- var node = $from.node($from.depth);
175
- var wrapper = $from.node($from.depth - 1);
176
-
177
- if (wrapper && wrapper.type === listItem) {
178
- /** Check if the wrapper has any visible content */
179
- var wrapperHasContent = (0, _document.hasVisibleContent)(wrapper);
180
-
181
- if ((0, _document.isNodeEmpty)(node) && !wrapperHasContent) {
182
- return (0, _outdentList.outdentList)()(state, dispatch);
183
- }
184
-
185
- if (!(0, _prosemirrorUtils.hasParentNodeOfType)(codeBlock)(selection)) {
186
- return splitListItem(listItem)(state, dispatch);
187
- }
188
- }
189
- }
190
-
191
- return false;
192
- };
193
-
194
- exports.enterKeyCommand = enterKeyCommand;
195
-
196
- var joinToPreviousListItem = function joinToPreviousListItem(state, dispatch) {
197
- var $from = state.selection.$from;
198
- var _state$schema$nodes2 = state.schema.nodes,
199
- paragraph = _state$schema$nodes2.paragraph,
200
- codeBlock = _state$schema$nodes2.codeBlock,
201
- bulletList = _state$schema$nodes2.bulletList,
202
- orderedList = _state$schema$nodes2.orderedList; // const isGapCursorShown = state.selection instanceof GapCursorSelection;
203
-
204
- var $cutPos =
205
- /* isGapCursorShown ? state.doc.resolve($from.pos + 1) : */
206
- $from;
207
- var $cut = (0, _commands.findCutBefore)($cutPos);
208
-
209
- if (!$cut) {
210
- return false;
211
- } // see if the containing node is a list
212
-
213
-
214
- if ($cut.nodeBefore && [bulletList, orderedList].indexOf($cut.nodeBefore.type) > -1) {
215
- // and the node after this is a paragraph or a codeBlock
216
- if ($cut.nodeAfter && ($cut.nodeAfter.type === paragraph || $cut.nodeAfter.type === codeBlock)) {
217
- // find the nearest paragraph that precedes this node
218
- var $lastNode = $cut.doc.resolve($cut.pos - 1);
219
-
220
- while ($lastNode.parent.type !== paragraph) {
221
- $lastNode = state.doc.resolve($lastNode.pos - 1);
222
- }
223
-
224
- var tr = state.tr; // if (isGapCursorShown) {
225
- // const nodeBeforePos = findPositionOfNodeBefore(tr.selection);
226
- // if (typeof nodeBeforePos !== 'number') {
227
- // return false;
228
- // }
229
- // // append the codeblock to the list node
230
- // const list = $cut.nodeBefore.copy(
231
- // $cut.nodeBefore.content.append(
232
- // Fragment.from(listItem.createChecked({}, $cut.nodeAfter)),
233
- // ),
234
- // );
235
- // tr.replaceWith(
236
- // nodeBeforePos,
237
- // $from.pos + $cut.nodeAfter.nodeSize,
238
- // list,
239
- // );
240
- // } else {
241
-
242
- var step = (0, _replaceContent.moveTargetIntoList)({
243
- insertPosition: $lastNode.pos,
244
- $target: $cut
245
- }); // ED-13966: check if the step will cause an ProseMirror error
246
- // if there's an error don't apply the step as it will might lead into a data loss.
247
- // It doesn't play well with media being a leaf node.
248
-
249
- var stepResult = state.tr.maybeStep(step);
250
-
251
- if (stepResult.failed) {
252
- return false;
253
- }
254
-
255
- tr = state.tr.step(step); // }
256
- // find out if there's now another list following and join them
257
- // as in, [list, p, list] => [list with p, list], and we want [joined list]
258
-
259
- var $postCut = tr.doc.resolve(tr.mapping.map($cut.pos + $cut.nodeAfter.nodeSize));
260
-
261
- if ($postCut.nodeBefore && $postCut.nodeAfter && $postCut.nodeBefore.type === $postCut.nodeAfter.type && [bulletList, orderedList].indexOf($postCut.nodeBefore.type) > -1) {
262
- tr = tr.join($postCut.pos);
263
- }
264
-
265
- if (dispatch) {
266
- dispatch(tr.scrollIntoView());
267
- }
268
-
269
- return true;
270
- }
271
- }
272
-
273
- return false;
274
- };
275
-
276
- var backspaceKeyCommand = function backspaceKeyCommand(state, dispatch) {
277
- return baseCommand.chainCommands(_listBackspace.listBackspace, // if we're at the start of a list item, we need to either backspace
278
- // directly to an empty list item above, or outdent this node
279
- (0, _commands.filter)([_commands.isEmptySelectionAtStart, // list items might have multiple paragraphs; only do this at the first one
280
- _commands.isFirstChildOfParent, _selection.isInsideListItem], baseCommand.chainCommands(deletePreviousEmptyListItem, (0, _outdentList.outdentList)())), // if we're just inside a paragraph node (or gapcursor is shown) and backspace, then try to join
281
- // the text to the previous list item, if one exists
282
- (0, _commands.filter)([function (state) {
283
- return state.selection.empty;
284
- }, _selection.canJoinToPreviousListItem], joinToPreviousListItem))(state, dispatch);
285
- };
286
-
287
- exports.backspaceKeyCommand = backspaceKeyCommand;
288
- var deleteKeyCommand = _joinListItemForward.joinListItemForward; // Get the depth of the nearest ancestor list
289
-
290
- exports.deleteKeyCommand = deleteKeyCommand;
291
-
292
- var rootListDepth = function rootListDepth(pos, nodes) {
293
- var bulletList = nodes.bulletList,
294
- orderedList = nodes.orderedList,
295
- listItem = nodes.listItem;
296
- var depth;
297
-
298
- for (var i = pos.depth - 1; i > 0; i -= 1) {
299
- var node = pos.node(i);
300
-
301
- if (node.type === bulletList || node.type === orderedList) {
302
- depth = i;
303
- }
304
-
305
- if (node.type !== bulletList && node.type !== orderedList && node.type !== listItem) {
306
- break;
307
- }
308
- }
309
-
310
- return depth;
311
- };
312
-
313
- exports.rootListDepth = rootListDepth;
314
-
315
- function untoggleSelectedList(tr) {
316
- var selection = tr.selection;
317
- var depth = rootListDepth(selection.$to, tr.doc.type.schema.nodes);
318
- var newtr = (0, _transforms.liftFollowingList)(selection.$to.pos, selection.$to.end(depth), depth || 0, tr);
319
- newtr = (0, _transforms.liftSelectionList)(selection, tr);
320
- return newtr;
321
- }
322
-
323
- function toggleList(listType) {
324
- return function (state, dispatch) {
325
- var tr = state.tr;
326
- var listInsideSelection = (0, _selection.selectionContainsList)(tr);
327
- var listNodeType = state.schema.nodes[listType];
328
-
329
- if (listInsideSelection) {
330
- var selection = state.selection;
331
- var fromNode = selection.$from.node(selection.$from.depth - 2);
332
- var toNode = selection.$to.node(selection.$to.depth - 2);
333
-
334
- if ((fromNode === null || fromNode === void 0 ? void 0 : fromNode.type.name) === listType && (toNode === null || toNode === void 0 ? void 0 : toNode.type.name) === listType) {
335
- var _tr = state.tr;
336
- _tr = untoggleSelectedList(_tr);
337
-
338
- if (dispatch) {
339
- dispatch(_tr);
340
- }
341
-
342
- return true;
343
- }
344
-
345
- (0, _conversions.convertListType)({
346
- tr: tr,
347
- nextListNodeType: listNodeType
348
- });
349
- } else {
350
- // Need to have this before wrapInList so the wrapping is done with valid content
351
- // For example, if trying to convert centre or right aligned paragraphs to lists
352
- (0, _mark.sanitiseMarksInSelection)(tr, listNodeType);
353
- (0, _wrapAndJoinLists.wrapInListAndJoin)(listNodeType, tr);
354
- } // If document wasn't changed, return false from the command to indicate that the
355
- // editing action failed
356
-
357
-
358
- if (!tr.docChanged) {
359
- return false;
360
- }
361
-
362
- if (dispatch) {
363
- dispatch(tr);
364
- }
365
-
366
- return true;
367
- };
368
- }
369
-
370
- function toggleBulletList(view) {
371
- return toggleList("bulletList")(view.state, view.dispatch);
372
- }
373
-
374
- function toggleOrderedList(view) {
375
- return toggleList("orderedList")(view.state, view.dispatch);
376
- }
377
-
378
- var insertContentDeleteRange = function insertContentDeleteRange(tr, getSelectionResolvedPos, insertions, deletions) {
379
- insertions.forEach(function (contentInsert) {
380
- var _contentInsert = _slicedToArray(contentInsert, 2),
381
- content = _contentInsert[0],
382
- pos = _contentInsert[1];
383
-
384
- tr.insert(tr.mapping.map(pos), content);
385
- });
386
- deletions.forEach(function (deleteRange) {
387
- var _deleteRange = _slicedToArray(deleteRange, 2),
388
- firstPos = _deleteRange[0],
389
- lastPos = _deleteRange[1];
390
-
391
- tr["delete"](tr.mapping.map(firstPos), tr.mapping.map(lastPos));
392
- });
393
- tr.setSelection(new _prosemirrorState.TextSelection(getSelectionResolvedPos(tr)));
394
- };
395
-
396
- exports.insertContentDeleteRange = insertContentDeleteRange;
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.joinListItemForward = void 0;
7
-
8
- var _commands = require("../../../../utils/commands");
9
-
10
- var _joinListItemsForward = require("../actions/join-list-items-forward");
11
-
12
- var joinListItemForward = function joinListItemForward(state, dispatch) {
13
- var tr = state.tr,
14
- $head = state.selection.$head;
15
- var walkNode = (0, _commands.walkNextNode)($head);
16
-
17
- if (!(0, _commands.isEmptySelectionAtEnd)(state)) {
18
- return false;
19
- }
20
-
21
- var scenarios = (0, _joinListItemsForward.calcJoinListScenario)(walkNode, $head);
22
-
23
- if (!scenarios) {
24
- return false;
25
- }
26
-
27
- var action = scenarios;
28
- var result = action({
29
- tr: tr,
30
- $next: walkNode.$pos,
31
- $head: $head
32
- });
33
-
34
- if (!result) {
35
- return false;
36
- }
37
-
38
- if (dispatch) {
39
- dispatch(tr);
40
- }
41
-
42
- return true;
43
- };
44
-
45
- exports.joinListItemForward = joinListItemForward;