@prezly/slate-lists
Advanced tools
Comparing version
@@ -1,4 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Point } from 'slate'; | ||
import { Path } from 'slate'; | ||
import { Editor, Path } from 'slate'; | ||
import { Span } from 'slate'; | ||
@@ -10,2 +9,2 @@ import { Range } from 'slate'; | ||
*/ | ||
export declare function getCursorPosition(editor: SlateEditor, at: Range | Point | Span | Path | null): Point | null; | ||
export declare function getCursorPosition(editor: Editor, at: Range | Point | Span | Path | null): Point | null; |
@@ -1,2 +0,2 @@ | ||
import { Path } from 'slate'; | ||
import { Editor, Path } from 'slate'; | ||
import { Span } from 'slate'; | ||
@@ -20,3 +20,3 @@ import { Range } from 'slate'; | ||
if (Path.isPath(at)) { | ||
return editor.point(at, { | ||
return Editor.point(editor, at, { | ||
edge: 'start' | ||
@@ -23,0 +23,0 @@ }); |
@@ -1,6 +0,5 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { type Path, Point } from 'slate'; | ||
export declare function getCursorPositionInNode(editor: SlateEditor, cursorLocation: Point, nodePath: Path): { | ||
import { type Path, Editor, Point } from 'slate'; | ||
export declare function getCursorPositionInNode(editor: Editor, cursorLocation: Point, nodePath: Path): { | ||
isEnd: boolean; | ||
isStart: boolean; | ||
}; |
@@ -1,5 +0,5 @@ | ||
import { Point } from 'slate'; | ||
import { Editor, Point } from 'slate'; | ||
export function getCursorPositionInNode(editor, cursorLocation, nodePath) { | ||
const nodeStartPoint = editor.start(nodePath); | ||
const nodeEndPoint = editor.end(nodePath); | ||
const nodeStartPoint = Editor.start(editor, nodePath); | ||
const nodeEndPoint = Editor.end(editor, nodePath); | ||
const isStart = Point.equals(cursorLocation, nodeStartPoint); | ||
@@ -6,0 +6,0 @@ const isEnd = Point.equals(cursorLocation, nodeEndPoint); |
@@ -1,4 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Element, Location, NodeEntry } from 'slate'; | ||
import { Span } from 'slate'; | ||
import { Editor, Span } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +7,2 @@ /** | ||
*/ | ||
export declare function getListItems(editor: SlateEditor, schema: ListsSchema, at?: Location | Span | null): NodeEntry<Element>[]; | ||
export declare function getListItems(editor: Editor, schema: ListsSchema, at?: Location | Span | null): NodeEntry<Element>[]; |
@@ -1,2 +0,2 @@ | ||
import { Path, Point, Range, Span } from 'slate'; | ||
import { Editor, Path, Point, Range, Span } from 'slate'; | ||
/** | ||
@@ -11,3 +11,3 @@ * Returns all "list-items" in a given Range. | ||
const start = getLocationStart(at); | ||
const listItems = editor.nodes({ | ||
const listItems = Editor.nodes(editor, { | ||
at, | ||
@@ -14,0 +14,0 @@ match: schema.isListItemNode |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Element, Location, NodeEntry } from 'slate'; | ||
import type { Editor, Element, Location, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +6,2 @@ /** | ||
*/ | ||
export declare function getLists(editor: SlateEditor, schema: ListsSchema, at: Location | null): NodeEntry<Element>[]; | ||
export declare function getLists(editor: Editor, schema: ListsSchema, at: Location | null): NodeEntry<Element>[]; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry, Path } from 'slate'; | ||
import type { Editor, NodeEntry, Path } from 'slate'; | ||
import { Element } from 'slate'; | ||
@@ -9,2 +8,2 @@ import type { ListsSchema } from '../types'; | ||
*/ | ||
export declare function getNestedList(editor: SlateEditor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; | ||
export declare function getNestedList(editor: Editor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { type NodeEntry, Path } from 'slate'; | ||
export declare function getNextSibling(editor: SlateEditor, path: Path): NodeEntry | null; | ||
import { type Editor, type NodeEntry, Path } from 'slate'; | ||
export declare function getNextSibling(editor: Editor, path: Path): NodeEntry | null; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Element, NodeEntry, Path } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function getParentList(editor: SlateEditor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; | ||
export declare function getParentList(editor: Editor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
/** | ||
@@ -6,3 +7,3 @@ * Returns parent "list" node of "list-item" at a given path. | ||
export function getParentList(editor, schema, path) { | ||
const parentList = editor.above({ | ||
const parentList = Editor.above(editor, { | ||
at: path, | ||
@@ -9,0 +10,0 @@ match: node => schema.isListNode(node) |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Element, NodeEntry, Path } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function getParentListItem(editor: SlateEditor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; | ||
export declare function getParentListItem(editor: Editor, schema: ListsSchema, path: Path): NodeEntry<Element> | null; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
/** | ||
@@ -6,3 +7,3 @@ * Returns parent "list-item" node of "list-item" at a given path. | ||
export function getParentListItem(editor, schema, path) { | ||
const parentListItem = editor.above({ | ||
const parentListItem = Editor.above(editor, { | ||
at: path, | ||
@@ -9,0 +10,0 @@ match: node => schema.isListItemNode(node) |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { type NodeEntry, Path } from 'slate'; | ||
export declare function getPrevSibling(editor: SlateEditor, path: Path): NodeEntry | null; | ||
import { type Editor, type NodeEntry, Path } from 'slate'; | ||
export declare function getPrevSibling(editor: Editor, path: Path): NodeEntry | null; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location, Span } from 'slate'; | ||
import type { Editor, Location, Span } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +6,2 @@ /** | ||
*/ | ||
export declare function isAtEmptyListItem(editor: SlateEditor, schema: ListsSchema, at?: Location | Span | null): boolean; | ||
export declare function isAtEmptyListItem(editor: Editor, schema: ListsSchema, at?: Location | Span | null): boolean; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import type { Editor, Location } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +6,2 @@ /** | ||
*/ | ||
export declare function isAtStartOfListItem(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function isAtStartOfListItem(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import type { Editor, Location } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +6,2 @@ /** | ||
*/ | ||
export declare function isDeleteBackwardAllowed(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function isDeleteBackwardAllowed(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -1,4 +0,4 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
export declare function isInList(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function isInList(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
export function isInList(editor, schema) { | ||
@@ -6,3 +7,3 @@ let at = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : editor.selection; | ||
} | ||
for (const [currentNode] of editor.levels({ | ||
for (const [currentNode] of Editor.levels(editor, { | ||
at | ||
@@ -9,0 +10,0 @@ })) { |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +7,2 @@ /** | ||
*/ | ||
export declare function isListItemContainingText(editor: SlateEditor, schema: ListsSchema, node: Node): boolean; | ||
export declare function isListItemContainingText(editor: Editor, schema: ListsSchema, node: Node): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element } from 'slate'; | ||
import { Editor, Element } from 'slate'; | ||
/** | ||
@@ -8,3 +8,3 @@ * Returns true if given "list-item" node contains a non-empty "list-item-text" node. | ||
return node.children.some(node => { | ||
return Element.isElement(node) && schema.isListItemTextNode(node) && !editor.isEmpty(node); | ||
return Element.isElement(node) && schema.isListItemTextNode(node) && !Editor.isEmpty(editor, node); | ||
}); | ||
@@ -11,0 +11,0 @@ } |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Element, Location, Node, NodeEntry, Path, Range } from 'slate'; | ||
import type { Editor, Element, Location, Node, NodeEntry, Path, Range } from 'slate'; | ||
import { moveListItemsToAnotherList, moveListToListItem } from './transformations'; | ||
@@ -7,35 +6,35 @@ import type { ListsSchema } from './types'; | ||
export declare const ListsEditor: { | ||
isListsEnabled(editor: SlateEditor): boolean; | ||
getListsSchema(editor: SlateEditor): ListsSchema | undefined; | ||
isConvertibleToListTextNode(editor: SlateEditor, node: Node): boolean; | ||
isDefaultTextNode(editor: SlateEditor, node: Node): boolean; | ||
isListNode(editor: SlateEditor, node: Node, type?: ListType): boolean; | ||
isListItemNode(editor: SlateEditor, node: Node): boolean; | ||
isListItemTextNode(editor: SlateEditor, node: Node): boolean; | ||
createDefaultTextNode(editor: SlateEditor, props?: Partial<Element>): Element; | ||
createListNode(editor: SlateEditor, type?: ListType, props?: Partial<Element>): Element; | ||
createListItemNode(editor: SlateEditor, props?: Partial<Element>): Element; | ||
createListItemTextNode(editor: SlateEditor, props?: Partial<Element>): Element; | ||
isDeleteBackwardAllowed(editor: SlateEditor, at?: Location | null): boolean; | ||
isAtStartOfListItem(editor: SlateEditor, at?: Location | null): boolean; | ||
isAtEmptyListItem(editor: SlateEditor, at?: Location | null): boolean; | ||
isAtList(editor: SlateEditor, at?: Location | null): boolean; | ||
isListItemContainingText(editor: SlateEditor, node: Node): boolean; | ||
getLists(editor: SlateEditor, at: Range | null): NodeEntry<import("slate").BaseElement>[]; | ||
getListItems(editor: SlateEditor, at?: Location | null): NodeEntry<import("slate").BaseElement>[]; | ||
getListType(editor: SlateEditor, node: Node): ListType; | ||
getNestedList(editor: SlateEditor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
getParentList(editor: SlateEditor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
getParentListItem(editor: SlateEditor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
increaseDepth(editor: SlateEditor, at?: Location | null): boolean; | ||
increaseListItemDepth(editor: SlateEditor, listItemPath: Path): boolean; | ||
decreaseDepth(editor: SlateEditor, at?: Location | null): boolean; | ||
decreaseListItemDepth(editor: SlateEditor, listItemPath: Path): boolean; | ||
mergeListWithPreviousSiblingList(editor: SlateEditor, entry: NodeEntry): boolean; | ||
moveListItemsToAnotherList(editor: SlateEditor, parameters: Parameters<typeof moveListItemsToAnotherList>[2]): boolean; | ||
moveListToListItem(editor: SlateEditor, parameters: Parameters<typeof moveListToListItem>[2]): void; | ||
setListType(editor: SlateEditor, listType: ListType, at?: Location | null): boolean; | ||
splitListItem(editor: SlateEditor, at?: Location | null): boolean; | ||
unwrapList(editor: SlateEditor, at?: Location | null): boolean; | ||
wrapInList(editor: SlateEditor, listType?: ListType, at?: Location | null): boolean; | ||
isListsEnabled(editor: Editor): boolean; | ||
getListsSchema(editor: Editor): ListsSchema | undefined; | ||
isConvertibleToListTextNode(editor: Editor, node: Node): boolean; | ||
isDefaultTextNode(editor: Editor, node: Node): boolean; | ||
isListNode(editor: Editor, node: Node, type?: ListType): boolean; | ||
isListItemNode(editor: Editor, node: Node): boolean; | ||
isListItemTextNode(editor: Editor, node: Node): boolean; | ||
createDefaultTextNode(editor: Editor, props?: Partial<Element>): Element; | ||
createListNode(editor: Editor, type?: ListType, props?: Partial<Element>): Element; | ||
createListItemNode(editor: Editor, props?: Partial<Element>): Element; | ||
createListItemTextNode(editor: Editor, props?: Partial<Element>): Element; | ||
isDeleteBackwardAllowed(editor: Editor, at?: Location | null): boolean; | ||
isAtStartOfListItem(editor: Editor, at?: Location | null): boolean; | ||
isAtEmptyListItem(editor: Editor, at?: Location | null): boolean; | ||
isAtList(editor: Editor, at?: Location | null): boolean; | ||
isListItemContainingText(editor: Editor, node: Node): boolean; | ||
getLists(editor: Editor, at: Range | null): NodeEntry<import("slate").BaseElement>[]; | ||
getListItems(editor: Editor, at?: Location | null): NodeEntry<import("slate").BaseElement>[]; | ||
getListType(editor: Editor, node: Node): ListType; | ||
getNestedList(editor: Editor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
getParentList(editor: Editor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
getParentListItem(editor: Editor, path: Path): NodeEntry<import("slate").BaseElement> | null; | ||
increaseDepth(editor: Editor, at?: Location | null): boolean; | ||
increaseListItemDepth(editor: Editor, listItemPath: Path): boolean; | ||
decreaseDepth(editor: Editor, at?: Location | null): boolean; | ||
decreaseListItemDepth(editor: Editor, listItemPath: Path): boolean; | ||
mergeListWithPreviousSiblingList(editor: Editor, entry: NodeEntry): boolean; | ||
moveListItemsToAnotherList(editor: Editor, parameters: Parameters<typeof moveListItemsToAnotherList>[2]): boolean; | ||
moveListToListItem(editor: Editor, parameters: Parameters<typeof moveListToListItem>[2]): void; | ||
setListType(editor: Editor, listType: ListType, at?: Location | null): boolean; | ||
splitListItem(editor: Editor, at?: Location | null): boolean; | ||
unwrapList(editor: Editor, at?: Location | null): boolean; | ||
wrapInList(editor: Editor, listType?: ListType, at?: Location | null): boolean; | ||
}; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { Editor, NodeEntry } from 'slate'; | ||
import { Node } from 'slate'; | ||
@@ -10,2 +9,2 @@ import type { ListsSchema } from '../types'; | ||
*/ | ||
export declare function normalizeListChildren(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeListChildren(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node, Text } from 'slate'; | ||
import { Node, Text, Transforms } from 'slate'; | ||
/** | ||
@@ -22,3 +22,3 @@ * All children of a "list" have to be "list-items". It can happen (e.g. during pasting) that | ||
if (children.length > 1) { | ||
editor.removeNodes({ | ||
Transforms.removeNodes(editor, { | ||
at: childPath | ||
@@ -29,3 +29,3 @@ }); | ||
// to avoid never-ending normalization (Slate will insert empty text node). | ||
editor.removeNodes({ | ||
Transforms.removeNodes(editor, { | ||
at: path | ||
@@ -36,3 +36,3 @@ }); | ||
} | ||
editor.wrapNodes(schema.createListItemNode({ | ||
Transforms.wrapNodes(editor, schema.createListItemNode({ | ||
children: [schema.createListItemTextNode({ | ||
@@ -47,3 +47,3 @@ children: [childNode] | ||
if (schema.isListItemTextNode(childNode)) { | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: childPath | ||
@@ -55,3 +55,3 @@ }); | ||
// Wrap it into a list item so that `normalizeOrphanNestedList` can take care of it. | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: childPath | ||
@@ -62,6 +62,6 @@ }); | ||
if (!schema.isListItemNode(childNode)) { | ||
editor.setNodes(schema.createListItemTextNode(), { | ||
Transforms.setNodes(editor, schema.createListItemTextNode(), { | ||
at: childPath | ||
}); | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: childPath | ||
@@ -68,0 +68,0 @@ }); |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { Editor, NodeEntry } from 'slate'; | ||
import { Node } from 'slate'; | ||
@@ -8,2 +7,2 @@ import type { ListsSchema } from '../types'; | ||
*/ | ||
export declare function normalizeListItemChildren(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeListItemChildren(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node, Text } from 'slate'; | ||
import { Node, Text, Transforms } from 'slate'; | ||
/** | ||
@@ -13,3 +13,2 @@ * A "list-item" can have a single "list-item-text" and optionally an extra "list" as a child. | ||
for (const [childIndex, [childNode, childPath]] of children.entries()) { | ||
// @ts-expect-error TODO: Fix this | ||
if (Text.isText(childNode) || editor.isInline(childNode)) { | ||
@@ -19,3 +18,3 @@ const listItemText = schema.createListItemTextNode({ | ||
}); | ||
editor.wrapNodes(listItemText, { | ||
Transforms.wrapNodes(editor, listItemText, { | ||
at: childPath | ||
@@ -26,3 +25,3 @@ }); | ||
if (schema.isListItemTextNode(previousChildNode)) { | ||
editor.mergeNodes({ | ||
Transforms.mergeNodes(editor, { | ||
at: childPath | ||
@@ -35,3 +34,3 @@ }); | ||
if (schema.isListItemNode(childNode)) { | ||
editor.liftNodes({ | ||
Transforms.liftNodes(editor, { | ||
at: childPath | ||
@@ -42,3 +41,3 @@ }); | ||
if (schema.isListItemTextNode(childNode) && childIndex !== 0) { | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: childPath | ||
@@ -49,3 +48,3 @@ }); | ||
if (!schema.isListItemTextNode(childNode) && !schema.isListNode(childNode)) { | ||
editor.setNodes(schema.createListItemTextNode(), { | ||
Transforms.setNodes(editor, schema.createListItemTextNode(), { | ||
at: childPath | ||
@@ -52,0 +51,0 @@ }); |
@@ -1,4 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import { Node } from 'slate'; | ||
import { Editor, Node } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +7,2 @@ /** | ||
*/ | ||
export declare function normalizeListItemTextChildren(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeListItemTextChildren(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element, Node } from 'slate'; | ||
import { Editor, Element, Node, Transforms } from 'slate'; | ||
/** | ||
@@ -12,5 +12,4 @@ * A "list-item-text" can have only inline nodes in it. | ||
for (const [childNode, childPath] of Node.children(editor, path)) { | ||
// @ts-expect-error TODO: Fix this | ||
if (Element.isElement(childNode) && !editor.isInline(childNode)) { | ||
editor.unwrapNodes({ | ||
if (Element.isElement(childNode) && !Editor.isInline(editor, childNode)) { | ||
Transforms.unwrapNodes(editor, { | ||
at: childPath | ||
@@ -17,0 +16,0 @@ }); |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Node, NodeEntry, Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -12,2 +11,2 @@ /** | ||
*/ | ||
export declare function normalizeOrphanListItem(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeOrphanListItem(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element } from 'slate'; | ||
import { Element, Transforms } from 'slate'; | ||
import { isContainingTextNodes, isElementOrEditor } from "../lib/index.js"; | ||
@@ -18,7 +18,7 @@ /** | ||
if (isContainingTextNodes(child)) { | ||
editor.setNodes(schema.createDefaultTextNode(), { | ||
Transforms.setNodes(editor, schema.createDefaultTextNode(), { | ||
at: [...path, index] | ||
}); | ||
} else { | ||
editor.unwrapNodes({ | ||
Transforms.unwrapNodes(editor, { | ||
at: [...path, index], | ||
@@ -25,0 +25,0 @@ mode: 'highest' |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Editor, Node, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -12,2 +11,2 @@ /** | ||
*/ | ||
export declare function normalizeOrphanListItemText(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeOrphanListItemText(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element } from 'slate'; | ||
import { Element, Transforms } from 'slate'; | ||
import { isContainingTextNodes, isElementOrEditor } from "../lib/index.js"; | ||
@@ -18,7 +18,7 @@ /** | ||
if (isContainingTextNodes(child)) { | ||
editor.setNodes(schema.createDefaultTextNode(), { | ||
Transforms.setNodes(editor, schema.createDefaultTextNode(), { | ||
at: [...path, index] | ||
}); | ||
} else { | ||
editor.unwrapNodes({ | ||
Transforms.unwrapNodes(editor, { | ||
at: [...path, index], | ||
@@ -25,0 +25,0 @@ mode: 'highest' |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { Editor, NodeEntry } from 'slate'; | ||
import { Node } from 'slate'; | ||
@@ -9,2 +8,2 @@ import type { ListsSchema } from '../types'; | ||
*/ | ||
export declare function normalizeOrphanNestedList(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function normalizeOrphanNestedList(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node } from 'slate'; | ||
import { Node, Transforms } from 'slate'; | ||
import { getNestedList, getPrevSibling } from "../lib/index.js"; | ||
@@ -40,3 +40,3 @@ import { moveListItemsToAnotherList, moveListToListItem } from "../transformations/index.js"; | ||
// Remove now empty "list-item". | ||
editor.removeNodes({ | ||
Transforms.removeNodes(editor, { | ||
at: path | ||
@@ -46,6 +46,6 @@ }); | ||
// If there's no previous "list-item" to move nested "list" into, just lift it up. | ||
editor.unwrapNodes({ | ||
Transforms.unwrapNodes(editor, { | ||
at: listPath | ||
}); | ||
editor.unwrapNodes({ | ||
Transforms.unwrapNodes(editor, { | ||
at: path | ||
@@ -52,0 +52,0 @@ }); |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Editor, Node, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +7,2 @@ /** | ||
*/ | ||
export declare function normalizeSiblingLists(editor: SlateEditor, schema: ListsSchema, entry: NodeEntry<Node>): boolean; | ||
export declare function normalizeSiblingLists(editor: Editor, schema: ListsSchema, entry: NodeEntry<Node>): boolean; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { NodeEntry } from 'slate'; | ||
import type { Editor, NodeEntry } from 'slate'; | ||
import * as Normalizations from './normalizations'; | ||
@@ -7,3 +6,3 @@ /** | ||
*/ | ||
export declare function normalizeNode(editor: SlateEditor, entry: NodeEntry): boolean; | ||
export declare function normalizeNode(editor: Editor, entry: NodeEntry): boolean; | ||
export declare namespace normalizeNode { | ||
@@ -10,0 +9,0 @@ const normalizeListChildren: typeof Normalizations.normalizeListChildren; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
export declare function onBackspaceDecreaseListDepth(editor: SlateEditor, event: KeyboardEvent): boolean; | ||
import type { Editor } from 'slate'; | ||
export declare function onBackspaceDecreaseListDepth(editor: Editor, event: KeyboardEvent): boolean; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
export declare function onEnterEscapeFromEmptyList(editor: SlateEditor, event: KeyboardEvent): boolean; | ||
import type { Editor } from 'slate'; | ||
export declare function onEnterEscapeFromEmptyList(editor: Editor, event: KeyboardEvent): boolean; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
export declare function onEnterSplitNonEmptyList(editor: SlateEditor, event: KeyboardEvent): boolean; | ||
import type { Editor } from 'slate'; | ||
export declare function onEnterSplitNonEmptyList(editor: Editor, event: KeyboardEvent): boolean; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
export declare function onShiftTabDecreaseListDepth(editor: SlateEditor, event: KeyboardEvent): boolean; | ||
import type { Editor } from 'slate'; | ||
export declare function onShiftTabDecreaseListDepth(editor: Editor, event: KeyboardEvent): boolean; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
export declare function onTabIncreaseListDepth(editor: SlateEditor, event: KeyboardEvent): boolean; | ||
import type { Editor } from 'slate'; | ||
export declare function onTabIncreaseListDepth(editor: Editor, event: KeyboardEvent): boolean; |
@@ -1,5 +0,5 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { KeyboardEvent } from 'react'; | ||
import { Editor } from 'slate'; | ||
import * as OnKeyDownHandlers from './on-key-down'; | ||
export declare function onKeyDown(editor: SlateEditor, event: KeyboardEvent): boolean | void; | ||
export declare function onKeyDown(editor: Editor, event: KeyboardEvent): boolean | void; | ||
export declare namespace onKeyDown { | ||
@@ -6,0 +6,0 @@ const onTabIncreaseListDepth: typeof OnKeyDownHandlers.onTabIncreaseListDepth; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
import { ListsEditor } from "./ListsEditor.js"; | ||
@@ -14,3 +15,3 @@ import * as OnKeyDownHandlers from "./on-key-down/index.js"; | ||
// https://github.com/ianstormtaylor/slate/issues/3758 | ||
editor.normalize({ | ||
Editor.normalize(editor, { | ||
force: true | ||
@@ -17,0 +18,0 @@ }); |
@@ -1,6 +0,6 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Editor } from 'slate'; | ||
import type { ListsSchema } from './types'; | ||
export declare function register(editor: SlateEditor, schema: ListsSchema): void; | ||
export declare function unregister(editor: SlateEditor): void; | ||
export declare function has(editor: SlateEditor): boolean; | ||
export declare function get(editor: SlateEditor): ListsSchema; | ||
export declare function register(editor: Editor, schema: ListsSchema): void; | ||
export declare function unregister(editor: Editor): void; | ||
export declare function has(editor: Editor): boolean; | ||
export declare function get(editor: Editor): ListsSchema; |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location, Span } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare function decreaseDepth(editor: SlateEditor, schema: ListsSchema, at?: Location | Span | null): boolean; | ||
export declare function decreaseDepth(editor: Editor, schema: ListsSchema, at?: Location | Span | null): boolean; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
import { getListItems, pickSubtreesRoots } from "../lib/index.js"; | ||
@@ -20,3 +21,3 @@ import { decreaseListItemDepth } from "./decreaseListItemDepth.js"; | ||
let [_, path] = _ref; | ||
return editor.pathRef(path); | ||
return Editor.pathRef(editor, path); | ||
}); | ||
@@ -23,0 +24,0 @@ let handled = false; |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { Path } from 'slate'; | ||
import { Editor, Path } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -9,2 +8,2 @@ /** | ||
*/ | ||
export declare function decreaseListItemDepth(editor: SlateEditor, schema: ListsSchema, listItemPath: Path): boolean; | ||
export declare function decreaseListItemDepth(editor: Editor, schema: ListsSchema, listItemPath: Path): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node, Path } from 'slate'; | ||
import { Editor, Node, Path, Transforms } from 'slate'; | ||
import { NESTED_LIST_PATH_INDEX, TEXT_PATH_INDEX } from "../constants.js"; | ||
@@ -21,3 +21,3 @@ import { getListType, getParentList, getParentListItem } from "../lib/index.js"; | ||
const nextSiblings = parentListNode.children.slice(listItemIndex + 1); | ||
editor.withoutNormalizing(() => { | ||
Editor.withoutNormalizing(editor, () => { | ||
// We have to move all subsequent sibling "list-items" into a new "list" that will be | ||
@@ -34,3 +34,3 @@ // nested in the "list-item" we're trying to move. | ||
const [, parentListItemPath] = parentListItem; | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: listItemPath, | ||
@@ -43,3 +43,3 @@ to: Path.next(parentListItemPath) | ||
if (previousSiblings.length === 0) { | ||
editor.removeNodes({ | ||
Transforms.removeNodes(editor, { | ||
at: parentListPath | ||
@@ -53,3 +53,3 @@ }); | ||
if (Node.has(editor, listItemNestedListPath)) { | ||
editor.setNodes(schema.createListNode(getListType(schema, parentListNode), { | ||
Transforms.setNodes(editor, schema.createListNode(getListType(schema, parentListNode), { | ||
children: [] | ||
@@ -59,6 +59,6 @@ }), { | ||
}); | ||
editor.liftNodes({ | ||
Transforms.liftNodes(editor, { | ||
at: listItemNestedListPath | ||
}); | ||
editor.liftNodes({ | ||
Transforms.liftNodes(editor, { | ||
at: Path.next(listItemPath) | ||
@@ -68,9 +68,9 @@ }); | ||
if (Node.has(editor, listItemTextPath)) { | ||
editor.setNodes(schema.createDefaultTextNode(), { | ||
Transforms.setNodes(editor, schema.createDefaultTextNode(), { | ||
at: listItemTextPath | ||
}); | ||
editor.liftNodes({ | ||
Transforms.liftNodes(editor, { | ||
at: listItemTextPath | ||
}); | ||
editor.liftNodes({ | ||
Transforms.liftNodes(editor, { | ||
at: listItemPath | ||
@@ -77,0 +77,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare function increaseDepth(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function increaseDepth(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -0,1 +1,2 @@ | ||
import { Editor } from 'slate'; | ||
import { getListItems, getPrevSibling, pickSubtreesRoots } from "../lib/index.js"; | ||
@@ -30,5 +31,5 @@ import { ListType } from "../types.js"; | ||
let [_, path] = _ref2; | ||
return editor.pathRef(path); | ||
return Editor.pathRef(editor, path); | ||
}); | ||
editor.withoutNormalizing(() => { | ||
Editor.withoutNormalizing(editor, () => { | ||
// Before we indent "list-items", we want to convert every non list-related block in selection to a "list". | ||
@@ -35,0 +36,0 @@ wrapInList(editor, schema, ListType.UNORDERED); |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import { Path } from 'slate'; | ||
import { Editor, Path } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,2 +6,2 @@ /** | ||
*/ | ||
export declare function increaseListItemDepth(editor: SlateEditor, schema: ListsSchema, listItemPath: Path): boolean; | ||
export declare function increaseListItemDepth(editor: Editor, schema: ListsSchema, listItemPath: Path): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element, Node, Path } from 'slate'; | ||
import { Editor, Element, Node, Path, Transforms } from 'slate'; | ||
import { NESTED_LIST_PATH_INDEX } from "../constants.js"; | ||
@@ -22,3 +22,3 @@ import { getListType, getPrevSibling } from "../lib/index.js"; | ||
let changed = false; | ||
editor.withoutNormalizing(() => { | ||
Editor.withoutNormalizing(editor, () => { | ||
// Ensure there's a nested "list" in the previous sibling "list-item". | ||
@@ -30,3 +30,3 @@ if (!previousListItemHasChildList) { | ||
const listNode = Node.get(editor, listNodePath); | ||
editor.insertNodes(schema.createListNode(getListType(schema, listNode), { | ||
Transforms.insertNodes(editor, schema.createListNode(getListType(schema, listNode), { | ||
children: [] | ||
@@ -41,3 +41,3 @@ }), { | ||
const index = previousListItemHasChildList ? previousListItemChildList.children.length : 0; | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: listItemPath, | ||
@@ -44,0 +44,0 @@ to: [...previousListItemChildListPath, index] |
@@ -1,4 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Editor, Node, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
export declare function mergeListWithPreviousSiblingList(editor: SlateEditor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; | ||
export declare function mergeListWithPreviousSiblingList(editor: Editor, schema: ListsSchema, [node, path]: NodeEntry<Node>): boolean; |
@@ -0,1 +1,2 @@ | ||
import { Transforms } from 'slate'; | ||
import { getListType, getParentListItem, getPrevSibling } from "../lib/index.js"; | ||
@@ -24,3 +25,3 @@ export function mergeListWithPreviousSiblingList(editor, schema, _ref) { | ||
} | ||
editor.mergeNodes({ | ||
Transforms.mergeNodes(editor, { | ||
at: path | ||
@@ -27,0 +28,0 @@ }); |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Editor, Node, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,5 +6,5 @@ /** | ||
*/ | ||
export declare function moveListItemsToAnotherList(editor: SlateEditor, schema: ListsSchema, parameters: { | ||
export declare function moveListItemsToAnotherList(editor: Editor, schema: ListsSchema, parameters: { | ||
at: NodeEntry<Node>; | ||
to: NodeEntry<Node>; | ||
}): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element } from 'slate'; | ||
import { Element, Transforms } from 'slate'; | ||
/** | ||
@@ -11,3 +11,3 @@ * Moves all "list-items" from one "list" to the end of another "list". | ||
for (let i = 0; i < sourceListNode.children.length; ++i) { | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: [...sourceListPath, 0], | ||
@@ -14,0 +14,0 @@ to: [...targetListPath, targetListNode.children.length + i] |
@@ -1,3 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Node, NodeEntry } from 'slate'; | ||
import type { Editor, Node, NodeEntry } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -7,5 +6,5 @@ /** | ||
*/ | ||
export declare function moveListToListItem(editor: SlateEditor, schema: ListsSchema, parameters: { | ||
export declare function moveListToListItem(editor: Editor, schema: ListsSchema, parameters: { | ||
at: NodeEntry<Node>; | ||
to: NodeEntry<Node>; | ||
}): void; |
@@ -0,1 +1,2 @@ | ||
import { Transforms } from 'slate'; | ||
import { NESTED_LIST_PATH_INDEX } from "../constants.js"; | ||
@@ -12,3 +13,3 @@ /** | ||
} | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: sourceListPath, | ||
@@ -15,0 +16,0 @@ to: [...targetListPath, NESTED_LIST_PATH_INDEX] |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema, ListType } from '../types'; | ||
@@ -7,2 +7,2 @@ /** | ||
*/ | ||
export declare function setListType(editor: SlateEditor, schema: ListsSchema, listType: ListType, at?: Location | null): boolean; | ||
export declare function setListType(editor: Editor, schema: ListsSchema, listType: ListType, at?: Location | null): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node } from 'slate'; | ||
import { Editor, Node, Transforms } from 'slate'; | ||
import { getLists } from "../lib/index.js"; | ||
@@ -17,3 +17,3 @@ /** | ||
let [_, path] = _ref; | ||
return editor.pathRef(path); | ||
return Editor.pathRef(editor, path); | ||
}); | ||
@@ -24,3 +24,3 @@ refs.forEach(ref => { | ||
if (node && path) { | ||
editor.setNodes(schema.createListNode(listType, node), { | ||
Transforms.setNodes(editor, schema.createListNode(listType, node), { | ||
at: path | ||
@@ -27,0 +27,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -11,2 +11,2 @@ /** | ||
*/ | ||
export declare function splitListItem(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function splitListItem(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Node, Path, Range } from 'slate'; | ||
import { Editor, Node, Path, Range, Transforms } from 'slate'; | ||
import { NESTED_LIST_PATH_INDEX, TEXT_PATH_INDEX } from "../constants.js"; | ||
@@ -26,3 +26,3 @@ import { getCursorPositionInNode, getListItems } from "../lib/index.js"; | ||
// Remove everything in selection (this will collapse the selection). | ||
editor.delete(); | ||
Transforms.delete(editor); | ||
} | ||
@@ -45,3 +45,3 @@ const listItemsInSelection = getListItems(editor, schema, editor.selection); | ||
}); | ||
editor.insertNodes(newListItem, { | ||
Transforms.insertNodes(editor, newListItem, { | ||
at: listItemPath | ||
@@ -55,3 +55,3 @@ }); | ||
editor.withoutNormalizing(() => { | ||
Editor.withoutNormalizing(editor, () => { | ||
if (isEnd) { | ||
@@ -61,13 +61,13 @@ const newListItem = schema.createListItemNode({ | ||
}); | ||
editor.insertNodes(newListItem, { | ||
Transforms.insertNodes(editor, newListItem, { | ||
at: newListItemPath | ||
}); | ||
// Move the cursor to the new "list-item". | ||
editor.select(newListItemPath); | ||
Transforms.select(editor, newListItemPath); | ||
} else { | ||
// Split current "list-item-text" element into 2. | ||
editor.splitNodes(); | ||
Transforms.splitNodes(editor); | ||
// The current "list-item-text" has a parent "list-item", the new one needs its own. | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: newListItemTextPath | ||
@@ -77,3 +77,3 @@ }); | ||
// Move the new "list-item" up to be a sibling of the original "list-item". | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: newListItemTextPath, | ||
@@ -86,3 +86,3 @@ to: newListItemPath | ||
if (hasNestedList) { | ||
editor.moveNodes({ | ||
Transforms.moveNodes(editor, { | ||
at: Path.next(listItemTextPath), | ||
@@ -89,0 +89,0 @@ to: [...newListItemPath, NESTED_LIST_PATH_INDEX] |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema } from '../types'; | ||
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare function unwrapList(editor: SlateEditor, schema: ListsSchema, at?: Location | null): boolean; | ||
export declare function unwrapList(editor: Editor, schema: ListsSchema, at?: Location | null): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Point, Range } from 'slate'; | ||
import { Editor, Point, Range } from 'slate'; | ||
import { getListItems } from "../lib/index.js"; | ||
@@ -15,5 +15,5 @@ import { decreaseDepth } from "./decreaseDepth.js"; | ||
const span = toSpan(at); | ||
const start = editor.pathRef(span[0]); | ||
const end = editor.pathRef(span[1]); | ||
editor.withoutNormalizing(() => { | ||
const start = Editor.pathRef(editor, span[0]); | ||
const end = Editor.pathRef(editor, span[1]); | ||
Editor.withoutNormalizing(editor, () => { | ||
do { | ||
@@ -20,0 +20,0 @@ if (!start.current || !end.current) { |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Location } from 'slate'; | ||
import { Editor } from 'slate'; | ||
import type { ListsSchema, ListType } from '../types'; | ||
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export declare function wrapInList(editor: SlateEditor, schema: ListsSchema, listType: ListType, at?: Location | null): boolean; | ||
export declare function wrapInList(editor: Editor, schema: ListsSchema, listType: ListType, at?: Location | null): boolean; |
@@ -1,2 +0,2 @@ | ||
import { Element } from 'slate'; | ||
import { Editor, Element, Transforms } from 'slate'; | ||
/** | ||
@@ -13,3 +13,3 @@ * All nodes matching `isConvertibleToListTextNode()` in the current selection | ||
} | ||
const nonListEntries = Array.from(editor.nodes({ | ||
const nonListEntries = Array.from(Editor.nodes(editor, { | ||
at, | ||
@@ -25,3 +25,3 @@ match: node => { | ||
let [_, path] = _ref; | ||
return editor.pathRef(path); | ||
return Editor.pathRef(editor, path); | ||
}); | ||
@@ -31,10 +31,10 @@ refs.forEach(ref => { | ||
if (path) { | ||
editor.withoutNormalizing(() => { | ||
editor.setNodes(schema.createListItemTextNode(), { | ||
Editor.withoutNormalizing(editor, () => { | ||
Transforms.setNodes(editor, schema.createListItemTextNode(), { | ||
at: path | ||
}); | ||
editor.wrapNodes(schema.createListItemNode(), { | ||
Transforms.wrapNodes(editor, schema.createListItemNode(), { | ||
at: path | ||
}); | ||
editor.wrapNodes(schema.createListNode(listType), { | ||
Transforms.wrapNodes(editor, schema.createListNode(listType), { | ||
at: path | ||
@@ -41,0 +41,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { ReactEditor } from 'slate-react'; | ||
import type { ListsSchema } from './types'; | ||
export declare function withLists(schema: ListsSchema): <T extends SlateEditor>(editor: T) => T; | ||
export declare function withLists(schema: ListsSchema): <T extends ReactEditor>(editor: T) => T; |
@@ -1,2 +0,2 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
export declare function withListsNormalization<T extends SlateEditor>(editor: T): T; | ||
import type { Editor } from 'slate'; | ||
export declare function withListsNormalization<T extends Editor>(editor: T): T; |
@@ -1,2 +0,3 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { Editor } from 'slate'; | ||
import type { ReactEditor } from 'slate-react'; | ||
/** | ||
@@ -6,2 +7,2 @@ * Enables Range.prototype.cloneContents monkey patch to improve pasting behavior | ||
*/ | ||
export declare function withListsReact<T extends SlateEditor>(editor: T): T; | ||
export declare function withListsReact<T extends Editor & ReactEditor>(editor: T): T; |
@@ -1,2 +0,1 @@ | ||
import type { SlateEditor } from '@udecode/plate-common'; | ||
import type { ListsSchema } from './types'; | ||
@@ -6,2 +5,2 @@ /** | ||
*/ | ||
export declare function withListsSchema(schema: ListsSchema): <T extends SlateEditor>(editor: T) => T; | ||
export declare function withListsSchema(schema: ListsSchema): <T extends import("slate").BaseEditor>(editor: T) => T; |
{ | ||
"name": "@prezly/slate-lists", | ||
"version": "0.117.0-alpha.0", | ||
"version": "0.117.0", | ||
"description": "The best Slate lists extension out there", | ||
@@ -39,3 +39,3 @@ "license": "MIT", | ||
"test:esm": "node --input-type module -e \" import '../../.mocha/mockDOM.cjs'; import './build/index.js'; \" ", | ||
"test:types": "tsc --noEmit --esModuleInterop --skipLibCheck build/index.d.ts", | ||
"test:types": "tsc --noEmit --esModuleInterop build/index.d.ts", | ||
"clean": "pnpm clean:build && pnpm clean:node_modules", | ||
@@ -48,4 +48,4 @@ "clean:node_modules": "rimraf node_modules/", | ||
"react-dom": "^18.3.0", | ||
"slate": "^0.110.2", | ||
"slate-react": "^0.111.0" | ||
"slate": "^0.101.5", | ||
"slate-react": "^0.101.5" | ||
}, | ||
@@ -61,3 +61,3 @@ "dependencies": { | ||
}, | ||
"gitHead": "e0c56962f25c9b1ccc77853b181efd27ad76f63b" | ||
"gitHead": "638570c73395471cc5698b054e2e47d1f2eebe70" | ||
} |
111237
-0.81%2005
-0.89%