@lofcz/platejs-list-classic 52.0.11 → 52.3.6

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.
@@ -1386,5 +1386,4 @@ const BaseListPlugin = createTSlatePlugin({
1386
1386
  } }));
1387
1387
 
1388
1388
  //#endregion
1389
- export { moveListItemsToList as A, getHighestEmptyList as B, insertTodoListItem as C, removeFirstListItem as D, moveListItems as E, getTodoListItemEntry as F, isListNested as H, getPropsIfTaskList as I, getPropsIfTaskListLiNode as L, isListRoot as M, isAcrossListItems as N, moveListItemUp as O, hasListChild as P, getListRoot as R, moveListItemSublistItemsToListItemSublist as S, insertListItem as T, getListTypes as V, toggleBulletedList as _, BaseNumberedListPlugin as a, toggleTaskList as b, withNormalizeList as c, normalizeListItem as d, withInsertFragmentList as f, withDeleteBackwardList as g, withDeleteForwardList as h, BaseListPlugin as i, moveListItemDown as j, unwrapList as k, normalizeNestedList as l, withDeleteFragmentList as m, BaseListItemContentPlugin as n, BaseTaskListPlugin as o, withInsertBreakList as p, BaseListItemPlugin as r, withList as s, BaseBulletedListPlugin as t, getDeepInlineChildren as u, toggleList as v, BaseTodoListPlugin as w, removeListItem as x, toggleNumberedList as y, getListItemEntry as z };
1390
- //# sourceMappingURL=BaseListPlugin-n9uuTtLe.js.map
1389
+ export { moveListItemsToList as A, getHighestEmptyList as B, insertTodoListItem as C, removeFirstListItem as D, moveListItems as E, getTodoListItemEntry as F, isListNested as H, getPropsIfTaskList as I, getPropsIfTaskListLiNode as L, isListRoot as M, isAcrossListItems as N, moveListItemUp as O, hasListChild as P, getListRoot as R, moveListItemSublistItemsToListItemSublist as S, insertListItem as T, getListTypes as V, toggleBulletedList as _, BaseNumberedListPlugin as a, toggleTaskList as b, withNormalizeList as c, normalizeListItem as d, withInsertFragmentList as f, withDeleteBackwardList as g, withDeleteForwardList as h, BaseListPlugin as i, moveListItemDown as j, unwrapList as k, normalizeNestedList as l, withDeleteFragmentList as m, BaseListItemContentPlugin as n, BaseTaskListPlugin as o, withInsertBreakList as p, BaseListItemPlugin as r, withList as s, BaseBulletedListPlugin as t, getDeepInlineChildren as u, toggleList as v, BaseTodoListPlugin as w, removeListItem as x, toggleNumberedList as y, getListItemEntry as z };
@@ -0,0 +1,15 @@
1
+ import * as platejs12 from "platejs";
2
+ import { TElement } from "platejs";
3
+
4
+ //#region src/lib/BaseTodoListPlugin.d.ts
5
+ interface TTodoListItemElement extends TElement {
6
+ checked?: boolean;
7
+ }
8
+ declare const BaseTodoListPlugin: platejs12.SlatePlugin<platejs12.PluginConfig<"action_item", {
9
+ inheritCheckStateOnLineEndBreak: boolean;
10
+ inheritCheckStateOnLineStartBreak: boolean;
11
+ }, {}, Record<"action_item", {
12
+ toggle: () => void;
13
+ }>, {}>>;
14
+ //#endregion
15
+ export { TTodoListItemElement as n, BaseTodoListPlugin as t };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,351 @@
1
- import { $ as moveListItemDown, A as BaseNumberedListPlugin, B as RemoveListItemOptions, C as withDeleteBackwardList, D as BaseListItemContentPlugin, E as BaseBulletedListPlugin, F as unindentListItems, G as moveListItemsToList, H as removeFirstListItem, I as toggleBulletedList, J as MoveListItemUpOptions, K as MoveListItemsOptions, L as toggleList, M as ListConfig, N as unwrapList, O as BaseListItemPlugin, P as UnindentListItemsOptions, Q as MoveListItemDownOptions, R as toggleNumberedList, S as withDeleteForwardList, T as TTodoListItemElement, U as moveListSiblingsAfterCursor, V as removeListItem, W as MergeListItemIntoListOptions, X as MoveListItemSublistItemsToListItemSublistOptions, Y as moveListItemUp, Z as moveListItemSublistItemsToListItemSublist, _ as withNormalizeList, a as hasListChild, b as withInsertBreakList, c as getPropsIfTaskList, d as getListRoot, et as insertTodoListItem, f as getListItemEntry, g as normalizeListItem, h as getDeepInlineChildren, i as isAcrossListItems, j as BaseTaskListPlugin, k as BaseListPlugin, l as getPropsIfTaskListLiNode, m as normalizeNestedList, n as isListRoot, nt as insertListItem, o as getTodoListItemEntry, p as getHighestEmptyList, q as moveListItems, r as isListNested, rt as indentListItems, s as GetPropsIfTaskListLiNodeOptions, t as someList, tt as InsertListItemOptions, u as getListTypes, v as withList, w as BaseTodoListPlugin, x as withDeleteFragmentList, y as withInsertFragmentList, z as toggleTaskList } from "./index-CYSu3DSy";
1
+ import { n as TTodoListItemElement, t as BaseTodoListPlugin } from "./BaseTodoListPlugin-C3ztdXje";
2
+ import * as platejs6 from "platejs";
3
+ import { Ancestor, Descendant, EditorNodesOptions, ElementEntry, NodeEntry, OmitFirst, OverrideEditor, Path, PluginConfig, Point, SlateEditor, TElement, TLocation, TRange } from "platejs";
4
+
5
+ //#region src/lib/transforms/indentListItems.d.ts
6
+ declare const indentListItems: (editor: SlateEditor) => void;
7
+ //#endregion
8
+ //#region src/lib/transforms/insertListItem.d.ts
9
+ type InsertListItemOptions = {
10
+ inheritCheckStateOnLineEndBreak?: boolean;
11
+ inheritCheckStateOnLineStartBreak?: boolean;
12
+ };
13
+ /** Insert list item if selection in li>p. TODO: test */
14
+ declare const insertListItem: (editor: SlateEditor, options?: InsertListItemOptions) => boolean;
15
+ //#endregion
16
+ //#region src/lib/transforms/insertTodoListItem.d.ts
17
+ /** Insert todo list item if selection in li>p. TODO: test */
18
+ declare const insertTodoListItem: (editor: SlateEditor) => boolean;
19
+ //#endregion
20
+ //#region src/lib/transforms/moveListItemDown.d.ts
21
+ type MoveListItemDownOptions = {
22
+ list: ElementEntry;
23
+ listItem: ElementEntry;
24
+ };
25
+ declare const moveListItemDown: (editor: SlateEditor, {
26
+ list,
27
+ listItem
28
+ }: MoveListItemDownOptions) => false | undefined;
29
+ //#endregion
30
+ //#region src/lib/transforms/moveListItemSublistItemsToListItemSublist.d.ts
31
+ type MoveListItemSublistItemsToListItemSublistOptions = {
32
+ /** The list item to merge. */
33
+ fromListItem: ElementEntry;
34
+ /** The list item where to merge. */
35
+ toListItem: ElementEntry;
36
+ /** Move to the start of the list instead of the end. */
37
+ start?: boolean;
38
+ };
39
+ /**
40
+ * Move fromListItem sublist list items to the end of `toListItem` sublist. If
41
+ * there is no `toListItem` sublist, insert one.
42
+ */
43
+ declare const moveListItemSublistItemsToListItemSublist: (editor: SlateEditor, {
44
+ fromListItem,
45
+ start,
46
+ toListItem
47
+ }: MoveListItemSublistItemsToListItemSublistOptions) => boolean;
48
+ //#endregion
49
+ //#region src/lib/transforms/moveListItemUp.d.ts
50
+ type MoveListItemUpOptions = {
51
+ list: ElementEntry;
52
+ listItem: ElementEntry;
53
+ };
54
+ /** Move a list item up. */
55
+ declare const moveListItemUp: (editor: SlateEditor, {
56
+ list,
57
+ listItem
58
+ }: MoveListItemUpOptions) => boolean;
59
+ //#endregion
60
+ //#region src/lib/transforms/moveListItems.d.ts
61
+ type MoveListItemsOptions = {
62
+ at?: EditorNodesOptions['at'];
63
+ enableResetOnShiftTab?: boolean;
64
+ increase?: boolean;
65
+ };
66
+ declare const moveListItems: (editor: SlateEditor, {
67
+ at,
68
+ enableResetOnShiftTab,
69
+ increase
70
+ }?: MoveListItemsOptions) => boolean | undefined;
71
+ //#endregion
72
+ //#region src/lib/transforms/moveListItemsToList.d.ts
73
+ type MergeListItemIntoListOptions = {
74
+ /**
75
+ * Delete `fromListItem` sublist if true.
76
+ *
77
+ * @default true
78
+ */
79
+ deleteFromList?: boolean;
80
+ /** List items of the list will be moved. */
81
+ fromList?: ElementEntry;
82
+ /** List items of the sublist of this node will be moved. */
83
+ fromListItem?: ElementEntry;
84
+ fromStartIndex?: number;
85
+ to?: Path;
86
+ /** List items will be moved in this list. */
87
+ toList?: ElementEntry;
88
+ /** List position where to move the list items. */
89
+ toListIndex?: number | null;
90
+ };
91
+ /**
92
+ * Move the list items of the sublist of `fromListItem` to `toList` (if
93
+ * `fromListItem` is defined). Move the list items of `fromList` to `toList` (if
94
+ * `fromList` is defined).
95
+ */
96
+ declare const moveListItemsToList: (editor: SlateEditor, {
97
+ deleteFromList,
98
+ fromList,
99
+ fromListItem,
100
+ fromStartIndex,
101
+ to: _to,
102
+ toList,
103
+ toListIndex
104
+ }: MergeListItemIntoListOptions) => boolean;
105
+ //#endregion
106
+ //#region src/lib/transforms/moveListSiblingsAfterCursor.d.ts
107
+ declare const moveListSiblingsAfterCursor: (editor: SlateEditor, {
108
+ at,
109
+ to
110
+ }: {
111
+ at: Path;
112
+ to: Path;
113
+ }) => boolean | void;
114
+ //#endregion
115
+ //#region src/lib/transforms/removeFirstListItem.d.ts
116
+ /** If list is not nested and if li is not the first child, move li up. */
117
+ declare const removeFirstListItem: (editor: SlateEditor, {
118
+ list,
119
+ listItem
120
+ }: {
121
+ list: ElementEntry;
122
+ listItem: ElementEntry;
123
+ }) => boolean;
124
+ //#endregion
125
+ //#region src/lib/transforms/removeListItem.d.ts
126
+ type RemoveListItemOptions = {
127
+ list: ElementEntry;
128
+ listItem: ElementEntry;
129
+ reverse?: boolean;
130
+ };
131
+ /** Remove list item and move its sublist to list if any. */
132
+ declare const removeListItem: (editor: SlateEditor, {
133
+ list,
134
+ listItem,
135
+ reverse
136
+ }: RemoveListItemOptions) => boolean;
137
+ //#endregion
138
+ //#region src/lib/transforms/toggleList.d.ts
139
+ declare const toggleList: (editor: SlateEditor, {
140
+ type
141
+ }: {
142
+ type: string;
143
+ }) => boolean;
144
+ declare const toggleBulletedList: (editor: SlateEditor) => boolean;
145
+ declare const toggleTaskList: (editor: SlateEditor, defaultChecked?: boolean) => boolean;
146
+ declare const toggleNumberedList: (editor: SlateEditor) => boolean;
147
+ //#endregion
148
+ //#region src/lib/transforms/unindentListItems.d.ts
149
+ type UnindentListItemsOptions = Omit<MoveListItemsOptions, 'increase'>;
150
+ declare const unindentListItems: (editor: SlateEditor, options?: UnindentListItemsOptions) => boolean | undefined;
151
+ //#endregion
152
+ //#region src/lib/transforms/unwrapList.d.ts
153
+ declare const unwrapList: (editor: SlateEditor, {
154
+ at
155
+ }?: {
156
+ at?: Path;
157
+ }) => void;
158
+ //#endregion
159
+ //#region src/lib/BaseListPlugin.d.ts
160
+ type ListConfig = PluginConfig<'listClassic', {
161
+ enableResetOnShiftTab?: boolean;
162
+ /** Inherit the checked state of above node after insert break at the end */
163
+ inheritCheckStateOnLineEndBreak?: boolean;
164
+ /** Inherit the checked state of below node after insert break at the start */
165
+ inheritCheckStateOnLineStartBreak?: boolean;
166
+ /** Valid children types for list items, in addition to p and ul types. */
167
+ validLiChildrenTypes?: string[];
168
+ }, {}, {
169
+ toggle: {
170
+ bulletedList: OmitFirst<typeof toggleBulletedList>;
171
+ list: OmitFirst<typeof toggleList>;
172
+ numberedList: OmitFirst<typeof toggleNumberedList>;
173
+ taskList: OmitFirst<typeof toggleTaskList>;
174
+ };
175
+ }>;
176
+ declare const BaseBulletedListPlugin: platejs6.SlatePlugin<PluginConfig<"ul", {}, {}, Record<"ul", {
177
+ toggle: () => void;
178
+ }>, {}>>;
179
+ declare const BaseNumberedListPlugin: platejs6.SlatePlugin<PluginConfig<"ol", {}, {}, Record<"ol", {
180
+ toggle: () => void;
181
+ }>, {}>>;
182
+ declare const BaseTaskListPlugin: platejs6.SlatePlugin<PluginConfig<"taskList", {
183
+ inheritCheckStateOnLineEndBreak: boolean;
184
+ inheritCheckStateOnLineStartBreak: boolean;
185
+ }, {}, Record<"taskList", {
186
+ toggle: () => void;
187
+ }>, {}>>;
188
+ declare const BaseListItemPlugin: platejs6.SlatePlugin<PluginConfig<"li", {}, {}, {}, {}>>;
189
+ declare const BaseListItemContentPlugin: platejs6.SlatePlugin<PluginConfig<"lic", {}, {}, {}, {}>>;
190
+ /** Enables support for bulleted, numbered and to-do lists. */
191
+ declare const BaseListPlugin: platejs6.SlatePlugin<PluginConfig<"listClassic", {
192
+ enableResetOnShiftTab?: boolean;
193
+ /** Inherit the checked state of above node after insert break at the end */
194
+ inheritCheckStateOnLineEndBreak?: boolean;
195
+ /** Inherit the checked state of below node after insert break at the start */
196
+ inheritCheckStateOnLineStartBreak?: boolean;
197
+ /** Valid children types for list items, in addition to p and ul types. */
198
+ validLiChildrenTypes?: string[];
199
+ }, {}, {
200
+ toggle: {
201
+ bulletedList: (() => boolean) & (() => boolean);
202
+ list: ((args_0: {
203
+ type: string;
204
+ }) => boolean) & ((args_0: {
205
+ type: string;
206
+ }) => boolean);
207
+ numberedList: (() => boolean) & (() => boolean);
208
+ taskList: ((defaultChecked?: boolean | undefined) => boolean) & ((defaultChecked?: boolean | undefined) => boolean);
209
+ };
210
+ }, {}>>;
211
+ //#endregion
212
+ //#region src/lib/withDeleteBackwardList.d.ts
213
+ declare const withDeleteBackwardList: OverrideEditor<ListConfig>;
214
+ //#endregion
215
+ //#region src/lib/withDeleteForwardList.d.ts
216
+ declare const withDeleteForwardList: OverrideEditor<ListConfig>;
217
+ //#endregion
218
+ //#region src/lib/withDeleteFragmentList.d.ts
219
+ declare const withDeleteFragmentList: OverrideEditor<ListConfig>;
220
+ //#endregion
221
+ //#region src/lib/withInsertBreakList.d.ts
222
+ declare const withInsertBreakList: OverrideEditor<ListConfig>;
223
+ //#endregion
224
+ //#region src/lib/withInsertFragmentList.d.ts
225
+ declare const withInsertFragmentList: OverrideEditor<ListConfig>;
226
+ //#endregion
227
+ //#region src/lib/withList.d.ts
228
+ declare const withList: OverrideEditor<ListConfig>;
229
+ //#endregion
230
+ //#region src/lib/withNormalizeList.d.ts
231
+ /** Normalize list node to force the ul>li>p+ul structure. */
232
+ declare const withNormalizeList: OverrideEditor<ListConfig>;
233
+ //#endregion
234
+ //#region src/lib/normalizers/normalizeListItem.d.ts
235
+ /**
236
+ * Recursively get all the:
237
+ *
238
+ * - Block children
239
+ * - Inline children except those at excludeDepth
240
+ */
241
+ declare const getDeepInlineChildren: (editor: SlateEditor, {
242
+ children
243
+ }: {
244
+ children: NodeEntry<Descendant>[];
245
+ }) => NodeEntry<Descendant>[];
246
+ /**
247
+ * If the list item has no child: insert an empty list item container. Else:
248
+ * move the children that are not valid to the list item container.
249
+ */
250
+ declare const normalizeListItem: (editor: SlateEditor, {
251
+ listItem,
252
+ validLiChildrenTypes
253
+ }: {
254
+ listItem: ElementEntry;
255
+ } & ListConfig["options"]) => boolean;
256
+ //#endregion
257
+ //#region src/lib/normalizers/normalizeNestedList.d.ts
258
+ declare const normalizeNestedList: (editor: SlateEditor, {
259
+ nestedListItem
260
+ }: {
261
+ nestedListItem: ElementEntry;
262
+ }) => boolean | undefined;
263
+ //#endregion
264
+ //#region src/lib/queries/getHighestEmptyList.d.ts
265
+ /**
266
+ * Find the highest end list that can be deleted. Its path should be different
267
+ * to diffListPath. If the highest end list 2+ items, return liPath. Get the
268
+ * parent list until:
269
+ *
270
+ * - The list has less than 2 items.
271
+ * - Its path is not equals to diffListPath.
272
+ */
273
+ declare const getHighestEmptyList: (editor: SlateEditor, {
274
+ diffListPath,
275
+ liPath
276
+ }: {
277
+ liPath: Path;
278
+ diffListPath?: Path;
279
+ }) => Path | undefined;
280
+ //#endregion
281
+ //#region src/lib/queries/getListItemEntry.d.ts
282
+ /**
283
+ * Returns the nearest li and ul / ol wrapping node entries for a given path
284
+ * (default = selection)
285
+ */
286
+ declare const getListItemEntry: (editor: SlateEditor, {
287
+ at
288
+ }?: {
289
+ at?: TLocation | null;
290
+ }) => {
291
+ list: ElementEntry;
292
+ listItem: ElementEntry;
293
+ } | undefined;
294
+ //#endregion
295
+ //#region src/lib/queries/getListRoot.d.ts
296
+ /** Searches upward for the root list element */
297
+ declare const getListRoot: (editor: SlateEditor, at?: Path | Point | TRange | null) => ElementEntry | undefined;
298
+ //#endregion
299
+ //#region src/lib/queries/getListTypes.d.ts
300
+ declare const getListTypes: (editor: SlateEditor) => string[];
301
+ //#endregion
302
+ //#region src/lib/queries/getTaskListProps.d.ts
303
+ type GetPropsIfTaskListLiNodeOptions = {
304
+ liNode: TElement;
305
+ inherit?: boolean;
306
+ };
307
+ declare const getPropsIfTaskListLiNode: (editor: SlateEditor, {
308
+ inherit,
309
+ liNode: node
310
+ }: GetPropsIfTaskListLiNodeOptions) => {
311
+ checked: boolean;
312
+ } | undefined;
313
+ declare const getPropsIfTaskList: (editor: SlateEditor, type: string, partial?: {
314
+ checked?: boolean;
315
+ }) => {
316
+ checked: boolean;
317
+ } | undefined;
318
+ //#endregion
319
+ //#region src/lib/queries/getTodoListItemEntry.d.ts
320
+ /**
321
+ * Returns the nearest li and ul / ol wrapping node entries for a given path
322
+ * (default = selection)
323
+ */
324
+ declare const getTodoListItemEntry: (editor: SlateEditor, {
325
+ at
326
+ }?: {
327
+ at?: TLocation | null;
328
+ }) => {
329
+ list: ElementEntry;
330
+ listItem: ElementEntry;
331
+ } | undefined;
332
+ //#endregion
333
+ //#region src/lib/queries/hasListChild.d.ts
334
+ /** Is there a list child in the node. */
335
+ declare const hasListChild: (editor: SlateEditor, node: Ancestor) => boolean;
336
+ //#endregion
337
+ //#region src/lib/queries/isAcrossListItems.d.ts
338
+ /** Is selection across blocks with list items */
339
+ declare const isAcrossListItems: (editor: SlateEditor, at?: TRange | null) => boolean;
340
+ //#endregion
341
+ //#region src/lib/queries/isListNested.d.ts
342
+ /** Is the list nested, i.e. its parent is a list item. */
343
+ declare const isListNested: (editor: SlateEditor, listPath: Path) => boolean;
344
+ //#endregion
345
+ //#region src/lib/queries/isListRoot.d.ts
346
+ declare const isListRoot: (editor: SlateEditor, node: Descendant) => boolean;
347
+ //#endregion
348
+ //#region src/lib/queries/someList.d.ts
349
+ declare const someList: (editor: SlateEditor, type: string) => boolean;
350
+ //#endregion
2
351
  export { BaseBulletedListPlugin, BaseListItemContentPlugin, BaseListItemPlugin, BaseListPlugin, BaseNumberedListPlugin, BaseTaskListPlugin, BaseTodoListPlugin, GetPropsIfTaskListLiNodeOptions, InsertListItemOptions, ListConfig, MergeListItemIntoListOptions, MoveListItemDownOptions, MoveListItemSublistItemsToListItemSublistOptions, MoveListItemUpOptions, MoveListItemsOptions, RemoveListItemOptions, TTodoListItemElement, UnindentListItemsOptions, getDeepInlineChildren, getHighestEmptyList, getListItemEntry, getListRoot, getListTypes, getPropsIfTaskList, getPropsIfTaskListLiNode, getTodoListItemEntry, hasListChild, indentListItems, insertListItem, insertTodoListItem, isAcrossListItems, isListNested, isListRoot, moveListItemDown, moveListItemSublistItemsToListItemSublist, moveListItemUp, moveListItems, moveListItemsToList, moveListSiblingsAfterCursor, normalizeListItem, normalizeNestedList, removeFirstListItem, removeListItem, someList, toggleBulletedList, toggleList, toggleNumberedList, toggleTaskList, unindentListItems, unwrapList, withDeleteBackwardList, withDeleteForwardList, withDeleteFragmentList, withInsertBreakList, withInsertFragmentList, withList, withNormalizeList };
