@titaui/pc 1.10.40 → 1.10.44-beta.1

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 (107) hide show
  1. package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +18 -3
  2. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-project.js +5 -1
  3. package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/index.css +19 -1
  4. package/lib/components/superset-charts/utils/axios.js +2 -2
  5. package/lib/components/upload/index.js +2 -4
  6. package/lib/index.js +0 -8
  7. package/package.json +2 -20
  8. package/lib/components/rich-editor/basic/schema.js +0 -47
  9. package/lib/components/rich-editor/consts/events.js +0 -12
  10. package/lib/components/rich-editor/enums.js +0 -42
  11. package/lib/components/rich-editor/index.js +0 -58
  12. package/lib/components/rich-editor/keymap.js +0 -119
  13. package/lib/components/rich-editor/keymaps/index.js +0 -241
  14. package/lib/components/rich-editor/models/controller.js +0 -18
  15. package/lib/components/rich-editor/models/editor.js +0 -47
  16. package/lib/components/rich-editor/models/plugin.js +0 -20
  17. package/lib/components/rich-editor/models/schema.js +0 -121
  18. package/lib/components/rich-editor/plugins/block/block-quote/commond.js +0 -27
  19. package/lib/components/rich-editor/plugins/block/block-quote/index.js +0 -126
  20. package/lib/components/rich-editor/plugins/block/heading/commonds.js +0 -31
  21. package/lib/components/rich-editor/plugins/block/heading/index.js +0 -188
  22. package/lib/components/rich-editor/plugins/block/index.js +0 -57
  23. package/lib/components/rich-editor/plugins/block/lists/actions/conversions.js +0 -172
  24. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list-items-selected.js +0 -163
  25. package/lib/components/rich-editor/plugins/block/lists/actions/indent-list.js +0 -59
  26. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-forward.js +0 -74
  27. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/index.js +0 -45
  28. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-paragraph.js +0 -104
  29. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-list-item-with-parent-nested-list.js +0 -92
  30. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-nested-list-with-parent-list-item.js +0 -89
  31. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-paragraph-with-list.js +0 -48
  32. package/lib/components/rich-editor/plugins/block/lists/actions/join-list-items-scenarios/join-sibling-list-items.js +0 -61
  33. package/lib/components/rich-editor/plugins/block/lists/actions/merge-lists.js +0 -34
  34. package/lib/components/rich-editor/plugins/block/lists/actions/outdent-list-items-selected.js +0 -289
  35. package/lib/components/rich-editor/plugins/block/lists/actions/wrap-and-join-lists.js +0 -180
  36. package/lib/components/rich-editor/plugins/block/lists/baseCommand.js +0 -328
  37. package/lib/components/rich-editor/plugins/block/lists/commond/indent-list.js +0 -60
  38. package/lib/components/rich-editor/plugins/block/lists/commond/index.js +0 -398
  39. package/lib/components/rich-editor/plugins/block/lists/commond/join-list-item-forward.js +0 -45
  40. package/lib/components/rich-editor/plugins/block/lists/commond/listBackspace.js +0 -302
  41. package/lib/components/rich-editor/plugins/block/lists/commond/outdent-list.js +0 -43
  42. package/lib/components/rich-editor/plugins/block/lists/index.js +0 -222
  43. package/lib/components/rich-editor/plugins/block/lists/messages.js +0 -38
  44. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/input-rule.js +0 -152
  45. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/keymap.js +0 -33
  46. package/lib/components/rich-editor/plugins/block/lists/pm-plugins/main.js +0 -94
  47. package/lib/components/rich-editor/plugins/block/lists/styles.js +0 -15
  48. package/lib/components/rich-editor/plugins/block/lists/transforms.js +0 -347
  49. package/lib/components/rich-editor/plugins/block/lists/utils/analytics.js +0 -48
  50. package/lib/components/rich-editor/plugins/block/lists/utils/find.js +0 -126
  51. package/lib/components/rich-editor/plugins/block/lists/utils/indentation.js +0 -87
  52. package/lib/components/rich-editor/plugins/block/lists/utils/node.js +0 -144
  53. package/lib/components/rich-editor/plugins/block/lists/utils/replace-content.js +0 -31
  54. package/lib/components/rich-editor/plugins/block/lists/utils/selection.js +0 -201
  55. package/lib/components/rich-editor/plugins/block/lists/utils.js +0 -52
  56. package/lib/components/rich-editor/plugins/block/paragraph/index.js +0 -91
  57. package/lib/components/rich-editor/plugins/core/index.js +0 -90
  58. package/lib/components/rich-editor/plugins/core/pm-plugins/focus-handler.js +0 -67
  59. package/lib/components/rich-editor/plugins/core/pm-plugins/keymap.js +0 -29
  60. package/lib/components/rich-editor/plugins/core/pm-plugins/reactNodeView.js +0 -80
  61. package/lib/components/rich-editor/plugins/extension/alignment/commond.js +0 -24
  62. package/lib/components/rich-editor/plugins/extension/alignment/index.js +0 -111
  63. package/lib/components/rich-editor/plugins/extension/alignment/utils.js +0 -19
  64. package/lib/components/rich-editor/plugins/extension/index.js +0 -18
  65. package/lib/components/rich-editor/plugins/index.js +0 -44
  66. package/lib/components/rich-editor/plugins/inline/color/commond.js +0 -128
  67. package/lib/components/rich-editor/plugins/inline/color/consts.js +0 -43
  68. package/lib/components/rich-editor/plugins/inline/color/index.css +0 -61
  69. package/lib/components/rich-editor/plugins/inline/color/index.js +0 -209
  70. package/lib/components/rich-editor/plugins/inline/color/selector.js +0 -250
  71. package/lib/components/rich-editor/plugins/inline/delete-line/index.js +0 -147
  72. package/lib/components/rich-editor/plugins/inline/em/index.js +0 -93
  73. package/lib/components/rich-editor/plugins/inline/index.js +0 -83
  74. package/lib/components/rich-editor/plugins/inline/link/commands.js +0 -256
  75. package/lib/components/rich-editor/plugins/inline/link/index.js +0 -149
  76. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/fake-cursor-for-toolbar.js +0 -77
  77. package/lib/components/rich-editor/plugins/inline/link/pm-plugins/main.js +0 -293
  78. package/lib/components/rich-editor/plugins/inline/link/ui/index.css +0 -79
  79. package/lib/components/rich-editor/plugins/inline/link/ui/linkEditor.js +0 -148
  80. package/lib/components/rich-editor/plugins/inline/link/ui/linkToolbar.js +0 -88
  81. package/lib/components/rich-editor/plugins/inline/link/ui/toolbarBtn.js +0 -117
  82. package/lib/components/rich-editor/plugins/inline/link/utils.js +0 -33
  83. package/lib/components/rich-editor/plugins/inline/strong/index.js +0 -137
  84. package/lib/components/rich-editor/plugins/inline/under-line/index.js +0 -145
  85. package/lib/components/rich-editor/plugins/util.js +0 -281
  86. package/lib/components/rich-editor/react/reactNodeView.js +0 -383
  87. package/lib/components/rich-editor/react/uiProvider.js +0 -185
  88. package/lib/components/rich-editor/schemas/basic.js +0 -309
  89. package/lib/components/rich-editor/schemas/index.js +0 -19
  90. package/lib/components/rich-editor/schemas/list.js +0 -342
  91. package/lib/components/rich-editor/types/commond.js +0 -5
  92. package/lib/components/rich-editor/types/index.js +0 -18
  93. package/lib/components/rich-editor/ui/Popup/index.js +0 -247
  94. package/lib/components/rich-editor/ui/Popup/utils.js +0 -399
  95. package/lib/components/rich-editor/ui/editor/index.css +0 -144
  96. package/lib/components/rich-editor/ui/editor/index.js +0 -143
  97. package/lib/components/rich-editor/ui/normal-toolbar/index.css +0 -29
  98. package/lib/components/rich-editor/ui/normal-toolbar/index.js +0 -109
  99. package/lib/components/rich-editor/utils/browser.js +0 -35
  100. package/lib/components/rich-editor/utils/commands.js +0 -266
  101. package/lib/components/rich-editor/utils/document.js +0 -160
  102. package/lib/components/rich-editor/utils/event.js +0 -79
  103. package/lib/components/rich-editor/utils/helpers.js +0 -16
  104. package/lib/components/rich-editor/utils/mark.js +0 -168
  105. package/lib/components/rich-editor/utils/slice.js +0 -85
  106. package/lib/components/rich-editor/utils/toolbar.js +0 -228
  107. package/yarn-error.log +0 -22184
