@mx-space/cli 0.14.1 → 0.15.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.
Files changed (56) hide show
  1. package/README.md +35 -11
  2. package/dist/{Lexical.dev-DTxuYHmG.mjs → Lexical.dev-Cck4n26y.mjs} +998 -584
  3. package/dist/{Lexical.node-BlCLnfA6.mjs → Lexical.node-D6wf2D5M.mjs} +15 -5
  4. package/dist/Lexical.prod-DCwS1oTq.mjs +7170 -0
  5. package/dist/{LexicalClipboard.dev-CdFkLR_D.mjs → LexicalClipboard.dev-CMkPHV7O.mjs} +6 -6
  6. package/dist/{LexicalClipboard.node-ktUajxsv.mjs → LexicalClipboard.node-m4nZ7IYw.mjs} +2 -2
  7. package/dist/{LexicalClipboard.prod-DliyLofW.mjs → LexicalClipboard.prod-B_rN1vE1.mjs} +10 -8
  8. package/dist/{LexicalCodeCore.dev-CL9tHWJX.mjs → LexicalCodeCore.dev-DyJw3i8V.mjs} +62 -72
  9. package/dist/{LexicalCodeCore.prod-BoMSJc29.mjs → LexicalCodeCore.prod-DPXLHQLF.mjs} +212 -213
  10. package/dist/{LexicalDragon.dev-CqW7Aq5H.mjs → LexicalDragon.dev-ZkNfMwrE.mjs} +3 -3
  11. package/dist/{LexicalDragon.node-DLXctJyy.mjs → LexicalDragon.node-Ds9oLUFh.mjs} +2 -2
  12. package/dist/{LexicalDragon.prod-DHI3T6n5.mjs → LexicalDragon.prod-B58ic2av.mjs} +5 -4
  13. package/dist/{LexicalExtension.dev-BP-18zns.mjs → LexicalExtension.dev-DvwHs1Xv.mjs} +79 -67
  14. package/dist/{LexicalExtension.node-BWH6xbzG.mjs → LexicalExtension.node-5OymZQfy.mjs} +4 -2
  15. package/dist/{LexicalExtension.prod-Cs6OgrDn.mjs → LexicalExtension.prod-Ce0T5smQ.mjs} +372 -358
  16. package/dist/{LexicalHeadless.dev-DJp__UcP.mjs → LexicalHeadless.dev-DA0WldSR.mjs} +2 -2
  17. package/dist/{LexicalHeadless.prod-o0v9cIu5.mjs → LexicalHeadless.prod-1kQgKB6c.mjs} +2 -2
  18. package/dist/{LexicalHtml.dev-DoymwFpG.mjs → LexicalHtml.dev-BDB7CUrx.mjs} +14 -12
  19. package/dist/{LexicalHtml.node-CVkbWtUA.mjs → LexicalHtml.node-DpVNt7It.mjs} +4 -4
  20. package/dist/{LexicalHtml.prod-C2b3z99k.mjs → LexicalHtml.prod-HkxM5scw.mjs} +331 -300
  21. package/dist/{LexicalLink.dev-7cgLOLIe.mjs → LexicalLink.dev-C5zNJlrm.mjs} +65 -59
  22. package/dist/{LexicalLink.prod-DWFgoXHR.mjs → LexicalLink.prod-Bkt9hQAt.mjs} +196 -201
  23. package/dist/{LexicalList.dev-Ci2iOxFx.mjs → LexicalList.dev-B7VgME-m.mjs} +55 -82
  24. package/dist/LexicalList.prod-B8c7TDjH.mjs +951 -0
  25. package/dist/{LexicalMarkdown.dev-C0ZYCyuR.mjs → LexicalMarkdown.dev-B5z9kLbV.mjs} +62 -42
  26. package/dist/{LexicalMarkdown.prod-0M-Nc-rh.mjs → LexicalMarkdown.prod-wKzw7FFH.mjs} +255 -202
  27. package/dist/{LexicalRichText.dev-Cnr1kDym.mjs → LexicalRichText.dev-CUd6Li5F.mjs} +399 -120
  28. package/dist/{LexicalRichText.node-BUJZAiap.mjs → LexicalRichText.node-BKfaQ-CH.mjs} +12 -8
  29. package/dist/LexicalRichText.prod-SBewjJHx.mjs +708 -0
  30. package/dist/{LexicalSelection.dev-C4L7l8OB.mjs → LexicalSelection.dev-D27JOCqj.mjs} +48 -17
  31. package/dist/{LexicalSelection.node-CLKroUMQ.mjs → LexicalSelection.node-DBEwPjBu.mjs} +5 -4
  32. package/dist/{LexicalSelection.prod-DzFqpTlw.mjs → LexicalSelection.prod-OaYhXHOL.mjs} +101 -92
  33. package/dist/{LexicalTable.dev-Cc9-zqKa.mjs → LexicalTable.dev-6IFFOAE0.mjs} +590 -259
  34. package/dist/LexicalTable.prod-2CaLZ7fH.mjs +2524 -0
  35. package/dist/{LexicalUtils.dev-BRgK0L6G.mjs → LexicalUtils.dev-DJA7J_7v.mjs} +15 -19
  36. package/dist/{LexicalUtils.node-BVAwOkL4.mjs → LexicalUtils.node-Df9oPTlA.mjs} +6 -6
  37. package/dist/{LexicalUtils.prod-C1gtvVDP.mjs → LexicalUtils.prod-Bb7V4Ewg.mjs} +155 -159
  38. package/dist/bin/mxs.mjs +1 -1
  39. package/dist/esm-CDcJmHkG.mjs +2 -0
  40. package/dist/{esm-BNu4sUWV.mjs → esm-DLzrv7gD.mjs} +1837 -6015
  41. package/dist/index.d.mts +57 -62
  42. package/dist/index.mjs +1 -1
  43. package/dist/{mxs-CMX2yklg.mjs → mxs-BIRW5Axj.mjs} +13579 -8682
  44. package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
  45. package/dist/vendor/litexml/cli.mjs +7043 -6207
  46. package/dist/vendor/litexml/litexml-html-preview-client.css +80 -47
  47. package/dist/vendor/litexml/litexml-html-preview-client.js +14422 -10838
  48. package/dist/vendor/litexml/style.css +6 -2
  49. package/package.json +23 -23
  50. package/skills/commands-ai.md +45 -12
  51. package/skills/overview.md +1 -1
  52. package/dist/Lexical.prod-CeB9UQuo.mjs +0 -6816
  53. package/dist/LexicalList.prod-D0xX5d3G.mjs +0 -944
  54. package/dist/LexicalRichText.prod-BfbMQ9uM.mjs +0 -538
  55. package/dist/LexicalTable.prod-BgO4nCxy.mjs +0 -2336
  56. package/dist/esm-jbwcVZth.mjs +0 -2