package/dist/index.js CHANGED
@@ -34,5 +34,4 @@ const unindentListItems = (editor, options = {}) => moveListItems(editor, {
34
34
  });
35
35
 
36
36
  //#endregion
37
- export { BaseBulletedListPlugin, BaseListItemContentPlugin, BaseListItemPlugin, BaseListPlugin, BaseNumberedListPlugin, BaseTaskListPlugin, BaseTodoListPlugin, getDeepInlineChildren, getHighestEmptyList, getListItemEntry, getListRoot, getListTypes, getPropsIfTaskList, getPropsIfTaskListLiNode, getTodoListItemEntry, hasListChild, indentListItems, insertListItem, insertTodoListItem, isAcrossListItems, isListNested, isListRoot, moveListItemDown, moveListItemSublistItemsToListItemSublist, moveListItemUp, moveListItems, moveListItemsToList, moveListSiblingsAfterCursor, normalizeListItem, normalizeNestedList, removeFirstListItem, removeListItem, someList, toggleBulletedList, toggleList, toggleNumberedList, toggleTaskList, unindentListItems, unwrapList, withDeleteBackwardList, withDeleteForwardList, withDeleteFragmentList, withInsertBreakList, withInsertFragmentList, withList, withNormalizeList };
38
- //# sourceMappingURL=index.js.map
37
+ export { BaseBulletedListPlugin, BaseListItemContentPlugin, BaseListItemPlugin, BaseListPlugin, BaseNumberedListPlugin, BaseTaskListPlugin, BaseTodoListPlugin, getDeepInlineChildren, getHighestEmptyList, getListItemEntry, getListRoot, getListTypes, getPropsIfTaskList, getPropsIfTaskListLiNode, getTodoListItemEntry, hasListChild, indentListItems, insertListItem, insertTodoListItem, isAcrossListItems, isListNested, isListRoot, moveListItemDown, moveListItemSublistItemsToListItemSublist, moveListItemUp, moveListItems, moveListItemsToList, moveListSiblingsAfterCursor, normalizeListItem, normalizeNestedList, removeFirstListItem, removeListItem, someList, toggleBulletedList, toggleList, toggleNumberedList, toggleTaskList, unindentListItems, unwrapList, withDeleteBackwardList, withDeleteForwardList, withDeleteFragmentList, withInsertBreakList, withInsertFragmentList, withList, withNormalizeList };
@@ -1,19 +1,51 @@
1
- import { T as TTodoListItemElement } from "../index-CYSu3DSy";
1
+ import { n as TTodoListItemElement } from "../BaseTodoListPlugin-C3ztdXje";
2
+ import * as platejs0 from "platejs";
3
+ import * as platejs_react0 from "platejs/react";
2
4
 
3
5
  //#region src/react/ListPlugin.d.ts
4
- declare const BulletedListPlugin: any;
5
- declare const TaskListPlugin: any;
6
- declare const NumberedListPlugin: any;
7
- declare const ListItemContentPlugin: any;
8
- declare const ListItemPlugin: any;
6
+ declare const BulletedListPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"ul", {}, {}, Record<"ul", {
7
+ toggle: () => void;
8
+ }>, {}>>;
9
+ declare const TaskListPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"taskList", {
10
+ inheritCheckStateOnLineEndBreak: boolean;
11
+ inheritCheckStateOnLineStartBreak: boolean;
12
+ }, {}, Record<"taskList", {
13
+ toggle: () => void;
14
+ }>, {}>>;
15
+ declare const NumberedListPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"ol", {}, {}, Record<"ol", {
16
+ toggle: () => void;
17
+ }>, {}>>;
18
+ declare const ListItemContentPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"lic", {}, {}, {}, {}>>;
19
+ declare const ListItemPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"li", {}, {}, {}, {}>>;
9
20
  /**
10
21
  * Enables support for bulleted, numbered and to-do lists with React-specific
11
22
  * features.
12
23
  */
13
- declare const ListPlugin: any;
24
+ declare const ListPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"listClassic", {
25
+ enableResetOnShiftTab?: boolean;
26
+ inheritCheckStateOnLineEndBreak?: boolean;
27
+ inheritCheckStateOnLineStartBreak?: boolean;
28
+ validLiChildrenTypes?: string[];
29
+ }, {}, {
30
+ toggle: {
31
+ bulletedList: (() => boolean) & (() => boolean);
32
+ list: ((args_0: {
33
+ type: string;
34
+ }) => boolean) & ((args_0: {
35
+ type: string;
36
+ }) => boolean);
37
+ numberedList: (() => boolean) & (() => boolean);
38
+ taskList: ((defaultChecked?: boolean | undefined) => boolean) & ((defaultChecked?: boolean | undefined) => boolean);
39
+ };
40
+ }, {}>>;
14
41
  //#endregion
15
42
  //#region src/react/TodoListPlugin.d.ts
16
- declare const TodoListPlugin: any;
43
+ declare const TodoListPlugin: platejs_react0.PlatePlugin<platejs0.PluginConfig<"action_item", {
44
+ inheritCheckStateOnLineEndBreak: boolean;
45
+ inheritCheckStateOnLineStartBreak: boolean;
46
+ }, {}, Record<"action_item", {
47
+ toggle: () => void;
48
+ }>, {}>>;
17
49
  //#endregion
18
50
  //#region src/react/hooks/useListToolbarButton.d.ts
