@lexical/list 0.12.3 → 0.12.5
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.js.flow +2 -0
- package/LexicalList.prod.js +1 -1
- package/LexicalListItemNode.d.ts +2 -2
- package/package.json +3 -3
package/LexicalList.dev.js
CHANGED
|
@@ -175,7 +175,7 @@ function $getListItemValue(listItem) {
|
|
|
175
175
|
function insertList(editor, listType) {
|
|
176
176
|
editor.update(() => {
|
|
177
177
|
const selection = lexical.$getSelection();
|
|
178
|
-
if (lexical.$
|
|
178
|
+
if (lexical.$INTERNAL_isPointSelection(selection)) {
|
|
179
179
|
const nodes = selection.getNodes();
|
|
180
180
|
const anchor = selection.anchor;
|
|
181
181
|
const anchorNode = anchor.getNode();
|
|
@@ -200,7 +200,7 @@ function insertList(editor, listType) {
|
|
|
200
200
|
const handled = new Set();
|
|
201
201
|
for (let i = 0; i < nodes.length; i++) {
|
|
202
202
|
const node = nodes[i];
|
|
203
|
-
if (lexical.$isElementNode(node) && node.isEmpty() && !handled.has(node.getKey())) {
|
|
203
|
+
if (lexical.$isElementNode(node) && node.isEmpty() && !$isListItemNode(node) && !handled.has(node.getKey())) {
|
|
204
204
|
createListOrMerge(node, listType);
|
|
205
205
|
continue;
|
|
206
206
|
}
|
package/LexicalList.js.flow
CHANGED
|
@@ -51,6 +51,8 @@ declare export class ListItemNode extends ElementNode {
|
|
|
51
51
|
canInsertAfter(node: LexicalNode): boolean;
|
|
52
52
|
canReplaceWith(replacement: LexicalNode): boolean;
|
|
53
53
|
canMergeWith(node: LexicalNode): boolean;
|
|
54
|
+
getValue(): number;
|
|
55
|
+
setValue(value: number): void;
|
|
54
56
|
getChecked(): boolean | void;
|
|
55
57
|
setChecked(boolean): this;
|
|
56
58
|
toggleChecked(): void;
|
package/LexicalList.prod.js
CHANGED
|
@@ -29,7 +29,7 @@ function Q(a){let b=[];for(let d=0;d<a.length;d++){var c=a[d];p(c)?(b.push(c),c=
|
|
|
29
29
|
function q(a){return a instanceof L}let R=h.createCommand("INSERT_UNORDERED_LIST_COMMAND"),S=h.createCommand("INSERT_ORDERED_LIST_COMMAND"),T=h.createCommand("INSERT_CHECK_LIST_COMMAND"),U=h.createCommand("REMOVE_LIST_COMMAND");exports.$createListItemNode=y;exports.$createListNode=D;exports.$getListDepth=n;
|
|
30
30
|
exports.$handleListInsertParagraph=function(){var a=h.$getSelection();if(!h.$isRangeSelection(a)||!a.isCollapsed())return!1;a=a.anchor.getNode();if(!p(a)||0!==a.getChildrenSize())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=y(),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=y(),c.append(f),
|
|
31
31
|
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=T;exports.INSERT_ORDERED_LIST_COMMAND=S;exports.INSERT_UNORDERED_LIST_COMMAND=R;exports.ListItemNode=H;exports.ListNode=L;exports.REMOVE_LIST_COMMAND=U;
|
|
32
|
-
exports.insertList=function(a,b){a.update(()=>{var c=h.$getSelection();if(h.$
|
|
32
|
+
exports.insertList=function(a,b){a.update(()=>{var c=h.$getSelection();if(h.$INTERNAL_isPointSelection(c)){var d=c.getNodes();c=c.anchor.getNode();var e=c.getParent();if(z(c,d))d=D(b),h.$isRootOrShadowRoot(e)?(c.replace(d),e=y(),h.$isElementNode(c)&&(e.setFormat(c.getFormatType()),e.setIndent(c.getIndent())),d.append(e)):p(c)&&(c=c.getParentOrThrow(),B(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()&&!p(f)&&!c.has(f.getKey()))C(f,
|
|
33
33
|
b);else if(h.$isLeafNode(f))for(f=f.getParent();null!=f;){let l=f.getKey();if(q(f)){if(!c.has(l)){var g=D(b);B(g,f.getChildren());f.replace(g);E(g);c.add(l)}break}else{g=f.getParent();if(h.$isRootOrShadowRoot(g)&&!c.has(l)){c.add(l);C(f,b);break}f=g}}}}})};
|
|
34
34
|
exports.removeList=function(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(r(e));else for(e=0;e<d.length;e++){var f=d[e];h.$isLeafNode(f)&&(f=k.$getNearestNodeOfType(f,H),null!=f&&c.add(r(f)))}for(let g of c){c=g;d=t(g);for(let l of d)d=h.$createParagraphNode(),B(d,l.getChildren()),c.insertAfter(d),c=d,l.__key===b.anchor.key&&b.anchor.set(d.getKey(),0,"element"),l.__key===b.focus.key&&b.focus.set(d.getKey(),0,"element"),
|
|
35
35
|
l.remove();g.remove()}}})}
|
package/LexicalListItemNode.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import type { DOMConversionMap, DOMExportOutput, EditorConfig,
|
|
8
|
+
import type { BaseSelection, DOMConversionMap, DOMExportOutput, EditorConfig, LexicalNode, NodeKey, ParagraphNode, RangeSelection, SerializedElementNode, Spread } from 'lexical';
|
|
9
9
|
import { ElementNode, LexicalEditor } from 'lexical';
|
|
10
10
|
export type SerializedListItemNode = Spread<{
|
|
11
11
|
checked: boolean | undefined;
|
|
@@ -44,7 +44,7 @@ export declare class ListItemNode extends ElementNode {
|
|
|
44
44
|
canInsertAfter(node: LexicalNode): boolean;
|
|
45
45
|
canReplaceWith(replacement: LexicalNode): boolean;
|
|
46
46
|
canMergeWith(node: LexicalNode): boolean;
|
|
47
|
-
extractWithChild(child: LexicalNode, selection:
|
|
47
|
+
extractWithChild(child: LexicalNode, selection: BaseSelection): boolean;
|
|
48
48
|
isParentRequired(): true;
|
|
49
49
|
createParentElementNode(): ElementNode;
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"list"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.12.
|
|
11
|
+
"version": "0.12.5",
|
|
12
12
|
"main": "LexicalList.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.12.
|
|
14
|
+
"lexical": "0.12.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lexical/utils": "0.12.
|
|
17
|
+
"@lexical/utils": "0.12.5"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|