@@ -1,8 +1,8 @@
1
- import { f as namedSignals, l as effect } from "./LexicalExtension.node-BWH6xbzG.mjs";
2
- import { $ as $insertNodeToNearestRootAtCaret, A as $getChildCaret, At as $setFormatFromDOM, Bn as KEY_ARROW_LEFT_COMMAND, Ct as $normalizeCaret, Dt as $rewindSiblingCaret, G as $getSiblingCaret, Gt as COMMAND_PRIORITY_BEFORE_EDITOR, Hn as KEY_ARROW_UP_COMMAND, Ir as getStyleObjectFromCSS, Kn as KEY_ESCAPE_COMMAND, R as $getNearestNodeFromDOMNode, Sr as getActiveElement, Un as KEY_BACKSPACE_COMMAND, W as $getSelection, Yt as COMMAND_PRIORITY_LOW, ai as safeCast, at as $isElementNode, b as $findMatchingParent, bn as INSERT_PARAGRAPH_COMMAND, br as defineExtension, bt as $isTextNode, ct as $isLeafNode, d as $createLineBreakNode, dn as ElementNode, fr as TextNode, ft as $isParagraphNode, gr as createCommand, hr as configExtension, ht as $isRootOrShadowRoot, ii as removeClassNamesFromElement, jr as getNearestEditorFromDOMNode, jt as $setPointFromCaret, kt as $setDirectionFromDOM, l as $copyNode, lr as SKIP_SELECTION_FOCUS_TAG, mr as buildImportMap, n as $applyNodeReplacement, ni as mergeRegister, oi as setDOMStyleFromCSS, p as $createParagraphNode, pr as addClassNamesToElement, pt as $isRangeSelection, qn as KEY_SPACE_COMMAND, qr as isHTMLElement, ri as normalizeClassNames, rt as $isDecoratorNode, sr as SKIP_DOM_SELECTION_TAG, t as $addUpdateTag, v as $createTextNode, z as $getNodeByKey, zn as KEY_ARROW_DOWN_COMMAND } from "./Lexical.node-BlCLnfA6.mjs";
3
- import { _ as isElementOfTag, a as $isBlockLevel, c as DOMImportExtension, h as defineImportRule, o as $propagateTextAlignToBlockChildren, s as CoreImportExtension, v as sel } from "./LexicalHtml.node-CVkbWtUA.mjs";
4
- import { i as $getNearestNodeOfType, p as calculateZoomLevel } from "./LexicalUtils.node-BVAwOkL4.mjs";
5
- //#region ../../node_modules/.pnpm/@lexical+list@0.46.0_typescript@6.0.3/node_modules/@lexical/list/dist/LexicalList.dev.mjs
1
+ import { f as namedSignals, l as effect } from "./LexicalExtension.node-5OymZQfy.mjs";
2
+ import { $r as isHTMLElement, $t as COMMAND_PRIORITY_LOW, A as $getChildCaret, At as $rewindSiblingCaret, B as $getNodeByKey, Et as $normalizeCaret, G as $getSelection, Hr as getStyleObjectFromCSS, I as $getDocument, K as $getSiblingCaret, Kn as KEY_ARROW_UP_COMMAND, Lr as getNearestEditorFromDOMNode, Mt as $setDirectionFromDOM, Nt as $setFormatFromDOM, Or as getActiveElement, Pt as $setPointFromCaret, St as $isTextNode, Tr as defineExtension, Un as KEY_ARROW_DOWN_COMMAND, Wn as KEY_ARROW_LEFT_COMMAND, Xn as KEY_ESCAPE_COMMAND, Yt as COMMAND_PRIORITY_BEFORE_EDITOR, Zn as KEY_SPACE_COMMAND, _r as TextNode, b as $findMatchingParent, br as configExtension, ci as mergeRegister, d as $createLineBreakNode, di as registerEventListeners, et as $insertNodeToNearestRootAtCaret, fi as removeClassNamesFromElement, fr as SKIP_DOM_SELECTION_TAG, gt as $isRootOrShadowRoot, hn as ElementNode, l as $copyNode, li as normalizeClassNames, lt as $isLeafNode, mi as setDOMStyleFromCSS, mr as SKIP_SELECTION_FOCUS_TAG, mt as $isRangeSelection, n as $applyNodeReplacement, ot as $isElementNode, p as $createParagraphNode, pi as safeCast, pt as $isParagraphNode, qn as KEY_BACKSPACE_COMMAND, t as $addUpdateTag, ui as registerEventListener, v as $createTextNode, vr as addClassNamesToElement, wn as INSERT_PARAGRAPH_COMMAND, xr as createCommand, yr as buildImportMap, z as $getNearestNodeFromDOMNode } from "./Lexical.node-D6wf2D5M.mjs";
3
+ import { a as $isBlockLevel, c as CoreImportExtension, g as defineImportRule, l as DOMImportExtension, o as $propagateTextAlignToBlockChildren, v as isElementOfTag, y as sel } from "./LexicalHtml.node-DpVNt7It.mjs";
4
+ import { f as calculateZoomLevel, i as $getNearestNodeOfType } from "./LexicalUtils.node-Df9oPTlA.mjs";
5
+ //#region ../../node_modules/.pnpm/@lexical+list@0.49.0_typescript@6.0.3/node_modules/@lexical/list/dist/LexicalList.dev.mjs
6
6
  /**
7
7
  * Copyright (c) Meta Platforms, Inc. and affiliates.
8
8
  *
@@ -80,7 +80,7 @@ function $getAllListItems(node) {
80
80
  * @param node - The node to be checked.
81
81
  * @returns true if the node is a ListItemNode and has a ListNode child, false otherwise.
82
82
  */