19
51
  declare const useListToolbarButtonState: ({
@@ -22,11 +54,11 @@ declare const useListToolbarButtonState: ({
22
54
  nodeType?: string | undefined;
23
55
  }) => {
24
56
  nodeType: string;
25
- pressed: any;
57
+ pressed: boolean;
26
58
  };
27
59
  declare const useListToolbarButton: (state: ReturnType<typeof useListToolbarButtonState>) => {
28
60
  props: {
29
- pressed: any;
61
+ pressed: boolean;
30
62
  onClick: () => void;
31
63
  onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => void;
32
64
  };
@@ -45,5 +77,4 @@ declare const useTodoListElement: (state: ReturnType<typeof useTodoListElementSt
45
77
  };
46
78
  };
47
79
  //#endregion
48
- export { BulletedListPlugin, ListItemContentPlugin, ListItemPlugin, ListPlugin, NumberedListPlugin, TaskListPlugin, TodoListPlugin, useListToolbarButton, useListToolbarButtonState, useTodoListElement, useTodoListElementState };
49
- //# sourceMappingURL=index.d.ts.map
80
+ export { BulletedListPlugin, ListItemContentPlugin, ListItemPlugin, ListPlugin, NumberedListPlugin, TaskListPlugin, TodoListPlugin, useListToolbarButton, useListToolbarButtonState, useTodoListElement, useTodoListElementState };
@@ -152,5 +152,4 @@ const useTodoListElement = (state) => {
152
152
  };
153
153
 
154
154
  //#endregion
155
- export { BulletedListPlugin, ListItemContentPlugin, ListItemPlugin, ListPlugin, NumberedListPlugin, TaskListPlugin, TodoListPlugin, useListToolbarButton, useListToolbarButtonState, useTodoListElement, useTodoListElementState };
156
- //# sourceMappingURL=index.js.map
155
+ export { BulletedListPlugin, ListItemContentPlugin, ListItemPlugin, ListPlugin, NumberedListPlugin, TaskListPlugin, TodoListPlugin, useListToolbarButton, useListToolbarButtonState, useTodoListElement, useTodoListElementState };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/platejs-list-classic",
3
- "version": "52.0.11",
3
+ "version": "52.3.6",
4
4
  "description": "List Classic plugin for Plate",
5
5
  "keywords": [
6
6
  "plate",
@@ -33,7 +33,8 @@
33
33
  "react-compiler-runtime": "^1.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@plate/scripts": "1.0.0"
36
+ "@plate/scripts": "1.0.0",
37
+ "platejs": "npm:@lofcz/platejs@52.3.6"
37
38
  },
38
39
  "peerDependencies": {
39
40
  "platejs": ">=52.0.11",
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseListPlugin-n9uuTtLe.js","names":["Path","SlateEditor","TElement","KEYS","isListNested","editor","listPath","listParentNode","api","parent","type","getType","li","SlateEditor","KEYS","getListTypes","editor","getType","olClassic","ulClassic","taskList","Path","SlateEditor","PathApi","KEYS","getListTypes","getHighestEmptyList","editor","diffListPath","liPath","list","api","above","at","match","type","listNode","listPath","equals","children","length","liParent","getType","li","ElementEntry","Path","SlateEditor","TElement","TLocation","KEYS","NodeApi","RangeApi","getListItemEntry","editor","at","selection","list","listItem","liType","getType","li","_at","isRange","isCollapsed","focus","path","anchor","node","get","api","above","match","type","parent","ElementEntry","Path","Point","SlateEditor","TElement","TRange","getListTypes","getListRoot","editor","at","selection","parentList","api","above","match","type","parentListPath","SlateEditor","TElement","KEYS","GetPropsIfTaskListLiNodeOptions","liNode","inherit","getPropsIfTaskListLiNode","editor","node","getType","li","type","checked","undefined","getPropsIfTaskList","partial","taskList","ElementEntry","Path","SlateEditor","TElement","TLocation","KEYS","NodeApi","RangeApi","getTodoListItemEntry","editor","at","selection","list","listItem","todoType","getType","listTodoClassic","_at","isRange","isCollapsed","focus","path","anchor","node","get","api","above","match","type","parent","Ancestor","SlateEditor","match","getListTypes","hasListChild","editor","node","children","some","n","type","SlateEditor","TRange","KEYS","RangeApi","isAcrossListItems","editor","at","selection","isCollapsed","isAcrossBlocks","api","isAt","blocks","some","match","type","getType","li","Descendant","SlateEditor","ElementApi","getListTypes","isListRoot","editor","node","isElement","includes","type","ElementEntry","SlateEditor","TElement","match","PathApi","getListTypes","MoveListItemDownOptions","list","listItem","moveListItemDown","editor","moved","listNode","listItemPath","previousListItemPath","previous","previousSiblingItem","api","node","previousNode","previousPath","sublist","children","find","n","type","newPath","concat","length","tf","withoutNormalizing","wrapNodes","at","moveNodes","to","ElementEntry","Path","SlateEditor","NodeApi","PathApi","getListTypes","MergeListItemIntoListOptions","deleteFromList","fromList","fromListItem","fromStartIndex","to","toList","toListIndex","moveListItemsToList","editor","_to","fromListPath","moved","tf","withoutNormalizing","fromListItemSublist","api","descendant","at","match","type","lastChildPath","lastChild","next","concat","moveNodes","children","fromIndex","delete","Path","SlateEditor","ElementApi","KEYS","NodeApi","getListTypes","unwrapList","editor","at","ancestorListTypeCheck","api","above","match","type","selection","commonNode","common","anchor","path","focus","isElement","includes","tf","withoutNormalizing","unwrapNodes","getType","li","split","ElementEntry","Path","SlateEditor","TElement","KEYS","NodeApi","PathApi","hasListChild","moveListItemsToList","unwrapList","MoveListItemUpOptions","list","listItem","moveListItemUp","editor","move","listNode","listPath","liNode","liPath","liParent","api","above","at","match","type","getType","li","toListPath","next","_error","condA","condB","isLastChild","tf","insertNodes","children","toListNode","get","fromListItem","toList","deleteFromList","fromList","fromStartIndex","concat","liParentPath","movedUpLiPath","moveNodes","to","moved","withoutNormalizing","ElementEntry","SlateEditor","isListNested","moveListItemUp","removeFirstListItem","editor","list","listItem","listPath","EditorNodesOptions","Path","PathRef","SlateEditor","KEYS","PathApi","isListNested","moveListItemDown","moveListItemUp","removeFirstListItem","MoveListItemsOptions","at","enableResetOnShiftTab","increase","moveListItems","editor","selection","undefined","_nodes","api","nodes","match","type","getType","lic","lics","Array","from","length","highestLicPaths","highestLicPathRefs","forEach","licPath","liPath","parent","isAncestor","some","path","highestLiPath","push","pathRef","licPathRefsToMove","reverse","tf","withoutNormalizing","moved","licPathRef","unref","listItem","parentList","_moved","list","SlateEditor","TElement","KEYS","PathApi","InsertListItemOptions","inheritCheckStateOnLineEndBreak","inheritCheckStateOnLineStartBreak","insertListItem","editor","options","liType","getType","li","licType","lic","selection","licEntry","api","above","match","type","paragraphPath","listItemEntry","parent","listItemNode","listItemPath","optionalTasklistProps","checked","undefined","success","tf","withoutNormalizing","isCollapsed","delete","isStart","focus","isEnd","isEmpty","after","nextParagraphPath","next","nextListItemPath","insertNodes","children","text","at","marks","select","splitNodes","wrapNodes","moveNodes","to","collapse","edge","length","concat","TElement","createSlatePlugin","KEYS","getTodoListItemEntry","insertTodoListItem","TTodoListItemElement","checked","BaseTodoListPlugin","key","listTodoClassic","node","isElement","options","inheritCheckStateOnLineEndBreak","inheritCheckStateOnLineStartBreak","overrideEditor","editor","tf","insertBreak","transforms","insertBreakTodoList","selection","res","inserted","extendTransforms","type","toggle","toggleBlock","SlateEditor","KEYS","PathApi","BaseTodoListPlugin","insertTodoListItem","editor","inheritCheckStateOnLineEndBreak","inheritCheckStateOnLineStartBreak","getOptions","todoType","getType","listTodoClassic","selection","todoEntry","api","above","match","type","todo","paragraphPath","success","tf","withoutNormalizing","isCollapsed","delete","isStart","focus","isEnd","isEmpty","after","nextParagraphPath","next","insertNodes","checked","children","text","at","marks","select","splitNodes","ElementEntry","Path","SlateEditor","TElement","NodeApi","PathApi","getListTypes","MoveListItemSublistItemsToListItemSublistOptions","fromListItem","toListItem","start","moveListItemSublistItemsToListItemSublist","editor","fromListItemPath","toListItemPath","moved","tf","withoutNormalizing","fromListItemSublist","api","descendant","at","match","type","fromListItemSublistPath","toListItemSublist","to","fromList","parent","fromListNode","fromListType","toListItemSublistPath","concat","insertNodes","children","next","lastChild","moveNodes","delete","ElementEntry","SlateEditor","TElement","deleteMerge","KEYS","PathApi","getPropsIfTaskListLiNode","hasListChild","moveListItemsToList","moveListItemSublistItemsToListItemSublist","RemoveListItemOptions","list","listItem","reverse","removeListItem","editor","liNode","liPath","api","isExpanded","previousLiPath","previous","success","tf","withoutNormalizing","previousLi","node","tempLiPath","next","insertNodes","children","text","type","getType","lic","inherit","li","at","tempLi","tempLiPathRef","pathRef","fromListItem","toListItem","unref","removeNodes","toList","toListIndex","SlateEditor","TElement","ElementApi","KEYS","NodeApi","RangeApi","BaseListPlugin","getListItemEntry","getListTypes","getPropsIfTaskList","unwrapList","ToggleListOptions","type","checked","_toggleList","editor","tf","withoutNormalizing","selection","validLiChildrenTypes","getOptions","api","isCollapsed","isAt","blocks","res","list","setNodes","at","mode","match","n","isElement","includes","children","wrapNodes","_nodes","nodes","getType","p","Array","from","blockAbove","block","lic","listItem","li","path","startPoint","endPoint","edges","commonEntry","common","startList","node","start","endList","end","rangeLength","Math","min","length","rootPathLength","filter","forEach","_n","toggleList","toggleBulletedList","ulClassic","toggleTaskList","defaultChecked","taskList","toggleNumberedList","olClassic","NodeEntry","OverrideEditor","TElement","deleteMerge","KEYS","PathApi","ListConfig","isAcrossListItems","isListNested","getListItemEntry","removeFirstListItem","removeListItem","withDeleteBackwardList","editor","tf","deleteBackward","transforms","unit","deleteBackwardList","res","moved","list","listItem","api","isAt","start","match","node","type","getType","li","withoutNormalizing","hasPrevious","resetBlock","at","pointBeforeListItem","before","selection","focus","currentLic","hasMultipleChildren","anchor","licType","lic","_licNodes","nodes","mode","children","length","reverse","leftoverListItem","parent","removeNodes","EditorTransforms","ElementEntry","OverrideEditor","SlateEditor","TElement","KEYS","NodeApi","PathApi","ListConfig","getListItemEntry","getListRoot","hasListChild","isAcrossListItems","moveListItemsToList","moveListItemUp","removeFirstListItem","removeListItem","selectionIsNotInAListHandler","editor","pointAfterSelection","api","after","selection","focus","nextSiblingListRes","at","listItem","parentBlockEntity","block","anchor","string","tf","removeNodes","sublistRes","selectionIsInAListHandler","res","list","defaultDelete","unit","liType","getType","li","_nodes","nodes","mode","match","node","path","length","isNodeLi","type","isSiblingOfNodeLi","get","next","liWithSiblings","Array","from","entry","pointAfterListItem","listRoot","deleteFromList","fromList","toList","siblingListItem","siblingList","parent","reverse","licType","lic","_licNodes","nextSelectableLic","children","leftoverListItem","nestedList","nestedListItem","withDeleteForwardList","deleteForward","transforms","deleteForwardList","skipDefaultDelete","isAt","end","withoutNormalizing","OverrideEditor","SlateEditor","TRange","deleteMerge","KEYS","ListConfig","getHighestEmptyList","hasListChild","isAcrossListItems","getLiStart","editor","start","api","selection","above","at","match","type","getType","li","withDeleteFragmentList","tf","deleteFragment","transforms","direction","deleteFragmentList","deleted","withoutNormalizing","end","liEnd","liEndCanBeDeleted","liEndPathRef","pathRef","undefined","liStart","liEndPath","unref","listStart","parent","deletePath","diffListPath","liPath","removeNodes","OverrideEditor","KEYS","ListConfig","getListItemEntry","insertListItem","moveListItemUp","withInsertBreakList","editor","getOptions","tf","insertBreak","transforms","insertBreakList","selection","res","moved","list","listItem","api","isEmpty","block","match","type","getType","li","didReset","resetBlock","at","inserted","Ancestor","AncestorEntry","Descendant","DescendantEntry","ElementEntry","OverrideEditor","Path","TElement","TText","ElementApi","KEYS","NodeApi","PathApi","ListConfig","getPropsIfTaskListLiNode","isListRoot","withInsertFragmentList","editor","tf","insertFragment","listItemType","getType","li","listItemContentType","lic","getFirstAncestorOfType","root","entry","type","ancestor","parent","get","findListItemsWithContent","first","prev","node","children","trimList","listRoot","_texts","texts","textEntries","Array","from","commonAncestorEntry","reduce","commonAncestor","textEntry","isAncestor","common","rest","wrapNodeIntoListItem","props","Record","isSingleLic","fragment","isFragmentOnlyListRoot","length","nodes","filter","isElement","getTextAndListItemNodes","liEntry","licEntry","liPath","licNode","licPath","isEmptyNode","string","flatMap","map","v","inherit","liNode","textNode","listItemNodes","currentSublists","newLic","newSublists","insertNodes","at","next","select","removeNodes","path","text","transforms","api","match","mode","Descendant","ElementEntry","NodeEntry","PathRef","SlateEditor","TElement","KEYS","match","NodeApi","PathApi","ListConfig","getListTypes","moveListItemUp","getDeepInlineChildren","editor","children","inlineChildren","child","api","isBlock","push","Array","from","normalizeListItem","listItem","validLiChildrenTypes","changed","allValidLiChildrenTypes","Set","getType","lic","olClassic","taskList","ulClassic","liPath","liChildren","invalidLiChildrenPathRefs","filter","has","type","map","childPath","pathRef","firstLiChild","firstLiChildNode","firstLiChildPath","tf","insertNodes","create","block","at","concat","parent","sublist","reverse","forEach","c","list","removeNodes","includes","setNodes","licChildren","length","blockPathRefs","licChild","to","next","path","moveNodes","unref","ref","ElementEntry","SlateEditor","match","PathApi","getListTypes","normalizeNestedList","editor","nestedListItem","path","parentNode","api","parent","hasParentList","type","previousListItemPath","previous","previousSiblingItem","node","previousPath","newPath","concat","tf","moveNodes","at","to","OverrideEditor","TElement","ElementApi","KEYS","match","NodeApi","PathApi","ListConfig","normalizeListItem","normalizeNestedList","getListTypes","isListRoot","moveListItemsToList","withNormalizeList","editor","getOptions","tf","normalizeNode","transforms","node","path","liType","getType","li","licType","lic","defaultType","p","isElement","nonLiChild","Array","from","children","find","child","type","wrapNodes","at","taskList","nonTaskListItems","filter","length","withoutNormalizing","forEach","itemPath","setNodes","checked","taskListItems","unsetNodes","some","item","removeNodes","nextPath","next","nextNode","get","deleteFromList","fromList","toList","prevPath","previous","prevNode","nestedListItem","listItem","validLiChildrenTypes","api","parent","OverrideEditor","KEYS","RangeApi","ListConfig","unwrapList","moveListItems","withDeleteBackwardList","withDeleteForwardList","withDeleteFragmentList","withInsertBreakList","withInsertFragmentList","withNormalizeList","withList","ctx","editor","getOptions","tf","resetBlock","tab","transforms","options","api","block","at","match","type","getType","li","apply","workRange","selection","isCollapsed","anchor","focus","isBackward","unhangRange","select","listSelected","some","enableResetOnShiftTab","increase","reverse","OmitFirst","PluginConfig","bindFirst","createSlatePlugin","createTSlatePlugin","KEYS","toggleBulletedList","toggleList","toggleNumberedList","toggleTaskList","withList","ListConfig","enableResetOnShiftTab","inheritCheckStateOnLineEndBreak","inheritCheckStateOnLineStartBreak","validLiChildrenTypes","toggle","bulletedList","list","numberedList","taskList","BaseBulletedListPlugin","key","ulClassic","node","isContainer","isElement","parsers","html","deserializer","rules","validNodeName","render","as","extendTransforms","editor","BaseNumberedListPlugin","olClassic","BaseTaskListPlugin","options","BaseListItemPlugin","li","inject","plugins","parser","preInsert","type","api","some","match","isStrictSiblings","BaseListItemContentPlugin","lic","BaseListPlugin","listClassic","overrideEditor","extendEditorTransforms"],"sources":["../src/lib/queries/isListNested.ts","../src/lib/queries/getListTypes.ts","../src/lib/queries/getHighestEmptyList.ts","../src/lib/queries/getListItemEntry.ts","../src/lib/queries/getListRoot.ts","../src/lib/queries/getTaskListProps.ts","../src/lib/queries/getTodoListItemEntry.ts","../src/lib/queries/hasListChild.ts","../src/lib/queries/isAcrossListItems.ts","../src/lib/queries/isListRoot.ts","../src/lib/transforms/moveListItemDown.ts","../src/lib/transforms/moveListItemsToList.ts","../src/lib/transforms/unwrapList.ts","../src/lib/transforms/moveListItemUp.ts","../src/lib/transforms/removeFirstListItem.ts","../src/lib/transforms/moveListItems.ts","../src/lib/transforms/insertListItem.ts","../src/lib/BaseTodoListPlugin.ts","../src/lib/transforms/insertTodoListItem.ts","../src/lib/transforms/moveListItemSublistItemsToListItemSublist.ts","../src/lib/transforms/removeListItem.ts","../src/lib/transforms/toggleList.ts","../src/lib/withDeleteBackwardList.ts","../src/lib/withDeleteForwardList.ts","../src/lib/withDeleteFragmentList.ts","../src/lib/withInsertBreakList.ts","../src/lib/withInsertFragmentList.ts","../src/lib/normalizers/normalizeListItem.ts","../src/lib/normalizers/normalizeNestedList.ts","../src/lib/withNormalizeList.ts","../src/lib/withList.ts","../src/lib/BaseListPlugin.ts"],"sourcesContent":["import type { Path, SlateEditor, TElement } from 'platejs';\n\nimport { KEYS } from 'platejs';\n\n/** Is the list nested, i.e. its parent is a list item. */\nexport const isListNested = (editor: SlateEditor, listPath: Path) => {\n const listParentNode = editor.api.parent<TElement>(listPath)?.[0];\n\n return listParentNode?.type === editor.getType(KEYS.li);\n};\n","import type { SlateEditor } from 'platejs';\n\nimport { KEYS } from 'platejs';\n\nexport const getListTypes = (editor: SlateEditor) => [\n editor.getType(KEYS.olClassic),\n editor.getType(KEYS.ulClassic),\n editor.getType(KEYS.taskList),\n];\n","import { type Path, type SlateEditor, PathApi } from 'platejs';\nimport { KEYS } from 'platejs';\n\nimport { getListTypes } from './getListTypes';\n\n/**\n * Find the highest end list that can be deleted. Its path should be different\n * to diffListPath. If the highest end list 2+ items, return liPath. Get the\n * parent list until:\n *\n * - The list has less than 2 items.\n * - Its path is not equals to diffListPath.\n */\nexport const getHighestEmptyList = (\n editor: SlateEditor,\n {\n diffListPath,\n liPath,\n }: {\n liPath: Path;\n diffListPath?: Path;\n }\n): Path | undefined => {\n const list = editor.api.above({\n at: liPath,\n match: { type: getListTypes(editor) },\n });\n\n if (!list) return;\n\n const [listNode, listPath] = list;\n\n if (!diffListPath || !PathApi.equals(listPath, diffListPath)) {\n if (listNode.children.length < 2) {\n const liParent = editor.api.above({\n at: listPath,\n match: { type: editor.getType(KEYS.li) },\n });\n\n if (liParent) {\n return (\n getHighestEmptyList(editor, { diffListPath, liPath: liParent[1] }) ||\n listPath\n );\n }\n }\n\n return liPath;\n }\n};\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n type TElement,\n type TLocation,\n KEYS,\n NodeApi,\n RangeApi,\n} from 'platejs';\n\n/**\n * Returns the nearest li and ul / ol wrapping node entries for a given path\n * (default = selection)\n */\nexport const getListItemEntry = (\n editor: SlateEditor,\n { at = editor.selection }: { at?: TLocation | null } = {}\n): { list: ElementEntry; listItem: ElementEntry } | undefined => {\n const liType = editor.getType(KEYS.li);\n\n let _at: Path;\n\n if (RangeApi.isRange(at) && !RangeApi.isCollapsed(at)) {\n _at = at.focus.path;\n } else if (RangeApi.isRange(at)) {\n _at = at.anchor.path;\n } else {\n _at = at as Path;\n }\n if (_at) {\n const node = NodeApi.get<TElement>(editor, _at);\n\n if (node) {\n const listItem = editor.api.above<TElement>({\n at: _at,\n match: { type: liType },\n });\n\n if (listItem) {\n const list = editor.api.parent<TElement>(listItem[1])!;\n\n return { list, listItem };\n }\n }\n }\n};\n","import type {\n ElementEntry,\n Path,\n Point,\n SlateEditor,\n TElement,\n TRange,\n} from 'platejs';\n\nimport { getListTypes } from './getListTypes';\n\n/** Searches upward for the root list element */\nexport const getListRoot = (\n editor: SlateEditor,\n at: Path | Point | TRange | null = editor.selection\n): ElementEntry | undefined => {\n if (!at) return;\n\n const parentList = editor.api.above<TElement>({\n at,\n match: {\n type: getListTypes(editor),\n },\n });\n\n if (parentList) {\n const [, parentListPath] = parentList;\n\n return getListRoot(editor, parentListPath) ?? parentList;\n }\n};\n","import { type SlateEditor, type TElement, KEYS } from 'platejs';\n\nexport type GetPropsIfTaskListLiNodeOptions = {\n liNode: TElement;\n inherit?: boolean;\n};\n\nexport const getPropsIfTaskListLiNode = (\n editor: SlateEditor,\n { inherit = false, liNode: node }: GetPropsIfTaskListLiNodeOptions\n) =>\n editor.getType(KEYS.li) === node.type && 'checked' in node\n ? { checked: inherit ? (node.checked as boolean) : false }\n : undefined;\n\nexport const getPropsIfTaskList = (\n editor: SlateEditor,\n type: string,\n partial: { checked?: boolean } = {}\n) =>\n editor.getType(KEYS.taskList) === type\n ? { checked: false, ...partial }\n : undefined;\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n type TElement,\n type TLocation,\n KEYS,\n NodeApi,\n RangeApi,\n} from 'platejs';\n\n/**\n * Returns the nearest li and ul / ol wrapping node entries for a given path\n * (default = selection)\n */\nexport const getTodoListItemEntry = (\n editor: SlateEditor,\n { at = editor.selection }: { at?: TLocation | null } = {}\n): { list: ElementEntry; listItem: ElementEntry } | undefined => {\n const todoType = editor.getType(KEYS.listTodoClassic);\n\n let _at: Path;\n\n if (RangeApi.isRange(at) && !RangeApi.isCollapsed(at)) {\n _at = at.focus.path;\n } else if (RangeApi.isRange(at)) {\n _at = at.anchor.path;\n } else {\n _at = at as Path;\n }\n if (_at) {\n const node = NodeApi.get<TElement>(editor, _at);\n\n if (node) {\n const listItem = editor.api.above<TElement>({\n at: _at,\n match: { type: todoType },\n });\n\n if (listItem) {\n const list = editor.api.parent<TElement>(listItem[1])!;\n\n return { list, listItem };\n }\n }\n }\n};\n","import { type Ancestor, type SlateEditor, match } from 'platejs';\n\nimport { getListTypes } from './getListTypes';\n\n/** Is there a list child in the node. */\nexport const hasListChild = (editor: SlateEditor, node: Ancestor) =>\n node.children.some((n) => match(n, [], { type: getListTypes(editor) }));\n","import { type SlateEditor, type TRange, KEYS, RangeApi } from 'platejs';\n\n/** Is selection across blocks with list items */\nexport const isAcrossListItems = (\n editor: SlateEditor,\n at: TRange | null = editor.selection\n) => {\n if (!at || RangeApi.isCollapsed(at)) {\n return false;\n }\n\n const isAcrossBlocks = editor.api.isAt({ at, blocks: true });\n\n if (!isAcrossBlocks) return false;\n\n return editor.api.some({\n at,\n match: { type: editor.getType(KEYS.li) },\n });\n};\n","import { type Descendant, type SlateEditor, ElementApi } from 'platejs';\n\nimport { getListTypes } from './getListTypes';\n\nexport const isListRoot = (editor: SlateEditor, node: Descendant): boolean =>\n ElementApi.isElement(node) && getListTypes(editor).includes(node.type);\n","import {\n type ElementEntry,\n type SlateEditor,\n type TElement,\n match,\n PathApi,\n} from 'platejs';\n\nimport { getListTypes } from '../queries/index';\n\nexport type MoveListItemDownOptions = {\n list: ElementEntry;\n listItem: ElementEntry;\n};\n\nexport const moveListItemDown = (\n editor: SlateEditor,\n { list, listItem }: MoveListItemDownOptions\n) => {\n let moved = false;\n\n const [listNode] = list;\n const [, listItemPath] = listItem;\n\n const previousListItemPath = PathApi.previous(listItemPath);\n\n if (!previousListItemPath) {\n return;\n }\n\n // Previous sibling is the new parent\n const previousSiblingItem = editor.api.node(previousListItemPath);\n\n if (previousSiblingItem) {\n const [previousNode, previousPath] = previousSiblingItem;\n\n const sublist = (previousNode.children as TElement[]).find((n) =>\n match(n, [], { type: getListTypes(editor) })\n );\n const newPath = previousPath.concat(\n sublist ? [1, sublist.children.length] : [1]\n );\n\n editor.tf.withoutNormalizing(() => {\n if (!sublist) {\n // Create new sublist\n editor.tf.wrapNodes<TElement>(\n { children: [], type: listNode.type },\n { at: listItemPath }\n );\n }\n\n // Move the current item to the sublist\n editor.tf.moveNodes({\n at: listItemPath,\n to: newPath,\n });\n\n moved = true;\n });\n }\n\n return moved;\n};\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport { getListTypes } from '../queries/getListTypes';\n\nexport type MergeListItemIntoListOptions = {\n /**\n * Delete `fromListItem` sublist if true.\n *\n * @default true\n */\n deleteFromList?: boolean;\n\n /** List items of the list will be moved. */\n fromList?: ElementEntry;\n\n /** List items of the sublist of this node will be moved. */\n fromListItem?: ElementEntry;\n\n fromStartIndex?: number;\n\n to?: Path;\n\n /** List items will be moved in this list. */\n toList?: ElementEntry;\n\n /** List position where to move the list items. */\n toListIndex?: number | null;\n};\n\n/**\n * Move the list items of the sublist of `fromListItem` to `toList` (if\n * `fromListItem` is defined). Move the list items of `fromList` to `toList` (if\n * `fromList` is defined).\n */\nexport const moveListItemsToList = (\n editor: SlateEditor,\n {\n deleteFromList = true,\n fromList,\n fromListItem,\n fromStartIndex,\n to: _to,\n toList,\n toListIndex = null,\n }: MergeListItemIntoListOptions\n) => {\n let fromListPath: Path | undefined;\n let moved: boolean | void = false;\n\n editor.tf.withoutNormalizing(() => {\n if (fromListItem) {\n const fromListItemSublist = editor.api.descendant({\n at: fromListItem[1],\n match: {\n type: getListTypes(editor),\n },\n });\n\n if (!fromListItemSublist) return;\n\n fromListPath = fromListItemSublist?.[1];\n } else if (fromList) {\n fromListPath = fromList[1];\n } else {\n return;\n }\n\n let to: Path | null = null;\n\n if (_to) to = _to;\n if (toList) {\n if (toListIndex === null) {\n const lastChildPath = NodeApi.lastChild(editor, toList[1])?.[1];\n to = lastChildPath\n ? PathApi.next(lastChildPath)\n : toList[1].concat([0]);\n } else {\n to = toList[1].concat([toListIndex]);\n }\n }\n if (!to) return;\n\n moved = editor.tf.moveNodes({\n at: fromListPath,\n children: true,\n fromIndex: fromStartIndex,\n to,\n });\n\n // Remove the empty list\n if (deleteFromList) {\n editor.tf.delete({ at: fromListPath });\n }\n });\n\n return moved;\n};\n","import {\n type Path,\n type SlateEditor,\n ElementApi,\n KEYS,\n NodeApi,\n} from 'platejs';\n\nimport { getListTypes } from '../queries/index';\n\nexport const unwrapList = (editor: SlateEditor, { at }: { at?: Path } = {}) => {\n const ancestorListTypeCheck = () => {\n if (editor.api.above({ at, match: { type: getListTypes(editor) } })) {\n return true;\n }\n // The selection's common node might be a list type\n if (!at && editor.selection) {\n const commonNode = NodeApi.common(\n editor,\n editor.selection.anchor.path,\n editor.selection.focus.path\n )!;\n\n if (\n ElementApi.isElement(commonNode[0]) &&\n getListTypes(editor).includes(commonNode[0].type)\n ) {\n return true;\n }\n }\n\n return false;\n };\n\n editor.tf.withoutNormalizing(() => {\n do {\n // const licEntry = editor.api.block({\n // at,\n // match: { type: editor.getType(BaseListItemContentPlugin) },\n // });\n\n // Allow other LIC types\n // if (licEntry) {\n // editor.tf.setNodes(\n // { type: editor.getType(BaseParagraphPlugin) },\n // { at }\n // );\n // }\n\n editor.tf.unwrapNodes({\n at,\n match: { type: editor.getType(KEYS.li) },\n split: true,\n });\n\n editor.tf.unwrapNodes({\n at,\n match: {\n type: getListTypes(editor),\n },\n split: true,\n });\n } while (ancestorListTypeCheck());\n });\n};\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n type TElement,\n KEYS,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport { hasListChild } from '../queries/hasListChild';\nimport { moveListItemsToList } from './moveListItemsToList';\nimport { unwrapList } from './unwrapList';\n\nexport type MoveListItemUpOptions = {\n list: ElementEntry;\n listItem: ElementEntry;\n};\n\n/** Move a list item up. */\nexport const moveListItemUp = (\n editor: SlateEditor,\n { list, listItem }: MoveListItemUpOptions\n) => {\n const move = () => {\n const [listNode, listPath] = list;\n const [liNode, liPath] = listItem;\n\n const liParent = editor.api.above<TElement>({\n at: listPath,\n match: { type: editor.getType(KEYS.li) },\n });\n\n if (!liParent) {\n let toListPath: Path;\n\n try {\n toListPath = PathApi.next(listPath);\n } catch (_error) {\n return;\n }\n\n const condA = hasListChild(editor, liNode);\n const condB = !NodeApi.isLastChild(editor, liPath);\n\n if (condA || condB) {\n // Insert a new list next to `list`\n editor.tf.insertNodes(\n {\n children: [],\n type: listNode.type,\n },\n { at: toListPath }\n );\n }\n if (condA) {\n const toListNode = NodeApi.get<TElement>(editor, toListPath);\n\n if (!toListNode) return;\n\n // Move li sub-lis to the new list\n moveListItemsToList(editor, {\n fromListItem: listItem,\n toList: [toListNode, toListPath],\n });\n }\n // If there is siblings li, move them to the new list\n if (condB) {\n const toListNode = NodeApi.get<TElement>(editor, toListPath);\n\n if (!toListNode) return;\n\n // Move next lis to the new list\n moveListItemsToList(editor, {\n deleteFromList: false,\n fromList: list,\n fromStartIndex: liPath.at(-1)! + 1,\n toList: [toListNode, toListPath],\n });\n }\n\n // Finally, unwrap the list\n unwrapList(editor, { at: liPath.concat(0) });\n\n return true;\n }\n\n const [, liParentPath] = liParent;\n\n const toListPath = liPath.concat([1]);\n\n // If li has next siblings, we need to move them.\n if (!NodeApi.isLastChild(editor, liPath)) {\n // If li has no sublist, insert one.\n if (!hasListChild(editor, liNode)) {\n editor.tf.insertNodes(\n {\n children: [],\n type: listNode.type,\n },\n { at: toListPath }\n );\n }\n\n const toListNode = NodeApi.get<TElement>(editor, toListPath);\n\n if (!toListNode) return;\n\n // Move next siblings to li sublist.\n moveListItemsToList(editor, {\n deleteFromList: false,\n fromListItem: liParent,\n fromStartIndex: liPath.at(-1)! + 1,\n toList: [toListNode, toListPath],\n });\n }\n\n const movedUpLiPath = PathApi.next(liParentPath);\n\n // Move li one level up: next to the li parent.\n editor.tf.moveNodes({\n at: liPath,\n to: movedUpLiPath,\n });\n\n return true;\n };\n\n let moved: boolean | undefined = false;\n\n editor.tf.withoutNormalizing(() => {\n moved = move();\n });\n\n return moved;\n};\n","import type { ElementEntry, SlateEditor } from 'platejs';\n\nimport { isListNested } from '../queries/isListNested';\nimport { moveListItemUp } from './moveListItemUp';\n\n/** If list is not nested and if li is not the first child, move li up. */\nexport const removeFirstListItem = (\n editor: SlateEditor,\n {\n list,\n listItem,\n }: {\n list: ElementEntry;\n listItem: ElementEntry;\n }\n) => {\n const [, listPath] = list;\n\n if (!isListNested(editor, listPath)) {\n moveListItemUp(editor, { list, listItem });\n\n return true;\n }\n\n return false;\n};\n","import {\n type EditorNodesOptions,\n type Path,\n type PathRef,\n type SlateEditor,\n KEYS,\n PathApi,\n} from 'platejs';\n\nimport { isListNested } from '../queries/isListNested';\nimport { moveListItemDown } from './moveListItemDown';\nimport { moveListItemUp } from './moveListItemUp';\nimport { removeFirstListItem } from './removeFirstListItem';\n\nexport type MoveListItemsOptions = {\n at?: EditorNodesOptions['at'];\n enableResetOnShiftTab?: boolean;\n increase?: boolean;\n};\n\nexport const moveListItems = (\n editor: SlateEditor,\n {\n at = editor.selection ?? undefined,\n enableResetOnShiftTab,\n increase = true,\n }: MoveListItemsOptions = {}\n) => {\n const _nodes = editor.api.nodes({\n at,\n match: {\n type: editor.getType(KEYS.lic),\n },\n });\n\n // Get the selected lic\n const lics = Array.from(_nodes);\n\n if (lics.length === 0) return;\n\n const highestLicPaths: Path[] = [];\n const highestLicPathRefs: PathRef[] = [];\n\n // Filter out the nested lic, we just need to move the highest ones\n lics.forEach((lic) => {\n const licPath = lic[1];\n const liPath = PathApi.parent(licPath);\n\n const isAncestor = highestLicPaths.some((path) => {\n const highestLiPath = PathApi.parent(path);\n\n return PathApi.isAncestor(highestLiPath, liPath);\n });\n\n if (!isAncestor) {\n highestLicPaths.push(licPath);\n highestLicPathRefs.push(editor.api.pathRef(licPath));\n }\n });\n\n const licPathRefsToMove = increase\n ? highestLicPathRefs\n : highestLicPathRefs.reverse();\n\n return editor.tf.withoutNormalizing(() => {\n let moved = false;\n\n licPathRefsToMove.forEach((licPathRef) => {\n const licPath = licPathRef.unref();\n\n if (!licPath) return;\n\n const listItem = editor.api.parent(licPath);\n\n if (!listItem) return;\n\n const parentList = editor.api.parent(listItem[1]);\n\n if (!parentList) return;\n\n let _moved: any;\n\n if (increase) {\n _moved = moveListItemDown(editor, {\n list: parentList as any,\n listItem: listItem as any,\n });\n } else if (isListNested(editor, parentList[1])) {\n // un-indent a sub-list item\n _moved = moveListItemUp(editor, {\n list: parentList as any,\n listItem: listItem as any,\n });\n } else if (enableResetOnShiftTab) {\n // unindenting a top level list item, effectively breaking apart the list.\n _moved = removeFirstListItem(editor, {\n list: parentList as any,\n listItem: listItem as any,\n });\n }\n\n moved = _moved || moved;\n });\n\n return moved;\n });\n};\n","import { type SlateEditor, type TElement, KEYS, PathApi } from 'platejs';\n\nexport type InsertListItemOptions = {\n inheritCheckStateOnLineEndBreak?: boolean;\n inheritCheckStateOnLineStartBreak?: boolean;\n};\n\n/** Insert list item if selection in li>p. TODO: test */\nexport const insertListItem = (\n editor: SlateEditor,\n options: InsertListItemOptions = {}\n): boolean => {\n const liType = editor.getType(KEYS.li);\n const licType = editor.getType(KEYS.lic);\n\n if (!editor.selection) {\n return false;\n }\n\n const licEntry = editor.api.above({ match: { type: licType } });\n\n if (!licEntry) return false;\n\n const [, paragraphPath] = licEntry;\n\n const listItemEntry = editor.api.parent(paragraphPath);\n\n if (!listItemEntry) return false;\n\n const [listItemNode, listItemPath] = listItemEntry;\n\n if (listItemNode.type !== liType) return false;\n\n const optionalTasklistProps =\n 'checked' in listItemNode ? { checked: false } : undefined;\n\n let success = false;\n\n editor.tf.withoutNormalizing(() => {\n if (!editor.api.isCollapsed()) {\n editor.tf.delete();\n }\n\n const isStart = editor.api.isStart(editor.selection!.focus, paragraphPath);\n const isEnd = editor.api.isEmpty(editor.selection, { after: true });\n\n const nextParagraphPath = PathApi.next(paragraphPath);\n const nextListItemPath = PathApi.next(listItemPath);\n\n /** If start, insert a list item before */\n if (isStart) {\n if (optionalTasklistProps && options.inheritCheckStateOnLineStartBreak) {\n optionalTasklistProps.checked = listItemNode.checked as boolean;\n }\n\n editor.tf.insertNodes(\n {\n children: [{ children: [{ text: '' }], type: licType }],\n ...optionalTasklistProps,\n type: liType,\n },\n { at: listItemPath }\n );\n\n success = true;\n\n return;\n }\n /**\n * If not end, split nodes, wrap a list item on the new paragraph and move\n * it to the next list item\n */\n if (isEnd) {\n /** If end, insert a list item after and select it */\n const marks = editor.api.marks() || {};\n\n if (optionalTasklistProps && options.inheritCheckStateOnLineEndBreak) {\n optionalTasklistProps.checked = listItemNode.checked as boolean;\n }\n\n editor.tf.insertNodes(\n {\n children: [{ children: [{ text: '', ...marks }], type: licType }],\n ...optionalTasklistProps,\n type: liType,\n },\n { at: nextListItemPath }\n );\n editor.tf.select(nextListItemPath);\n } else {\n editor.tf.withoutNormalizing(() => {\n editor.tf.splitNodes();\n editor.tf.wrapNodes<TElement>(\n {\n children: [],\n ...optionalTasklistProps,\n type: liType,\n },\n { at: nextParagraphPath }\n );\n editor.tf.moveNodes({\n at: nextParagraphPath,\n to: nextListItemPath,\n });\n editor.tf.select(nextListItemPath);\n editor.tf.collapse({\n edge: 'start',\n });\n });\n }\n /** If there is a list in the list item, move it to the next list item */\n if (listItemNode.children.length > 1) {\n editor.tf.moveNodes({\n at: nextParagraphPath,\n to: nextListItemPath.concat(1),\n });\n }\n\n success = true;\n });\n\n return success;\n};\n","import { type TElement, createSlatePlugin, KEYS } from 'platejs';\n\nimport { getTodoListItemEntry } from './queries';\nimport { insertTodoListItem } from './transforms';\n\nexport interface TTodoListItemElement extends TElement {\n checked?: boolean;\n}\n\nexport const BaseTodoListPlugin = createSlatePlugin({\n key: KEYS.listTodoClassic,\n node: { isElement: true },\n options: {\n inheritCheckStateOnLineEndBreak: false,\n inheritCheckStateOnLineStartBreak: false,\n },\n})\n .overrideEditor(({ editor, tf: { insertBreak } }) => ({\n transforms: {\n insertBreak() {\n const insertBreakTodoList = () => {\n if (!editor.selection) return;\n\n const res = getTodoListItemEntry(editor);\n\n // If selection is in a todo li\n if (res) {\n const inserted = insertTodoListItem(editor);\n\n if (inserted) return true;\n }\n };\n\n if (insertBreakTodoList()) return;\n\n insertBreak();\n },\n },\n }))\n .extendTransforms(({ editor, type }) => ({\n toggle: () => {\n editor.tf.toggleBlock(type);\n },\n }));\n","import { type SlateEditor, KEYS, PathApi } from 'platejs';\n\nimport { BaseTodoListPlugin } from '../BaseTodoListPlugin';\n\n/** Insert todo list item if selection in li>p. TODO: test */\nexport const insertTodoListItem = (editor: SlateEditor): boolean => {\n const { inheritCheckStateOnLineEndBreak, inheritCheckStateOnLineStartBreak } =\n editor.getOptions(BaseTodoListPlugin);\n const todoType = editor.getType(KEYS.listTodoClassic);\n\n if (!editor.selection) {\n return false;\n }\n\n const todoEntry = editor.api.above({ match: { type: todoType } });\n\n if (!todoEntry) return false;\n\n const [todo, paragraphPath] = todoEntry;\n\n let success = false;\n\n editor.tf.withoutNormalizing(() => {\n if (!editor.api.isCollapsed()) {\n editor.tf.delete();\n }\n\n const isStart = editor.api.isStart(editor.selection!.focus, paragraphPath);\n const isEnd = editor.api.isEmpty(editor.selection, { after: true });\n\n const nextParagraphPath = PathApi.next(paragraphPath);\n\n /** If start, insert a list item before */\n if (isStart) {\n editor.tf.insertNodes(\n {\n checked: inheritCheckStateOnLineStartBreak ? todo.checked : false,\n children: [{ text: '' }],\n type: todoType,\n },\n { at: paragraphPath }\n );\n\n success = true;\n\n return;\n }\n /** If not end, split the nodes */\n if (isEnd) {\n /** If end, insert a list item after and select it */\n const marks = editor.api.marks() || {};\n editor.tf.insertNodes(\n {\n checked: inheritCheckStateOnLineEndBreak ? todo.checked : false,\n children: [{ text: '', ...marks }],\n type: todoType,\n },\n { at: nextParagraphPath }\n );\n editor.tf.select(nextParagraphPath);\n } else {\n editor.tf.withoutNormalizing(() => {\n editor.tf.splitNodes();\n });\n }\n\n success = true;\n });\n\n return success;\n};\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n type TElement,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport { getListTypes } from '../queries/getListTypes';\n\nexport type MoveListItemSublistItemsToListItemSublistOptions = {\n /** The list item to merge. */\n fromListItem: ElementEntry;\n\n /** The list item where to merge. */\n toListItem: ElementEntry;\n\n /** Move to the start of the list instead of the end. */\n start?: boolean;\n};\n\n/**\n * Move fromListItem sublist list items to the end of `toListItem` sublist. If\n * there is no `toListItem` sublist, insert one.\n */\nexport const moveListItemSublistItemsToListItemSublist = (\n editor: SlateEditor,\n {\n fromListItem,\n start,\n toListItem,\n }: MoveListItemSublistItemsToListItemSublistOptions\n) => {\n const [, fromListItemPath] = fromListItem;\n const [, toListItemPath] = toListItem;\n let moved: boolean | void = false;\n\n editor.tf.withoutNormalizing(() => {\n const fromListItemSublist = editor.api.descendant<TElement>({\n at: fromListItemPath,\n match: {\n type: getListTypes(editor),\n },\n });\n\n if (!fromListItemSublist) return;\n\n const [, fromListItemSublistPath] = fromListItemSublist;\n\n const toListItemSublist = editor.api.descendant<TElement>({\n at: toListItemPath,\n match: {\n type: getListTypes(editor),\n },\n });\n\n let to: Path;\n\n if (!toListItemSublist) {\n const fromList = editor.api.parent(fromListItemPath);\n\n if (!fromList) return;\n\n const [fromListNode] = fromList;\n\n const fromListType = fromListNode.type;\n\n const toListItemSublistPath = toListItemPath.concat([1]);\n\n editor.tf.insertNodes(\n { children: [], type: fromListType as string },\n { at: toListItemSublistPath }\n );\n\n to = toListItemSublistPath.concat([0]);\n } else if (start) {\n const [, toListItemSublistPath] = toListItemSublist;\n to = toListItemSublistPath.concat([0]);\n } else {\n to = PathApi.next(NodeApi.lastChild(editor, toListItemSublist[1])![1]);\n }\n\n moved = editor.tf.moveNodes({\n at: fromListItemSublistPath,\n children: true,\n to,\n });\n\n // Remove the empty list\n editor.tf.delete({ at: fromListItemSublistPath });\n });\n\n return moved;\n};\n","import {\n type ElementEntry,\n type SlateEditor,\n type TElement,\n deleteMerge,\n KEYS,\n PathApi,\n} from 'platejs';\n\nimport { getPropsIfTaskListLiNode, hasListChild } from '../queries';\nimport { moveListItemsToList } from './moveListItemsToList';\nimport { moveListItemSublistItemsToListItemSublist } from './moveListItemSublistItemsToListItemSublist';\n\nexport type RemoveListItemOptions = {\n list: ElementEntry;\n listItem: ElementEntry;\n reverse?: boolean;\n};\n\n/** Remove list item and move its sublist to list if any. */\nexport const removeListItem = (\n editor: SlateEditor,\n { list, listItem, reverse = true }: RemoveListItemOptions\n) => {\n const [liNode, liPath] = listItem;\n\n // Stop if the list item has no sublist\n if (editor.api.isExpanded() || !hasListChild(editor, liNode)) {\n return false;\n }\n\n const previousLiPath = PathApi.previous(liPath);\n\n let success = false;\n\n editor.tf.withoutNormalizing(() => {\n /**\n * If there is a previous li, we need to move sub-lis to the previous li. As\n * we need to delete first, we will:\n *\n * 1. Insert a temporary li: tempLi\n * 2. Move sub-lis to tempLi\n * 3. Delete\n * 4. Move sub-lis from tempLi to the previous li.\n * 5. Remove tempLi\n */\n if (previousLiPath) {\n const previousLi = editor.api.node<TElement>(previousLiPath);\n\n if (!previousLi) return;\n\n // 1\n let tempLiPath = PathApi.next(liPath);\n editor.tf.insertNodes(\n {\n children: [\n {\n children: [{ text: '' }],\n type: editor.getType(KEYS.lic),\n },\n ],\n ...getPropsIfTaskListLiNode(editor, {\n inherit: true,\n liNode: previousLi[0],\n }),\n type: editor.getType(KEYS.li),\n },\n { at: tempLiPath }\n );\n\n const tempLi = editor.api.node<TElement>(tempLiPath);\n\n if (!tempLi) return;\n\n const tempLiPathRef = editor.api.pathRef(tempLi[1]);\n\n // 2\n moveListItemSublistItemsToListItemSublist(editor, {\n fromListItem: listItem,\n toListItem: tempLi,\n });\n\n // 3\n deleteMerge(editor, {\n reverse,\n });\n\n tempLiPath = tempLiPathRef.unref()!;\n\n // 4\n moveListItemSublistItemsToListItemSublist(editor, {\n fromListItem: [tempLi[0], tempLiPath],\n toListItem: previousLi,\n });\n\n // 5\n editor.tf.removeNodes({ at: tempLiPath });\n\n success = true;\n\n return;\n }\n\n // If it's the first li, move the sublist to the parent list\n moveListItemsToList(editor, {\n fromListItem: listItem,\n toList: list,\n toListIndex: 1,\n });\n });\n\n return success;\n};\n","import {\n type SlateEditor,\n type TElement,\n ElementApi,\n KEYS,\n NodeApi,\n RangeApi,\n} from 'platejs';\n\nimport { BaseListPlugin } from '../BaseListPlugin';\nimport {\n getListItemEntry,\n getListTypes,\n getPropsIfTaskList,\n} from '../queries/index';\nimport { unwrapList } from './unwrapList';\n\ntype ToggleListOptions = { type: string; checked?: boolean };\n\nconst _toggleList = (\n editor: SlateEditor,\n { checked = false, type }: ToggleListOptions\n) =>\n editor.tf.withoutNormalizing(() => {\n if (!editor.selection) {\n return;\n }\n\n const { validLiChildrenTypes } = editor.getOptions(BaseListPlugin);\n\n if (editor.api.isCollapsed() || !editor.api.isAt({ blocks: true })) {\n // selection is collapsed\n const res = getListItemEntry(editor);\n\n if (res) {\n const { list } = res;\n\n if (list[0].type === type) {\n unwrapList(editor);\n } else {\n editor.tf.setNodes(\n { type },\n {\n at: editor.selection,\n mode: 'lowest',\n match: (n) =>\n ElementApi.isElement(n) &&\n getListTypes(editor).includes(n.type),\n }\n );\n }\n } else {\n const list = { children: [], type };\n editor.tf.wrapNodes<TElement>(list);\n\n const _nodes = editor.api.nodes({\n match: { type: editor.getType(KEYS.p) },\n });\n const nodes = Array.from(_nodes);\n\n const blockAbove = editor.api.block({\n match: { type: validLiChildrenTypes },\n });\n\n if (!blockAbove) {\n editor.tf.setNodes({\n type: editor.getType(KEYS.lic),\n });\n }\n\n const listItem = {\n children: [],\n ...getPropsIfTaskList(editor, type, { checked }),\n type: editor.getType(KEYS.li),\n };\n\n for (const [, path] of nodes) {\n editor.tf.wrapNodes<TElement>(listItem, {\n at: path,\n });\n }\n }\n } else {\n // selection is a range\n\n const [startPoint, endPoint] = RangeApi.edges(editor.selection!);\n const commonEntry = NodeApi.common<TElement>(\n editor,\n startPoint.path,\n endPoint.path\n )!;\n\n if (\n getListTypes(editor).includes(commonEntry[0].type) ||\n (commonEntry[0] as TElement).type === editor.getType(KEYS.li)\n ) {\n if ((commonEntry[0] as TElement).type === type) {\n unwrapList(editor);\n } else {\n const startList = editor.api.node({\n at: RangeApi.start(editor.selection),\n match: { type: getListTypes(editor) },\n mode: 'lowest',\n });\n const endList = editor.api.node({\n at: RangeApi.end(editor.selection),\n match: { type: getListTypes(editor) },\n mode: 'lowest',\n });\n const rangeLength = Math.min(\n startList![1].length,\n endList![1].length\n );\n\n editor.tf.setNodes(\n { type },\n {\n at: editor.selection,\n mode: 'all',\n match: (n, path) =>\n ElementApi.isElement(n) &&\n getListTypes(editor).includes(n.type) &&\n path.length >= rangeLength,\n }\n );\n }\n } else {\n const rootPathLength = commonEntry[1].length;\n const _nodes = editor.api.nodes<TElement>({\n mode: 'all',\n });\n const nodes = Array.from(_nodes).filter(\n ([, path]) => path.length === rootPathLength + 1\n );\n\n nodes.forEach((n) => {\n if (getListTypes(editor).includes(n[0].type)) {\n editor.tf.setNodes(\n { type },\n {\n at: n[1],\n mode: 'all',\n match: (_n) =>\n ElementApi.isElement(_n) &&\n getListTypes(editor).includes(_n.type),\n }\n );\n } else {\n if (!validLiChildrenTypes?.includes(n[0].type)) {\n editor.tf.setNodes(\n { type: editor.getType(KEYS.lic) },\n { at: n[1] }\n );\n }\n\n const listItem = {\n children: [],\n ...getPropsIfTaskList(editor, type, { checked }),\n type: editor.getType(KEYS.li),\n };\n editor.tf.wrapNodes<TElement>(listItem, {\n at: n[1],\n });\n\n const list = { children: [], type };\n editor.tf.wrapNodes<TElement>(list, { at: n[1] });\n }\n });\n }\n }\n });\n\nexport const toggleList = (editor: SlateEditor, { type }: { type: string }) =>\n _toggleList(editor, { type });\n\nexport const toggleBulletedList = (editor: SlateEditor) =>\n toggleList(editor, { type: editor.getType(KEYS.ulClassic) });\n\nexport const toggleTaskList = (editor: SlateEditor, defaultChecked = false) =>\n _toggleList(editor, {\n checked: defaultChecked,\n type: editor.getType(KEYS.taskList),\n });\n\nexport const toggleNumberedList = (editor: SlateEditor) =>\n toggleList(editor, { type: editor.getType(KEYS.olClassic) });\n","import {\n type NodeEntry,\n type OverrideEditor,\n type TElement,\n deleteMerge,\n KEYS,\n PathApi,\n} from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { isAcrossListItems, isListNested } from './queries';\nimport { getListItemEntry } from './queries/getListItemEntry';\nimport { removeFirstListItem } from './transforms/removeFirstListItem';\nimport { removeListItem } from './transforms/removeListItem';\n\nexport const withDeleteBackwardList: OverrideEditor<ListConfig> = ({\n editor,\n tf: { deleteBackward },\n}) => ({\n transforms: {\n deleteBackward(unit) {\n const deleteBackwardList = () => {\n const res = getListItemEntry(editor, {});\n let moved: boolean | undefined = false;\n\n if (res) {\n const { list, listItem } = res;\n\n if (\n editor.api.isAt({\n start: true,\n match: (node) => node.type === editor.getType(KEYS.li),\n })\n ) {\n editor.tf.withoutNormalizing(() => {\n moved = removeFirstListItem(editor, { list, listItem });\n\n if (moved) return true;\n\n moved = removeListItem(editor, { list, listItem });\n\n if (moved) return true;\n if (\n !PathApi.hasPrevious(listItem[1]) &&\n !isListNested(editor, list[1])\n ) {\n editor.tf.resetBlock({ at: listItem[1] });\n\n moved = true;\n\n return;\n }\n\n const pointBeforeListItem = editor.api.before(\n editor.selection!.focus\n );\n\n let currentLic: NodeEntry<TElement> | undefined;\n let hasMultipleChildren = false;\n\n if (\n pointBeforeListItem &&\n isAcrossListItems(editor, {\n anchor: editor.selection!.anchor,\n focus: pointBeforeListItem,\n })\n ) {\n const licType = editor.getType(KEYS.lic);\n const _licNodes = editor.api.nodes<TElement>({\n at: listItem[1],\n mode: 'lowest',\n match: (node) => node.type === licType,\n });\n currentLic = [..._licNodes][0];\n hasMultipleChildren = currentLic[0].children.length > 1;\n }\n\n deleteMerge(editor, {\n reverse: true,\n unit,\n });\n moved = true;\n\n if (!currentLic || !hasMultipleChildren) return;\n\n const leftoverListItem = editor.api.node<TElement>(\n PathApi.parent(currentLic[1])\n )!;\n\n if (\n leftoverListItem &&\n leftoverListItem[0].children.length === 0\n ) {\n editor.tf.removeNodes({ at: leftoverListItem[1] });\n }\n });\n }\n }\n\n return moved;\n };\n\n if (deleteBackwardList()) return;\n\n deleteBackward(unit);\n },\n },\n});\n","import {\n type EditorTransforms,\n type ElementEntry,\n type OverrideEditor,\n type SlateEditor,\n type TElement,\n KEYS,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport {\n getListItemEntry,\n getListRoot,\n hasListChild,\n isAcrossListItems,\n} from './queries/index';\nimport {\n moveListItemsToList,\n moveListItemUp,\n removeFirstListItem,\n removeListItem,\n} from './transforms/index';\n\nconst selectionIsNotInAListHandler = (editor: SlateEditor): boolean => {\n const pointAfterSelection = editor.api.after(editor.selection!.focus);\n\n if (pointAfterSelection) {\n // there is a block after it\n const nextSiblingListRes = getListItemEntry(editor, {\n at: pointAfterSelection,\n });\n\n if (nextSiblingListRes) {\n // the next block is a list\n const { listItem } = nextSiblingListRes;\n const parentBlockEntity = editor.api.block({\n at: editor.selection!.anchor,\n });\n\n if (!editor.api.string(parentBlockEntity![1])) {\n // the selected block is empty\n editor.tf.removeNodes();\n\n return true;\n }\n if (hasListChild(editor, listItem[0])) {\n // the next block has children, so we have to move the first item up\n const sublistRes = getListItemEntry(editor, {\n at: [...listItem[1], 1, 0, 0],\n });\n\n moveListItemUp(editor, sublistRes!);\n }\n }\n }\n\n return false;\n};\n\nconst selectionIsInAListHandler = (\n editor: SlateEditor,\n res: { list: ElementEntry; listItem: ElementEntry },\n defaultDelete: EditorTransforms['deleteBackward'],\n unit: 'block' | 'character' | 'line' | 'word' = 'character'\n): boolean => {\n const { listItem } = res;\n\n // if it has no children\n if (!hasListChild(editor, listItem[0])) {\n const liType = editor.getType(KEYS.li);\n const _nodes = editor.api.nodes({\n at: listItem[1],\n mode: 'lowest',\n match: (node, path) => {\n if (path.length === 0) {\n return false;\n }\n\n const isNodeLi = (node as TElement).type === liType;\n const isSiblingOfNodeLi =\n NodeApi.get<TElement>(editor, PathApi.next(path))?.type === liType;\n\n return isNodeLi && isSiblingOfNodeLi;\n },\n });\n const liWithSiblings = Array.from(_nodes, (entry) => entry[1])[0];\n\n if (!liWithSiblings) {\n // there are no more list item in the list\n const pointAfterListItem = editor.api.after(listItem[1]);\n\n if (pointAfterListItem) {\n // there is a block after it\n const nextSiblingListRes = getListItemEntry(editor, {\n at: pointAfterListItem,\n });\n\n if (nextSiblingListRes) {\n // it is a list so we merge the lists\n const listRoot = getListRoot(editor, listItem[1]);\n\n moveListItemsToList(editor, {\n deleteFromList: true,\n fromList: nextSiblingListRes.list,\n toList: listRoot,\n });\n\n return true;\n }\n }\n\n return false;\n }\n\n const siblingListItem = editor.api.node<TElement>(\n PathApi.next(liWithSiblings)\n );\n\n if (!siblingListItem) return false;\n\n const siblingList = editor.api.parent<TElement>(siblingListItem[1]);\n\n if (\n siblingList &&\n removeListItem(editor, {\n list: siblingList,\n listItem: siblingListItem,\n reverse: false,\n })\n ) {\n return true;\n }\n\n const pointAfterListItem = editor.api.after(editor.selection!.focus);\n\n if (\n !pointAfterListItem ||\n !isAcrossListItems(editor, {\n anchor: editor.selection!.anchor,\n focus: pointAfterListItem,\n })\n ) {\n return false;\n }\n\n // get closest lic ancestor of next selectable\n const licType = editor.getType(KEYS.lic);\n const _licNodes = editor.api.nodes<TElement>({\n at: pointAfterListItem.path,\n mode: 'lowest',\n match: (node) => node.type === licType,\n });\n const nextSelectableLic = [..._licNodes][0];\n\n // let slate handle single child cases\n if (nextSelectableLic[0].children.length < 2) return false;\n\n // manually run default delete\n defaultDelete(unit);\n\n const leftoverListItem = editor.api.node<TElement>(\n PathApi.parent(nextSelectableLic[1])\n )!;\n\n if (leftoverListItem && leftoverListItem[0].children.length === 0) {\n // remove the leftover empty list item\n editor.tf.removeNodes({ at: leftoverListItem[1] });\n }\n\n return true;\n }\n\n // if it has children\n const nestedList = editor.api.node<TElement>(\n PathApi.next([...listItem[1], 0])\n );\n\n if (!nestedList) return false;\n\n const nestedListItem = Array.from(\n NodeApi.children<TElement>(editor, nestedList[1])\n )[0];\n\n if (\n removeFirstListItem(editor, {\n list: nestedList,\n listItem: nestedListItem,\n })\n ) {\n return true;\n }\n if (\n removeListItem(editor, {\n list: nestedList,\n listItem: nestedListItem,\n })\n ) {\n return true;\n }\n\n return false;\n};\n\nexport const withDeleteForwardList: OverrideEditor<ListConfig> = ({\n editor,\n tf: { deleteForward },\n}) => ({\n transforms: {\n deleteForward(unit) {\n const deleteForwardList = () => {\n let skipDefaultDelete = false;\n\n if (!editor?.selection) {\n return skipDefaultDelete;\n }\n if (!editor.api.isAt({ end: true })) {\n return skipDefaultDelete;\n }\n\n editor.tf.withoutNormalizing(() => {\n const res = getListItemEntry(editor, {});\n\n if (!res) {\n skipDefaultDelete = selectionIsNotInAListHandler(editor);\n\n return;\n }\n\n skipDefaultDelete = selectionIsInAListHandler(\n editor,\n res,\n deleteForward,\n unit\n );\n });\n\n return skipDefaultDelete;\n };\n\n if (deleteForwardList()) return;\n\n deleteForward(unit);\n },\n },\n});\n","import {\n type OverrideEditor,\n type SlateEditor,\n type TRange,\n deleteMerge,\n KEYS,\n} from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { getHighestEmptyList } from './queries/getHighestEmptyList';\nimport { hasListChild } from './queries/index';\nimport { isAcrossListItems } from './queries/isAcrossListItems';\n\nconst getLiStart = (editor: SlateEditor) => {\n const start = editor.api.start(editor.selection as TRange);\n\n return editor.api.above({\n at: start,\n match: { type: editor.getType(KEYS.li) },\n });\n};\n\nexport const withDeleteFragmentList: OverrideEditor<ListConfig> = ({\n editor,\n tf: { deleteFragment },\n}) => ({\n transforms: {\n deleteFragment(direction) {\n const deleteFragmentList = () => {\n let deleted = false;\n\n editor.tf.withoutNormalizing(() => {\n // Selection should be across list items\n if (!isAcrossListItems(editor)) return;\n\n /**\n * Check if the end li can be deleted (if it has no sublist). Store\n * the path ref to delete it after deleteMerge.\n */\n const end = editor.api.end(editor.selection as TRange);\n const liEnd = editor.api.above({\n at: end,\n match: { type: editor.getType(KEYS.li) },\n });\n const liEndCanBeDeleted = liEnd && !hasListChild(editor, liEnd[0]);\n const liEndPathRef = liEndCanBeDeleted\n ? editor.api.pathRef(liEnd![1])\n : undefined;\n\n // use deleteFragment when selection wrapped around list\n if (!getLiStart(editor) || !liEnd) {\n deleted = false;\n\n return;\n }\n\n /** Delete fragment and move end block children to start block */\n deleteMerge(editor);\n\n const liStart = getLiStart(editor);\n\n if (liEndPathRef) {\n const liEndPath = liEndPathRef.unref()!;\n const listStart = liStart && editor.api.parent(liStart[1]);\n\n const deletePath = getHighestEmptyList(editor, {\n diffListPath: listStart?.[1],\n liPath: liEndPath,\n });\n\n if (deletePath) {\n editor.tf.removeNodes({ at: deletePath });\n }\n\n deleted = true;\n }\n });\n\n return deleted;\n };\n\n if (deleteFragmentList()) return;\n\n deleteFragment(direction);\n },\n },\n});\n","import { type OverrideEditor, KEYS } from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { getListItemEntry } from './queries/getListItemEntry';\nimport { insertListItem } from './transforms/insertListItem';\nimport { moveListItemUp } from './transforms/moveListItemUp';\n\nexport const withInsertBreakList: OverrideEditor<ListConfig> = ({\n editor,\n getOptions,\n tf: { insertBreak },\n}) => ({\n transforms: {\n insertBreak() {\n const insertBreakList = () => {\n if (!editor.selection) return;\n\n const res = getListItemEntry(editor, {});\n let moved: boolean | undefined;\n\n // If selection is in a li\n if (res) {\n const { list, listItem } = res;\n\n // If selected li is empty, move it up.\n if (editor.api.isEmpty(editor.selection, { block: true })) {\n moved = moveListItemUp(editor, {\n list,\n listItem,\n });\n\n if (moved) return true;\n }\n }\n\n const block = editor.api.block({\n match: { type: editor.getType(KEYS.li) },\n });\n if (block && editor.api.isEmpty(editor.selection, { block: true })) {\n const didReset = editor.tf.resetBlock({ at: block[1] });\n\n if (didReset) return true;\n }\n\n /** If selection is in li > p, insert li. */\n if (!moved) {\n const inserted = insertListItem(editor, getOptions());\n\n if (inserted) return true;\n }\n };\n\n if (insertBreakList()) return;\n\n insertBreak();\n },\n },\n});\n","import {\n type Ancestor,\n type AncestorEntry,\n type Descendant,\n type DescendantEntry,\n type ElementEntry,\n type OverrideEditor,\n type Path,\n type TElement,\n type TText,\n ElementApi,\n KEYS,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { getPropsIfTaskListLiNode, isListRoot } from './queries';\n\nexport const withInsertFragmentList: OverrideEditor<ListConfig> = ({\n editor,\n tf: { insertFragment },\n}) => {\n const listItemType = editor.getType(KEYS.li);\n const listItemContentType = editor.getType(KEYS.lic);\n\n const getFirstAncestorOfType = (\n root: Descendant,\n entry: DescendantEntry,\n type: string\n ): AncestorEntry => {\n let ancestor: Path = PathApi.parent(entry[1]);\n\n while (NodeApi.get<TElement>(root, ancestor)!.type !== type) {\n ancestor = PathApi.parent(ancestor);\n }\n\n return [NodeApi.get<Ancestor>(root, ancestor)!, ancestor];\n };\n\n const findListItemsWithContent = (first: Descendant): Descendant[] => {\n let prev: Descendant | null = null;\n let node = first;\n\n while (\n isListRoot(editor, node) ||\n (node.type === listItemType &&\n (node.children as TElement[])[0].type !== listItemContentType)\n ) {\n prev = node;\n [node] = node.children as Descendant[];\n }\n\n return prev ? (prev.children as Descendant[]) : [node];\n };\n\n /**\n * Removes the \"empty\" leading lis. Empty in this context means lis only with\n * other lis as children.\n *\n * @returns If argument is not a list root, returns it, otherwise returns ul[]\n * or li[].\n */\n const trimList = (listRoot: Descendant): TElement[] => {\n if (!isListRoot(editor, listRoot)) {\n return [listRoot as TElement];\n }\n\n const _texts = NodeApi.texts(listRoot);\n const textEntries = Array.from(_texts);\n\n const commonAncestorEntry = textEntries.reduce(\n (commonAncestor, textEntry) =>\n PathApi.isAncestor(commonAncestor[1], textEntry[1])\n ? commonAncestor\n : (NodeApi.common(listRoot, textEntry[1], commonAncestor[1]) as any),\n // any list item would do, we grab the first one\n getFirstAncestorOfType(listRoot, textEntries[0], listItemType)\n );\n\n const [first, ...rest] = isListRoot(\n editor,\n commonAncestorEntry[0] as Descendant\n )\n ? (commonAncestorEntry[0] as any).children\n : [commonAncestorEntry[0]];\n\n return [...findListItemsWithContent(first), ...rest];\n };\n\n const wrapNodeIntoListItem = (\n node: Descendant,\n props?: Record<string, any>\n ): TElement =>\n node.type === listItemType\n ? (node as TElement)\n : ({\n children: [node],\n ...props,\n type: listItemType,\n } as TElement);\n\n /**\n * Checks if the fragment only consists of a single LIC in which case it is\n * considered the user's intention was to copy a text, not a list\n */\n const isSingleLic = (fragment: Descendant[]) => {\n const isFragmentOnlyListRoot =\n fragment.length === 1 && isListRoot(editor, fragment[0]);\n\n return (\n isFragmentOnlyListRoot &&\n [...NodeApi.nodes({ children: fragment } as any)]\n .filter((entry): entry is ElementEntry =>\n ElementApi.isElement(entry[0])\n )\n .filter(([node]) => node.type === listItemContentType).length === 1\n );\n };\n\n const getTextAndListItemNodes = (\n fragment: Descendant[],\n liEntry: ElementEntry,\n licEntry: ElementEntry\n ) => {\n const [, liPath] = liEntry;\n const [licNode, licPath] = licEntry;\n const isEmptyNode = !NodeApi.string(licNode);\n const [first, ...rest] = fragment.flatMap(trimList).map((v) =>\n wrapNodeIntoListItem(\n v,\n getPropsIfTaskListLiNode(editor, {\n inherit: true,\n liNode: liEntry[0],\n })\n )\n );\n let textNode: TText;\n let listItemNodes: TElement[];\n\n if (isListRoot(editor, fragment[0])) {\n if (isSingleLic(fragment)) {\n textNode = first as any;\n listItemNodes = rest as TElement[];\n } else if (isEmptyNode) {\n // FIXME: is there a more direct way to set this?\n const li = NodeApi.get(editor, liPath);\n const [, ...currentSublists] = li!.children as TElement[];\n const [newLic, ...newSublists] = first.children as TElement[];\n editor.tf.insertNodes(newLic, {\n at: PathApi.next(licPath),\n select: true,\n });\n editor.tf.removeNodes({\n at: licPath,\n });\n\n if (newSublists?.length) {\n if (currentSublists?.length) {\n // TODO: any better way to compile the path where the LIs of the newly inserted element will be inserted?\n const path = [...liPath, 1, 0];\n editor.tf.insertNodes(newSublists[0].children as TElement[], {\n at: path,\n select: true,\n });\n } else {\n editor.tf.insertNodes(newSublists, {\n at: PathApi.next(licPath),\n select: true,\n });\n }\n }\n\n textNode = { text: '' };\n listItemNodes = rest as TElement[];\n } else {\n textNode = { text: '' };\n listItemNodes = [first as TElement, ...(rest as TElement[])];\n }\n } else {\n textNode = first as any;\n listItemNodes = rest as TElement[];\n }\n\n return { listItemNodes, textNode };\n };\n\n return {\n transforms: {\n insertFragment(fragment) {\n let liEntry = editor.api.node<TElement>({\n match: { type: listItemType },\n mode: 'lowest',\n });\n\n // not inserting into a list item, delegate to other plugins\n if (!liEntry) {\n return insertFragment(\n isListRoot(editor, fragment[0])\n ? [{ text: '' }, ...fragment]\n : fragment\n );\n }\n\n // delete selection (if necessary) so that it can check if needs to insert into an empty block\n insertFragment([{ text: '' }] as any);\n\n // refetch to find the currently selected LI after the deletion above is performed\n liEntry = editor.api.node<TElement>({\n match: { type: listItemType },\n mode: 'lowest',\n });\n\n // Check again if liEntry is undefined after the deletion above.\n // This prevents unexpected behavior when pasting while a list is highlighted\n if (!liEntry) {\n return insertFragment(\n isListRoot(editor, fragment[0])\n ? [{ text: '' }, ...fragment]\n : fragment\n );\n }\n\n const licEntry = editor.api.node<TElement>({\n match: { type: listItemContentType },\n mode: 'lowest',\n });\n\n if (!licEntry) {\n return insertFragment(\n isListRoot(editor, fragment[0])\n ? [{ text: '' }, ...fragment]\n : fragment\n );\n }\n\n const { listItemNodes, textNode } = getTextAndListItemNodes(\n fragment,\n liEntry!,\n licEntry\n );\n\n insertFragment<TText>([textNode]); // insert text if needed\n\n const [, liPath] = liEntry!;\n\n return editor.tf.insertNodes(listItemNodes, {\n at: PathApi.next(liPath),\n select: true,\n });\n },\n },\n };\n};\n","import {\n type Descendant,\n type ElementEntry,\n type NodeEntry,\n type PathRef,\n type SlateEditor,\n type TElement,\n KEYS,\n match,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport type { ListConfig } from '../BaseListPlugin';\n\nimport { getListTypes } from '../queries/index';\nimport { moveListItemUp } from '../transforms/index';\n\n/**\n * Recursively get all the:\n *\n * - Block children\n * - Inline children except those at excludeDepth\n */\nexport const getDeepInlineChildren = (\n editor: SlateEditor,\n {\n children,\n }: {\n children: NodeEntry<Descendant>[];\n }\n) => {\n const inlineChildren: NodeEntry<Descendant>[] = [];\n\n for (const child of children) {\n if (editor.api.isBlock(child[0])) {\n inlineChildren.push(\n ...getDeepInlineChildren(editor, {\n children: Array.from(NodeApi.children(editor, child[1])),\n })\n );\n } else {\n inlineChildren.push(child);\n }\n }\n\n return inlineChildren;\n};\n\n/**\n * If the list item has no child: insert an empty list item container. Else:\n * move the children that are not valid to the list item container.\n */\nexport const normalizeListItem = (\n editor: SlateEditor,\n {\n listItem,\n validLiChildrenTypes = [],\n }: { listItem: ElementEntry } & ListConfig['options']\n) => {\n let changed = false;\n\n const allValidLiChildrenTypes = new Set([\n editor.getType(KEYS.lic),\n editor.getType(KEYS.olClassic),\n editor.getType(KEYS.taskList),\n editor.getType(KEYS.ulClassic),\n ...validLiChildrenTypes,\n ]);\n\n const [, liPath] = listItem;\n const liChildren = Array.from(\n NodeApi.children<TElement>(editor, listItem[1])\n );\n\n // Get invalid (type) li children path refs to be moved\n const invalidLiChildrenPathRefs = liChildren\n .filter(([child]) => !allValidLiChildrenTypes.has(child.type))\n .map(([, childPath]) => editor.api.pathRef(childPath));\n\n const firstLiChild: ElementEntry | undefined = liChildren[0];\n const [firstLiChildNode, firstLiChildPath] = firstLiChild ?? [];\n\n // If li has no child or inline child, insert lic\n if (!firstLiChild || !editor.api.isBlock(firstLiChildNode)) {\n editor.tf.insertNodes(\n editor.api.create.block({\n type: editor.getType(KEYS.lic),\n }),\n {\n at: liPath.concat([0]),\n }\n );\n\n return true;\n }\n // If first li child is a block but not lic, set it to lic\n if (\n editor.api.isBlock(firstLiChildNode) &&\n !match(firstLiChildNode, [], {\n type: editor.getType(KEYS.lic),\n })\n ) {\n if (\n match(firstLiChildNode, [], {\n type: getListTypes(editor),\n })\n ) {\n // the listItem has no lic so we move the children up a level\n const parent = editor.api.parent(listItem[1]);\n const sublist = firstLiChild;\n const children = Array.from(\n NodeApi.children<TElement>(editor, firstLiChild[1])\n ).reverse();\n children.forEach((c) => {\n moveListItemUp(editor, {\n list: sublist,\n listItem: c,\n });\n });\n\n editor.tf.removeNodes({ at: [...parent![1], 0] });\n\n return true;\n }\n // Allow block elements listed as valid li children types to be a first child instead of LIC\n if (validLiChildrenTypes.includes(firstLiChildNode.type)) {\n return true;\n }\n\n editor.tf.setNodes(\n {\n type: editor.getType(KEYS.lic),\n },\n {\n at: firstLiChildPath,\n }\n );\n\n changed = true;\n }\n\n const licChildren = Array.from(NodeApi.children(editor, firstLiChild[1]));\n\n if (licChildren.length > 0) {\n const blockPathRefs: PathRef[] = [];\n const inlineChildren: NodeEntry[] = [];\n\n // Check that lic has no block children\n for (const licChild of licChildren) {\n if (!editor.api.isBlock(licChild[0])) {\n break;\n }\n\n blockPathRefs.push(editor.api.pathRef(licChild[1]));\n\n inlineChildren.push(\n ...getDeepInlineChildren(editor, {\n children: Array.from(NodeApi.children(editor, licChild[1])),\n })\n );\n }\n\n const to = PathApi.next(licChildren.at(-1)![1]);\n\n // Move lic nested inline children to its children\n inlineChildren.reverse().forEach(([, path]) => {\n editor.tf.moveNodes({\n at: path,\n to,\n });\n });\n\n // Remove lic block children\n blockPathRefs.forEach((pathRef) => {\n const path = pathRef.unref();\n\n if (path) {\n editor.tf.removeNodes({\n at: path,\n });\n }\n });\n\n if (blockPathRefs.length > 0) {\n changed = true;\n }\n }\n if (changed) return true;\n\n // Ensure that any text nodes under the list are inside the list item container\n invalidLiChildrenPathRefs.reverse().forEach((ref) => {\n const path = ref.unref();\n\n if (path) {\n editor.tf.moveNodes({\n at: path,\n to: firstLiChildPath.concat([0]),\n });\n }\n });\n\n return invalidLiChildrenPathRefs.length > 0;\n};\n","import { type ElementEntry, type SlateEditor, match, PathApi } from 'platejs';\n\nimport { getListTypes } from '../queries/index';\n\n// When pasting from e.g. Google Docs, the structure of nested lists like \"ul -> ul\"\n// should be normalized to \"ul -> li -> lic + ul\".\n// In other words, a nested list as a direct children of a list should be moved into a previous list item sibling\nexport const normalizeNestedList = (\n editor: SlateEditor,\n { nestedListItem }: { nestedListItem: ElementEntry }\n) => {\n const [, path] = nestedListItem;\n\n const parentNode = editor.api.parent(path);\n const hasParentList =\n parentNode && match(parentNode[0], [], { type: getListTypes(editor) });\n\n if (!hasParentList) {\n return false;\n }\n\n const previousListItemPath = PathApi.previous(path);\n\n if (!previousListItemPath) {\n return false;\n }\n\n // Previous sibling is the new parent\n const previousSiblingItem = editor.api.node(previousListItemPath);\n\n if (previousSiblingItem) {\n const [, previousPath] = previousSiblingItem;\n const newPath = previousPath.concat([1]);\n\n // Move the current item to the sublist\n editor.tf.moveNodes({\n at: path,\n to: newPath,\n });\n\n return true;\n }\n};\n","import {\n type OverrideEditor,\n type TElement,\n ElementApi,\n KEYS,\n match,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { normalizeListItem } from './normalizers/normalizeListItem';\nimport { normalizeNestedList } from './normalizers/normalizeNestedList';\nimport { getListTypes, isListRoot } from './queries';\nimport { moveListItemsToList } from './transforms';\n\n/** Normalize list node to force the ul>li>p+ul structure. */\nexport const withNormalizeList: OverrideEditor<ListConfig> = ({\n editor,\n getOptions,\n tf: { normalizeNode },\n}) => ({\n transforms: {\n normalizeNode([node, path]) {\n const liType = editor.getType(KEYS.li);\n const licType = editor.getType(KEYS.lic);\n const defaultType = editor.getType(KEYS.p);\n\n if (!ElementApi.isElement(node)) {\n return normalizeNode([node, path]);\n }\n if (isListRoot(editor, node)) {\n const nonLiChild = Array.from(NodeApi.children(editor, path)).find(\n ([child]) => child.type !== liType\n );\n\n if (nonLiChild) {\n return editor.tf.wrapNodes<TElement>(\n { children: [], type: liType },\n { at: nonLiChild[1] }\n );\n }\n\n // add \"checked\" prop to list-item nodes if they have a taskList parent but no \"checked\" prop\n // remove \"checked\" prop from list-item nodes if they do not have a taskList parent but a \"checked\" prop\n if (node.type === editor.getType(KEYS.taskList)) {\n const nonTaskListItems = Array.from(\n NodeApi.children(editor, path)\n ).filter(([child]) => child.type === liType && !('checked' in child));\n\n if (nonTaskListItems.length > 0) {\n return editor.tf.withoutNormalizing(() =>\n nonTaskListItems.forEach(([, itemPath]) => {\n editor.tf.setNodes({ checked: false }, { at: itemPath });\n })\n );\n }\n } else {\n const taskListItems = Array.from(\n NodeApi.children(editor, path)\n ).filter(([child]) => child.type === liType && 'checked' in child);\n\n if (taskListItems.length > 0) {\n return editor.tf.withoutNormalizing(() =>\n taskListItems.forEach(([, itemPath]) => {\n editor.tf.unsetNodes('checked', { at: itemPath });\n })\n );\n }\n }\n }\n // remove empty list\n if (match(node, [], { type: getListTypes(editor) })) {\n if (\n node.children.length === 0 ||\n !node.children.some((item) => item.type === liType)\n ) {\n return editor.tf.removeNodes({ at: path });\n }\n\n const nextPath = PathApi.next(path);\n const nextNode = NodeApi.get<TElement>(editor, nextPath)!;\n\n // Has a list afterwards with the same type\n if (nextNode?.type === node.type) {\n moveListItemsToList(editor, {\n deleteFromList: true,\n fromList: [nextNode, nextPath],\n toList: [node, path],\n });\n }\n\n const prevPath = PathApi.previous(path)!;\n const prevNode = NodeApi.get<TElement>(editor, prevPath);\n\n // Has a list before with the same type\n if (prevNode?.type === node.type) {\n editor.tf.normalizeNode([prevNode, prevPath]);\n\n // early return since this node will no longer exists\n return;\n }\n if (normalizeNestedList(editor, { nestedListItem: [node, path] })) {\n return;\n }\n }\n if (\n node.type === editor.getType(KEYS.li) &&\n normalizeListItem(editor, {\n listItem: [node, path],\n validLiChildrenTypes: getOptions().validLiChildrenTypes,\n })\n ) {\n return;\n }\n // LIC should have LI parent. If not, set LIC to DEFAULT type.\n if (\n node.type === licType &&\n licType !== defaultType &&\n editor.api.parent(path)?.[0].type !== liType\n ) {\n editor.tf.setNodes({ type: defaultType }, { at: path });\n\n return;\n }\n\n normalizeNode([node, path]);\n },\n },\n});\n","import { type OverrideEditor, KEYS, RangeApi } from 'platejs';\n\nimport type { ListConfig } from './BaseListPlugin';\n\nimport { unwrapList } from '.';\nimport { moveListItems } from './transforms/index';\nimport { withDeleteBackwardList } from './withDeleteBackwardList';\nimport { withDeleteForwardList } from './withDeleteForwardList';\nimport { withDeleteFragmentList } from './withDeleteFragmentList';\nimport { withInsertBreakList } from './withInsertBreakList';\nimport { withInsertFragmentList } from './withInsertFragmentList';\nimport { withNormalizeList } from './withNormalizeList';\n\nexport const withList: OverrideEditor<ListConfig> = (ctx) => {\n const {\n editor,\n getOptions,\n tf: { resetBlock, tab },\n } = ctx;\n\n return {\n transforms: {\n resetBlock: (options) => {\n if (\n editor.api.block({\n at: options?.at,\n match: { type: editor.getType(KEYS.li) },\n })\n ) {\n unwrapList(editor);\n return;\n }\n\n return resetBlock(options);\n },\n tab: (options) => {\n const apply = () => {\n let workRange = editor.selection;\n\n if (editor.selection) {\n const { selection } = editor;\n\n // Unhang the expanded selection\n if (!editor.api.isCollapsed()) {\n const { anchor, focus } = RangeApi.isBackward(selection)\n ? {\n anchor: { ...selection.focus },\n focus: { ...selection.anchor },\n }\n : {\n anchor: { ...selection.anchor },\n focus: { ...selection.focus },\n };\n\n // This is a workaround for a Slate bug\n // See: https://github.com/ianstormtaylor/slate/pull/5039\n const unhangRange = editor.api.unhangRange({ anchor, focus });\n\n if (unhangRange) {\n workRange = unhangRange;\n editor.tf.select(unhangRange);\n }\n }\n\n // check if we're in a list context.\n const listSelected = editor.api.some({\n match: { type: editor.getType(KEYS.li) },\n });\n\n if (workRange && listSelected) {\n moveListItems(editor, {\n at: workRange,\n enableResetOnShiftTab: getOptions().enableResetOnShiftTab,\n increase: !options.reverse,\n });\n\n return true; // Prevent default\n }\n }\n };\n\n if (apply()) return true;\n\n return tab(options);\n },\n ...withInsertBreakList(ctx).transforms,\n ...withDeleteBackwardList(ctx).transforms,\n ...withDeleteForwardList(ctx as any).transforms,\n ...withDeleteFragmentList(ctx as any).transforms,\n ...withInsertFragmentList(ctx as any).transforms,\n ...withNormalizeList(ctx as any).transforms,\n },\n };\n};\n","import {\n type OmitFirst,\n type PluginConfig,\n bindFirst,\n createSlatePlugin,\n createTSlatePlugin,\n KEYS,\n} from 'platejs';\n\nimport {\n toggleBulletedList,\n toggleList,\n toggleNumberedList,\n toggleTaskList,\n} from './transforms';\nimport { withList } from './withList';\n\nexport type ListConfig = PluginConfig<\n 'listClassic',\n {\n enableResetOnShiftTab?: boolean;\n /** Inherit the checked state of above node after insert break at the end */\n inheritCheckStateOnLineEndBreak?: boolean;\n /** Inherit the checked state of below node after insert break at the start */\n inheritCheckStateOnLineStartBreak?: boolean;\n /** Valid children types for list items, in addition to p and ul types. */\n validLiChildrenTypes?: string[];\n },\n {},\n {\n toggle: {\n bulletedList: OmitFirst<typeof toggleBulletedList>;\n list: OmitFirst<typeof toggleList>;\n numberedList: OmitFirst<typeof toggleNumberedList>;\n taskList: OmitFirst<typeof toggleTaskList>;\n };\n }\n>;\n\nexport const BaseBulletedListPlugin = createSlatePlugin({\n key: KEYS.ulClassic,\n node: { isContainer: true, isElement: true },\n parsers: {\n html: {\n deserializer: {\n rules: [\n {\n validNodeName: 'UL',\n },\n ],\n },\n },\n },\n render: { as: 'ul' },\n}).extendTransforms(({ editor }) => ({\n toggle: () => {\n toggleBulletedList(editor);\n },\n}));\n\nexport const BaseNumberedListPlugin = createSlatePlugin({\n key: KEYS.olClassic,\n node: { isContainer: true, isElement: true },\n parsers: { html: { deserializer: { rules: [{ validNodeName: 'OL' }] } } },\n render: { as: 'ol' },\n}).extendTransforms(({ editor }) => ({\n toggle: () => {\n toggleNumberedList(editor);\n },\n}));\n\nexport const BaseTaskListPlugin = createSlatePlugin({\n key: KEYS.taskList,\n node: { isContainer: true, isElement: true },\n options: {\n inheritCheckStateOnLineEndBreak: false,\n inheritCheckStateOnLineStartBreak: false,\n },\n render: { as: 'ul' },\n}).extendTransforms(({ editor }) => ({\n toggle: () => {\n toggleTaskList(editor);\n },\n}));\n\nexport const BaseListItemPlugin = createSlatePlugin({\n key: KEYS.li,\n inject: {\n plugins: {\n [KEYS.html]: {\n parser: {\n preInsert: ({ editor, type }) => editor.api.some({ match: { type } }),\n },\n },\n },\n },\n node: { isContainer: true, isElement: true, isStrictSiblings: true },\n parsers: { html: { deserializer: { rules: [{ validNodeName: 'LI' }] } } },\n render: { as: 'li' },\n});\n\nexport const BaseListItemContentPlugin = createSlatePlugin({\n key: KEYS.lic,\n node: {\n isElement: true,\n },\n});\n\n/** Enables support for bulleted, numbered and to-do lists. */\nexport const BaseListPlugin = createTSlatePlugin<ListConfig>({\n key: KEYS.listClassic,\n plugins: [\n BaseBulletedListPlugin,\n BaseNumberedListPlugin,\n BaseTaskListPlugin,\n BaseListItemPlugin,\n BaseListItemContentPlugin,\n ],\n})\n .overrideEditor(withList)\n .extendEditorTransforms(({ editor }) => ({\n toggle: {\n bulletedList: bindFirst(toggleBulletedList, editor),\n list: bindFirst(toggleList, editor),\n numberedList: bindFirst(toggleNumberedList, editor),\n taskList: bindFirst(toggleTaskList, editor),\n },\n }));\n"],"mappings":";;;;AAKA,MAAaI,gBAAg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e7C,SAAS,CACxB8C,wBAAwB,EAAErB,cAAc,EACvCnB,QAAQ;CACNC,cAAcf,UAAUI,oBAAoB6B,OAAO;CACnDjB,MAAMhB,UAAUK,YAAY4B,OAAO;CACnChB,cAAcjB,UAAUM,oBAAoB2B,OAAO;CACnDf,UAAUlB,UAAUO,gBAAgB0B,OAAM;CAC5C,EACD,EAAE"}
@@ -1,328 +0,0 @@
1
- import { Ancestor, Descendant, EditorNodesOptions, ElementEntry, NodeEntry, OmitFirst, OverrideEditor, Path, PluginConfig, Point, SlateEditor, TElement, TLocation, TRange } from "platejs";
2
-
3
- //#region src/lib/transforms/indentListItems.d.ts
4
- declare const indentListItems: (editor: SlateEditor) => void;
5
- //#endregion
6
- //#region src/lib/transforms/insertListItem.d.ts
7
- type InsertListItemOptions = {
8
- inheritCheckStateOnLineEndBreak?: boolean;
9
- inheritCheckStateOnLineStartBreak?: boolean;
10
- };
11
- /** Insert list item if selection in li>p. TODO: test */
12
- declare const insertListItem: (editor: SlateEditor, options?: InsertListItemOptions) => boolean;
13
- //#endregion
14
- //#region src/lib/transforms/insertTodoListItem.d.ts
15
- /** Insert todo list item if selection in li>p. TODO: test */
16
- declare const insertTodoListItem: (editor: SlateEditor) => boolean;
17
- //#endregion
18
- //#region src/lib/transforms/moveListItemDown.d.ts
19
- type MoveListItemDownOptions = {
20
- list: ElementEntry;
21
- listItem: ElementEntry;
22
- };
23
- declare const moveListItemDown: (editor: SlateEditor, {
24
- list,
25
- listItem
26
- }: MoveListItemDownOptions) => false | undefined;
27
- //#endregion
28
- //#region src/lib/transforms/moveListItemSublistItemsToListItemSublist.d.ts
29
- type MoveListItemSublistItemsToListItemSublistOptions = {
30
- /** The list item to merge. */
31
- fromListItem: ElementEntry;
32
- /** The list item where to merge. */
33
- toListItem: ElementEntry;
34
- /** Move to the start of the list instead of the end. */
35
- start?: boolean;
36
- };
37
- /**
38
- * Move fromListItem sublist list items to the end of `toListItem` sublist. If
39
- * there is no `toListItem` sublist, insert one.
40
- */
41
- declare const moveListItemSublistItemsToListItemSublist: (editor: SlateEditor, {
42
- fromListItem,
43
- start,
44
- toListItem
45
- }: MoveListItemSublistItemsToListItemSublistOptions) => boolean;
46
- //#endregion
47
- //#region src/lib/transforms/moveListItemUp.d.ts
48
- type MoveListItemUpOptions = {
49
- list: ElementEntry;
50
- listItem: ElementEntry;
51
- };
52
- /** Move a list item up. */
53
- declare const moveListItemUp: (editor: SlateEditor, {
54
- list,
55
- listItem
56
- }: MoveListItemUpOptions) => boolean;
57
- //#endregion
58
- //#region src/lib/transforms/moveListItems.d.ts
59
- type MoveListItemsOptions = {
60
- at?: EditorNodesOptions['at'];
61
- enableResetOnShiftTab?: boolean;
62
- increase?: boolean;
63
- };
64
- declare const moveListItems: (editor: SlateEditor, {
65
- at,
66
- enableResetOnShiftTab,
67
- increase
68
- }?: MoveListItemsOptions) => any;
69
- //#endregion
70
- //#region src/lib/transforms/moveListItemsToList.d.ts
71
- type MergeListItemIntoListOptions = {
72
- /**
73
- * Delete `fromListItem` sublist if true.
74
- *
75
- * @default true
76
- */
77
- deleteFromList?: boolean;
78
- /** List items of the list will be moved. */
79
- fromList?: ElementEntry;
80
- /** List items of the sublist of this node will be moved. */
81
- fromListItem?: ElementEntry;
82
- fromStartIndex?: number;
83
- to?: Path;
84
- /** List items will be moved in this list. */
85
- toList?: ElementEntry;
86
- /** List position where to move the list items. */
87
- toListIndex?: number | null;
88
- };
89
- /**
90
- * Move the list items of the sublist of `fromListItem` to `toList` (if
91
- * `fromListItem` is defined). Move the list items of `fromList` to `toList` (if
92
- * `fromList` is defined).
93
- */
94
- declare const moveListItemsToList: (editor: SlateEditor, {
95
- deleteFromList,
96
- fromList,
97
- fromListItem,
98
- fromStartIndex,
99
- to: _to,
100
- toList,
101
- toListIndex
102
- }: MergeListItemIntoListOptions) => boolean;
103
- //#endregion
104
- //#region src/lib/transforms/moveListSiblingsAfterCursor.d.ts
105
- declare const moveListSiblingsAfterCursor: (editor: SlateEditor, {
106
- at,
107
- to
108
- }: {
109
- at: Path;
110
- to: Path;
111
- }) => any;
112
- //#endregion
113
- //#region src/lib/transforms/removeFirstListItem.d.ts
114
- /** If list is not nested and if li is not the first child, move li up. */
115
- declare const removeFirstListItem: (editor: SlateEditor, {
116
- list,
117
- listItem
118
- }: {
119
- list: ElementEntry;
120
- listItem: ElementEntry;
121
- }) => boolean;
122
- //#endregion
123
- //#region src/lib/transforms/removeListItem.d.ts
124
- type RemoveListItemOptions = {
125
- list: ElementEntry;
126
- listItem: ElementEntry;
127
- reverse?: boolean;
128
- };
129
- /** Remove list item and move its sublist to list if any. */
130
- declare const removeListItem: (editor: SlateEditor, {
131
- list,
132
- listItem,
133
- reverse
134
- }: RemoveListItemOptions) => boolean;
135
- //#endregion
136
- //#region src/lib/transforms/toggleList.d.ts
137
- declare const toggleList: (editor: SlateEditor, {
138
- type
139
- }: {
140
- type: string;
141
- }) => any;
142
- declare const toggleBulletedList: (editor: SlateEditor) => any;
143
- declare const toggleTaskList: (editor: SlateEditor, defaultChecked?: boolean) => any;
144
- declare const toggleNumberedList: (editor: SlateEditor) => any;
145
- //#endregion
146
- //#region src/lib/transforms/unindentListItems.d.ts
147
- type UnindentListItemsOptions = Omit<MoveListItemsOptions, 'increase'>;
148
- declare const unindentListItems: (editor: SlateEditor, options?: UnindentListItemsOptions) => any;
149
- //#endregion
150
- //#region src/lib/transforms/unwrapList.d.ts
151
- declare const unwrapList: (editor: SlateEditor, {
152
- at
153
- }?: {
154
- at?: Path;
155
- }) => void;
156
- //#endregion
157
- //#region src/lib/BaseListPlugin.d.ts
158
- type ListConfig = PluginConfig<'listClassic', {
159
- enableResetOnShiftTab?: boolean;
160
- /** Inherit the checked state of above node after insert break at the end */
161
- inheritCheckStateOnLineEndBreak?: boolean;
162
- /** Inherit the checked state of below node after insert break at the start */
163
- inheritCheckStateOnLineStartBreak?: boolean;
164
- /** Valid children types for list items, in addition to p and ul types. */
165
- validLiChildrenTypes?: string[];
166
- }, {}, {
167
- toggle: {
168
- bulletedList: OmitFirst<typeof toggleBulletedList>;
169
- list: OmitFirst<typeof toggleList>;
170
- numberedList: OmitFirst<typeof toggleNumberedList>;
171
- taskList: OmitFirst<typeof toggleTaskList>;
172
- };
173
- }>;
174
- declare const BaseBulletedListPlugin: any;
175
- declare const BaseNumberedListPlugin: any;
176
- declare const BaseTaskListPlugin: any;
177
- declare const BaseListItemPlugin: any;
178
- declare const BaseListItemContentPlugin: any;
179
- /** Enables support for bulleted, numbered and to-do lists. */
180
- declare const BaseListPlugin: any;
181
- //#endregion
182
- //#region src/lib/BaseTodoListPlugin.d.ts
183
- interface TTodoListItemElement extends TElement {
184
- checked?: boolean;
185
- }
186
- declare const BaseTodoListPlugin: any;
187
- //#endregion
188
- //#region src/lib/withDeleteBackwardList.d.ts
189
- declare const withDeleteBackwardList: OverrideEditor<ListConfig>;
190
- //#endregion
191
- //#region src/lib/withDeleteForwardList.d.ts
192
- declare const withDeleteForwardList: OverrideEditor<ListConfig>;
193
- //#endregion
194
- //#region src/lib/withDeleteFragmentList.d.ts
195
- declare const withDeleteFragmentList: OverrideEditor<ListConfig>;
196
- //#endregion
197
- //#region src/lib/withInsertBreakList.d.ts
198
- declare const withInsertBreakList: OverrideEditor<ListConfig>;
199
- //#endregion
200
- //#region src/lib/withInsertFragmentList.d.ts
201
- declare const withInsertFragmentList: OverrideEditor<ListConfig>;
202
- //#endregion
203
- //#region src/lib/withList.d.ts
204
- declare const withList: OverrideEditor<ListConfig>;
205
- //#endregion
206
- //#region src/lib/withNormalizeList.d.ts
207
- /** Normalize list node to force the ul>li>p+ul structure. */
208
- declare const withNormalizeList: OverrideEditor<ListConfig>;
209
- //#endregion
210
- //#region src/lib/normalizers/normalizeListItem.d.ts
211
- /**
212
- * Recursively get all the:
213
- *
214
- * - Block children
215
- * - Inline children except those at excludeDepth
216
- */
217
- declare const getDeepInlineChildren: (editor: SlateEditor, {
218
- children
219
- }: {
220
- children: NodeEntry<Descendant>[];
221
- }) => NodeEntry<Descendant>[];
222
- /**
223
- * If the list item has no child: insert an empty list item container. Else:
224
- * move the children that are not valid to the list item container.
225
- */
226
- declare const normalizeListItem: (editor: SlateEditor, {
227
- listItem,
228
- validLiChildrenTypes
229
- }: {
230
- listItem: ElementEntry;
231
- } & ListConfig["options"]) => boolean;
232
- //#endregion
233
- //#region src/lib/normalizers/normalizeNestedList.d.ts
234
- declare const normalizeNestedList: (editor: SlateEditor, {
235
- nestedListItem
236
- }: {
237
- nestedListItem: ElementEntry;
238
- }) => boolean | undefined;
239
- //#endregion
240
- //#region src/lib/queries/getHighestEmptyList.d.ts
241
- /**
242
- * Find the highest end list that can be deleted. Its path should be different
243
- * to diffListPath. If the highest end list 2+ items, return liPath. Get the
244
- * parent list until:
245
- *
246
- * - The list has less than 2 items.
247
- * - Its path is not equals to diffListPath.
248
- */
249
- declare const getHighestEmptyList: (editor: SlateEditor, {
250
- diffListPath,
251
- liPath
252
- }: {
253
- liPath: Path;
254
- diffListPath?: Path;
255
- }) => Path | undefined;
256
- //#endregion
257
- //#region src/lib/queries/getListItemEntry.d.ts
258
- /**
259
- * Returns the nearest li and ul / ol wrapping node entries for a given path
260
- * (default = selection)
261
- */
262
- declare const getListItemEntry: (editor: SlateEditor, {
263
- at
264
- }?: {
265
- at?: TLocation | null;
266
- }) => {
267
- list: ElementEntry;
268
- listItem: ElementEntry;
269
- } | undefined;
270
- //#endregion
271
- //#region src/lib/queries/getListRoot.d.ts
272
- /** Searches upward for the root list element */
273
- declare const getListRoot: (editor: SlateEditor, at?: Path | Point | TRange | null) => ElementEntry | undefined;
274
- //#endregion
275
- //#region src/lib/queries/getListTypes.d.ts
276
- declare const getListTypes: (editor: SlateEditor) => any[];
277
- //#endregion
278
- //#region src/lib/queries/getTaskListProps.d.ts
279
- type GetPropsIfTaskListLiNodeOptions = {
280
- liNode: TElement;
281
- inherit?: boolean;
282
- };
283
- declare const getPropsIfTaskListLiNode: (editor: SlateEditor, {
284
- inherit,
285
- liNode: node
286
- }: GetPropsIfTaskListLiNodeOptions) => {
287
- checked: boolean;
288
- } | undefined;
289
- declare const getPropsIfTaskList: (editor: SlateEditor, type: string, partial?: {
290
- checked?: boolean;
291
- }) => {
292
- checked: boolean;
293
- } | undefined;
294
- //#endregion
295
- //#region src/lib/queries/getTodoListItemEntry.d.ts
296
- /**
297
- * Returns the nearest li and ul / ol wrapping node entries for a given path
298
- * (default = selection)
299
- */
300
- declare const getTodoListItemEntry: (editor: SlateEditor, {
301
- at
302
- }?: {
303
- at?: TLocation | null;
304
- }) => {
305
- list: ElementEntry;
306
- listItem: ElementEntry;
307
- } | undefined;
308
- //#endregion
309
- //#region src/lib/queries/hasListChild.d.ts
310
- /** Is there a list child in the node. */
311
- declare const hasListChild: (editor: SlateEditor, node: Ancestor) => any;
312
- //#endregion
313
- //#region src/lib/queries/isAcrossListItems.d.ts
314
- /** Is selection across blocks with list items */
315
- declare const isAcrossListItems: (editor: SlateEditor, at?: TRange | null) => any;
316
- //#endregion
317
- //#region src/lib/queries/isListNested.d.ts
318
- /** Is the list nested, i.e. its parent is a list item. */
319
- declare const isListNested: (editor: SlateEditor, listPath: Path) => boolean;
320
- //#endregion
321
- //#region src/lib/queries/isListRoot.d.ts
322
- declare const isListRoot: (editor: SlateEditor, node: Descendant) => boolean;
323
- //#endregion
324
- //#region src/lib/queries/someList.d.ts
325
- declare const someList: (editor: SlateEditor, type: string) => boolean;
326
- //#endregion
327
- export { moveListItemDown as $, BaseNumberedListPlugin as A, RemoveListItemOptions as B, withDeleteBackwardList as C, BaseListItemContentPlugin as D, BaseBulletedListPlugin as E, unindentListItems as F, moveListItemsToList as G, removeFirstListItem as H, toggleBulletedList as I, MoveListItemUpOptions as J, MoveListItemsOptions as K, toggleList as L, ListConfig as M, unwrapList as N, BaseListItemPlugin as O, UnindentListItemsOptions as P, MoveListItemDownOptions as Q, toggleNumberedList as R, withDeleteForwardList as S, TTodoListItemElement as T, moveListSiblingsAfterCursor as U, removeListItem as V, MergeListItemIntoListOptions as W, MoveListItemSublistItemsToListItemSublistOptions as X, moveListItemUp as Y, moveListItemSublistItemsToListItemSublist as Z, withNormalizeList as _, hasListChild as a, withInsertBreakList as b, getPropsIfTaskList as c, getListRoot as d, insertTodoListItem as et, getListItemEntry as f, normalizeListItem as g, getDeepInlineChildren as h, isAcrossListItems as i, BaseTaskListPlugin as j, BaseListPlugin as k, getPropsIfTaskListLiNode as l, normalizeNestedList as m, isListRoot as n, insertListItem as nt, getTodoListItemEntry as o, getHighestEmptyList as p, moveListItems as q, isListNested as r, indentListItems as rt, GetPropsIfTaskListLiNodeOptions as s, someList as t, InsertListItemOptions as tt, getListTypes as u, withList as v, BaseTodoListPlugin as w, withDeleteFragmentList as x, withInsertFragmentList as y, toggleTaskList as z };
328
- //# sourceMappingURL=index-CYSu3DSy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CYSu3DSy.d.ts","names":[],"sources":["../src/lib/transforms/indentListItems.ts","../src/lib/transforms/insertListItem.ts","../src/lib/transforms/insertTodoListItem.ts","../src/lib/transforms/moveListItemDown.ts","../src/lib/transforms/moveListItemSublistItemsToListItemSublist.ts","../src/lib/transforms/moveListItemUp.ts","../src/lib/transforms/moveListItems.ts","../src/lib/transforms/moveListItemsToList.ts","../src/lib/transforms/moveListSiblingsAfterCursor.ts","../src/lib/transforms/removeFirstListItem.ts","../src/lib/transforms/removeListItem.ts","../src/lib/transforms/toggleList.ts","../src/lib/transforms/unindentListItems.ts","../src/lib/transforms/unwrapList.ts","../src/lib/BaseListPlugin.ts","../src/lib/BaseTodoListPlugin.ts","../src/lib/withDeleteBackwardList.ts","../src/lib/withDeleteForwardList.ts","../src/lib/withDeleteFragmentList.ts","../src/lib/withInsertBreakList.ts","../src/lib/withInsertFragmentList.ts","../src/lib/withList.ts","../src/lib/withNormalizeList.ts","../src/lib/normalizers/normalizeListItem.ts","../src/lib/normalizers/normalizeNestedList.ts","../src/lib/queries/getHighestEmptyList.ts","../src/lib/queries/getListItemEntry.ts","../src/lib/queries/getListRoot.ts","../src/lib/queries/getListTypes.ts","../src/lib/queries/getTaskListProps.ts","../src/lib/queries/getTodoListItemEntry.ts","../src/lib/queries/hasListChild.ts","../src/lib/queries/isAcrossListItems.ts","../src/lib/queries/isListNested.ts","../src/lib/queries/isListRoot.ts","../src/lib/queries/someList.ts"],"sourcesContent":[],"mappings":";;;cAIa,0BAA2B;;;KCF5B,qBAAA;;EDEC,iCAA2B,CAAA,EAAA,OAAW;;;cCItC,yBACH,uBACC;;;;cCLE,6BAA8B;;;KCK/B,uBAAA;QACJ;EHPK,QAAA,EGQD,YHNX;;cGSY,2BACH;;;GACY;;;KCNV,gDAAA;;EJPC,YAAA,EISG,YJPf;;cIUa;;EHdF,KAAA,CAAA,EAAA,OAAA;AAMZ,CAAA;;;;ACHA;cEqBa,oDACH;;;;GAKL;;;KClBO,qBAAA;QACJ;ELXK,QAAA,EKYD,YLVX;;;cKcY,yBACH;;;GACY;;;KCRV,oBAAA;OACL;ENXM,qBAEZ,CAAA,EAAA,OAFuC;;;cMgB3B,wBACH;;;;IAKL;;;KChBO,4BAAA;;APNZ;;;;ECFY,cAAA,CAAA,EAAA,OAAqB;EAMpB;aMWA;;iBAGI;ELjBJ,cAAA,CAAA,EAAA,MAiEZ;OK5CM;;WAGI;EJnBC;EAKC,WAAA,CAAA,EAAA,MAgDZ,GAAA,IAAA;CA/CS;;;;;;cIwBG,8BACH;;;;;MACR;;;GAQG;;;cCtCQ,sCACH;;;;MAKF;ERdK,EAAA,EQeL,IRfK;;;;;cSEA,8BACH;;;;ETHG,IAAA,ESQH,YTNT;YSOa;;;;KCAF,qBAAA;QACJ;EVVK,QAAA,EUWD,YVTX;;;;ACJW,cSkBC,cTlBoB,EAAA,CAAA,MAAA,ESmBvB,WTnBuB,EAAA;EAAA,IAAA;EAAA,QAAA;EAAA;AAAA,CAAA,ESoBK,qBTpBL,EAAA,GAAA,OAAA;;;cU0KpB,qBAAsB;;AXxKnC;;AAAA,CAAA,EAAA,GAAa,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AAA,EAAA,GAAa,OAAA,GAAA,SAEZ;;;;;AAFD;;;;ACFA;AAMA;cwBKa,8BACH;;;AvBTV;UuBcY;iBACO;AvBfnB,CAAA,EAAA,GuBiBG,IvBjBU,GAAA,SAAA;;;;;AFDb;;c0BWa,2BACH;;AzBdV,CAAA;OyBeoC;AzBfpC,CAAA,EAAA,GAAY;EAMC,IAAA,EyBUF,YzBwGV;YyBxGkC;;;;;cCNtB,sBACH,kBACJ,OAAO,QAAQ,kBAClB;;;cCXU,uBAAwB;;;KCFzB,+BAAA;UACF;E7BCG,OAAA,CAAA,EAAA,OAAA;;c6BGA,mCACH;;UACR;GAAmC;;A5BPrC,CAAA,GAAY,SAAA;AAMC,c4BOA,kB5BNH,EAAA,CAAA,MACC,E4BMD,W5BNC,EAAA,IAAA,EAA0B,MAAA,EAAA,QAAA,EAAA;;;;ACLrC,CAAA,GAAa,SAAA;;;;;AFDb;;c8BWa,+BACH;;A7BdV,CAAA;O6BeoC;A7BfpC,CAAA,EAAA,GAAY;EAMC,IAAA,E6BUF,Y7BwGV;Y6BxGkC;;;;;cCbtB,uBAAwB,mBAAmB;;;;cCF3C,4BACH,kBACJ;;;;cCAO,uBAAwB,uBAAuB;;;cCD/C,qBAAsB,mBAAmB;;;cCAzC,mBAAoB"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["SlateEditor","getListItemEntry","someList","editor","type","list","SlateEditor","moveListItems","indentListItems","editor","increase","ElementEntry","Path","SlateEditor","TElement","match","NodeApi","PathApi","getListTypes","moveListSiblingsAfterCursor","editor","at","to","offset","parent","listNode","get","listEntry","type","isParent","tf","moveNodes","children","fromIndex","SlateEditor","MoveListItemsOptions","moveListItems","UnindentListItemsOptions","Omit","unindentListItems","editor","options","increase"],"sources":["../src/lib/queries/someList.ts","../src/lib/transforms/indentListItems.ts","../src/lib/transforms/moveListSiblingsAfterCursor.ts","../src/lib/transforms/unindentListItems.ts"],"sourcesContent":["import type { SlateEditor } from 'platejs';\n\nimport { getListItemEntry } from '../index';\n\nexport const someList = (editor: SlateEditor, type: string) =>\n getListItemEntry(editor)?.list?.[0].type === type;\n","import type { SlateEditor } from 'platejs';\n\nimport { moveListItems } from './moveListItems';\n\nexport const indentListItems = (editor: SlateEditor) => {\n moveListItems(editor, { increase: true });\n};\n","import {\n type ElementEntry,\n type Path,\n type SlateEditor,\n type TElement,\n match,\n NodeApi,\n PathApi,\n} from 'platejs';\n\nimport { getListTypes } from '../queries/getListTypes';\n\nexport const moveListSiblingsAfterCursor = (\n editor: SlateEditor,\n {\n at,\n to,\n }: {\n at: Path;\n to: Path;\n }\n) => {\n const offset = at.at(-1)!;\n at = PathApi.parent(at);\n const listNode = NodeApi.get<TElement>(editor, at)!;\n const listEntry: ElementEntry = [listNode, at];\n\n if (\n !match(listNode, [], { type: getListTypes(editor) }) ||\n PathApi.isParent(at, to) // avoid moving nodes within its own list\n ) {\n return false;\n }\n\n return editor.tf.moveNodes({\n at: listEntry[1],\n children: true,\n fromIndex: offset + 1,\n to,\n });\n};\n","import type { SlateEditor } from 'platejs';\n\nimport { type MoveListItemsOptions, moveListItems } from './moveListItems';\n\nexport type UnindentListItemsOptions = Omit<MoveListItemsOptions, 'increase'>;\n\nexport const unindentListItems = (\n editor: SlateEditor,\n options: UnindentListItemsOptions = {}\n) => moveListItems(editor, { ...options, increase: false });\n"],"mappings":";;;;AAIA,MAAaE,YAAYC,QAAqBC,SAC5CH,iBAAiBE,OAAO,EAAEE,OAAO,GAAGD,SAASA;;;;ACD/C,MAAaI,mBAAmBC,WAAwB;AACtDF,eAAcE,QAAQ,EAAEC,UAAU,MAAM,CAAC;;;;;ACO3C,MAAaS,+BACXC,QACA,EACEC,IACAC,SAKC;CACH,MAAMC,SAASF,GAAGA,GAAG,GAAG;AACxBA,MAAKJ,QAAQO,OAAOH,GAAG;CACvB,MAAMI,WAAWT,QAAQU,IAAcN,QAAQC,GAAG;CAClD,MAAMM,YAA0B,CAACF,UAAUJ,GAAG;AAE9C,KACE,CAACN,MAAMU,UAAU,EAAE,EAAE,EAAEG,MAAMV,aAAaE,OAAM,EAAG,CAAC,IACpDH,QAAQY,SAASR,IAAIC,GAAG,CAExB,QAAO;AAGT,QAAOF,OAAOU,GAAGC,UAAU;EACzBV,IAAIM,UAAU;EACdK,UAAU;EACVC,WAAWV,SAAS;EACpBD;EACD,CAAC;;;;;ACjCJ,MAAaiB,qBACXC,QACAC,UAAoC,EAAE,KACnCL,cAAcI,QAAQ;CAAE,GAAGC;CAASC,UAAU;CAAO,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/react/ListPlugin.tsx","../../src/react/TodoListPlugin.tsx","../../src/react/hooks/useListToolbarButton.ts","../../src/react/hooks/useTodoListElement.ts"],"sourcesContent":[],"mappings":";;;cAWa;cAEA;cAEA;AAJA,cAMA,qBAN0D,EAAA,GAAA;AAE1D,cAMA,cANkD,EAAA,GAAA;AAE/D;AAEA;AAEA;AAMA;cAAa;;;cCrBA;;;cCCA;;;;;EFMA,QAAA,EAAA,MAAA;EAEA,OAAA,EAAA,GAAA;AAEb,CAAA;AAEa,cEIA,oBFJgE,EAAA,CAAA,KAAA,EEKpE,UFLoE,CAAA,OEKlD,yBFLkD,CAAA,EAAA,GAAA;EAEhE,KAAA,EAAA;IAMA,OAAA,EAQX,GAAA;;qBEAqB,KAAA,CAAM,WAAW;;AD7BxC,CAAA;;;cEAa;;AHOb;WGJW;AHIX,CAAA,EAAA,GAAa,GAAA;AAEA,cGQA,kBHRkD,EAAA,CAAA,KAAA,EGStD,UHTsD,CAAA,OGSpC,uBHToC,CAAA,EAAA,GAAA;EAElD,aAAA,EAAA;IAEA,OAAA,EAAA,OAAA;IAEA,eAAkD,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAAA,IAAA;EAMlD,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["toPlatePlugin","BaseBulletedListPlugin","BaseListItemContentPlugin","BaseListItemPlugin","BaseListPlugin","BaseNumberedListPlugin","BaseTaskListPlugin","BulletedListPlugin","TaskListPlugin","NumberedListPlugin","ListItemContentPlugin","ListItemPlugin","ListPlugin","plugins","toPlatePlugin","BaseTodoListPlugin","TodoListPlugin","KEYS","useEditorRef","useEditorSelector","ListPlugin","useListToolbarButtonState","t0","$","_c","t1","undefined","nodeType","t2","ulClassic","t3","t4","editor","selection","api","some","match","type","getType","pressed","t5","useListToolbarButton","state","getTransforms","tf","toggle","list","props","onClick","onMouseDown","_temp","e","preventDefault","useEditorRef","useReadOnly","TTodoListItemElement","useTodoListElementState","t0","$","_c","element","editor","checked","readOnly","t1","useTodoListElement","state","value","tf","setNodes","at","t2","checkboxProps","onCheckedChange"],"sources":["../../src/react/ListPlugin.tsx","../../src/react/TodoListPlugin.tsx","../../src/react/hooks/useListToolbarButton.ts","../../src/react/hooks/useTodoListElement.ts"],"sourcesContent":["import { toPlatePlugin } from 'platejs/react';\n\nimport {\n BaseBulletedListPlugin,\n BaseListItemContentPlugin,\n BaseListItemPlugin,\n BaseListPlugin,\n BaseNumberedListPlugin,\n BaseTaskListPlugin,\n} from '../lib';\n\nexport const BulletedListPlugin = toPlatePlugin(BaseBulletedListPlugin);\n\nexport const TaskListPlugin = toPlatePlugin(BaseTaskListPlugin);\n\nexport const NumberedListPlugin = toPlatePlugin(BaseNumberedListPlugin);\n\nexport const ListItemContentPlugin = toPlatePlugin(BaseListItemContentPlugin);\n\nexport const ListItemPlugin = toPlatePlugin(BaseListItemPlugin);\n\n/**\n * Enables support for bulleted, numbered and to-do lists with React-specific\n * features.\n */\nexport const ListPlugin = toPlatePlugin(BaseListPlugin, {\n plugins: [\n BulletedListPlugin,\n TaskListPlugin,\n NumberedListPlugin,\n ListItemPlugin,\n ListItemContentPlugin,\n ],\n});\n","import { toPlatePlugin } from 'platejs/react';\n\nimport { BaseTodoListPlugin } from '../lib/BaseTodoListPlugin';\n\nexport const TodoListPlugin = toPlatePlugin(BaseTodoListPlugin);\n","import { KEYS } from 'platejs';\nimport { useEditorRef, useEditorSelector } from 'platejs/react';\n\nimport { ListPlugin } from '../ListPlugin';\n\nexport const useListToolbarButtonState = ({\n nodeType = KEYS.ulClassic as string,\n} = {}) => {\n const pressed = useEditorSelector(\n (editor) =>\n !!editor.selection &&\n editor.api.some({ match: { type: editor.getType(nodeType) } }),\n [nodeType]\n );\n\n return {\n nodeType,\n pressed,\n };\n};\n\nexport const useListToolbarButton = (\n state: ReturnType<typeof useListToolbarButtonState>\n) => {\n const editor = useEditorRef();\n const tf = editor.getTransforms(ListPlugin);\n\n return {\n props: {\n pressed: state.pressed,\n onClick: () => {\n tf.toggle.list({ type: state.nodeType });\n },\n onMouseDown: (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault();\n },\n },\n };\n};\n","import { useEditorRef, useReadOnly } from 'platejs/react';\n\nimport type { TTodoListItemElement } from '../../lib';\n\nexport const useTodoListElementState = ({\n element,\n}: {\n element: TTodoListItemElement;\n}): any => {\n const editor = useEditorRef();\n const { checked } = element;\n const readOnly = useReadOnly();\n\n return {\n checked,\n editor,\n element,\n readOnly,\n };\n};\n\nexport const useTodoListElement = (\n state: ReturnType<typeof useTodoListElementState>\n) => {\n const { checked, element, readOnly } = state;\n const editor = useEditorRef();\n\n return {\n checkboxProps: {\n checked: !!checked,\n onCheckedChange: (value: boolean) => {\n if (readOnly) return;\n\n editor.tf.setNodes<TTodoListItemElement>(\n { checked: value },\n { at: element }\n );\n },\n },\n };\n};\n"],"mappings":";;;;;;AAWA,MAAaO,qBAAqBP,cAAcC,uBAAuB;AAEvE,MAAaO,iBAAiBR,cAAcM,mBAAmB;AAE/D,MAAaG,qBAAqBT,cAAcK,uBAAuB;AAEvE,MAAaK,wBAAwBV,cAAcE,0BAA0B;AAE7E,MAAaS,iBAAiBX,cAAcG,mBAAmB;;;;;AAM/D,MAAaS,aAAaZ,cAAcI,gBAAgB,EACtDS,SAAS;CACPN;CACAC;CACAC;CACAE;CACAD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