@lexical/list
Advanced tools
Comparing version 0.18.1-nightly.20241004.0 to 0.18.1-nightly.20241007.0
@@ -233,10 +233,7 @@ /** | ||
const listItem = $createListItemNode(); | ||
listItem.setFormat(node.getFormatType()); | ||
listItem.setIndent(node.getIndent()); | ||
append(listItem, node.getChildren()); | ||
let targetList; | ||
if ($isListNode(previousSibling) && listType === previousSibling.getListType()) { | ||
previousSibling.append(listItem); | ||
node.remove(); | ||
// if the same type of list is on both sides, merge them. | ||
if ($isListNode(nextSibling) && listType === nextSibling.getListType()) { | ||
@@ -246,7 +243,6 @@ append(previousSibling, nextSibling.getChildren()); | ||
} | ||
return previousSibling; | ||
targetList = previousSibling; | ||
} else if ($isListNode(nextSibling) && listType === nextSibling.getListType()) { | ||
nextSibling.getFirstChildOrThrow().insertBefore(listItem); | ||
node.remove(); | ||
return nextSibling; | ||
targetList = nextSibling; | ||
} else { | ||
@@ -256,4 +252,9 @@ const list = $createListNode(listType); | ||
node.replace(list); | ||
return list; | ||
targetList = list; | ||
} | ||
// listItem needs to be attached to root prior to setting indent | ||
listItem.setFormat(node.getFormatType()); | ||
listItem.setIndent(node.getIndent()); | ||
node.remove(); | ||
return targetList; | ||
} | ||
@@ -260,0 +261,0 @@ |
@@ -14,3 +14,3 @@ /** | ||
!q(f)&&!c.has(f.getKey()))F(f,b);else if(h.$isLeafNode(f))for(f=f.getParent();null!=f;){let m=f.getKey();if(r(f)){if(!c.has(m)){var k=B(b);E(k,f.getChildren());f.replace(k);c.add(m)}break}else{k=f.getParent();if(h.$isRootOrShadowRoot(k)&&!c.has(m)){c.add(m);F(f,b);break}f=k}}}}})}function E(a,b){a.splice(a.getChildrenSize(),0,b)} | ||
function F(a,b){if(r(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=y();e.setFormat(a.getFormatType());e.setIndent(a.getIndent());E(e,a.getChildren());if(r(c)&&b===c.getListType())return c.append(e),a.remove(),r(d)&&b===d.getListType()&&(E(c,d.getChildren()),d.remove()),c;if(r(d)&&b===d.getListType())return d.getFirstChildOrThrow().insertBefore(e),a.remove(),d;b=B(b);b.append(e);a.replace(b);return b} | ||
function F(a,b){if(r(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=y();E(e,a.getChildren());r(c)&&b===c.getListType()?(c.append(e),r(d)&&b===d.getListType()&&(E(c,d.getChildren()),d.remove()),b=c):r(d)&&b===d.getListType()?(d.getFirstChildOrThrow().insertBefore(e),b=d):(b=B(b),b.append(e),a.replace(b));e.setFormat(a.getFormatType());e.setIndent(a.getIndent());a.remove();return b} | ||
function G(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&v(c)&&v(d)&&(G(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&a.append(...c);b.remove()} | ||
@@ -17,0 +17,0 @@ function H(a){a.update(()=>{let b=h.$getSelection();if(h.$isRangeSelection(b)){var c=new Set,d=b.getNodes(),e=b.anchor.getNode();if(z(e,d))c.add(t(e));else for(e=0;e<d.length;e++){var f=d[e];h.$isLeafNode(f)&&(f=g.$getNearestNodeOfType(f,I),null!=f&&c.add(t(f)))}for(let k of c){c=k;d=u(k);for(let m of d)d=h.$createParagraphNode(),E(d,m.getChildren()),c.insertAfter(d),c=d,m.__key===b.anchor.key&&b.anchor.set(d.getKey(),0,"element"),m.__key===b.focus.key&&b.focus.set(d.getKey(),0,"element"),m.remove(); |
@@ -11,8 +11,8 @@ { | ||
"license": "MIT", | ||
"version": "0.18.1-nightly.20241004.0", | ||
"version": "0.18.1-nightly.20241007.0", | ||
"main": "LexicalList.js", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"@lexical/utils": "0.18.1-nightly.20241004.0", | ||
"lexical": "0.18.1-nightly.20241004.0" | ||
"@lexical/utils": "0.18.1-nightly.20241007.0", | ||
"lexical": "0.18.1-nightly.20241007.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139700
2934
+ Added@lexical/clipboard@0.18.1-nightly.20241007.0(transitive)
+ Added@lexical/html@0.18.1-nightly.20241007.0(transitive)
+ Added@lexical/selection@0.18.1-nightly.20241007.0(transitive)
+ Added@lexical/table@0.18.1-nightly.20241007.0(transitive)
+ Added@lexical/utils@0.18.1-nightly.20241007.0(transitive)
+ Addedlexical@0.18.1-nightly.20241007.0(transitive)
- Removed@lexical/clipboard@0.18.1-nightly.20241004.0(transitive)
- Removed@lexical/html@0.18.1-nightly.20241004.0(transitive)
- Removed@lexical/selection@0.18.1-nightly.20241004.0(transitive)
- Removed@lexical/table@0.18.1-nightly.20241004.0(transitive)
- Removed@lexical/utils@0.18.1-nightly.20241004.0(transitive)
- Removedlexical@0.18.1-nightly.20241004.0(transitive)