83
- function isNestedListNode(node) {
83
+ function $isNestedListNode(node) {
84
84
  return $isListItemNode(node) && $isListNode(node.getFirstChild());
85
85
  }
86
86
  /**
@@ -113,7 +113,7 @@ function $isSelectingEmptyListItem(anchorNode, nodes) {
113
113
  * the root/shadow root, it will replace the ListItemNode with a ListNode and the old ListItemNode.
114
114
  * Otherwise it will replace its parent with a new ListNode and re-insert the ListItemNode and any previous children.
115
115
  * If the selection's anchor node is not an empty ListItemNode, it will add a new ListNode or merge an existing ListNode,
116
- * unless the the node is a leaf node, in which case it will attempt to find a ListNode up the branch and replace it with
116
+ * unless the node is a leaf node, in which case it will attempt to find a ListNode up the branch and replace it with
117
117
  * a new ListNode, or create a new ListNode at the nearest root/shadow root.
118
118
  * @param listType - The type of list, "number" | "bullet" | "check".
119
119
  */
@@ -227,7 +227,7 @@ function $createListOrMerge(node, listType) {
227
227
  function mergeLists(list1, list2) {
228
228
  const listItem1 = list1.getLastChild();
229
229
  const listItem2 = list2.getFirstChild();
230
- if (listItem1 && listItem2 && isNestedListNode(listItem1) && isNestedListNode(listItem2)) {
230
+ if (listItem1 && listItem2 && $isNestedListNode(listItem1) && $isNestedListNode(listItem2)) {
231
231
  mergeLists(listItem1.getFirstChild(), listItem2.getFirstChild());
232
232
  listItem2.remove();
233
233
  }
@@ -303,11 +303,11 @@ function mergeNextSiblingListIfSameType(list) {
303
303
  */
304
304
  function $handleIndent(listItemNode) {
305
305
  const removed = /* @__PURE__ */ new Set();
306
- if (isNestedListNode(listItemNode) || removed.has(listItemNode.getKey())) return;
306
+ if ($isNestedListNode(listItemNode) || removed.has(listItemNode.getKey())) return;
307
307
  const parent = listItemNode.getParent();
308
308
  const nextSibling = listItemNode.getNextSibling();
309
309
  const previousSibling = listItemNode.getPreviousSibling();
310
- if (isNestedListNode(nextSibling) && isNestedListNode(previousSibling)) {
310
+ if ($isNestedListNode(nextSibling) && $isNestedListNode(previousSibling)) {
311
311
  const innerList = previousSibling.getFirstChild();
312
312
  if ($isListNode(innerList)) {
313
313
  innerList.append(listItemNode);
@@ -318,13 +318,13 @@ function $handleIndent(listItemNode) {
318
318
  removed.add(nextSibling.getKey());
319
319
  }
320
320
  }
321
- } else if (isNestedListNode(nextSibling)) {
321
+ } else if ($isNestedListNode(nextSibling)) {
322
322
  const innerList = nextSibling.getFirstChild();
323
323
  if ($isListNode(innerList)) {
324
324
  const firstChild = innerList.getFirstChild();
325
325
  if (firstChild !== null) firstChild.insertBefore(listItemNode);
326
326
  }
327
- } else if (isNestedListNode(previousSibling)) {
327
+ } else if ($isNestedListNode(previousSibling)) {
328
328
  const innerList = previousSibling.getFirstChild();
329
329
  if ($isListNode(innerList)) innerList.append(listItemNode);
330
330
  } else if ($isListNode(parent)) {
@@ -344,7 +344,7 @@ function $handleIndent(listItemNode) {
344
344
  * @param listItemNode - The ListItemNode to remove the indent (outdent).
345
345
  */
346
346
  function $handleOutdent(listItemNode) {
347
- if (isNestedListNode(listItemNode)) return;
347
+ if ($isNestedListNode(listItemNode)) return;
348
348
  const parentList = listItemNode.getParent();
349
349
  const grandparentListItem = parentList ? parentList.getParent() : void 0;
350
350
  if ($isListNode(grandparentListItem ? grandparentListItem.getParent() : void 0) && $isListItemNode(grandparentListItem) && $isListNode(parentList)) {
@@ -481,7 +481,7 @@ var ListItemNode = class extends ElementNode {
481
481
  this.__checked = prevNode.__checked;
482
482
  }
483
483
  createDOM(config) {
484
- const element = document.createElement("li");
484
+ const element = $getDocument().createElement("li");
485
485
  this.updateListItemDOM(null, element, config);
486
486
  return element;
487
487
  }
@@ -508,7 +508,7 @@ var ListItemNode = class extends ElementNode {
508
508
  if (formatType) element.style.textAlign = formatType;
509
509
  const direction = this.getDirection();
510
510
  if (direction) element.dir = direction;
511
- if (isNestedListNode(this)) return {
511
+ if ($isNestedListNode(this)) return {
512
512
  after(containerElement) {
513
513
  if (isHTMLElement(containerElement)) {
514
514
  const prevSibling = containerElement.previousElementSibling;
@@ -593,7 +593,7 @@ var ListItemNode = class extends ElementNode {
593
593
  const prevSibling = this.getPreviousSibling();
594
594
  const nextSibling = this.getNextSibling();
595
595
  super.remove(preserveEmptyParent);
596
- if (prevSibling && nextSibling && isNestedListNode(prevSibling) && isNestedListNode(nextSibling)) {
596
+ if (prevSibling && nextSibling && $isNestedListNode(prevSibling) && $isNestedListNode(nextSibling)) {
597
597
  mergeLists(prevSibling.getFirstChild(), nextSibling.getFirstChild());
598
598
  nextSibling.remove();
599
599
  }
@@ -608,27 +608,23 @@ var ListItemNode = class extends ElementNode {
608
608
  return newElement;
609
609
  }
610
610
  collapseAtStart(selection) {
611
- const paragraph = $createParagraphNode();
612
- this.getChildren().forEach((child) => paragraph.append(child));
611
+ if ($isNestedListNode(this)) return false;
613
612
  const listNode = this.getParentOrThrow();
614
- const listNodeParent = listNode.getParentOrThrow();
615
- const isIndented = $isListItemNode(listNodeParent);
616
- if (listNode.getChildrenSize() === 1) if (isIndented) {
617
- listNode.remove();
618
- listNodeParent.select();
619
- } else {
620
- listNode.insertBefore(paragraph);
621
- listNode.remove();
622
- const anchor = selection.anchor;
623
- const focus = selection.focus;
624
- const key = paragraph.getKey();
625
- if (anchor.type === "element" && anchor.getNode().is(this)) anchor.set(key, anchor.offset, "element");
626
- if (focus.type === "element" && focus.getNode().is(this)) focus.set(key, focus.offset, "element");
613
+ if ($isListItemNode(listNode.getParentOrThrow())) {
614
+ $handleOutdent(this);
615
+ return true;
627
616
  }
628
- else {
629
- listNode.insertBefore(paragraph);
630
- this.remove();
617
+ const paragraph = $createParagraphNode().append(...this.getChildren());
618
+ const nextSiblings = this.getNextSiblings();
619
+ if (nextSiblings.length > 0) {
620
+ const newList = $copyNode(listNode);
621
+ newList.append(...nextSiblings);
622
+ listNode.insertAfter(newList);
631
623
  }
624
+ listNode.insertAfter(paragraph);
625
+ this.remove();
626
+ if (listNode.getChildrenSize() === 0) listNode.remove();
627
+ paragraph.selectStart();
632
628
  return true;
633
629
  }
634
630
  getValue() {
@@ -859,7 +855,7 @@ var ListNode = class extends ElementNode {
859
855
  }
860
856
  createDOM(config, _editor) {
861
857
  const tag = this.__tag;
862
- const dom = document.createElement(tag);
858
+ const dom = $getDocument().createElement(tag);
863
859
  if (this.__start !== 1) dom.setAttribute("start", String(this.__start));
864
860
  dom.__lexicalListType = this.__listType;
865
861
  $setListThemeClassNames(dom, config.theme, this);
@@ -1100,23 +1096,16 @@ function registerCheckList(editor, options) {
1100
1096
  return false;
1101
1097
  });
1102
1098
  }, COMMAND_PRIORITY_LOW), editor.registerRootListener((rootElement) => {
1103
- if (rootElement !== null) {
1104
- rootElement.addEventListener("click", configHandleClick);
1105
- rootElement.addEventListener("pointerup", configHandlePointerUp);
1106
- rootElement.addEventListener("pointerdown", configHandleSelectDefaults, { capture: true });
1107
- rootElement.addEventListener("mousedown", configHandleSelectDefaults, { capture: true });
1108
- rootElement.addEventListener("touchstart", configHandleSelectDefaults, {
1109
- capture: true,
1110
- passive: false
1111
- });
1112
- return () => {
1113
- rootElement.removeEventListener("click", configHandleClick);
1114
- rootElement.removeEventListener("pointerup", configHandlePointerUp);
1115
- rootElement.removeEventListener("pointerdown", configHandleSelectDefaults, { capture: true });
1116
- rootElement.removeEventListener("mousedown", configHandleSelectDefaults, { capture: true });
1117
- rootElement.removeEventListener("touchstart", configHandleSelectDefaults, { capture: true });
1118
- };
1119
- }
1099
+ if (rootElement !== null) return mergeRegister(registerEventListeners(rootElement, {
1100
+ click: configHandleClick,
1101
+ pointerup: configHandlePointerUp
1102
+ }), registerEventListeners(rootElement, {
1103
+ mousedown: configHandleSelectDefaults,
1104
+ pointerdown: configHandleSelectDefaults
1105
+ }, { capture: true }), registerEventListener(rootElement, "touchstart", configHandleSelectDefaults, {
1106
+ capture: true,
1107
+ passive: false
1108
+ }));
1120
1109
  }));
1121
1110
  }
1122
1111
  function handleCheckItemEvent(event, callback) {
@@ -1140,7 +1129,8 @@ function handleCheckItemEvent(event, callback) {
1140
1129
  const rect = target.getBoundingClientRect();
1141
1130
  const zoom = calculateZoomLevel(target);
1142
1131
  const clientXInPixels = clientX / zoom;
1143
- const beforeStyles = window.getComputedStyle ? window.getComputedStyle(target, "::before") : { width: "0px" };
1132
+ const targetView = target.ownerDocument.defaultView;
1133
+ const beforeStyles = targetView ? targetView.getComputedStyle(target, "::before") : { width: "0px" };
1144
1134
  const beforeWidthInPixels = parseFloat(beforeStyles.width);
1145
1135
  const clickAreaPadding = pointerType === "touch" || "pointerType" in event && event.pointerType === "touch" ? 32 : 0;
1146
1136
  if (target.dir === "rtl" ? clientXInPixels < rect.right + clickAreaPadding && clientXInPixels > rect.right - beforeWidthInPixels - clickAreaPadding : clientXInPixels > rect.left - clickAreaPadding && clientXInPixels < rect.left + beforeWidthInPixels + clickAreaPadding) callback();
@@ -1413,7 +1403,18 @@ function registerList(editor, options) {
1413
1403
  }, COMMAND_PRIORITY_LOW), editor.registerCommand(INSERT_PARAGRAPH_COMMAND, () => {
1414
1404
  return $handleListInsertParagraph(!!(options && options.restoreNumbering));
1415
1405
  }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, (event) => {
1416
- if ($handleListItemBackspaceAdjacentToDecorator()) {
1406
+ const selection = $getSelection();
1407
+ if (!$isRangeSelection(selection) || !selection.isCollapsed()) return false;
1408
+ const { anchor } = selection;
1409
+ if (anchor.offset !== 0) return false;
1410
+ let current = anchor.getNode();
1411
+ while (!$isListItemNode(current)) {
1412
+ if (current.getPreviousSibling() !== null) return false;
1413
+ const parent = current.getParent();
1414
+ if (parent === null) return false;
1415
+ current = parent;
1416
+ }
1417
+ if ($isListItemNode(current) && current.collapseAtStart(selection)) {
1417
1418
  event.preventDefault();
1418
1419
  return true;
1419
1420
  }
@@ -1485,34 +1486,6 @@ function $findChildrenEndListItemNode(listItemNode) {
1485
1486
  return current;
1486
1487
  }
1487
1488
  /**
1488
- * #5072: When the first list item of a top-level list is adjacent to a
1489
- * non-isolated decorator that is either keyboard-selectable or a block, and
1490
- * the caret sits at the start of that list item, Backspace previously fell
1491
- * through `deleteCharacter`'s merge-block path and deleted the decorator
1492
- * outright. Convert the first list item into a paragraph inserted before the
1493
- * list instead, keeping the decorator and the list item's content intact.
1494
- */
1495
- function $handleListItemBackspaceAdjacentToDecorator() {
1496
- const selection = $getSelection();
1497
- if (!$isRangeSelection(selection) || !selection.isCollapsed() || selection.anchor.offset !== 0) return false;
1498
- const anchorNode = selection.anchor.getNode();
1499
- const listItem = $findMatchingParent(anchorNode, $isListItemNode);
1500
- if (!$isListItemNode(listItem)) return false;
1501
- const firstDescendant = listItem.getFirstDescendant();
1502
- if (firstDescendant === null) return false;
1503
- if (!listItem.is(anchorNode) && !firstDescendant.is(anchorNode)) return false;
1504
- const list = listItem.getParent();
1505
- if (!$isListNode(list) || !listItem.is(list.getFirstChild())) return false;
1506
- const previousBlock = list.getPreviousSibling();
1507
- if (!$isDecoratorNode(previousBlock) || previousBlock.isIsolated() || !(previousBlock.isKeyboardSelectable() || !previousBlock.isInline())) return false;
1508
- const paragraph = $createParagraphNode().append(...listItem.getChildren());
1509
- list.insertBefore(paragraph);
1510
- listItem.remove();
1511
- if (list.isEmpty()) list.remove();
1512
- paragraph.selectStart();
1513
- return true;
1514
- }
1515
- /**
1516
1489
  * Copyright (c) Meta Platforms, Inc. and affiliates.
1517
1490
  *
1518
1491
  * This source code is licensed under the MIT license found in the