chore: update lexical patch [skip e2e]

This commit is contained in:
Aman Harwara
2024-02-07 11:36:23 +05:30
parent c3dad5ae8d
commit 345d188fbb
5 changed files with 202 additions and 38 deletions

Binary file not shown.

View File

@@ -1,8 +1,8 @@
diff --git a/LexicalList.dev.js b/LexicalList.dev.js
index 3b91ac0e93f7e6a9d784c7d8a19f11496369ecc0..7965886b460ec64dbfad0025e5076ccb656d51c3 100644
index 3b91ac0e93f7e6a9d784c7d8a19f11496369ecc0..04236f990c38a3dded3da16dc35ef7cb0300a5fd 100644
--- a/LexicalList.dev.js
+++ b/LexicalList.dev.js
@@ -140,26 +140,18 @@ function wrapInListItem(node) {
@@ -140,27 +140,6 @@ function wrapInListItem(node) {
function $isSelectingEmptyListItem(anchorNode, nodes) {
return $isListItemNode(anchorNode) && (nodes.length === 0 || nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0);
}
@@ -13,19 +13,11 @@ index 3b91ac0e93f7e6a9d784c7d8a19f11496369ecc0..7965886b460ec64dbfad0025e5076ccb
- if (!$isListNode(list)) {
- {
- throw Error(`$getListItemValue: list node is not parent of list item node`);
+function $getListItemValues(list) {
+ let value = list.getStart();
+ const keyToValue = new Map();
+ for (const child of list.getChildren()) {
+ if ($isListItemNode(child)) {
+ keyToValue.set(child.getKey(), value);
+ if (!$isListNode(child.getFirstChild())) {
+ value++;
}
- }
- } else {
- value = list.getStart();
}
}
- }
- }
- const siblings = listItem.getPreviousSiblings();
- for (let i = 0; i < siblings.length; i++) {
- const sibling = siblings[i];
@@ -34,38 +26,210 @@ index 3b91ac0e93f7e6a9d784c7d8a19f11496369ecc0..7965886b460ec64dbfad0025e5076ccb
- }
- }
- return value;
+ return keyToValue;
}
-}
/**
@@ -360,11 +352,15 @@ function removeList(editor) {
function updateChildrenListItemValue(list, children) {
const childrenOrExisting = children || list.getChildren();
if (childrenOrExisting !== undefined) {
+ const keyValueMap = $getListItemValues(list);
for (let i = 0; i < childrenOrExisting.length; i++) {
const child = childrenOrExisting[i];
if ($isListItemNode(child)) {
const prevValue = child.getValue();
* Inserts a new ListNode. If the selection's anchor node is an empty ListItemNode and is a child of
@@ -357,17 +336,19 @@ function removeList(editor) {
* @param list - The list whose children are updated.
* @param children - An array of the children to be updated.
*/
-function updateChildrenListItemValue(list, children) {
- const childrenOrExisting = children || list.getChildren();
- if (childrenOrExisting !== undefined) {
- for (let i = 0; i < childrenOrExisting.length; i++) {
- const child = childrenOrExisting[i];
- if ($isListItemNode(child)) {
- const prevValue = child.getValue();
- const nextValue = $getListItemValue(child);
+ const nextValue = keyValueMap.get(child.getKey());
+ if (!(nextValue !== undefined)) {
+ throw Error(`updateChildrenListItemValue: list node is not parent of list item node`);
+ }
if (prevValue !== nextValue) {
child.setValue(nextValue);
- if (prevValue !== nextValue) {
- child.setValue(nextValue);
- }
+function updateChildrenListItemValue(list) {
+ const isNotChecklist = list.getListType() !== 'check';
+ let value = list.getStart();
+ for (const child of list.getChildren()) {
+ if ($isListItemNode(child)) {
+ if (child.getValue() !== value) {
+ child.setValue(value);
+ }
+ if (isNotChecklist && child.getChecked() != null) {
+ child.setChecked(undefined);
+ }
+ if (!$isListNode(child.getFirstChild())) {
+ value++;
}
}
}
@@ -603,12 +584,14 @@ class ListItemNode extends lexical.ElementNode {
}
static transform() {
return node => {
+ if (!$isListItemNode(node)) {
+ throw Error(`node is not a ListItemNode`);
+ }
+ if (node.__checked == null) {
+ return;
+ }
const parent = node.getParent();
if ($isListNode(parent)) {
- updateChildrenListItemValue(parent);
- if (!$isListItemNode(node)) {
- throw Error(`node is not a ListItemNode`);
- }
if (parent.getListType() !== 'check' && node.getChecked() != null) {
node.setChecked(undefined);
}
@@ -704,14 +687,8 @@ class ListItemNode extends lexical.ElementNode {
throw Error(`insertAfter: list node is not parent of list item node`);
}
}
- const siblings = this.getNextSiblings();
if ($isListItemNode(node)) {
- const after = super.insertAfter(node, restoreSelection);
- const afterListNode = node.getParentOrThrow();
- if ($isListNode(afterListNode)) {
- updateChildrenListItemValue(afterListNode);
- }
- return after;
+ return super.insertAfter(node, restoreSelection);
}
// Attempt to merge if the list is of the same type.
@@ -725,6 +702,7 @@ class ListItemNode extends lexical.ElementNode {
}
return child;
}
+ const siblings = this.getNextSiblings();
// Otherwise, split the list
// Split the lists and insert the node in between them
@@ -743,11 +721,6 @@ class ListItemNode extends lexical.ElementNode {
if (prevSibling && nextSibling && isNestedListNode(prevSibling) && isNestedListNode(nextSibling)) {
mergeLists(prevSibling.getFirstChild(), nextSibling.getFirstChild());
nextSibling.remove();
- } else if (nextSibling) {
- const parent = nextSibling.getParent();
- if ($isListNode(parent)) {
- updateChildrenListItemValue(parent);
- }
}
}
insertNewAfter(_, restoreSelection = true) {
@@ -839,16 +812,6 @@ class ListItemNode extends lexical.ElementNode {
}
return this;
}
- insertBefore(nodeToInsert) {
- if ($isListItemNode(nodeToInsert)) {
- const parent = this.getParentOrThrow();
- if ($isListNode(parent)) {
- const siblings = this.getNextSiblings();
- updateChildrenListItemValue(parent, siblings);
- }
- }
- return super.insertBefore(nodeToInsert);
- }
canInsertAfter(node) {
return $isListItemNode(node);
}
@@ -1018,6 +981,14 @@ class ListNode extends lexical.ElementNode {
setListThemeClassNames(dom, config.theme, this);
return false;
}
+ static transform() {
+ return node => {
+ if (!$isListNode(node)) {
+ throw Error(`node is not a ListNode`);
+ }
+ updateChildrenListItemValue(node);
+ };
+ }
static importDOM() {
return {
ol: node => ({
diff --git a/LexicalList.prod.js b/LexicalList.prod.js
index 4687f6a90633c254974aedd06538d334f84de249..462d3ab6f912f9e843d996ce19512529608829dd 100644
index 4687f6a90633c254974aedd06538d334f84de249..d8d58c7f664b5a4999e76041b755280fe2b25214 100644
--- a/LexicalList.prod.js
+++ b/LexicalList.prod.js
@@ -8,7 +8,8 @@
@@ -8,22 +8,23 @@
function n(a){let b=1;for(a=a.getParent();null!=a;){if(p(a)){a=a.getParent();if(q(a)){b++;a=a.getParent();continue}l(40)}break}return b}function r(a){a=a.getParent();q(a)||l(40);let b=a;for(;null!==b;)b=b.getParent(),q(b)&&(a=b);return a}function t(a){let b=[];a=a.getChildren().filter(p);for(let c=0;c<a.length;c++){let d=a[c],e=d.getFirstChild();q(e)?b=b.concat(t(e)):b.push(d)}return b}function u(a){return p(a)&&q(a.getFirstChild())}
function v(a){for(;null==a.getNextSibling()&&null==a.getPreviousSibling();){let b=a.getParent();if(null==b||!p(a)&&!q(a))break;a=b}a.remove()}function w(a){return y().append(a)}function z(a,b){return p(a)&&(0===b.length||1===b.length&&a.is(b[0])&&0===a.getChildrenSize())}function C(a,b){a.splice(a.getChildrenSize(),0,b)}
function D(a,b){if(q(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=y();e.setFormat(a.getFormatType());e.setIndent(a.getIndent());C(e,a.getChildren());if(q(c)&&b===c.getListType())return c.append(e),a.remove(),q(d)&&b===d.getListType()&&(C(c,d.getChildren()),d.remove()),c;if(q(d)&&b===d.getListType())return d.getFirstChildOrThrow().insertBefore(e),a.remove(),d;b=E(b);b.append(e);a.replace(b);F(b);return b}
-function G(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&u(c)&&u(d)&&(G(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&(a.append(...c),F(a));b.remove()}function F(a,b){a=b||a.getChildren();if(void 0!==a)for(b=0;b<a.length;b++){let f=a[b];if(p(f)){let g=f.getValue();var c=f,d=c.getParent(),e=1;null!=d&&(q(d)?e=d.getStart():l(44));c=c.getPreviousSiblings();for(d=0;d<c.length;d++){let m=c[d];p(m)&&!q(m.getFirstChild())&&e++}g!==e&&f.setValue(e)}}}
+function G(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&u(c)&&u(d)&&(G(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&(a.append(...c),F(a));b.remove()}
+function F(a,b){b=b||a.getChildren();if(void 0!==b){var c=a.getStart(),d=new Map;for(var e of a.getChildren())p(e)&&(d.set(e.getKey(),c),q(e.getFirstChild())||c++);a=d;for(e=0;e<b.length;e++)if(c=b[e],p(c)){d=c.getValue();let f=a.get(c.getKey());if(void 0===f)throw Error("updateChildrenListItemValue: list node is not parent of list item node");d!==f&&c.setValue(f)}}}
+function G(a,b){var c=a.getLastChild();let d=b.getFirstChild();c&&d&&u(c)&&u(d)&&(G(c.getFirstChild(),d.getFirstChild()),d.remove());c=b.getChildren();0<c.length&&(a.append(...c),F(a));b.remove()}function F(a){let b="check"!==a.getListType(),c=a.getStart();for(let d of a.getChildren())p(d)&&(d.getValue()!==c&&d.setValue(c),b&&null!=d.getChecked()&&d.setChecked(void 0),q(d.getFirstChild())||c++)}
function H(a){if(!u(a)){var b=a.getParent(),c=b?b.getParent():void 0,d=c?c.getParent():void 0;if(q(d)&&p(c)&&q(b)){var e=b?b.getFirstChild():void 0,f=b?b.getLastChild():void 0;if(a.is(e))c.insertBefore(a),b.isEmpty()&&c.remove();else if(a.is(f))c.insertAfter(a),b.isEmpty()&&c.remove();else{var g=b.getListType();e=y();let m=E(g);e.append(m);a.getPreviousSiblings().forEach(x=>m.append(x));f=y();g=E(g);f.append(g);C(g,a.getNextSiblings());c.insertBefore(e);c.insertAfter(f);c.replace(a)}F(b);F(d)}}}
class I extends h.ElementNode{static getType(){return"listitem"}static clone(a){return new I(a.__value,a.__checked,a.__key)}constructor(a,b,c){super(c);this.__value=void 0===a?1:a;this.__checked=b}createDOM(a){let b=document.createElement("li"),c=this.getParent();q(c)&&"check"===c.getListType()&&J(b,this,null);b.value=this.__value;K(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();q(d)&&"check"===d.getListType()&&J(b,this,a);b.value=this.__value;K(b,c.theme,this);return!1}static transform(){return a=>
{let b=a.getParent();q(b)&&(F(b),p(a)||l(144),"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:L,priority:0})}}static importJSON(a){let b=y();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),
-{let b=a.getParent();q(b)&&(F(b),p(a)||l(144),"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0))}}static importDOM(){return{li:()=>({conversion:L,priority:0})}}static importJSON(a){let b=y();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",value:this.getValue(),
-version:1}}append(...a){for(let b=0;b<a.length;b++){let c=a[b];if(h.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(p(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!q(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=E(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling();d.append(f)}c.insertAfter(a);
-a.insertAfter(d)}b&&(h.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){var c=this.getParentOrThrow();q(c)||l(39);var d=this.getNextSiblings();if(p(a))return b=super.insertAfter(a,b),a=a.getParentOrThrow(),q(a)&&F(a),b;if(q(a)){c=a;a=a.getChildren();for(d=a.length-1;0<=d;d--)c=a[d],this.insertAfter(c,b);return c}c.insertAfter(a,b);if(0!==d.length){let e=E(c.getListType());d.forEach(f=>e.append(f));
-a.insertAfter(e,b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a);b&&c&&u(b)&&u(c)?(G(b.getFirstChild(),c.getFirstChild()),c.remove()):c&&(a=c.getParent(),q(a)&&F(a))}insertNewAfter(a,b=!0){a=y(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=p(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):
-(c.insertBefore(b),c.remove(),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){return this.getLatest().__checked}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();
-if(null===a)return this.getLatest().__indent;a=a.getParentOrThrow();let b=0;for(;p(a);)a=a.getParentOrThrow().getParentOrThrow(),b++;return b}setIndent(a){"number"===typeof a&&-1<a||l(117);let b=this.getIndent();for(;b!==a;)if(b<a){a:{var c=new Set;if(u(this)||c.has(this.getKey()))break a;let g=this.getParent();var d=this.getNextSibling(),e=this.getPreviousSibling();if(u(d)&&u(e)){if(e=e.getFirstChild(),q(e)){e.append(this);var f=d.getFirstChild();q(f)&&(f=f.getChildren(),C(e,f),d.remove(),c.add(d.getKey()));
-F(e)}}else u(d)?(d=d.getFirstChild(),q(d)&&(c=d.getFirstChild(),null!==c&&c.insertBefore(this),F(d))):u(e)?(d=e.getFirstChild(),q(d)&&(d.append(this),F(d))):q(g)&&(c=y(),f=E(g.getListType()),c.append(f),f.append(this),e?e.insertAfter(c):d?d.insertBefore(c):g.append(c),F(f));q(g)&&F(g)}b++}else H(this),b--;return this}insertBefore(a){if(p(a)){let b=this.getParentOrThrow();if(q(b)){let c=this.getNextSiblings();F(b,c)}}return super.insertBefore(a)}canInsertAfter(a){return p(a)}canReplaceWith(a){return p(a)}canMergeWith(a){return h.$isParagraphNode(a)||
-p(a)}extractWithChild(a,b){if(!h.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return E("bullet")}}
+{p(a)||l(144);if(null!=a.__checked){var b=a.getParent();q(b)&&"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0)}}}static importDOM(){return{li:()=>({conversion:L,priority:0})}}static importJSON(a){let b=y();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem",
+value:this.getValue(),version:1}}append(...a){for(let b=0;b<a.length;b++){let c=a[b];if(h.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(p(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!q(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=E(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling();
+d.append(f)}c.insertAfter(a);a.insertAfter(d)}b&&(h.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){var c=this.getParentOrThrow();q(c)||l(39);if(p(a))return super.insertAfter(a,b);if(q(a)){c=a;a=a.getChildren();for(var d=a.length-1;0<=d;d--)c=a[d],this.insertAfter(c,b);return c}d=this.getNextSiblings();c.insertAfter(a,b);if(0!==d.length){let e=E(c.getListType());d.forEach(f=>e.append(f));a.insertAfter(e,
+b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a);b&&c&&u(b)&&u(c)&&(G(b.getFirstChild(),c.getFirstChild()),c.remove())}insertNewAfter(a,b=!0){a=y(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=p(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.insertBefore(b),c.remove(),c=a.anchor,
+a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){return this.getLatest().__checked}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();if(null===a)return this.getLatest().__indent;
+a=a.getParentOrThrow();let b=0;for(;p(a);)a=a.getParentOrThrow().getParentOrThrow(),b++;return b}setIndent(a){"number"===typeof a&&-1<a||l(117);let b=this.getIndent();for(;b!==a;)if(b<a){a:{var c=new Set;if(u(this)||c.has(this.getKey()))break a;let g=this.getParent();var d=this.getNextSibling(),e=this.getPreviousSibling();if(u(d)&&u(e)){if(e=e.getFirstChild(),q(e)){e.append(this);var f=d.getFirstChild();q(f)&&(f=f.getChildren(),C(e,f),d.remove(),c.add(d.getKey()));F(e)}}else u(d)?(d=d.getFirstChild(),
+q(d)&&(c=d.getFirstChild(),null!==c&&c.insertBefore(this),F(d))):u(e)?(d=e.getFirstChild(),q(d)&&(d.append(this),F(d))):q(g)&&(c=y(),f=E(g.getListType()),c.append(f),f.append(this),e?e.insertAfter(c):d?d.insertBefore(c):g.append(c),F(f));q(g)&&F(g)}b++}else H(this),b--;return this}canInsertAfter(a){return p(a)}canReplaceWith(a){return p(a)}canMergeWith(a){return h.$isParagraphNode(a)||p(a)}extractWithChild(a,b){if(!h.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&
+this.isParentOf(c)&&this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return E("bullet")}}
function K(a,b,c){let d=[],e=[];var f=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var g=b.nested.listitem;void 0!==f&&(f=f.split(" "),d.push(...f));if(b){f=c.getParent();f=q(f)&&"check"===f.getListType();let m=c.getChecked();f&&!m||e.push(b.listitemUnchecked);f&&m||e.push(b.listitemChecked);f&&d.push(m?b.listitemChecked:b.listitemUnchecked)}void 0!==g&&(g=g.split(" "),c.getChildren().some(m=>q(m))?d.push(...g):e.push(...g));0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
...d)}function J(a,b,c){q(b.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&b.__checked===c.__checked||a.setAttribute("aria-checked",b.getChecked()?"true":"false"))}function L(a){a=k.isHTMLElement(a)&&"true"===a.getAttribute("aria-checked");return{node:y(a)}}function y(a){return h.$applyNodeReplacement(new I(void 0,a))}function p(a){return a instanceof I}
class M extends h.ElementNode{static getType(){return"list"}static clone(a){return new M(a.__listType||O[a.__tag],a.__start,a.__key)}constructor(a,b,c){super(c);this.__listType=a=O[a]||a;this.__tag="number"===a?"ol":"ul";this.__start=b}getTag(){return this.__tag}setListType(a){let b=this.getWritable();b.__listType=a;b.__tag="number"===a?"ol":"ul"}getListType(){return this.__listType}getStart(){return this.__start}createDOM(a){let b=document.createElement(this.__tag);1!==this.__start&&b.setAttribute("start",
-String(this.__start));b.__lexicalListType=this.__listType;P(b,a.theme,this);return b}updateDOM(a,b,c){if(a.__tag!==this.__tag)return!0;P(b,c.theme,this);return!1}static importDOM(){return{ol:()=>({conversion:Q,priority:0}),ul:()=>({conversion:Q,priority:0})}}static importJSON(a){let b=E(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportDOM(a){({element:a}=super.exportDOM(a));a&&k.isHTMLElement(a)&&(1!==this.__start&&a.setAttribute("start",String(this.__start)),
-"check"===this.__listType&&a.setAttribute("__lexicalListType","check"));return{element:a}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=0;c<a.length;c++){var b=a[c];if(p(b))super.append(b);else{let d=y();q(b)?d.append(b):h.$isElementNode(b)?(b=h.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}F(this);return this}extractWithChild(a){return p(a)}}
+String(this.__start));b.__lexicalListType=this.__listType;P(b,a.theme,this);return b}updateDOM(a,b,c){if(a.__tag!==this.__tag)return!0;P(b,c.theme,this);return!1}static transform(){return a=>{if(!q(a))throw Error("node is not a ListNode");F(a)}}static importDOM(){return{ol:()=>({conversion:Q,priority:0}),ul:()=>({conversion:Q,priority:0})}}static importJSON(a){let b=E(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportDOM(a){({element:a}=super.exportDOM(a));
+a&&k.isHTMLElement(a)&&(1!==this.__start&&a.setAttribute("start",String(this.__start)),"check"===this.__listType&&a.setAttribute("__lexicalListType","check"));return{element:a}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=0;c<a.length;c++){var b=a[c];if(p(b))super.append(b);else{let d=y();q(b)?d.append(b):h.$isElementNode(b)?(b=h.$createTextNode(b.getTextContent()),
+d.append(b)):d.append(b);super.append(d)}}F(this);return this}extractWithChild(a){return p(a)}}
function P(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let m=f[`${c.__tag}Depth`]||[];b=n(c)-1;let x=b%m.length;var g=m[x];let N=f[c.__tag],A,B=f.nested;f=f.checklist;void 0!==B&&B.list&&(A=B.list);void 0!==N&&d.push(N);void 0!==f&&"check"===c.__listType&&d.push(f);if(void 0!==g)for(g=g.split(" "),d.push(...g),g=0;g<m.length;g++)g!==x&&e.push(c.__tag+g);void 0!==A&&(c=A.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
...d)}function R(a){let b=[];for(let d=0;d<a.length;d++){var c=a[d];p(c)?(b.push(c),c=c.getChildren(),1<c.length&&c.forEach(e=>{q(e)&&b.push(w(e))})):b.push(w(c))}return b}function Q(a){let b=a.nodeName.toLowerCase(),c=null;"ol"===b?c=E("number",a.start):"ul"===b&&(c=k.isHTMLElement(a)&&"check"===a.getAttribute("__lexicallisttype")?E("check"):E("bullet"));return{after:R,node:c}}let O={ol:"number",ul:"bullet"};function E(a,b=1){return h.$applyNodeReplacement(new M(a,b))}
function q(a){return a instanceof M}let S=h.createCommand("INSERT_UNORDERED_LIST_COMMAND"),T=h.createCommand("INSERT_ORDERED_LIST_COMMAND"),U=h.createCommand("INSERT_CHECK_LIST_COMMAND"),V=h.createCommand("REMOVE_LIST_COMMAND");exports.$createListItemNode=y;exports.$createListNode=E;exports.$getListDepth=n;
diff --git a/LexicalListItemNode.d.ts b/LexicalListItemNode.d.ts
index 9fd289fd0ab65e4f63b4d2814ec97f053348f9a9..cfed87598b2882973198cbb811552340a0fdcff6 100644
--- a/LexicalListItemNode.d.ts
+++ b/LexicalListItemNode.d.ts
@@ -40,7 +40,6 @@ export declare class ListItemNode extends ElementNode {
toggleChecked(): void;
getIndent(): number;
setIndent(indent: number): this;
- insertBefore(nodeToInsert: LexicalNode): LexicalNode;
canInsertAfter(node: LexicalNode): boolean;
canReplaceWith(replacement: LexicalNode): boolean;
canMergeWith(node: LexicalNode): boolean;
diff --git a/LexicalListNode.d.ts b/LexicalListNode.d.ts
index a04521af0011a36bae4a15ad5d04ce06b887d54e..ab4e18ab7e4116a1969479ef44e84657c2c51c87 100644
--- a/LexicalListNode.d.ts
+++ b/LexicalListNode.d.ts
@@ -30,6 +30,7 @@ export declare class ListNode extends ElementNode {
getStart(): number;
createDOM(config: EditorConfig, _editor?: LexicalEditor): HTMLElement;
updateDOM(prevNode: ListNode, dom: HTMLElement, config: EditorConfig): boolean;
+ static transform(): (node: LexicalNode) => void;
static importDOM(): DOMConversionMap | null;
static importJSON(serializedNode: SerializedListNode): ListNode;
exportDOM(editor: LexicalEditor): DOMExportOutput;
diff --git a/formatList.d.ts b/formatList.d.ts
index d1f43e38e50680a1248a03ae8ea71f8541c33bc1..2af0a0e63579c9e2fbcf67d9d018c75fcc39a76d 100644
--- a/formatList.d.ts
+++ b/formatList.d.ts
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
*/
-import { LexicalEditor, LexicalNode } from 'lexical';
+import { LexicalEditor } from 'lexical';
import { ListItemNode, ListNode } from './';
import { ListType } from './LexicalListNode';
/**
@@ -41,7 +41,7 @@ export declare function removeList(editor: LexicalEditor): void;
* @param list - The list whose children are updated.
* @param children - An array of the children to be updated.
*/
-export declare function updateChildrenListItemValue(list: ListNode, children?: Array<LexicalNode>): void;
+export declare function updateChildrenListItemValue(list: ListNode): void;
/**
* Adds an empty ListNode/ListItemNode chain at listItemNode, so as to
* create an indent effect. Won't indent ListItemNodes that have a ListNode as

View File

@@ -3,7 +3,7 @@
"version": "3.189.1",
"license": "AGPL-3.0",
"main": "dist/app.js",
"author": "Standard Notes",
"author": "Standard Notes.",
"private": true,
"files": [
"dist"

View File

@@ -3890,12 +3890,12 @@ __metadata:
"@lexical/list@patch:@lexical/list@npm:0.13.1#.yarn/patches/@lexical-list-npm-0.13.1-788c53f078.patch::locator=%40standardnotes%2Fapp-monorepo%40workspace%3A.":
version: 0.13.1
resolution: "@lexical/list@patch:@lexical/list@npm%3A0.13.1#.yarn/patches/@lexical-list-npm-0.13.1-788c53f078.patch::version=0.13.1&hash=759f3b&locator=%40standardnotes%2Fapp-monorepo%40workspace%3A."
resolution: "@lexical/list@patch:@lexical/list@npm%3A0.13.1#.yarn/patches/@lexical-list-npm-0.13.1-788c53f078.patch::version=0.13.1&hash=ef92c3&locator=%40standardnotes%2Fapp-monorepo%40workspace%3A."
dependencies:
"@lexical/utils": 0.13.1
peerDependencies:
lexical: 0.13.1
checksum: 4605422c81bc6e4d4b6881f539a9481f10c6a58b19af4ecd8b10a4d1917bed1ec3774986ab0bc2ba94b7c0b04212ada3f58ba55c82c44e95f6328dfed0cf0df6
checksum: 6908fa16cf9ad0bae644e16aa3ed51993619b8c02040f55420be72b46047633d49fe5438fc6511c84c755dd83ea1c051bb18c2077212c3d818393993924c93f6
languageName: node
linkType: hard