@@ -1,328 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.addListNodes = addListNodes;
7
- exports.bulletList = void 0;
8
- exports.liftListItem = liftListItem;
9
- exports.orderedList = exports.listItem = void 0;
10
- exports.sinkListItem = sinkListItem;
11
- exports.splitListItem = splitListItem;
12
- exports.wrapInList = wrapInList;
13
-
14
- var _prosemirrorTransform = require("prosemirror-transform");
15
-
16
- var _prosemirrorModel = require("prosemirror-model");
17
-
18
- var olDOM = ["ol", 0],
19
- ulDOM = ["ul", 0],
20
- liDOM = ["li", 0]; // :: NodeSpec
21
- // An ordered list [node spec](#model.NodeSpec). Has a single
22
- // attribute, `order`, which determines the number at which the list
23
- // starts counting, and defaults to 1. Represented as an `<ol>`
24
- // element.
25
-
26
- var orderedList = {
27
- attrs: {
28
- order: {
29
- "default": 1
30
- }
31
- },
32
- parseDOM: [{
33
- tag: "ol",
34
- getAttrs: function getAttrs(dom) {
35
- return {
36
- order: dom.hasAttribute("start") ? +dom.getAttribute("start") : 1
37
- };
38
- }
39
- }],
40
- toDOM: function toDOM(node) {
41
- return node.attrs.order == 1 ? olDOM : ["ol", {
42
- start: node.attrs.order
43
- }, 0];
44
- }
45
- }; // :: NodeSpec
46
- // A bullet list node spec, represented in the DOM as `<ul>`.
47
-
48
- exports.orderedList = orderedList;
49
- var bulletList = {
50
- parseDOM: [{
51
- tag: "ul"
52
- }],
53
- toDOM: function toDOM() {
54
- return ulDOM;
55
- }
56
- }; // :: NodeSpec
57
- // A list item (`<li>`) spec.
58
-
59
- exports.bulletList = bulletList;
60
- var listItem = {
61
- parseDOM: [{
62
- tag: "li"
63
- }],
64
- toDOM: function toDOM() {
65
- return liDOM;
66
- },
67
- defining: true
68
- };
69
- exports.listItem = listItem;
70
-
71
- function add(obj, props) {
72
- var copy = {};
73
-
74
- for (var prop in obj) {
75
- copy[prop] = obj[prop];
76
- }
77
-
78
- for (var _prop in props) {
79
- copy[_prop] = props[_prop];
80
- }
81
-
82
- return copy;
83
- } // :: (OrderedMap<NodeSpec>, string, ?string) → OrderedMap<NodeSpec>
84
- // Convenience function for adding list-related node types to a map
85
- // specifying the nodes for a schema. Adds
86
- // [`orderedList`](#schema-list.orderedList) as `"ordered_list"`,
87
- // [`bulletList`](#schema-list.bulletList) as `"bullet_list"`, and
88
- // [`listItem`](#schema-list.listItem) as `"list_item"`.
89
- //
90
- // `itemContent` determines the content expression for the list items.
91
- // If you want the commands defined in this module to apply to your
92
- // list structure, it should have a shape like `"paragraph block*"` or
93
- // `"paragraph (ordered_list | bullet_list)*"`. `listGroup` can be
94
- // given to assign a group name to the list node types, for example
95
- // `"block"`.
96
-
97
-
98
- function addListNodes(nodes, itemContent, listGroup) {
99
- return nodes.append({
100
- ordered_list: add(orderedList, {
101
- content: "list_item+",
102
- group: listGroup
103
- }),
104
- bullet_list: add(bulletList, {
105
- content: "list_item+",
106
- group: listGroup
107
- }),
108
- list_item: add(listItem, {
109
- content: itemContent
110
- })
111
- });
112
- } // :: (NodeType, ?Object) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
113
- // Returns a command function that wraps the selection in a list with
114
- // the given type an attributes. If `dispatch` is null, only return a
115
- // value to indicate whether this is possible, but don't actually
116
- // perform the change.
117
-
118
-
119
- function wrapInList(listType, attrs) {
120
- return function (state, dispatch) {
121
- var _state$selection = state.selection,
122
- $from = _state$selection.$from,
123
- $to = _state$selection.$to;
124
- var range = $from.blockRange($to),
125
- doJoin = false,
126
- outerRange = range;
127
- if (!range) return false; // This is at the top of an existing list item
128
-
129
- if (range.depth >= 2 && $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
130
- // Don't do anything if this is the top of the list
131
- if ($from.index(range.depth - 1) == 0) return false;
132
- var $insert = state.doc.resolve(range.start - 2);
133
- outerRange = new _prosemirrorModel.NodeRange($insert, $insert, range.depth);
134
- if (range.endIndex < range.parent.childCount) range = new _prosemirrorModel.NodeRange($from, state.doc.resolve($to.end(range.depth)), range.depth);
135
- doJoin = true;
136
- }
137
-
138
- var wrap = (0, _prosemirrorTransform.findWrapping)(outerRange, listType, attrs, range);
139
- if (!wrap) return false;
140
- if (dispatch) dispatch(doWrapInList(state.tr, range, wrap, doJoin, listType).scrollIntoView());
141
- return true;
142
- };
143
- }
144
-
145
- function doWrapInList(tr, range, wrappers, joinBefore, listType) {
146
- var content = _prosemirrorModel.Fragment.empty;
147
-
148
- for (var i = wrappers.length - 1; i >= 0; i--) {
149
- content = _prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
150
- }
151
-
152
- tr.step(new _prosemirrorTransform.ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new _prosemirrorModel.Slice(content, 0, 0), wrappers.length, true));
153
- var found = 0;
154
-
155
- for (var _i = 0; _i < wrappers.length; _i++) {
156
- if (wrappers[_i].type == listType) found = _i + 1;
157
- }
158
-
159
- var splitDepth = wrappers.length - found;
160
- var splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0),
161
- parent = range.parent;
162
-
163
- for (var _i2 = range.startIndex, e = range.endIndex, first = true; _i2 < e; _i2++, first = false) {
164
- if (!first && (0, _prosemirrorTransform.canSplit)(tr.doc, splitPos, splitDepth)) {
165
- tr.split(splitPos, splitDepth);
166
- splitPos += 2 * splitDepth;
167
- }
168
-
169
- splitPos += parent.child(_i2).nodeSize;
170
- }
171
-
172
- return tr;
173
- } // :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
174
- // Build a command that splits a non-empty textblock at the top level
175
- // of a list item by also splitting that list item.
176
-
177
-
178
- function splitListItem(itemType) {
179
- return function (state, dispatch) {
180
- var _state$selection2 = state.selection,
181
- $from = _state$selection2.$from,
182
- $to = _state$selection2.$to,
183
- node = _state$selection2.node;
184
- if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;
185
- var grandParent = $from.node(-1);
186
- if (grandParent.type != itemType) return false;
187
-
188
- if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {
189
- // In an empty block. If this is a nested list, the wrapping
190
- // list item should be split. Otherwise, bail out and let next
191
- // command handle lifting.
192
- if ($from.depth == 2 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;
193
-
194
- if (dispatch) {
195
- var wrap = _prosemirrorModel.Fragment.empty;
196
- var depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3; // Build a fragment containing empty versions of the structure
197
- // from the outer list item to the parent node of the cursor
198
-
199
- for (var d = $from.depth - depthBefore; d >= $from.depth - 3; d--) {
200
- wrap = _prosemirrorModel.Fragment.from($from.node(d).copy(wrap));
201
- }
202
-
203
- var depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3; // Add a second list item with an empty default start node
204
-
205
- wrap = wrap.append(_prosemirrorModel.Fragment.from(itemType.createAndFill()));
206
- var start = $from.before($from.depth - (depthBefore - 1));
207
-
208
- var _tr = state.tr.replace(start, $from.after(-depthAfter), new _prosemirrorModel.Slice(wrap, 4 - depthBefore, 0));
209
-
210
- var sel = -1;
211
-
212
- _tr.doc.nodesBetween(start, _tr.doc.content.size, function (node, pos) {
213
- if (sel > -1) return false;
214
- if (node.isTextblock && node.content.size == 0) sel = pos + 1;
215
- });
216
-
217
- if (sel > -1) _tr.setSelection(state.selection.constructor.near(_tr.doc.resolve(sel)));
218
- dispatch(_tr.scrollIntoView());
219
- }
220
-
221
- return true;
222
- }
223
-
224
- var nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
225
- var tr = state.tr["delete"]($from.pos, $to.pos);
226
- var types = nextType && [null, {
227
- type: nextType
228
- }];
229
- if (!(0, _prosemirrorTransform.canSplit)(tr.doc, $from.pos, 2, types)) return false;
230
- if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());
231
- return true;
232
- };
233
- } // :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
234
- // Create a command to lift the list item around the selection up into
235
- // a wrapping list.
236
-
237
-
238
- function liftListItem(itemType) {
239
- return function (state, dispatch) {
240
- var _state$selection3 = state.selection,
241
- $from = _state$selection3.$from,
242
- $to = _state$selection3.$to;
243
- var range = $from.blockRange($to, function (node) {
244
- return node.childCount && node.firstChild.type == itemType;
245
- });
246
- if (!range) return false;
247
- if (!dispatch) return true;
248
- if ($from.node(range.depth - 1).type == itemType) // Inside a parent list
249
- return liftToOuterList(state, dispatch, itemType, range);else // Outer list node
250
- return liftOutOfList(state, dispatch, range);
251
- };
252
- }
253
-
254
- function liftToOuterList(state, dispatch, itemType, range) {
255
- var tr = state.tr,
256
- end = range.end,
257
- endOfList = range.$to.end(range.depth);
258
-
259
- if (end < endOfList) {
260
- // There are siblings after the lifted items, which must become
261
- // children of the last item
262
- tr.step(new _prosemirrorTransform.ReplaceAroundStep(end - 1, endOfList, end, endOfList, new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
263
- range = new _prosemirrorModel.NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
264
- }
265
-
266
- dispatch(tr.lift(range, (0, _prosemirrorTransform.liftTarget)(range)).scrollIntoView());
267
- return true;
268
- }
269
-
270
- function liftOutOfList(state, dispatch, range) {
271
- var tr = state.tr,
272
- list = range.parent; // Merge the list items into a single big item
273
-
274
- for (var pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
275
- pos -= list.child(i).nodeSize;
276
- tr["delete"](pos - 1, pos + 1);
277
- }
278
-
279
- var $start = tr.doc.resolve(range.start),
280
- item = $start.nodeAfter;
281
- if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) return false;
282
- var atStart = range.startIndex == 0,
283
- atEnd = range.endIndex == list.childCount;
284
- var parent = $start.node(-1),
285
- indexBefore = $start.index(-1);
286
- if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? _prosemirrorModel.Fragment.empty : _prosemirrorModel.Fragment.from(list)))) return false;
287
- var start = $start.pos,
288
- end = start + item.nodeSize; // Strip off the surrounding list. At the sides where we're not at
289
- // the end of the list, the existing list is closed. At sides where
290
- // this is the end, it is overwritten to its end.
291
-
292
- tr.step(new _prosemirrorTransform.ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new _prosemirrorModel.Slice((atStart ? _prosemirrorModel.Fragment.empty : _prosemirrorModel.Fragment.from(list.copy(_prosemirrorModel.Fragment.empty))).append(atEnd ? _prosemirrorModel.Fragment.empty : _prosemirrorModel.Fragment.from(list.copy(_prosemirrorModel.Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
293
- dispatch(tr.scrollIntoView());
294
- return true;
295
- } // :: (NodeType) → (state: EditorState, dispatch: ?(tr: Transaction)) → bool
296
- // Create a command to sink the list item around the selection down
297
- // into an inner list.
298
-
299
-
300
- function sinkListItem(itemType) {
301
- return function (state, dispatch) {
302
- var _state$selection4 = state.selection,
303
- $from = _state$selection4.$from,
304
- $to = _state$selection4.$to;
305
- var range = $from.blockRange($to, function (node) {
306
- return node.childCount && node.firstChild.type == itemType;
307
- });
308
- if (!range) return false;
309
- var startIndex = range.startIndex;
310
- if (startIndex == 0) return false;
311
- var parent = range.parent,
312
- nodeBefore = parent.child(startIndex - 1);
313
- if (nodeBefore.type != itemType) return false;
314
-
315
- if (dispatch) {
316
- var nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
317
-
318
- var inner = _prosemirrorModel.Fragment.from(nestedBefore ? itemType.create() : null);
319
-
320
- var slice = new _prosemirrorModel.Slice(_prosemirrorModel.Fragment.from(itemType.create(null, _prosemirrorModel.Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
321
- var before = range.start,
322
- after = range.end;
323
- dispatch(state.tr.step(new _prosemirrorTransform.ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());
324
- }
325
-
326
- return true;
327
- };
328
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MAX_NESTED_LIST_INDENTATION = void 0;
7
- exports.indentList = indentList;
8
-
9
- var _indentation = require("../utils/indentation");
10
-
11
- var _indentListItemsSelected = require("../actions/indent-list-items-selected");
12
-
13
- var _find = require("../utils/find");
14
-
15
- var _selection = require("../utils/selection");
16
-
17
- // import { Command } from '../../../types';
18
- var MAX_NESTED_LIST_INDENTATION = 6;
19
- exports.MAX_NESTED_LIST_INDENTATION = MAX_NESTED_LIST_INDENTATION;
20
-
21
- function indentList() {
22
- return function (state, dispatch) {
23
- var tr = state.tr,
24
- $from = state.selection.$from; // don't indent if selection is not inside a list
25
-
26
- if (!(0, _selection.isInsideListItem)(state)) {
27
- return false;
28
- }
29
-
30
- var firstListItemSelectedAttributes = (0, _selection.getListItemAttributes)($from);
31
- var parentListNode = (0, _find.findFirstParentListNode)($from);
32
-
33
- if (!parentListNode || firstListItemSelectedAttributes && firstListItemSelectedAttributes.indentLevel === 0 && firstListItemSelectedAttributes.itemIndex === 0) {
34
- if ((0, _selection.isInsideTableCell)(state)) {
35
- // dont consume tab, as table-keymap should move cursor to next cell
36
- return false;
37
- } else {
38
- // Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
39
- return true;
40
- }
41
- }
42
-
43
- (0, _indentListItemsSelected.indentListItemsSelected)(tr);
44
- var maximimunNestedLevelReached = !(0, _indentation.hasValidListIndentationLevel)({
45
- tr: tr,
46
- maxIndentation: MAX_NESTED_LIST_INDENTATION
47
- });
48
-
49
- if (maximimunNestedLevelReached || !tr.docChanged) {
50
- // Even though this is a non-operation, we don't want to send this event to the browser. Because if we return false, the browser will move the focus to another place
51
- return true;
52
- }
53
-
54
- if (dispatch) {
55
- dispatch(tr);
56
- }
57
-
58
- return true;
59
- };
60
- }