@limetech/lime-elements 37.16.0 → 37.17.0

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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## [37.17.0](https://github.com/Lundalogik/lime-elements/compare/v37.16.0...v37.17.0) (2024-04-11)
2
+
3
+
4
+ ### Features
5
+
6
+
7
+ * **text-editor:** add buttons for lists ([50a1020](https://github.com/Lundalogik/lime-elements/commit/50a1020de0d9e60c37eb333f06d98c8c25efd4e7))
8
+
1
9
  ## [37.16.0](https://github.com/Lundalogik/lime-elements/compare/v37.15.1...v37.16.0) (2024-04-11)
2
10
 
3
11
 
@@ -12406,6 +12406,259 @@ To reuse elements from this schema, extend or read from its
12406
12406
  */
12407
12407
  const schema = new Schema({ nodes, marks });
12408
12408
 
12409
+ const olDOM = ["ol", 0], ulDOM = ["ul", 0], liDOM = ["li", 0];
12410
+ /**
12411
+ An ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single
12412
+ attribute, `order`, which determines the number at which the list
12413
+ starts counting, and defaults to 1. Represented as an `<ol>`
12414
+ element.
12415
+ */
12416
+ const orderedList = {
12417
+ attrs: { order: { default: 1 } },
12418
+ parseDOM: [{ tag: "ol", getAttrs(dom) {
12419
+ return { order: dom.hasAttribute("start") ? +dom.getAttribute("start") : 1 };
12420
+ } }],
12421
+ toDOM(node) {
12422
+ return node.attrs.order == 1 ? olDOM : ["ol", { start: node.attrs.order }, 0];
12423
+ }
12424
+ };
12425
+ /**
12426
+ A bullet list node spec, represented in the DOM as `<ul>`.
12427
+ */
12428
+ const bulletList = {
12429
+ parseDOM: [{ tag: "ul" }],
12430
+ toDOM() { return ulDOM; }
12431
+ };
12432
+ /**
12433
+ A list item (`<li>`) spec.
12434
+ */
12435
+ const listItem = {
12436
+ parseDOM: [{ tag: "li" }],
12437
+ toDOM() { return liDOM; },
12438
+ defining: true
12439
+ };
12440
+ function add$1(obj, props) {
12441
+ let copy = {};
12442
+ for (let prop in obj)
12443
+ copy[prop] = obj[prop];
12444
+ for (let prop in props)
12445
+ copy[prop] = props[prop];
12446
+ return copy;
12447
+ }
12448
+ /**
12449
+ Convenience function for adding list-related node types to a map
12450
+ specifying the nodes for a schema. Adds
12451
+ [`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `"ordered_list"`,
12452
+ [`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `"bullet_list"`, and
12453
+ [`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `"list_item"`.
12454
+
12455
+ `itemContent` determines the content expression for the list items.
12456
+ If you want the commands defined in this module to apply to your
12457
+ list structure, it should have a shape like `"paragraph block*"` or
12458
+ `"paragraph (ordered_list | bullet_list)*"`. `listGroup` can be
12459
+ given to assign a group name to the list node types, for example
12460
+ `"block"`.
12461
+ */
12462
+ function addListNodes(nodes, itemContent, listGroup) {
12463
+ return nodes.append({
12464
+ ordered_list: add$1(orderedList, { content: "list_item+", group: listGroup }),
12465
+ bullet_list: add$1(bulletList, { content: "list_item+", group: listGroup }),
12466
+ list_item: add$1(listItem, { content: itemContent })
12467
+ });
12468
+ }
12469
+ /**
12470
+ Returns a command function that wraps the selection in a list with
12471
+ the given type an attributes. If `dispatch` is null, only return a
12472
+ value to indicate whether this is possible, but don't actually
12473
+ perform the change.
12474
+ */
12475
+ function wrapInList(listType, attrs = null) {
12476
+ return function (state, dispatch) {
12477
+ let { $from, $to } = state.selection;
12478
+ let range = $from.blockRange($to), doJoin = false, outerRange = range;
12479
+ if (!range)
12480
+ return false;
12481
+ // This is at the top of an existing list item
12482
+ if (range.depth >= 2 && $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
12483
+ // Don't do anything if this is the top of the list
12484
+ if ($from.index(range.depth - 1) == 0)
12485
+ return false;
12486
+ let $insert = state.doc.resolve(range.start - 2);
12487
+ outerRange = new NodeRange($insert, $insert, range.depth);
12488
+ if (range.endIndex < range.parent.childCount)
12489
+ range = new NodeRange($from, state.doc.resolve($to.end(range.depth)), range.depth);
12490
+ doJoin = true;
12491
+ }
12492
+ let wrap = findWrapping(outerRange, listType, attrs, range);
12493
+ if (!wrap)
12494
+ return false;
12495
+ if (dispatch)
12496
+ dispatch(doWrapInList(state.tr, range, wrap, doJoin, listType).scrollIntoView());
12497
+ return true;
12498
+ };
12499
+ }
12500
+ function doWrapInList(tr, range, wrappers, joinBefore, listType) {
12501
+ let content = Fragment.empty;
12502
+ for (let i = wrappers.length - 1; i >= 0; i--)
12503
+ content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
12504
+ tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
12505
+ let found = 0;
12506
+ for (let i = 0; i < wrappers.length; i++)
12507
+ if (wrappers[i].type == listType)
12508
+ found = i + 1;
12509
+ let splitDepth = wrappers.length - found;
12510
+ let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;
12511
+ for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {
12512
+ if (!first && canSplit(tr.doc, splitPos, splitDepth)) {
12513
+ tr.split(splitPos, splitDepth);
12514
+ splitPos += 2 * splitDepth;
12515
+ }
12516
+ splitPos += parent.child(i).nodeSize;
12517
+ }
12518
+ return tr;
12519
+ }
12520
+ /**
12521
+ Build a command that splits a non-empty textblock at the top level
12522
+ of a list item by also splitting that list item.
12523
+ */
12524
+ function splitListItem(itemType, itemAttrs) {
12525
+ return function (state, dispatch) {
12526
+ let { $from, $to, node } = state.selection;
12527
+ if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))
12528
+ return false;
12529
+ let grandParent = $from.node(-1);
12530
+ if (grandParent.type != itemType)
12531
+ return false;
12532
+ if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {
12533
+ // In an empty block. If this is a nested list, the wrapping
12534
+ // list item should be split. Otherwise, bail out and let next
12535
+ // command handle lifting.
12536
+ if ($from.depth == 3 || $from.node(-3).type != itemType ||
12537
+ $from.index(-2) != $from.node(-2).childCount - 1)
12538
+ return false;
12539
+ if (dispatch) {
12540
+ let wrap = Fragment.empty;
12541
+ let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
12542
+ // Build a fragment containing empty versions of the structure
12543
+ // from the outer list item to the parent node of the cursor
12544
+ for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)
12545
+ wrap = Fragment.from($from.node(d).copy(wrap));
12546
+ let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1
12547
+ : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
12548
+ // Add a second list item with an empty default start node
12549
+ wrap = wrap.append(Fragment.from(itemType.createAndFill()));
12550
+ let start = $from.before($from.depth - (depthBefore - 1));
12551
+ let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
12552
+ let sel = -1;
12553
+ tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {
12554
+ if (sel > -1)
12555
+ return false;
12556
+ if (node.isTextblock && node.content.size == 0)
12557
+ sel = pos + 1;
12558
+ });
12559
+ if (sel > -1)
12560
+ tr.setSelection(Selection.near(tr.doc.resolve(sel)));
12561
+ dispatch(tr.scrollIntoView());
12562
+ }
12563
+ return true;
12564
+ }
12565
+ let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
12566
+ let tr = state.tr.delete($from.pos, $to.pos);
12567
+ let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;
12568
+ if (!canSplit(tr.doc, $from.pos, 2, types))
12569
+ return false;
12570
+ if (dispatch)
12571
+ dispatch(tr.split($from.pos, 2, types).scrollIntoView());
12572
+ return true;
12573
+ };
12574
+ }
12575
+ /**
12576
+ Create a command to lift the list item around the selection up into
12577
+ a wrapping list.
12578
+ */
12579
+ function liftListItem(itemType) {
12580
+ return function (state, dispatch) {
12581
+ let { $from, $to } = state.selection;
12582
+ let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
12583
+ if (!range)
12584
+ return false;
12585
+ if (!dispatch)
12586
+ return true;
12587
+ if ($from.node(range.depth - 1).type == itemType) // Inside a parent list
12588
+ return liftToOuterList(state, dispatch, itemType, range);
12589
+ else // Outer list node
12590
+ return liftOutOfList(state, dispatch, range);
12591
+ };
12592
+ }
12593
+ function liftToOuterList(state, dispatch, itemType, range) {
12594
+ let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
12595
+ if (end < endOfList) {
12596
+ // There are siblings after the lifted items, which must become
12597
+ // children of the last item
12598
+ tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
12599
+ range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
12600
+ }
12601
+ const target = liftTarget(range);
12602
+ if (target == null)
12603
+ return false;
12604
+ tr.lift(range, target);
12605
+ let after = tr.mapping.map(end, -1) - 1;
12606
+ if (canJoin(tr.doc, after))
12607
+ tr.join(after);
12608
+ dispatch(tr.scrollIntoView());
12609
+ return true;
12610
+ }
12611
+ function liftOutOfList(state, dispatch, range) {
12612
+ let tr = state.tr, list = range.parent;
12613
+ // Merge the list items into a single big item
12614
+ for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
12615
+ pos -= list.child(i).nodeSize;
12616
+ tr.delete(pos - 1, pos + 1);
12617
+ }
12618
+ let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;
12619
+ if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)
12620
+ return false;
12621
+ let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
12622
+ let parent = $start.node(-1), indexBefore = $start.index(-1);
12623
+ if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
12624
+ return false;
12625
+ let start = $start.pos, end = start + item.nodeSize;
12626
+ // Strip off the surrounding list. At the sides where we're not at
12627
+ // the end of the list, the existing list is closed. At sides where
12628
+ // this is the end, it is overwritten to its end.
12629
+ tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))
12630
+ .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
12631
+ dispatch(tr.scrollIntoView());
12632
+ return true;
12633
+ }
12634
+ /**
12635
+ Create a command to sink the list item around the selection down
12636
+ into an inner list.
12637
+ */
12638
+ function sinkListItem(itemType) {
12639
+ return function (state, dispatch) {
12640
+ let { $from, $to } = state.selection;
12641
+ let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
12642
+ if (!range)
12643
+ return false;
12644
+ let startIndex = range.startIndex;
12645
+ if (startIndex == 0)
12646
+ return false;
12647
+ let parent = range.parent, nodeBefore = parent.child(startIndex - 1);
12648
+ if (nodeBefore.type != itemType)
12649
+ return false;
12650
+ if (dispatch) {
12651
+ let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
12652
+ let inner = Fragment.from(nestedBefore ? itemType.create() : null);
12653
+ let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
12654
+ let before = range.start, after = range.end;
12655
+ dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))
12656
+ .scrollIntoView());
12657
+ }
12658
+ return true;
12659
+ };
12660
+ }
12661
+
12409
12662
  var base = {
12410
12663
  8: "Backspace",
12411
12664
  9: "Tab",
@@ -14925,199 +15178,6 @@ function getAllWrapping(node) {
14925
15178
  return res;
14926
15179
  }
14927
15180
 
14928
- /**
14929
- Returns a command function that wraps the selection in a list with
14930
- the given type an attributes. If `dispatch` is null, only return a
14931
- value to indicate whether this is possible, but don't actually
14932
- perform the change.
14933
- */
14934
- function wrapInList(listType, attrs = null) {
14935
- return function (state, dispatch) {
14936
- let { $from, $to } = state.selection;
14937
- let range = $from.blockRange($to), doJoin = false, outerRange = range;
14938
- if (!range)
14939
- return false;
14940
- // This is at the top of an existing list item
14941
- if (range.depth >= 2 && $from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
14942
- // Don't do anything if this is the top of the list
14943
- if ($from.index(range.depth - 1) == 0)
14944
- return false;
14945
- let $insert = state.doc.resolve(range.start - 2);
14946
- outerRange = new NodeRange($insert, $insert, range.depth);
14947
- if (range.endIndex < range.parent.childCount)
14948
- range = new NodeRange($from, state.doc.resolve($to.end(range.depth)), range.depth);
14949
- doJoin = true;
14950
- }
14951
- let wrap = findWrapping(outerRange, listType, attrs, range);
14952
- if (!wrap)
14953
- return false;
14954
- if (dispatch)
14955
- dispatch(doWrapInList(state.tr, range, wrap, doJoin, listType).scrollIntoView());
14956
- return true;
14957
- };
14958
- }
14959
- function doWrapInList(tr, range, wrappers, joinBefore, listType) {
14960
- let content = Fragment.empty;
14961
- for (let i = wrappers.length - 1; i >= 0; i--)
14962
- content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
14963
- tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
14964
- let found = 0;
14965
- for (let i = 0; i < wrappers.length; i++)
14966
- if (wrappers[i].type == listType)
14967
- found = i + 1;
14968
- let splitDepth = wrappers.length - found;
14969
- let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;
14970
- for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {
14971
- if (!first && canSplit(tr.doc, splitPos, splitDepth)) {
14972
- tr.split(splitPos, splitDepth);
14973
- splitPos += 2 * splitDepth;
14974
- }
14975
- splitPos += parent.child(i).nodeSize;
14976
- }
14977
- return tr;
14978
- }
14979
- /**
14980
- Build a command that splits a non-empty textblock at the top level
14981
- of a list item by also splitting that list item.
14982
- */
14983
- function splitListItem(itemType, itemAttrs) {
14984
- return function (state, dispatch) {
14985
- let { $from, $to, node } = state.selection;
14986
- if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))
14987
- return false;
14988
- let grandParent = $from.node(-1);
14989
- if (grandParent.type != itemType)
14990
- return false;
14991
- if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {
14992
- // In an empty block. If this is a nested list, the wrapping
14993
- // list item should be split. Otherwise, bail out and let next
14994
- // command handle lifting.
14995
- if ($from.depth == 3 || $from.node(-3).type != itemType ||
14996
- $from.index(-2) != $from.node(-2).childCount - 1)
14997
- return false;
14998
- if (dispatch) {
14999
- let wrap = Fragment.empty;
15000
- let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
15001
- // Build a fragment containing empty versions of the structure
15002
- // from the outer list item to the parent node of the cursor
15003
- for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)
15004
- wrap = Fragment.from($from.node(d).copy(wrap));
15005
- let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1
15006
- : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
15007
- // Add a second list item with an empty default start node
15008
- wrap = wrap.append(Fragment.from(itemType.createAndFill()));
15009
- let start = $from.before($from.depth - (depthBefore - 1));
15010
- let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));
15011
- let sel = -1;
15012
- tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {
15013
- if (sel > -1)
15014
- return false;
15015
- if (node.isTextblock && node.content.size == 0)
15016
- sel = pos + 1;
15017
- });
15018
- if (sel > -1)
15019
- tr.setSelection(Selection.near(tr.doc.resolve(sel)));
15020
- dispatch(tr.scrollIntoView());
15021
- }
15022
- return true;
15023
- }
15024
- let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
15025
- let tr = state.tr.delete($from.pos, $to.pos);
15026
- let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;
15027
- if (!canSplit(tr.doc, $from.pos, 2, types))
15028
- return false;
15029
- if (dispatch)
15030
- dispatch(tr.split($from.pos, 2, types).scrollIntoView());
15031
- return true;
15032
- };
15033
- }
15034
- /**
15035
- Create a command to lift the list item around the selection up into
15036
- a wrapping list.
15037
- */
15038
- function liftListItem(itemType) {
15039
- return function (state, dispatch) {
15040
- let { $from, $to } = state.selection;
15041
- let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
15042
- if (!range)
15043
- return false;
15044
- if (!dispatch)
15045
- return true;
15046
- if ($from.node(range.depth - 1).type == itemType) // Inside a parent list
15047
- return liftToOuterList(state, dispatch, itemType, range);
15048
- else // Outer list node
15049
- return liftOutOfList(state, dispatch, range);
15050
- };
15051
- }
15052
- function liftToOuterList(state, dispatch, itemType, range) {
15053
- let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
15054
- if (end < endOfList) {
15055
- // There are siblings after the lifted items, which must become
15056
- // children of the last item
15057
- tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
15058
- range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
15059
- }
15060
- const target = liftTarget(range);
15061
- if (target == null)
15062
- return false;
15063
- tr.lift(range, target);
15064
- let after = tr.mapping.map(end, -1) - 1;
15065
- if (canJoin(tr.doc, after))
15066
- tr.join(after);
15067
- dispatch(tr.scrollIntoView());
15068
- return true;
15069
- }
15070
- function liftOutOfList(state, dispatch, range) {
15071
- let tr = state.tr, list = range.parent;
15072
- // Merge the list items into a single big item
15073
- for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
15074
- pos -= list.child(i).nodeSize;
15075
- tr.delete(pos - 1, pos + 1);
15076
- }
15077
- let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;
15078
- if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)
15079
- return false;
15080
- let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
15081
- let parent = $start.node(-1), indexBefore = $start.index(-1);
15082
- if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
15083
- return false;
15084
- let start = $start.pos, end = start + item.nodeSize;
15085
- // Strip off the surrounding list. At the sides where we're not at
15086
- // the end of the list, the existing list is closed. At sides where
15087
- // this is the end, it is overwritten to its end.
15088
- tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))
15089
- .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
15090
- dispatch(tr.scrollIntoView());
15091
- return true;
15092
- }
15093
- /**
15094
- Create a command to sink the list item around the selection down
15095
- into an inner list.
15096
- */
15097
- function sinkListItem(itemType) {
15098
- return function (state, dispatch) {
15099
- let { $from, $to } = state.selection;
15100
- let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);
15101
- if (!range)
15102
- return false;
15103
- let startIndex = range.startIndex;
15104
- if (startIndex == 0)
15105
- return false;
15106
- let parent = range.parent, nodeBefore = parent.child(startIndex - 1);
15107
- if (nodeBefore.type != itemType)
15108
- return false;
15109
- if (dispatch) {
15110
- let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
15111
- let inner = Fragment.from(nestedBefore ? itemType.create() : null);
15112
- let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
15113
- let before = range.start, after = range.end;
15114
- dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))
15115
- .scrollIntoView());
15116
- }
15117
- return true;
15118
- };
15119
- }
15120
-
15121
15181
  /**
15122
15182
  Input rules are regular expressions describing a piece of text
15123
15183
  that, when typed, causes something to happen. This might be
@@ -15863,7 +15923,7 @@ const TextEditor = class {
15863
15923
  }
15864
15924
  componentDidLoad() {
15865
15925
  const mySchema = new Schema({
15866
- nodes: schema.spec.nodes,
15926
+ nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
15867
15927
  marks: schema.spec.marks,
15868
15928
  });
15869
15929
  this.view = new EditorView(this.host.shadowRoot.querySelector('#editor'), {