@lexical/list 0.6.1-next.0 → 0.6.3
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.
- package/LexicalList.dev.js +2 -2
- package/LexicalList.prod.js +2 -2
- package/package.json +3 -3
package/LexicalList.dev.js
CHANGED
|
@@ -1019,7 +1019,7 @@ function convertListItemElement(domNode) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
1021
|
function $createListItemNode(checked) {
|
|
1022
|
-
return new ListItemNode(undefined, checked);
|
|
1022
|
+
return lexical.$applyNodeReplacement(new ListItemNode(undefined, checked));
|
|
1023
1023
|
}
|
|
1024
1024
|
function $isListItemNode(node) {
|
|
1025
1025
|
return node instanceof ListItemNode;
|
|
@@ -1266,7 +1266,7 @@ const TAG_TO_LIST_TYPE = {
|
|
|
1266
1266
|
ul: 'bullet'
|
|
1267
1267
|
};
|
|
1268
1268
|
function $createListNode(listType, start = 1) {
|
|
1269
|
-
return new ListNode(listType, start);
|
|
1269
|
+
return lexical.$applyNodeReplacement(new ListNode(listType, start));
|
|
1270
1270
|
}
|
|
1271
1271
|
function $isListNode(node) {
|
|
1272
1272
|
return node instanceof ListNode;
|
package/LexicalList.prod.js
CHANGED
|
@@ -21,12 +21,12 @@ p(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.replace(b),c=a.anchor,
|
|
|
21
21
|
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)||
|
|
22
22
|
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}}
|
|
23
23
|
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 l=c.getChecked();f&&!l||e.push(b.listitemUnchecked);f&&l||e.push(b.listitemChecked);f&&d.push(l?b.listitemChecked:b.listitemUnchecked)}void 0!==g&&(g=g.split(" "),c.getChildren().some(l=>q(l))?d.push(...g):e.push(...g));0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,
|
|
24
|
-
...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}
|
|
24
|
+
...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 h.$applyNodeReplacement(new J(void 0,a))}function p(a){return a instanceof J}
|
|
25
25
|
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);
|
|
26
26
|
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=
|
|
27
27
|
0;c<a.length;c++){var b=a[c];if(p(b))super.append(b);else{let d=z();q(b)?d.append(b):h.$isElementNode(b)?(b=h.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}return this}extractWithChild(a){return p(a)}}
|
|
28
28
|
function P(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let l=f[`${c.__tag}Depth`]||[];b=n(c)-1;let x=b%l.length;var g=l[x];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<l.length;g++)g!==x&&e.push(c.__tag+g);void 0!==B&&(c=B.split(" "),1<b?d.push(...c):e.push(...c))}0<e.length&&k.removeClassNamesFromElement(a,...e);0<d.length&&k.addClassNamesToElement(a,...d)}
|
|
29
|
-
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(w(e))})):b.push(w(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}
|
|
29
|
+
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(w(e))})):b.push(w(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 h.$applyNodeReplacement(new N(a,b))}function q(a){return a instanceof N}
|
|
30
30
|
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=z;exports.$createListNode=E;exports.$getListDepth=n;
|
|
31
31
|
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=r(a),c=a.getParent();q(c)||m(40);let d=c.getParent(),e;if(h.$isRootOrShadowRoot(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),
|
|
32
32
|
e.insertAfter(c));b.forEach(g=>{g.remove();f.append(g)})}v(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")};
|
package/package.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"list"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.6.
|
|
11
|
+
"version": "0.6.3",
|
|
12
12
|
"main": "LexicalList.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.6.
|
|
14
|
+
"lexical": "0.6.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lexical/utils": "0.6.
|
|
17
|
+
"@lexical/utils": "0.6.3"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|