Skip to content

Instantly share code, notes, and snippets.

@hanford
Created June 27, 2022 14:57
Show Gist options
  • Save hanford/767a154ec7cd822b07b310e7c13ea761 to your computer and use it in GitHub Desktop.
Save hanford/767a154ec7cd822b07b310e7c13ea761 to your computer and use it in GitHub Desktop.
diff --git a/node_modules/@lexical/list/LexicalList.dev.js b/node_modules/@lexical/list/LexicalList.dev.js
index 015adef..a8ce544 100644
--- a/node_modules/@lexical/list/LexicalList.dev.js
+++ b/node_modules/@lexical/list/LexicalList.dev.js
@@ -10,12 +10,12 @@ var lexical = require('lexical');
var utils = require('@lexical/utils');
/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
+* Copyright (c) Meta Platforms, Inc. and affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*
+*/
function $getListDepth(listNode) {
let depth = 1;
let parent = listNode.getParent();
@@ -130,14 +130,18 @@ function $removeHighestEmptyListParent(sublist) {
emptyListPtr.remove();
}
+function wrapInListItem(node) {
+ const listItemWrapper = $createListItemNode();
+ return listItemWrapper.append(node);
+}
/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
+* Copyright (c) Meta Platforms, Inc. and affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*
+*/
function $isSelectingEmptyListItem(anchorNode, nodes) {
return $isListItemNode(anchorNode) && (nodes.length === 0 || nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0);
@@ -337,7 +341,8 @@ function $handleIndent(listItemNodes) {
return;
}
- const parent = listItemNode.getParent();
+ const parent = listItemNode.getParent(); // We can cast both of the below `isNestedListNode` only returns a boolean type instead of a user-defined type guards
+
const nextSibling = listItemNode.getNextSibling();
const previousSibling = listItemNode.getPreviousSibling(); // if there are nested lists on either side, merge them all together.
@@ -556,12 +561,12 @@ function $handleListInsertParagraph() {
}
/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
+* Copyright (c) Meta Platforms, Inc. and affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*
+*/
class ListItemNode extends lexical.ElementNode {
static getType() {
return 'listitem';
@@ -986,12 +991,12 @@ function $isListItemNode(node) {
}
/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
+* Copyright (c) Meta Platforms, Inc. and affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*
+*/
class ListNode extends lexical.ElementNode {
static getType() {
return 'list';
@@ -1122,7 +1127,7 @@ function setListThemeClassNames(dom, editorThemeClasses, node) {
const listTheme = editorThemeClasses.list;
if (listTheme !== undefined) {
- const listLevelsClassNames = listTheme[node.__tag + 'Depth'] || [];
+ const listLevelsClassNames = listTheme[`${node.__tag}Depth`] || [];
const listDepth = $getListDepth(node) - 1;
const normalizedListDepth = listDepth % listLevelsClassNames.length;
const listLevelClassName = listLevelsClassNames[normalizedListDepth];
@@ -1168,6 +1173,33 @@ function setListThemeClassNames(dom, editorThemeClasses, node) {
utils.addClassNamesToElement(dom, ...classesToAdd);
}
}
+/*
+* This function normalizes the children of a ListNode after the conversion from HTML,
+* ensuring that they are all ListItemNodes and contain either a single nested ListNode
+* or some other inline content.
+*/
+
+
+function normalizeChildren(nodes) {
+ const normalizedListItems = [];
+
+ for (let i = 0; i < nodes.length; i++) {
+ const node = nodes[i];
+
+ if ($isListItemNode(node)) {
+ normalizedListItems.push(node);
+ node.getChildren().forEach(child => {
+ if ($isListNode(child)) {
+ normalizedListItems.push(wrapInListItem(child));
+ }
+ });
+ } else {
+ normalizedListItems.push(wrapInListItem(node));
+ }
+ }
+
+ return normalizedListItems;
+}
function convertListNode(domNode) {
const nodeName = domNode.nodeName.toLowerCase();
@@ -1180,6 +1212,7 @@ function convertListNode(domNode) {
}
return {
+ after: normalizeChildren,
node
};
}
@@ -1196,12 +1229,12 @@ function $isListNode(node) {
}
/**
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
+* Copyright (c) Meta Platforms, Inc. and affiliates.
+*
+* This source code is licensed under the MIT license found in the
+* LICENSE file in the root directory of this source tree.
+*
+*/
const INSERT_UNORDERED_LIST_COMMAND = lexical.createCommand();
const INSERT_ORDERED_LIST_COMMAND = lexical.createCommand();
const INSERT_CHECK_LIST_COMMAND = lexical.createCommand();
diff --git a/node_modules/@lexical/list/LexicalList.prod.js b/node_modules/@lexical/list/LexicalList.prod.js
index 237dce1..6e585c2 100644
--- a/node_modules/@lexical/list/LexicalList.prod.js
+++ b/node_modules/@lexical/list/LexicalList.prod.js
@@ -5,29 +5,30 @@
* LICENSE file in the root directory of this source tree.
*/
'use strict';var h=require("lexical"),l=require("@lexical/utils");function m(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}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}m(40)}break}return b}function t(a){a=a.getParent();q(a)||m(40);let b=a;for(;null!==b;)b=b.getParent(),q(b)&&(a=b);return a}
-function u(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(u(e)):b.push(d)}return b}function v(a){return p(a)&&q(a.getFirstChild())}function w(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 x(a,b){return p(a)&&(0===b.length||1===b.length&&a.is(b[0])&&0===a.getChildrenSize())}function z(a,b){a.splice(a.getChildrenSize(),0,b)}
-function A(a,b){if(q(a))return a;let c=a.getPreviousSibling(),d=a.getNextSibling(),e=C();z(e,a.getChildren());if(q(c)&&b===c.getListType())return c.append(e),a.remove(),q(d)&&b===d.getListType()&&(z(c,d.getChildren()),d.remove()),c;if(q(d)&&b===d.getListType())return d.getFirstChildOrThrow().insertBefore(e),a.remove(),d;b=D(b);b.append(e);a.replace(b);E(b);return b}
-function E(a,b){(b||a.getChildren()).forEach(c=>{let d=c.getValue();var e=c.getParent();var f=1;null!=e&&(q(e)?f=e.getStart():m(44));e=c.getPreviousSiblings();for(let g=0;g<e.length;g++){let k=e[g];p(k)&&!q(k.getFirstChild())&&f++}d!==f&&c.setValue(f)})}
-function F(a){let b=new Set;a.forEach(c=>{if(!v(c)&&!b.has(c.getKey())){var d=c.getParent(),e=c.getNextSibling(),f=c.getPreviousSibling();if(v(e)&&v(f))f=f.getFirstChild(),q(f)&&(f.append(c),c=e.getFirstChild(),q(c)&&(c=c.getChildren(),z(f,c),e.remove(),b.add(e.getKey())),E(f));else if(v(e))e=e.getFirstChild(),q(e)&&(f=e.getFirstChild(),null!==f&&f.insertBefore(c),E(e));else if(v(f))e=f.getFirstChild(),q(e)&&(e.append(c),E(e));else if(q(d)){let g=C(),k=D(d.getListType());g.append(k);k.append(c);f?
-f.insertAfter(g):e?e.insertBefore(g):d.append(g)}q(d)&&E(d)}})}
-function G(a){a.forEach(b=>{if(!v(b)){var c=b.getParent(),d=c?c.getParent():void 0,e=d?d.getParent():void 0;if(q(e)&&p(d)&&q(c)){var f=c?c.getFirstChild():void 0,g=c?c.getLastChild():void 0;if(b.is(f))d.insertBefore(b),c.isEmpty()&&d.remove();else if(b.is(g))d.insertAfter(b),c.isEmpty()&&d.remove();else{var k=c.getListType();f=C();let r=D(k);f.append(r);b.getPreviousSiblings().forEach(y=>r.append(y));g=C();k=D(k);g.append(k);z(k,b.getNextSiblings());d.insertBefore(f);d.insertAfter(g);d.replace(b)}E(c);
-E(e)}}})}function H(a){var b=h.$getSelection();if(h.$isRangeSelection(b)){var c=b.getNodes(),d=[];0===c.length&&c.push(b.anchor.getNode());if(1===c.length){a:{for(c=c[0];null!==c;){if(p(c))break a;c=c.getParent()}c=null}null!==c&&(d=[c])}else{d=new Set;for(b=0;b<c.length;b++){let e=c[b];p(e)&&d.add(e)}d=Array.from(d)}0<d.length&&("indent"===a?F(d):G(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)&&(E(c),J(b,this,null,c));b.value=this.__value;K(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();q(d)&&(E(d),J(b,this,a,d));b.value=this.__value;K(b,c.theme,this);return!1}static importDOM(){return{li:()=>({conversion:L,
-priority:0})}}static importJSON(a){let b=new I(a.value,a.checked);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}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){if(p(a))return super.replace(a);let b=this.getParentOrThrow();
-if(q(b)){var c=b.__children;let e=c.length;var d=c.indexOf(this.__key);if(0===d)b.insertBefore(a);else if(d===e-1)b.insertAfter(a);else{c=D(b.getListType());let f=b.getChildren();for(d+=1;d<e;d++)c.append(f[d]);b.insertAfter(a);a.insertAfter(c)}this.remove();1===e&&b.remove()}return a}insertAfter(a){var b=this.getParentOrThrow();q(b)||m(39);var c=this.getNextSiblings();if(p(a))return b=super.insertAfter(a),a=a.getParentOrThrow(),q(a)&&E(a),b;if(q(a)&&a.getListType()===b.getListType()){b=a;a=a.getChildren();
-for(c=a.length-1;0<=c;c--)b=a[c],this.insertAfter(b);return b}b.insertAfter(a);if(0!==c.length){let d=D(b.getListType());c.forEach(e=>d.append(e));a.insertAfter(d)}return a}remove(a){let b=this.getNextSibling();super.remove(a);null!==b&&(a=b.getParent(),q(a)&&E(a))}insertNewAfter(){let a=C(null==this.__checked?void 0:!1);this.insertAfter(a);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=
+function u(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(u(e)):b.push(d)}return b}function v(a){return p(a)&&q(a.getFirstChild())}function w(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 x(a){return z().append(a)}function A(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=z();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 F(a,b){(b||a.getChildren()).forEach(c=>{let d=c.getValue();var e=c.getParent();var f=1;null!=e&&(q(e)?f=e.getStart():m(44));e=c.getPreviousSiblings();for(let g=0;g<e.length;g++){let k=e[g];p(k)&&!q(k.getFirstChild())&&f++}d!==f&&c.setValue(f)})}
+function G(a){let b=new Set;a.forEach(c=>{if(!v(c)&&!b.has(c.getKey())){var d=c.getParent(),e=c.getNextSibling(),f=c.getPreviousSibling();if(v(e)&&v(f))f=f.getFirstChild(),q(f)&&(f.append(c),c=e.getFirstChild(),q(c)&&(c=c.getChildren(),C(f,c),e.remove(),b.add(e.getKey())),F(f));else if(v(e))e=e.getFirstChild(),q(e)&&(f=e.getFirstChild(),null!==f&&f.insertBefore(c),F(e));else if(v(f))e=f.getFirstChild(),q(e)&&(e.append(c),F(e));else if(q(d)){let g=z(),k=E(d.getListType());g.append(k);k.append(c);f?
+f.insertAfter(g):e?e.insertBefore(g):d.append(g)}q(d)&&F(d)}})}
+function H(a){a.forEach(b=>{if(!v(b)){var c=b.getParent(),d=c?c.getParent():void 0,e=d?d.getParent():void 0;if(q(e)&&p(d)&&q(c)){var f=c?c.getFirstChild():void 0,g=c?c.getLastChild():void 0;if(b.is(f))d.insertBefore(b),c.isEmpty()&&d.remove();else if(b.is(g))d.insertAfter(b),c.isEmpty()&&d.remove();else{var k=c.getListType();f=z();let r=E(k);f.append(r);b.getPreviousSiblings().forEach(y=>r.append(y));g=z();k=E(k);g.append(k);C(k,b.getNextSiblings());d.insertBefore(f);d.insertAfter(g);d.replace(b)}F(c);
+F(e)}}})}function I(a){var b=h.$getSelection();if(h.$isRangeSelection(b)){var c=b.getNodes(),d=[];0===c.length&&c.push(b.anchor.getNode());if(1===c.length){a:{for(c=c[0];null!==c;){if(p(c))break a;c=c.getParent()}c=null}null!==c&&(d=[c])}else{d=new Set;for(b=0;b<c.length;b++){let e=c[b];p(e)&&d.add(e)}d=Array.from(d)}0<d.length&&("indent"===a?G(d):H(d))}}
+class J extends h.ElementNode{static getType(){return"listitem"}static clone(a){return new J(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)&&(F(c),K(b,this,null,c));b.value=this.__value;L(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();q(d)&&(F(d),K(b,this,a,d));b.value=this.__value;L(b,c.theme,this);return!1}static importDOM(){return{li:()=>({conversion:M,
+priority:0})}}static importJSON(a){let b=new J(a.value,a.checked);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}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){if(p(a))return super.replace(a);let b=this.getParentOrThrow();
+if(q(b)){var c=b.__children;let e=c.length;var d=c.indexOf(this.__key);if(0===d)b.insertBefore(a);else if(d===e-1)b.insertAfter(a);else{c=E(b.getListType());let f=b.getChildren();for(d+=1;d<e;d++)c.append(f[d]);b.insertAfter(a);a.insertAfter(c)}this.remove();1===e&&b.remove()}return a}insertAfter(a){var b=this.getParentOrThrow();q(b)||m(39);var c=this.getNextSiblings();if(p(a))return b=super.insertAfter(a),a=a.getParentOrThrow(),q(a)&&F(a),b;if(q(a)&&a.getListType()===b.getListType()){b=a;a=a.getChildren();
+for(c=a.length-1;0<=c;c--)b=a[c],this.insertAfter(b);return b}b.insertAfter(a);if(0!==c.length){let d=E(b.getListType());c.forEach(e=>d.append(e));a.insertAfter(d)}return a}remove(a){let b=this.getNextSibling();super.remove(a);null!==b&&(a=b.getParent(),q(a)&&F(a))}insertNewAfter(){let a=z(null==this.__checked?void 0:!1);this.insertAfter(a);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.replace(b),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){let b=this.getIndent();for(;b!==a;)b<a?(F([this]),b++):(G([this]),b--);return this}canIndent(){return!1}insertBefore(a){if(p(a)){let b=this.getParentOrThrow();if(q(b)){let c=this.getNextSiblings();E(b,c)}}return super.insertBefore(a)}canInsertAfter(a){return p(a)}canReplaceWith(a){return p(a)}canMergeWith(a){return h.$isParagraphNode(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){let b=this.getIndent();for(;b!==a;)b<a?(G([this]),b++):(H([this]),b--);return this}canIndent(){return!1}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}}
-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 k=c.getChecked();f&&!k||e.push(b.listitemUnchecked);f&&k||e.push(b.listitemChecked);f&&d.push(k?b.listitemChecked:b.listitemUnchecked)}void 0!==g&&(g=g.split(" "),c.getChildren().some(k=>q(k))?d.push(...g):e.push(...g));0<e.length&&l.removeClassNamesFromElement(a,...e);0<d.length&&l.addClassNamesToElement(a,
-...d)}function J(a,b,c,d){"check"===d.getListType()?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")):null!=b.getChecked()&&b.setChecked(void 0)}function L(){return{node:C()}}function C(a){return 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||N[a.__tag],a.__start,a.__key)}constructor(a,b,c){super(c);this.__listType=a=N[a]||a;this.__tag="number"===a?"ol":"ul";this.__start=b}getTag(){return this.__tag}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;O(b,a.theme,this);
-return b}updateDOM(a,b,c){if(a.__tag!==this.__tag)return!0;O(b,c.theme,this);return!1}static importDOM(){return{ol:()=>({conversion:P,priority:0}),ul:()=>({conversion:P,priority:0})}}static importJSON(a){let b=D(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}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=C();q(b)?d.append(b):(b=h.$createTextNode(b.getTextContent()),d.append(b));super.append(d)}}return this}extractWithChild(a){return p(a)}}
-function O(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let k=f[c.__tag+"Depth"]||[];b=n(c)-1;let r=b%k.length;var g=k[r];let y=f[c.__tag],B;f=f.nested;void 0!==f&&f.list&&(B=f.list);void 0!==y&&d.push(y);if(void 0!==g)for(g=g.split(" "),d.push(...g),g=0;g<k.length;g++)g!==r&&e.push(c.__tag+g);void 0!==B&&(c=B.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&l.removeClassNamesFromElement(a,...e);0<d.length&&l.addClassNamesToElement(a,...d)}
-function P(a){a=a.nodeName.toLowerCase();let b=null;"ol"===a?b=D("number"):"ul"===a&&(b=D("bullet"));return{node:b}}let N={ol:"number",ul:"bullet"};function D(a,b=1){return new M(a,b)}function q(a){return a instanceof M}let Q=h.createCommand(),R=h.createCommand(),S=h.createCommand(),T=h.createCommand();exports.$createListItemNode=C;exports.$createListNode=D;exports.$getListDepth=n;
-exports.$handleListInsertParagraph=function(){var a=h.$getSelection();if(!h.$isRangeSelection(a)||!a.isCollapsed())return!1;a=a.anchor.getNode();if(!p(a)||""!==a.getTextContent())return!1;var b=t(a),c=a.getParent();q(c)||m(40);let d=c.getParent(),e;if(h.$isRootNode(d))e=h.$createParagraphNode(),b.insertAfter(e);else if(p(d))e=C(),d.insertAfter(e);else return!1;e.select();b=a.getNextSiblings();if(0<b.length){let f=D(c.getListType());h.$isParagraphNode(e)?e.insertAfter(f):(c=C(),c.append(f),e.insertAfter(c));
-b.forEach(g=>{g.remove();f.append(g)})}w(a);return!0};exports.$isListItemNode=p;exports.$isListNode=q;exports.INSERT_CHECK_LIST_COMMAND=S;exports.INSERT_ORDERED_LIST_COMMAND=R;exports.INSERT_UNORDERED_LIST_COMMAND=Q;exports.ListItemNode=I;exports.ListNode=M;exports.REMOVE_LIST_COMMAND=T;exports.indentList=function(){H("indent")};
-exports.insertList=function(a,b){a.update(()=>{var c=h.$getSelection();if(h.$isRangeSelection(c)){var d=c.getNodes();c=c.anchor.getNode();var e=c.getParent();if(x(c,d))d=D(b),h.$isRootNode(e)?(c.replace(d),c=C(),d.append(c)):p(c)&&(c=c.getParentOrThrow(),z(d,c.getChildren()),c.replace(d));else for(c=new Set,e=0;e<d.length;e++){var f=d[e];if(h.$isElementNode(f)&&f.isEmpty()&&!c.has(f.getKey()))A(f,b);else if(h.$isLeafNode(f))for(f=f.getParent();null!=f;){let k=f.getKey();if(q(f)){if(!c.has(k)){var g=
-D(b);z(g,f.getChildren());f.replace(g);E(g);c.add(k)}break}else{g=f.getParent();if(h.$isRootNode(g)&&!c.has(k)){c.add(k);A(f,b);break}f=g}}}}})};exports.outdentList=function(){H("outdent")};
-exports.removeList=function(a){a.update(()=>{var b=h.$getSelection();if(h.$isRangeSelection(b)){let d=new Set,e=b.getNodes();b=b.anchor.getNode();if(x(b,e))d.add(t(b));else for(b=0;b<e.length;b++){var c=e[b];h.$isLeafNode(c)&&(c=l.$getNearestNodeOfType(c,I),null!=c&&d.add(t(c)))}d.forEach(f=>{let g=f;u(f).forEach(k=>{if(null!=k){let r=h.$createParagraphNode();z(r,k.getChildren());g.insertAfter(r);g=r;k.remove()}});f.remove()})}})}
+function L(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 k=c.getChecked();f&&!k||e.push(b.listitemUnchecked);f&&k||e.push(b.listitemChecked);f&&d.push(k?b.listitemChecked:b.listitemUnchecked)}void 0!==g&&(g=g.split(" "),c.getChildren().some(k=>q(k))?d.push(...g):e.push(...g));0<e.length&&l.removeClassNamesFromElement(a,...e);0<d.length&&l.addClassNamesToElement(a,
+...d)}function K(a,b,c,d){"check"===d.getListType()?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")):null!=b.getChecked()&&b.setChecked(void 0)}function M(){return{node:z()}}function z(a){return new J(void 0,a)}function p(a){return a instanceof J}
+class N extends h.ElementNode{static getType(){return"list"}static clone(a){return new N(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}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}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=z();q(b)?d.append(b):(b=h.$createTextNode(b.getTextContent()),d.append(b));super.append(d)}}return this}extractWithChild(a){return p(a)}}
+function P(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let k=f[`${c.__tag}Depth`]||[];b=n(c)-1;let r=b%k.length;var g=k[r];let y=f[c.__tag],B;f=f.nested;void 0!==f&&f.list&&(B=f.list);void 0!==y&&d.push(y);if(void 0!==g)for(g=g.split(" "),d.push(...g),g=0;g<k.length;g++)g!==r&&e.push(c.__tag+g);void 0!==B&&(c=B.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&l.removeClassNamesFromElement(a,...e);0<d.length&&l.addClassNamesToElement(a,...d)}
+function R(a){let b=[];for(let c=0;c<a.length;c++){let d=a[c];p(d)?(b.push(d),d.getChildren().forEach(e=>{q(e)&&b.push(x(e))})):b.push(x(d))}return b}function Q(a){a=a.nodeName.toLowerCase();let b=null;"ol"===a?b=E("number"):"ul"===a&&(b=E("bullet"));return{after:R,node:b}}let O={ol:"number",ul:"bullet"};function E(a,b=1){return new N(a,b)}function q(a){return a instanceof N}let S=h.createCommand(),T=h.createCommand(),U=h.createCommand(),V=h.createCommand();exports.$createListItemNode=z;
+exports.$createListNode=E;exports.$getListDepth=n;
+exports.$handleListInsertParagraph=function(){var a=h.$getSelection();if(!h.$isRangeSelection(a)||!a.isCollapsed())return!1;a=a.anchor.getNode();if(!p(a)||""!==a.getTextContent())return!1;var b=t(a),c=a.getParent();q(c)||m(40);let d=c.getParent(),e;if(h.$isRootNode(d))e=h.$createParagraphNode(),b.insertAfter(e);else if(p(d))e=z(),d.insertAfter(e);else return!1;e.select();b=a.getNextSiblings();if(0<b.length){let f=E(c.getListType());h.$isParagraphNode(e)?e.insertAfter(f):(c=z(),c.append(f),e.insertAfter(c));
+b.forEach(g=>{g.remove();f.append(g)})}w(a);return!0};exports.$isListItemNode=p;exports.$isListNode=q;exports.INSERT_CHECK_LIST_COMMAND=U;exports.INSERT_ORDERED_LIST_COMMAND=T;exports.INSERT_UNORDERED_LIST_COMMAND=S;exports.ListItemNode=J;exports.ListNode=N;exports.REMOVE_LIST_COMMAND=V;exports.indentList=function(){I("indent")};
+exports.insertList=function(a,b){a.update(()=>{var c=h.$getSelection();if(h.$isRangeSelection(c)){var d=c.getNodes();c=c.anchor.getNode();var e=c.getParent();if(A(c,d))d=E(b),h.$isRootNode(e)?(c.replace(d),c=z(),d.append(c)):p(c)&&(c=c.getParentOrThrow(),C(d,c.getChildren()),c.replace(d));else for(c=new Set,e=0;e<d.length;e++){var f=d[e];if(h.$isElementNode(f)&&f.isEmpty()&&!c.has(f.getKey()))D(f,b);else if(h.$isLeafNode(f))for(f=f.getParent();null!=f;){let k=f.getKey();if(q(f)){if(!c.has(k)){var g=
+E(b);C(g,f.getChildren());f.replace(g);F(g);c.add(k)}break}else{g=f.getParent();if(h.$isRootNode(g)&&!c.has(k)){c.add(k);D(f,b);break}f=g}}}}})};exports.outdentList=function(){I("outdent")};
+exports.removeList=function(a){a.update(()=>{var b=h.$getSelection();if(h.$isRangeSelection(b)){let d=new Set,e=b.getNodes();b=b.anchor.getNode();if(A(b,e))d.add(t(b));else for(b=0;b<e.length;b++){var c=e[b];h.$isLeafNode(c)&&(c=l.$getNearestNodeOfType(c,J),null!=c&&d.add(t(c)))}d.forEach(f=>{let g=f;u(f).forEach(k=>{if(null!=k){let r=h.$createParagraphNode();C(r,k.getChildren());g.insertAfter(r);g=r;k.remove()}});f.remove()})}})}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment