@lexical/list 0.1.11 → 0.1.14

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.
@@ -477,7 +477,7 @@ function outdentList() {
477
477
  function $handleListInsertParagraph() {
478
478
  const selection = lexical.$getSelection();
479
479
 
480
- if (selection === null || !selection.isCollapsed()) {
480
+ if (!lexical.$isRangeSelection(selection) || !selection.isCollapsed()) {
481
481
  return false;
482
482
  } // Only run this code on empty list items
483
483
 
@@ -23,7 +23,7 @@ class I extends k.ElementNode{static getType(){return"list"}static clone(b){retu
23
23
  priority:0})}}canBeEmpty(){return!1}append(...b){for(let c=0;c<b.length;c++){var a=b[c];if(f.$isListItemNode(a))super.append(a);else{const d=f.$createListItemNode();L(a)?d.append(a):(a=k.$createTextNode(a.getTextContent()),d.append(a));super.append(d)}}return this}}
24
24
  function J(b,a,c){const d=[],e=[];a=a.list;if(void 0!==a){a:{var g=1;for(var h=c.getParent();null!=h;){if(f.$isListItemNode(h)){h=h.getParent();if(f.$isListNode(h)){g++;h=h.getParent();continue}n(2)}break a}}h=g%5;const l=a[c.__tag+(0===h?5:h)],m=a[c.__tag];let r;a=a.nested;void 0!==a&&a.list&&(r=a.list);void 0!==m&&d.push(m);if(void 0!==l)for(a=l.split(" "),d.push(...a),a=1;6>a;a++)a!==h&&e.push(c.__tag+a);void 0!==r&&(c=r.split(" "),1<g?d.push(...c):e.push(...c))}0<d.length&&A(b,...d);0<e.length&&
25
25
  B(b,...e)}function K(b){b=b.nodeName.toLowerCase();let a=null;if("ol"===b||"ul"===b)a=M(b);return{node:a}}function M(b,a=1){return new I(b,a)}function L(b){return b instanceof I}exports.$createListItemNode=H;exports.$createListNode=M;
26
- exports.$handleListInsertParagraph=function(){var b=k.$getSelection();if(null===b||!b.isCollapsed())return!1;b=b.anchor.getNode();if(!f.$isListItemNode(b)||""!==b.getTextContent())return!1;var a=q(b),c=b.getParent();f.$isListNode(c)||n(2);const d=c.getParent();let e;if(k.$isRootNode(d))e=k.$createParagraphNode(),a.insertAfter(e);else if(f.$isListItemNode(d))e=f.$createListItemNode(),d.insertAfter(e);else return!1;e.select();a=b.getNextSiblings();if(0<a.length){const g=f.$createListNode(c.getTag());
26
+ exports.$handleListInsertParagraph=function(){var b=k.$getSelection();if(!k.$isRangeSelection(b)||!b.isCollapsed())return!1;b=b.anchor.getNode();if(!f.$isListItemNode(b)||""!==b.getTextContent())return!1;var a=q(b),c=b.getParent();f.$isListNode(c)||n(2);const d=c.getParent();let e;if(k.$isRootNode(d))e=k.$createParagraphNode(),a.insertAfter(e);else if(f.$isListItemNode(d))e=f.$createListItemNode(),d.insertAfter(e);else return!1;e.select();a=b.getNextSiblings();if(0<a.length){const g=f.$createListNode(c.getTag());
27
27
  k.$isParagraphNode(e)?e.insertAfter(g):(c=f.$createListItemNode(),c.append(g),e.insertAfter(c));a.forEach(h=>{h.remove();g.append(h)})}v(b);return!0};exports.$isListItemNode=G;exports.$isListNode=L;exports.ListItemNode=C;exports.ListNode=I;exports.indentList=function(){return z("indent")};
28
28
  exports.insertList=function(b,a){b.update(()=>{var c=k.$getSelection();if(k.$isRangeSelection(c)){var d=c.getNodes();c=c.anchor.getNode();var e=c.getParent();if(0===d.length)d=f.$createListNode(a),k.$isRootNode(e)?(c.replace(d),c=f.$createListItemNode(),d.append(c)):f.$isListItemNode(c)&&(c=c.getParentOrThrow(),d.append(...c.getChildren()),c.replace(d));else for(c=new Set,e=0;e<d.length;e++){var g=d[e];if(k.$isElementNode(g)&&g.isEmpty()&&!c.has(g.getKey()))w(g,a);else if(k.$isLeafNode(g))for(g=g.getParent();null!=
29
29
  g;){const l=g.getKey();if(f.$isListNode(g)){if(!c.has(l)){var h=f.$createListNode(a);h.append(...g.getChildren());g.replace(h);c.add(l)}break}else{h=g.getParent();if(k.$isRootNode(h)&&!c.has(l)){c.add(l);w(g,a);break}g=h}}}}})};exports.outdentList=function(){return z("outdent")};
package/package.json CHANGED
@@ -12,10 +12,10 @@
12
12
  "list"
13
13
  ],
14
14
  "license": "MIT",
15
- "version": "0.1.11",
15
+ "version": "0.1.14",
16
16
  "main": "LexicalList.js",
17
17
  "peerDependencies": {
18
- "lexical": "0.1.11"
18
+ "lexical": "0.1.14"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",