Socket
Socket
Sign inDemoInstall

@udecode/slate-utils

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@udecode/slate-utils - npm Package Compare versions

Comparing version 32.0.1 to 34.0.0

287

dist/index.d.ts
import * as _udecode_slate from '@udecode/slate';
import { EDescendant, Value, TEditor, FindNodeOptions, TNodeEntry, EAncestor, GetAboveNodeOptions, ChildOf, TNode, EElementOrText, EAncestorEntry, TOperation, EElement, QueryNodeOptions, TAncestor, QueryEditorOptions, TElement, InsertNodesOptions, ENodeEntry, SetNodesOptions, RemoveNodesOptions, EMarks, WrapNodesOptions, TDescendant } from '@udecode/slate';
import * as slate from 'slate';
import { Path, Point, Location, Range } from 'slate';
import { Path, Location, Point, Range } from 'slate';
import { Modify } from '@udecode/utils';

@@ -12,49 +12,31 @@

/**
* Get the first descendant node matching the condition.
*/
/** Get the first descendant node matching the condition. */
declare const findDescendant: <N extends EDescendant<V>, V extends Value = Value>(editor: TEditor<V>, options: FindNodeOptions<V>) => TNodeEntry<N> | undefined;
/**
* Get the block above a location (default: selection).
*/
/** Get the top-level block. */
declare const getAncestorNode: <V extends Value = Value>(editor: TEditor<V>, path?: Path) => _udecode_slate.TNodeEntry<_udecode_slate.ENode<V>> | undefined;
/** Get the block above a location (default: selection). */
declare const getBlockAbove: <N extends EAncestor<V>, V extends Value = Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => _udecode_slate.TNodeEntry<N> | undefined;
/**
* Get children node entries of a node entry.
* TODO: try Node.children
*/
/** Get children node entries of a node entry. TODO: try Node.children */
declare const getChildren: <N extends ChildOf<R>, R extends TNode = TNode>(nodeEntry: TNodeEntry<R>) => TNodeEntry<N>[];
/**
* Get the edge blocks above a location (default: selection).
*/
/** Get the edge blocks above a location (default: selection). */
declare const getEdgeBlocksAbove: <N1 extends EAncestor<V>, N2 extends EAncestor<V> = N1, V extends Value = Value>(editor: TEditor<V>, { at: _at, ...options }?: GetAboveNodeOptions<V>) => [TNodeEntry<N1>, TNodeEntry<N2>] | null;
/**
* Get the last child of a node or null if no children.
*/
/** Get the last child of a node or null if no children. */
declare const getLastChild: <N extends ChildOf<R>, R extends TNode>(nodeEntry: TNodeEntry<R>) => TNodeEntry<N> | null;
/**
* Get last child path. If there is no child, last index is 0.
*/
/** Get last child path. If there is no child, last index is 0. */
declare const getLastChildPath: <N extends TNode>(nodeEntry: TNodeEntry<N>) => Path;
/**
* Is the child path the last one of the parent.
*/
/** Is the child path the last one of the parent. */
declare const isLastChild: <N extends TNode>(parentEntry: TNodeEntry<N>, childPath: Path) => boolean;
/**
* Get the last node at a given level.
*/
/** Get the last node at a given level. */
declare const getLastNodeByLevel: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, level: number) => TNodeEntry<N> | undefined;
/**
* Get selection mark value by key.
*/
/** Get selection mark value by key. */
declare const getMark: <V extends Value>(editor: TEditor<V>, key: string) => unknown;
/**
* Get the start point of the next node.
*/
/** Get the start point of the next node. */
declare const getNextNodeStartPoint: <V extends Value = Value>(editor: TEditor<V>, at: Path) => slate.BasePoint | undefined;

@@ -64,2 +46,3 @@

* Get the next sibling nodes after a path.
*
* @param ancestorEntry Ancestor of the sibling nodes

@@ -70,5 +53,6 @@ * @param path Path of the reference node

/**
* Get typed editor operations.
*/
/** Get node entries range. */
declare const getNodesRange: <V extends Value>(editor: TEditor<V>, nodeEntries: TNodeEntry[]) => slate.BaseRange | undefined;
/** Get typed editor operations. */
declare const getOperations: <V extends Value>(editor: TEditor<V>) => TOperation<EDescendant<V>>[];

@@ -78,31 +62,27 @@

distance?: number | undefined;
unit?: 'character' | 'word' | 'line' | 'block' | 'offset' | undefined;
unit?: 'block' | 'character' | 'line' | 'offset' | 'word' | undefined;
}
interface PointBeforeOptions extends BeforeOptions {
/**
* Lookup before the location for `matchString`.
* If true, get the point after the matching point. If false, get the matching
* point.
*/
matchString?: string | string[];
/**
* Lookup before the location until this predicate is true
*/
afterMatch?: boolean;
/** Lookup before the location until this predicate is true */
match?: (value: {
at: Location;
beforePoint: Point;
beforeString: string;
beforePoint: Point;
at: Location;
}) => boolean;
/** Lookup before the location for `matchString`. */
matchString?: string | string[];
/**
* If true, get the point after the matching point.
* If false, get the matching point.
* If true, lookup until the start of the editor value. If false, lookup until
* the first invalid character.
*/
afterMatch?: boolean;
/**
* If true, lookup until the start of the editor value.
* If false, lookup until the first invalid character.
*/
skipInvalid?: boolean;
}
/**
* {@link getPointBefore} with additional options.
* TODO: support for sequence of any characters.
* {@link getPointBefore} with additional options. TODO: support for sequence of
* any characters.
*/

@@ -112,6 +92,5 @@ declare const getPointBeforeLocation: <V extends Value>(editor: TEditor<V>, at: Location, options?: PointBeforeOptions) => any;

/**
* Get the point from a location (default: selection).
* If the location is a range, get the anchor point.
* If the location is a path, get the point at this path with offset 0.
* If `focus` is true, get the focus point.
* Get the point from a location (default: selection). If the location is a
* range, get the anchor point. If the location is a path, get the point at this
* path with offset 0. If `focus` is true, get the focus point.
*/

@@ -124,21 +103,18 @@ declare const getPointFromLocation: <V extends Value>(editor: TEditor<V>, { at, focus, }?: {

/**
* If the start point is inside an inline void, get the point before or after it.
* If the start point is inside an inline void, get the point before or after
* it.
*/
declare const getPointNextToVoid: <V extends Value>(editor: TEditor<V>, { at, after, }: {
declare const getPointNextToVoid: <V extends Value>(editor: TEditor<V>, { after, at, }: {
/** Get the point after (instead of before) the void node. */
after?: boolean | undefined;
at: Point;
/**
* Get the point after (instead of before) the void node.
*/
after?: boolean | undefined;
}) => slate.BasePoint;
/**
* Find the block before a block by id.
* If not found, find the first block by id and return [null, its previous path]
* Find the block before a block by id. If not found, find the first block by id
* and return [null, its previous path]
*/
declare const getPreviousBlockById: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, id: string, query?: QueryNodeOptions) => TNodeEntry<N> | undefined;
/**
* Get the end point of the previous node.
*/
/** Get the end point of the previous node. */
declare const getPreviousNodeEndPoint: <V extends Value = Value>(editor: TEditor<V>, at: Path) => slate.BasePoint | undefined;

@@ -152,9 +128,8 @@

}
/**
* Get range from {@link getPointBeforeLocation} to the end point of `at`.
*/
/** Get range from {@link getPointBeforeLocation} to the end point of `at`. */
declare const getRangeBefore: <V extends Value>(editor: TEditor<V>, at: Location, options?: RangeBeforeOptions) => Range | undefined;
/**
* Get the range from the start of the block above a location (default: selection) to the location.
* Get the range from the start of the block above a location (default:
* selection) to the location.
*/

@@ -166,22 +141,15 @@ declare const getRangeFromBlockStart: <V extends Value>(editor: TEditor<V>, options?: Omit<GetAboveNodeOptions<V>, 'match'>) => {

/**
* Get the selected text.
* Return empty string if no selection.
*/
/** Get the selected text. Return empty string if no selection. */
declare const getSelectionText: <V extends Value>(editor: TEditor<V>) => string;
/**
* Is an ancestor empty (empty text and no inline children).
*/
/** Is an ancestor empty (empty text and no inline children). */
declare const isAncestorEmpty: <V extends Value>(editor: TEditor<V>, node: TAncestor) => boolean;
/**
* Is the block above the selection empty.
*/
/** Is the block above the selection empty. */
declare const isBlockAboveEmpty: <V extends Value>(editor: TEditor<V>) => boolean;
/**
* Is there empty text after the selection.
* If there is no leaf after the selected leaf, return {@link isEndPoint}.
* Else, check if the next leaves are empty.
* Is there empty text after the selection. If there is no leaf after the
* selected leaf, return {@link isEndPoint}. Else, check if the next leaves are
* empty.
*/

@@ -193,19 +161,14 @@ declare const isBlockTextEmptyAfterSelection: <V extends Value>(editor: TEditor<V>) => boolean;

/**
* Whether the editor is empty. An editor is empty if it has only one empty element.
* Whether the editor is empty. An editor is empty if it has only one empty
* element.
*/
declare const isEditorEmpty: <V extends Value>(editor: TEditor<V>) => boolean;
/**
* Is it the first child of the parent
*/
/** Is it the first child of the parent */
declare const isFirstChild: (path: Path) => boolean;
/**
* Is the mark defined in the selection.
*/
/** Is the mark defined in the selection. */
declare const isMarkActive: <V extends Value>(editor: TEditor<V>, type: string) => boolean;
/**
* Is a point at the end of a word
*/
/** Is a point at the end of a word */
declare const isPointAtWordEnd: <V extends Value>(editor: TEditor<V>, { at }: {

@@ -217,25 +180,20 @@ at: Point;

* Is the range (default: selection) across blocks.
* - return undefined if block not found
* - return boolean whether one of the block is not found, but the other is found
* - return boolean whether block paths are unequal
*
* - Return undefined if block not found
* - Return boolean whether one of the block is not found, but the other is found
* - Return boolean whether block paths are unequal
*/
declare const isRangeAcrossBlocks: <V extends Value>(editor: TEditor<V>, { at, ...options }?: Omit<GetAboveNodeOptions<V>, "at"> & {
declare const isRangeAcrossBlocks: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
}) => boolean | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
/**
* Whether the range is in the same block.
*/
declare const isRangeInSameBlock: <V extends Value>(editor: TEditor<V>, { at, ...options }?: Omit<GetAboveNodeOptions<V>, "at"> & {
/** Whether the range is in the same block. */
declare const isRangeInSameBlock: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
}) => boolean | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
/**
* Is the range in the same single text path.
*/
/** Is the range in the same single text path. */
declare const isRangeInSingleText: (at: Range) => boolean;
/**
* Is the selection focus at the end of its parent block.
*/
/** Is the selection focus at the end of its parent block. */
declare const isSelectionAtBlockEnd: <V extends Value>(editor: TEditor<V>, options?: GetAboveNodeOptions<V>) => boolean;

@@ -250,5 +208,7 @@

/**
* Is the selection expanded.
*/
declare const isSelectionCoverBlock: <V extends Value>(editor: TEditor<V>, { at, ...options }?: {
at?: slate.BaseRange | null | undefined;
} & Omit<GetAboveNodeOptions<V>, "at">) => boolean | undefined;
/** Is the selection expanded. */
declare const isSelectionExpanded: <V extends Value>(editor: TEditor<V>) => boolean;

@@ -266,10 +226,8 @@

}) => {
match: RegExpMatchArray | null;
range: slate.BaseRange | undefined;
match: RegExpMatchArray | null;
};
/**
* Query the editor state.
*/
declare const queryEditor: <V extends Value = Value, E extends TEditor<V> = TEditor<V>>(editor: E, { filter, selectionAtBlockStart, selectionAtBlockEnd, allow, exclude, at, }?: QueryEditorOptions<V, E>) => boolean;
/** Query the editor state. */
declare const queryEditor: <V extends Value = Value, E extends TEditor<V> = TEditor<V>>(editor: E, { allow, at, exclude, filter, selectionAtBlockEnd, selectionAtBlockStart, }?: QueryEditorOptions<V, E>) => boolean;

@@ -281,55 +239,37 @@ declare const insertElements: <V extends Value>(editor: TEditor<V>, nodes: TElement | TElement[], options?: InsertNodesOptions<V>) => void;

interface MoveChildrenOptions<V extends Value = Value> {
/**
* Parent node of the children to move.
*/
/** Parent node of the children to move. */
at: ENodeEntry<V> | Path;
/**
* Path where to move the children.
*/
/** Path where to move the children. */
to: Path;
/**
* Start index of the children to move.
* Example: 1 means children[0] will not be moved.
* Start index of the children to move. Example: 1 means children[0] will not
* be moved.
*/
fromStartIndex?: number;
/**
* Condition for the child to be moved
*/
match?(entry: ENodeEntry<V>): boolean;
/** Condition for the child to be moved */
match?: (entry: ENodeEntry<V>) => boolean;
}
/**
* Move the children of a node to a path.
* Returns the number of children moved.
*/
declare const moveChildren: <V extends Value>(editor: TEditor<V>, { at, to, match, fromStartIndex }: MoveChildrenOptions<V>) => number;
/** Move the children of a node to a path. Returns the number of children moved. */
declare const moveChildren: <V extends Value>(editor: TEditor<V>, { at, fromStartIndex, match, to }: MoveChildrenOptions<V>) => number;
interface RemoveMarkOptions<V extends Value = Value> extends Omit<SetNodesOptions<V>, 'match' | 'split'> {
/**
* Mark or the array of marks that will be removed
*/
/** Mark or the array of marks that will be removed */
key: string | string[];
/** Range where the mark(s) will be removed */
at?: Range;
/**
* When location is not a Range,
* setting this to false can prevent the onChange event of the editor to fire
* When location is not a Range, setting this to false can prevent the
* onChange event of the editor to fire
*
* @default true
*/
shouldChange?: boolean;
/**
* Range where the mark(s) will be removed
*/
at?: Range;
}
/**
* Remove mark and trigger `onChange` if collapsed selection.
*/
declare const removeMark: <V extends Value>(editor: TEditor<V>, { key, at, shouldChange, ...rest }: RemoveMarkOptions<V>) => void;
/** Remove mark and trigger `onChange` if collapsed selection. */
declare const removeMark: <V extends Value>(editor: TEditor<V>, { at, key, shouldChange, ...rest }: RemoveMarkOptions<V>) => void;
/**
* Remove node children.
*/
/** Remove node children. */
declare const removeNodeChildren: <V extends Value = Value>(editor: TEditor<V>, path: Path, options?: Omit<RemoveNodesOptions<V>, 'at'>) => void;
/**
* Remove selection marks.
*/
/** Remove selection marks. */
declare const removeSelectionMark: <V extends Value = Value>(editor: TEditor<V>) => void;

@@ -340,38 +280,30 @@

nodes: N | N[];
insertOptions?: Omit<InsertNodesOptions<V>, 'at'>;
removeOptions?: Omit<RemoveNodesOptions<V>, 'at'>;
insertOptions?: Omit<InsertNodesOptions<V>, 'at'>;
}
/**
* Replace node children: remove then insert.
*/
declare const replaceNodeChildren: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, nodes, insertOptions, removeOptions }: ReplaceNodeChildrenOptions<N, V>) => void;
/** Replace node children: remove then insert. */
declare const replaceNodeChildren: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, insertOptions, nodes, removeOptions }: ReplaceNodeChildrenOptions<N, V>) => void;
declare const replaceNode: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, nodes, insertOptions, removeOptions }: ReplaceNodeChildrenOptions<N, V>) => void;
declare const replaceNode: <N extends EElementOrText<V>, V extends Value = Value>(editor: TEditor<V>, { at, insertOptions, nodes }: ReplaceNodeChildrenOptions<N, V>) => void;
/**
* Select the end point of the block above the selection.
*/
/** Select the end point of the block above the selection. */
declare const selectEndOfBlockAboveSelection: <V extends Value>(editor: TEditor<V>) => void;
/**
* Set marks to selected text.
*/
/** Set marks to selected text. */
declare const setMarks: <V extends Value>(editor: TEditor<V>, marks: EMarks<V>, clear?: string | string[]) => void;
interface ToggleMarkOptions {
key: string;
clear?: string | string[];
key: string;
}
/**
* Add/remove marks in the selection.
*
* @param editor
* @param key mark to toggle
* @param clear marks to clear when adding mark
* @param key Mark to toggle
* @param clear Marks to clear when adding mark
*/
declare const toggleMark: <V extends Value = Value>(editor: TEditor<V>, { key, clear }: ToggleMarkOptions) => void;
declare const toggleMark: <V extends Value = Value>(editor: TEditor<V>, { clear, key }: ToggleMarkOptions) => void;
/**
* Unwrap if the node type is in selection.
* Wrap otherwise.
*/
/** Unwrap if the node type is in selection. Wrap otherwise. */
declare const toggleWrapNodes: <V extends Value>(editor: TEditor<V>, type: string) => void;

@@ -381,4 +313,5 @@

* Wrap node children into a single element:
* - wraps the first child node into the element
* - move the other child nodes next to the element children.
*
* - Wraps the first child node into the element
* - Move the other child nodes next to the element children.
*/

@@ -393,2 +326,2 @@ declare const wrapNodeChildren: <N extends EElement<V>, V extends Value = Value>(editor: TEditor<V>, element: N, options: Modify<WrapNodesOptions<V>, {

export { type BeforeOptions, type MoveChildrenOptions, type PointBeforeOptions, type RangeBeforeOptions, type RemoveMarkOptions, type ReplaceNodeChildrenOptions, type ToggleMarkOptions, createDocumentNode, createNode, findDescendant, getBlockAbove, getChildren, getEdgeBlocksAbove, getLastChild, getLastChildPath, getLastNodeByLevel, getMark, getNextNodeStartPoint, getNextSiblingNodes, getOperations, getPointBeforeLocation, getPointFromLocation, getPointNextToVoid, getPreviousBlockById, getPreviousNodeEndPoint, getPreviousPath, getPreviousSiblingNode, getRangeBefore, getRangeFromBlockStart, getSelectionText, insertElements, insertEmptyElement, isAncestorEmpty, isBlockAboveEmpty, isBlockTextEmptyAfterSelection, isDocumentEnd, isEditorEmpty, isFirstChild, isLastChild, isMarkActive, isPointAtWordEnd, isRangeAcrossBlocks, isRangeInSameBlock, isRangeInSingleText, isSelectionAtBlockEnd, isSelectionAtBlockStart, isSelectionExpanded, isTextByPath, isWordAfterTrigger, moveChildren, queryEditor, removeMark, removeNodeChildren, removeSelectionMark, replaceNode, replaceNodeChildren, selectEndOfBlockAboveSelection, setMarks, toggleMark, toggleWrapNodes, wrapNodeChildren };
export { type BeforeOptions, type MoveChildrenOptions, type PointBeforeOptions, type RangeBeforeOptions, type RemoveMarkOptions, type ReplaceNodeChildrenOptions, type ToggleMarkOptions, createDocumentNode, createNode, findDescendant, getAncestorNode, getBlockAbove, getChildren, getEdgeBlocksAbove, getLastChild, getLastChildPath, getLastNodeByLevel, getMark, getNextNodeStartPoint, getNextSiblingNodes, getNodesRange, getOperations, getPointBeforeLocation, getPointFromLocation, getPointNextToVoid, getPreviousBlockById, getPreviousNodeEndPoint, getPreviousPath, getPreviousSiblingNode, getRangeBefore, getRangeFromBlockStart, getSelectionText, insertElements, insertEmptyElement, isAncestorEmpty, isBlockAboveEmpty, isBlockTextEmptyAfterSelection, isDocumentEnd, isEditorEmpty, isFirstChild, isLastChild, isMarkActive, isPointAtWordEnd, isRangeAcrossBlocks, isRangeInSameBlock, isRangeInSingleText, isSelectionAtBlockEnd, isSelectionAtBlockStart, isSelectionCoverBlock, isSelectionExpanded, isTextByPath, isWordAfterTrigger, moveChildren, queryEditor, removeMark, removeNodeChildren, removeSelectionMark, replaceNode, replaceNodeChildren, selectEndOfBlockAboveSelection, setMarks, toggleMark, toggleWrapNodes, wrapNodeChildren };

@@ -65,2 +65,3 @@ "use strict";

findDescendant: () => findDescendant,
getAncestorNode: () => getAncestorNode,
getBlockAbove: () => getBlockAbove,

@@ -75,2 +76,3 @@ getChildren: () => getChildren,

getNextSiblingNodes: () => getNextSiblingNodes,
getNodesRange: () => getNodesRange,
getOperations: () => getOperations,

@@ -103,2 +105,3 @@ getPointBeforeLocation: () => getPointBeforeLocation,

isSelectionAtBlockStart: () => isSelectionAtBlockStart,
isSelectionCoverBlock: () => isSelectionCoverBlock,
isSelectionExpanded: () => isSelectionExpanded,

@@ -128,4 +131,4 @@ isTextByPath: () => isTextByPath,

const {
at = editor.selection,
match: _match,
at = editor.selection,
reverse = false,

@@ -151,6 +154,6 @@ voids = false

const nodeEntries = (0, import_slate.getNodeDescendants)(root[0], {
from,
pass: ([n]) => voids ? false : (0, import_slate.isVoid)(editor, n),
reverse,
from,
to,
pass: ([n]) => voids ? false : (0, import_slate.isVoid)(editor, n)
to
});

@@ -167,5 +170,16 @@ for (const [node, path] of nodeEntries) {

// src/queries/getAncestorNode.ts
var import_slate3 = require("@udecode/slate");
var getAncestorNode = (editor, path) => {
var _a;
const { selection } = editor;
const at = path ? path[0] : (_a = selection == null ? void 0 : selection.focus) == null ? void 0 : _a.path[0];
if (!at)
return;
return (0, import_slate3.getNodeEntry)(editor, [at]);
};
// src/queries/getBlockAbove.ts
var import_slate3 = require("@udecode/slate");
var getBlockAbove = (editor, options = {}) => (0, import_slate3.getAboveNode)(editor, __spreadProps(__spreadValues({}, options), {
var import_slate4 = require("@udecode/slate");
var getBlockAbove = (editor, options = {}) => (0, import_slate4.getAboveNode)(editor, __spreadProps(__spreadValues({}, options), {
block: true

@@ -175,6 +189,6 @@ }));

// src/queries/getChildren.ts
var import_slate4 = require("@udecode/slate");
var import_slate5 = require("@udecode/slate");
var getChildren = (nodeEntry) => {
const [node, path] = nodeEntry;
if ((0, import_slate4.isAncestor)(node)) {
if ((0, import_slate5.isAncestor)(node)) {
const { children } = node;

@@ -190,3 +204,3 @@ return children.map((child, index) => {

// src/queries/getEdgeBlocksAbove.ts
var import_slate5 = require("@udecode/slate");
var import_slate6 = require("@udecode/slate");
var getEdgeBlocksAbove = (editor, _a = {}) => {

@@ -197,3 +211,3 @@ var _b = _a, { at: _at } = _b, options = __objRest(_b, ["at"]);

return null;
const [start, end] = (0, import_slate5.getEdgePoints)(editor, at != null ? at : editor.selection);
const [start, end] = (0, import_slate6.getEdgePoints)(editor, at != null ? at : editor.selection);
const startBlock = getBlockAbove(editor, __spreadValues({

@@ -213,7 +227,7 @@ at: start

// src/queries/getLastChild.ts
var import_slate6 = require("@udecode/slate");
var import_slate7 = require("slate");
var import_slate7 = require("@udecode/slate");
var import_slate8 = require("slate");
var getLastChild = (nodeEntry) => {
const [node, path] = nodeEntry;
if ((0, import_slate6.isText)(node))
if ((0, import_slate7.isText)(node))
return null;

@@ -233,9 +247,9 @@ if (node.children.length === 0)

const lastChildPath = getLastChildPath(parentEntry);
return import_slate7.Path.equals(lastChildPath, childPath);
return import_slate8.Path.equals(lastChildPath, childPath);
};
// src/queries/getLastNodeByLevel.ts
var import_slate8 = require("@udecode/slate");
var import_slate9 = require("@udecode/slate");
var getLastChild2 = (node, level) => {
if (!(level + 1) || !(0, import_slate8.isAncestor)(node))
if (!(level + 1) || !(0, import_slate9.isAncestor)(node))
return node;

@@ -251,3 +265,3 @@ const { children } = node;

return;
const [, lastPath] = (0, import_slate8.getLastNode)(editor, []);
const [, lastPath] = (0, import_slate9.getLastNode)(editor, []);
return [getLastChild2(lastNode, level - 1), lastPath.slice(0, level + 1)];

@@ -257,7 +271,7 @@ };

// src/queries/getMark.ts
var import_slate9 = require("@udecode/slate");
var import_slate10 = require("@udecode/slate");
var getMark = (editor, key) => {
if (!editor)
return;
const marks = (0, import_slate9.getMarks)(editor);
const marks = (0, import_slate10.getMarks)(editor);
return marks == null ? void 0 : marks[key];

@@ -267,5 +281,5 @@ };

// src/queries/getNextNodeStartPoint.ts
var import_slate10 = require("@udecode/slate");
var import_slate11 = require("@udecode/slate");
var getNextNodeStartPoint = (editor, at) => {
const nextEntry = (0, import_slate10.getNextNode)(editor, {
const nextEntry = (0, import_slate11.getNextNode)(editor, {
at

@@ -275,3 +289,3 @@ });

return;
return (0, import_slate10.getStartPoint)(editor, nextEntry[1]);
return (0, import_slate11.getStartPoint)(editor, nextEntry[1]);
};

@@ -293,2 +307,12 @@

// src/queries/getNodesRange.ts
var import_slate12 = require("@udecode/slate");
var getNodesRange = (editor, nodeEntries) => {
if (nodeEntries.length === 0)
return;
const firstBlockPath = nodeEntries[0][1];
const lastBlockPath = nodeEntries.at(-1)[1];
return (0, import_slate12.getRange)(editor, firstBlockPath, lastBlockPath);
};
// src/queries/getOperations.ts

@@ -298,3 +322,3 @@ var getOperations = (editor) => editor.operations;

// src/queries/getPointBeforeLocation.ts
var import_slate12 = require("@udecode/slate");
var import_slate14 = require("@udecode/slate");
var import_castArray = __toESM(require("lodash/castArray.js"));

@@ -304,3 +328,3 @@ var import_map = __toESM(require("lodash/map.js"));

// src/queries/isRangeAcrossBlocks.ts
var import_slate11 = require("slate");
var import_slate13 = require("slate");
var isRangeAcrossBlocks = (editor, _a = {}) => {

@@ -316,3 +340,3 @@ var _b = _a, {

return;
const [start, end] = import_slate11.Range.edges(at);
const [start, end] = import_slate13.Range.edges(at);
const startBlock = getBlockAbove(editor, __spreadValues({

@@ -328,3 +352,3 @@ at: start

return true;
return !import_slate11.Path.equals(startBlock[1], endBlock[1]);
return !import_slate13.Path.equals(startBlock[1], endBlock[1]);
};

@@ -335,3 +359,3 @@

if (!options || !options.match && !options.matchString) {
return (0, import_slate12.getPointBefore)(editor, at, options);
return (0, import_slate14.getPointBefore)(editor, at, options);
}

@@ -344,3 +368,3 @@ const unitOffset = !options.unit || options.unit === "offset";

let beforeAt = at;
let previousBeforePoint = (0, import_slate12.getPoint)(editor, at, { edge: "end" });
let previousBeforePoint = (0, import_slate14.getPoint)(editor, at, { edge: "end" });
const stackLength = matchString.length + 1;

@@ -350,3 +374,3 @@ const stack = Array.from({ length: stackLength });

while (true) {
const beforePoint = (0, import_slate12.getPointBefore)(editor, beforeAt, options);
const beforePoint = (0, import_slate14.getPointBefore)(editor, beforeAt, options);
if (!beforePoint)

@@ -362,3 +386,3 @@ return;

}
const beforeString = (0, import_slate12.getEditorString)(editor, {
const beforeString = (0, import_slate14.getEditorString)(editor, {
anchor: beforePoint,

@@ -376,3 +400,3 @@ focus: previousBeforePoint

}
if (matchString === beforeStringToMatch || ((_a = options.match) == null ? void 0 : _a.call(options, { beforeString: beforeStringToMatch, beforePoint, at }))) {
if (matchString === beforeStringToMatch || ((_a = options.match) == null ? void 0 : _a.call(options, { at, beforePoint, beforeString: beforeStringToMatch }))) {
if (options.afterMatch) {

@@ -400,3 +424,3 @@ if (stackLength && unitOffset) {

// src/queries/getPointFromLocation.ts
var import_slate13 = require("slate");
var import_slate15 = require("slate");
var getPointFromLocation = (editor, {

@@ -407,8 +431,8 @@ at = editor.selection,

let point;
if (import_slate13.Range.isRange(at))
if (import_slate15.Range.isRange(at))
point = focus ? at.focus : at.anchor;
if (import_slate13.Point.isPoint(at))
if (import_slate15.Point.isPoint(at))
point = at;
if (import_slate13.Path.isPath(at))
point = { path: at, offset: 0 };
if (import_slate15.Path.isPath(at))
point = { offset: 0, path: at };
return point;

@@ -418,14 +442,14 @@ };

// src/queries/getPointNextToVoid.ts
var import_slate14 = require("@udecode/slate");
var import_slate15 = require("slate");
var import_slate16 = require("@udecode/slate");
var import_slate17 = require("slate");
var getPointNextToVoid = (editor, {
at,
after
after,
at
}) => {
const startVoid = (0, import_slate14.getVoidNode)(editor, { at, mode: "highest" });
const startVoid = (0, import_slate16.getVoidNode)(editor, { at, mode: "highest" });
if (startVoid) {
const blockAbove = getBlockAbove(editor, { at });
if (blockAbove) {
const nextPoint = after ? (0, import_slate14.getPointAfter)(editor, at) : (0, import_slate14.getPointBefore)(editor, at);
if (nextPoint && blockAbove && import_slate15.Path.isAncestor(blockAbove[1], nextPoint.path)) {
const nextPoint = after ? (0, import_slate16.getPointAfter)(editor, at) : (0, import_slate16.getPointBefore)(editor, at);
if (nextPoint && blockAbove && import_slate17.Path.isAncestor(blockAbove[1], nextPoint.path)) {
at = nextPoint;

@@ -439,10 +463,10 @@ }

// src/queries/getPreviousBlockById.ts
var import_slate16 = require("@udecode/slate");
var import_slate18 = require("@udecode/slate");
var getPreviousBlockById = (editor, id, query) => {
const entry = (0, import_slate16.findNode)(editor, {
const entry = (0, import_slate18.findNode)(editor, {
match: { id }
});
if (entry) {
const prevEntry = (0, import_slate16.getPreviousNode)(editor, { at: entry[1] });
if (prevEntry && prevEntry[0].id && (0, import_slate16.isBlock)(editor, prevEntry[0])) {
const prevEntry = (0, import_slate18.getPreviousNode)(editor, { at: entry[1] });
if ((prevEntry == null ? void 0 : prevEntry[0].id) && (0, import_slate18.isBlock)(editor, prevEntry[0])) {
return prevEntry;

@@ -452,7 +476,6 @@ }

let found = false;
const _nodes = (0, import_slate16.getNodeEntries)(editor, {
mode: "highest",
reverse: true,
const _nodes = (0, import_slate18.getNodeEntries)(editor, {
at: [],
match: (n) => {
if (!(0, import_slate16.isBlock)(editor, n) || !n.id)
if (!(0, import_slate18.isBlock)(editor, n) || !n.id)
return false;

@@ -463,5 +486,6 @@ if (n.id === id) {

}
return found && n.id !== id && (0, import_slate16.queryNode)([n, []], query);
return found && n.id !== id && (0, import_slate18.queryNode)([n, []], query);
},
at: []
mode: "highest",
reverse: true
});

@@ -474,8 +498,8 @@ const nodeEntries = Array.from(_nodes);

return;
const _entries = (0, import_slate16.getNodeEntries)(editor, {
mode: "highest",
const _entries = (0, import_slate18.getNodeEntries)(editor, {
at: [],
match: (n) => {
return (0, import_slate16.isBlock)(editor, n) && !!n.id && (0, import_slate16.queryNode)([n, []], query);
return (0, import_slate18.isBlock)(editor, n) && !!n.id && (0, import_slate18.queryNode)([n, []], query);
},
at: []
mode: "highest"
});

@@ -491,5 +515,5 @@ const firstNodeEntry = Array.from(_entries);

// src/queries/getPreviousNodeEndPoint.ts
var import_slate17 = require("@udecode/slate");
var import_slate19 = require("@udecode/slate");
var getPreviousNodeEndPoint = (editor, at) => {
const prevEntry = (0, import_slate17.getPreviousNode)(editor, {
const prevEntry = (0, import_slate19.getPreviousNode)(editor, {
at

@@ -499,3 +523,3 @@ });

return;
return (0, import_slate17.getEndPoint)(editor, prevEntry[1]);
return (0, import_slate19.getEndPoint)(editor, prevEntry[1]);
};

@@ -514,3 +538,3 @@

// src/queries/getPreviousSiblingNode.ts
var import_slate18 = require("@udecode/slate");
var import_slate20 = require("@udecode/slate");
var import_last = __toESM(require("lodash/last.js"));

@@ -522,3 +546,3 @@ var getPreviousSiblingNode = (editor, path) => {

const previousSiblingPath = path.slice(0, -1).concat([previousSiblingIndex]);
const previousSiblingNode = (0, import_slate18.getNode)(editor, previousSiblingPath);
const previousSiblingNode = (0, import_slate20.getNode)(editor, previousSiblingPath);
return previousSiblingNode ? [previousSiblingNode, previousSiblingPath] : void 0;

@@ -529,3 +553,3 @@ }

// src/queries/getRangeBefore.ts
var import_slate19 = require("@udecode/slate");
var import_slate21 = require("@udecode/slate");
var getRangeBefore = (editor, at, options) => {

@@ -535,3 +559,3 @@ const anchor = getPointBeforeLocation(editor, at, options);

return;
const focus = (0, import_slate19.getPoint)(editor, at, { edge: "end" });
const focus = (0, import_slate21.getPoint)(editor, at, { edge: "end" });
return {

@@ -544,3 +568,3 @@ anchor,

// src/queries/getRangeFromBlockStart.ts
var import_slate20 = require("@udecode/slate");
var import_slate22 = require("@udecode/slate");
var getRangeFromBlockStart = (editor, options = {}) => {

@@ -551,3 +575,3 @@ var _a;

return;
const start = (0, import_slate20.getStartPoint)(editor, path);
const start = (0, import_slate22.getStartPoint)(editor, path);
const focus = getPointFromLocation(editor, options);

@@ -560,8 +584,8 @@ if (!focus)

// src/queries/getSelectionText.ts
var import_slate21 = require("@udecode/slate");
var getSelectionText = (editor) => (0, import_slate21.getEditorString)(editor, editor.selection);
var import_slate23 = require("@udecode/slate");
var getSelectionText = (editor) => (0, import_slate23.getEditorString)(editor, editor.selection);
// src/queries/isAncestorEmpty.ts
var import_slate22 = require("@udecode/slate");
var isAncestorEmpty = (editor, node) => !(0, import_slate22.getNodeString)(node) && !node.children.some((n) => (0, import_slate22.isInline)(editor, n));
var import_slate24 = require("@udecode/slate");
var isAncestorEmpty = (editor, node) => !(0, import_slate24.getNodeString)(node) && !node.children.some((n) => (0, import_slate24.isInline)(editor, n));

@@ -578,3 +602,3 @@ // src/queries/isBlockAboveEmpty.ts

// src/queries/isBlockTextEmptyAfterSelection.ts
var import_slate23 = require("@udecode/slate");
var import_slate25 = require("@udecode/slate");
var isBlockTextEmptyAfterSelection = (editor) => {

@@ -587,7 +611,7 @@ if (!editor.selection)

const cursor = editor.selection.focus;
const selectionParentEntry = (0, import_slate23.getParentNode)(editor, editor.selection);
const selectionParentEntry = (0, import_slate25.getParentNode)(editor, editor.selection);
if (!selectionParentEntry)
return false;
const [, selectionParentPath] = selectionParentEntry;
if (!(0, import_slate23.isEndPoint)(editor, cursor, selectionParentPath))
if (!(0, import_slate25.isEndPoint)(editor, cursor, selectionParentPath))
return false;

@@ -597,3 +621,3 @@ const siblingNodes = getNextSiblingNodes(blockAbove, cursor.path);

for (const siblingNode of siblingNodes) {
if ((0, import_slate23.isText)(siblingNode) && siblingNode.text) {
if ((0, import_slate25.isText)(siblingNode) && siblingNode.text) {
return false;

@@ -603,3 +627,3 @@ }

} else {
return (0, import_slate23.isEndPoint)(editor, cursor, blockAbove[1]);
return (0, import_slate25.isEndPoint)(editor, cursor, blockAbove[1]);
}

@@ -610,9 +634,9 @@ return true;

// src/queries/isDocumentEnd.ts
var import_slate24 = require("@udecode/slate");
var import_slate25 = require("slate");
var import_slate26 = require("@udecode/slate");
var import_slate27 = require("slate");
var isDocumentEnd = (editor) => {
if (editor.selection) {
const point = editor.selection.focus;
const endPoint = (0, import_slate24.getEndPoint)(editor, []);
return endPoint.offset === 0 && (0, import_slate24.isEndPoint)(editor, point, point) && import_slate25.Path.equals(import_slate25.Path.next(import_slate25.Path.parent(point.path)), endPoint.path);
const endPoint = (0, import_slate26.getEndPoint)(editor, []);
return endPoint.offset === 0 && (0, import_slate26.isEndPoint)(editor, point, point) && import_slate27.Path.equals(import_slate27.Path.next(import_slate27.Path.parent(point.path)), endPoint.path);
}

@@ -623,5 +647,5 @@ return false;

// src/queries/isEditorEmpty.ts
var import_slate26 = require("@udecode/slate");
var import_slate28 = require("@udecode/slate");
var isEditorEmpty = (editor) => {
return editor.children.length === 1 && (0, import_slate26.isElementEmpty)(editor, editor.children[0]);
return editor.children.length === 1 && (0, import_slate28.isElementEmpty)(editor, editor.children[0]);
};

@@ -639,8 +663,8 @@

// src/queries/isPointAtWordEnd.ts
var import_slate27 = require("@udecode/slate");
var AFTER_MATCH_REGEX = /^(\s|$)/;
var import_slate29 = require("@udecode/slate");
var AFTER_MATCH_REGEX = /^(?:\s|$)/;
var isPointAtWordEnd = (editor, { at }) => {
const after = (0, import_slate27.getPointAfter)(editor, at);
const afterRange = (0, import_slate27.getRange)(editor, at, after);
const afterText = (0, import_slate27.getEditorString)(editor, afterRange);
const after = (0, import_slate29.getPointAfter)(editor, at);
const afterRange = (0, import_slate29.getRange)(editor, at, after);
const afterText = (0, import_slate29.getEditorString)(editor, afterRange);
return !!afterText.match(AFTER_MATCH_REGEX);

@@ -650,3 +674,3 @@ };

// src/queries/isRangeInSameBlock.ts
var import_slate28 = require("slate");
var import_slate30 = require("slate");
var isRangeInSameBlock = (editor, _a = {}) => {

@@ -662,3 +686,3 @@ var _b = _a, {

return;
const [start, end] = import_slate28.Range.edges(at);
const [start, end] = import_slate30.Range.edges(at);
const startBlock = getBlockAbove(editor, __spreadValues({

@@ -672,22 +696,22 @@ at: start

return;
return import_slate28.Path.equals(startBlock[1], endBlock[1]);
return import_slate30.Path.equals(startBlock[1], endBlock[1]);
};
// src/queries/isRangeInSingleText.ts
var import_slate29 = require("slate");
var import_slate31 = require("slate");
var isRangeInSingleText = (at) => {
const [start, end] = import_slate29.Range.edges(at);
return import_slate29.Path.equals(start.path, end.path);
const [start, end] = import_slate31.Range.edges(at);
return import_slate31.Path.equals(start.path, end.path);
};
// src/queries/isSelectionAtBlockEnd.ts
var import_slate30 = require("@udecode/slate");
var import_slate32 = require("@udecode/slate");
var isSelectionAtBlockEnd = (editor, options) => {
var _a, _b;
const path = (_a = getBlockAbove(editor, options)) == null ? void 0 : _a[1];
return !!path && (0, import_slate30.isEndPoint)(editor, (_b = editor.selection) == null ? void 0 : _b.focus, path);
return !!path && (0, import_slate32.isEndPoint)(editor, (_b = editor.selection) == null ? void 0 : _b.focus, path);
};
// src/queries/isSelectionAtBlockStart.ts
var import_slate31 = require("@udecode/slate");
var import_slate33 = require("@udecode/slate");
var isSelectionAtBlockStart = (editor, options) => {

@@ -701,24 +725,34 @@ var _a;

return false;
return (0, import_slate31.isStartPoint)(editor, selection.focus, path) || (0, import_slate31.isExpanded)(editor.selection) && (0, import_slate31.isStartPoint)(editor, selection.anchor, path);
return (0, import_slate33.isStartPoint)(editor, selection.focus, path) || (0, import_slate33.isExpanded)(editor.selection) && (0, import_slate33.isStartPoint)(editor, selection.anchor, path);
};
// src/queries/isSelectionCoverBlock.ts
var isSelectionCoverBlock = (editor, _a = {}) => {
var _b = _a, {
at
} = _b, options = __objRest(_b, [
"at"
]);
return isSelectionAtBlockEnd(editor, options) && isSelectionAtBlockStart(editor, options) && isRangeInSameBlock(editor, options);
};
// src/queries/isSelectionExpanded.ts
var import_slate32 = require("@udecode/slate");
var isSelectionExpanded = (editor) => (0, import_slate32.isExpanded)(editor.selection);
var import_slate34 = require("@udecode/slate");
var isSelectionExpanded = (editor) => (0, import_slate34.isExpanded)(editor.selection);
// src/queries/isTextByPath.ts
var import_slate33 = require("@udecode/slate");
var import_slate35 = require("@udecode/slate");
var isTextByPath = (editor, path) => {
const node = (0, import_slate33.getNode)(editor, path);
return (0, import_slate33.isText)(node);
const node = (0, import_slate35.getNode)(editor, path);
return (0, import_slate35.isText)(node);
};
// src/queries/isWordAfterTrigger.ts
var import_slate34 = require("@udecode/slate");
var import_slate36 = require("@udecode/slate");
var import_utils2 = require("@udecode/utils");
var isWordAfterTrigger = (editor, { at, trigger }) => {
const wordBefore = (0, import_slate34.getPointBefore)(editor, at, { unit: "word" });
const before = wordBefore && (0, import_slate34.getPointBefore)(editor, wordBefore);
const beforeRange = before && (0, import_slate34.getRange)(editor, before, at);
const beforeText = (0, import_slate34.getEditorString)(editor, beforeRange);
const wordBefore = (0, import_slate36.getPointBefore)(editor, at, { unit: "word" });
const before = wordBefore && (0, import_slate36.getPointBefore)(editor, wordBefore);
const beforeRange = before && (0, import_slate36.getRange)(editor, before, at);
const beforeText = (0, import_slate36.getEditorString)(editor, beforeRange);
const escapedTrigger = (0, import_utils2.escapeRegExp)(trigger);

@@ -730,4 +764,4 @@ const beforeRegex = new RegExp(

return {
range: beforeRange,
match: match2
match: match2,
range: beforeRange
};

@@ -737,11 +771,11 @@ };

// src/queries/queryEditor.ts
var import_slate35 = require("@udecode/slate");
var import_slate37 = require("@udecode/slate");
var import_castArray2 = __toESM(require("lodash/castArray.js"));
var queryEditor = (editor, {
allow,
at = editor.selection || [],
exclude,
filter,
selectionAtBlockStart,
selectionAtBlockEnd,
allow,
exclude,
at = editor.selection || []
selectionAtBlockStart
} = {}) => {

@@ -752,7 +786,7 @@ if (filter && !filter(editor) || selectionAtBlockStart && !isSelectionAtBlockStart(editor) || selectionAtBlockEnd && !isSelectionAtBlockEnd(editor)) {

const allows = (0, import_castArray2.default)(allow);
if (allows.length > 0 && !(0, import_slate35.someNode)(editor, { at, match: { type: allows } })) {
if (allows.length > 0 && !(0, import_slate37.someNode)(editor, { at, match: { type: allows } })) {
return false;
}
const excludes = (0, import_castArray2.default)(exclude);
if (excludes.length > 0 && (0, import_slate35.someNode)(editor, { at, match: { type: excludes } })) {
if (excludes.length > 0 && (0, import_slate37.someNode)(editor, { at, match: { type: excludes } })) {
return false;

@@ -764,9 +798,9 @@ }

// src/transforms/insertElements.ts
var import_slate36 = require("@udecode/slate");
var import_slate38 = require("@udecode/slate");
var insertElements = (editor, nodes, options) => {
(0, import_slate36.insertNodes)(editor, nodes, options);
(0, import_slate38.insertNodes)(editor, nodes, options);
};
// src/transforms/insertEmptyElement.ts
var import_slate37 = require("@udecode/slate");
var import_slate39 = require("@udecode/slate");
var insertEmptyElement = (editor, type, options) => {

@@ -776,6 +810,6 @@ insertElements(

{
type,
children: [{ text: "" }]
children: [{ text: "" }],
type
},
(0, import_slate37.getQueryOptions)(editor, options)
(0, import_slate39.getQueryOptions)(editor, options)
);

@@ -785,17 +819,17 @@ };

// src/transforms/moveChildren.ts
var import_slate38 = require("@udecode/slate");
var import_slate39 = require("slate");
var moveChildren = (editor, { at, to, match: match2, fromStartIndex = 0 }) => {
var import_slate40 = require("@udecode/slate");
var import_slate41 = require("slate");
var moveChildren = (editor, { at, fromStartIndex = 0, match: match2, to }) => {
let moved = 0;
const parentPath = import_slate39.Path.isPath(at) ? at : at[1];
const parentNode = import_slate39.Path.isPath(at) ? (0, import_slate38.getNode)(editor, parentPath) : at[0];
const parentPath = import_slate41.Path.isPath(at) ? at : at[1];
const parentNode = import_slate41.Path.isPath(at) ? (0, import_slate40.getNode)(editor, parentPath) : at[0];
if (!parentNode)
return moved;
if (!(0, import_slate38.isBlock)(editor, parentNode))
if (!(0, import_slate40.isBlock)(editor, parentNode))
return moved;
for (let i = parentNode.children.length - 1; i >= fromStartIndex; i--) {
const childPath = [...parentPath, i];
const childNode = (0, import_slate38.getNode)(editor, childPath);
const childNode = (0, import_slate40.getNode)(editor, childPath);
if (!match2 || childNode && match2([childNode, childPath])) {
(0, import_slate38.moveNodes)(editor, { at: childPath, to });
(0, import_slate40.moveNodes)(editor, { at: childPath, to });
moved++;

@@ -808,7 +842,7 @@ }

// src/transforms/removeMark.ts
var import_slate40 = require("@udecode/slate");
var import_slate42 = require("@udecode/slate");
var import_castArray3 = __toESM(require("lodash/castArray.js"));
var import_slate41 = require("slate");
var import_slate43 = require("slate");
var removeMark = (editor, _a) => {
var _b = _a, { key, at, shouldChange = true } = _b, rest = __objRest(_b, ["key", "at", "shouldChange"]);
var _b = _a, { at, key, shouldChange = true } = _b, rest = __objRest(_b, ["at", "key", "shouldChange"]);
var _a2;

@@ -818,10 +852,10 @@ const selection = at != null ? at : editor.selection;

if (selection) {
if (import_slate41.Range.isRange(selection) && import_slate41.Range.isExpanded(selection)) {
(0, import_slate40.unsetNodes)(editor, key, __spreadValues({
if (import_slate43.Range.isRange(selection) && import_slate43.Range.isExpanded(selection)) {
(0, import_slate42.unsetNodes)(editor, key, __spreadValues({
at: selection,
match: import_slate40.isText,
match: import_slate42.isText,
split: true
}, rest));
} else if (editor.selection) {
const marks = (_a2 = (0, import_slate40.getMarks)(editor)) != null ? _a2 : {};
const marks = (_a2 = (0, import_slate42.getMarks)(editor)) != null ? _a2 : {};
key.forEach((k) => {

@@ -837,9 +871,9 @@ delete marks[k];

// src/transforms/removeNodeChildren.ts
var import_slate42 = require("@udecode/slate");
var import_slate44 = require("@udecode/slate");
var removeNodeChildren = (editor, path, options) => {
(0, import_slate42.withoutNormalizing)(editor, () => {
for (const [, childPath] of (0, import_slate42.getNodeChildren)(editor, path, {
(0, import_slate44.withoutNormalizing)(editor, () => {
for (const [, childPath] of (0, import_slate44.getNodeChildren)(editor, path, {
reverse: true
})) {
(0, import_slate42.removeNodes)(editor, __spreadProps(__spreadValues({}, options), { at: childPath }));
(0, import_slate44.removeNodes)(editor, __spreadProps(__spreadValues({}, options), { at: childPath }));
}

@@ -850,9 +884,9 @@ });

// src/transforms/removeSelectionMark.ts
var import_slate43 = require("@udecode/slate");
var import_slate45 = require("@udecode/slate");
var removeSelectionMark = (editor) => {
const marks = (0, import_slate43.getMarks)(editor);
const marks = (0, import_slate45.getMarks)(editor);
if (!marks)
return;
Object.keys(marks).forEach((key) => {
(0, import_slate43.removeEditorMark)(editor, key);
(0, import_slate45.removeEditorMark)(editor, key);
});

@@ -862,7 +896,7 @@ };

// src/transforms/replaceNode.ts
var import_slate44 = require("@udecode/slate");
var replaceNode = (editor, { at, nodes, insertOptions, removeOptions }) => {
(0, import_slate44.withoutNormalizing)(editor, () => {
(0, import_slate44.removeNodes)(editor, __spreadProps(__spreadValues({}, insertOptions), { at }));
(0, import_slate44.insertNodes)(editor, nodes, __spreadProps(__spreadValues({}, insertOptions), {
var import_slate46 = require("@udecode/slate");
var replaceNode = (editor, { at, insertOptions, nodes }) => {
(0, import_slate46.withoutNormalizing)(editor, () => {
(0, import_slate46.removeNodes)(editor, __spreadProps(__spreadValues({}, insertOptions), { at }));
(0, import_slate46.insertNodes)(editor, nodes, __spreadProps(__spreadValues({}, insertOptions), {
at

@@ -874,7 +908,7 @@ }));

// src/transforms/replaceNodeChildren.ts
var import_slate45 = require("@udecode/slate");
var replaceNodeChildren = (editor, { at, nodes, insertOptions, removeOptions }) => {
(0, import_slate45.withoutNormalizing)(editor, () => {
var import_slate47 = require("@udecode/slate");
var replaceNodeChildren = (editor, { at, insertOptions, nodes, removeOptions }) => {
(0, import_slate47.withoutNormalizing)(editor, () => {
removeNodeChildren(editor, at, removeOptions);
(0, import_slate45.insertNodes)(editor, nodes, __spreadProps(__spreadValues({}, insertOptions), {
(0, import_slate47.insertNodes)(editor, nodes, __spreadProps(__spreadValues({}, insertOptions), {
at: at.concat([0])

@@ -886,11 +920,11 @@ }));

// src/transforms/selectEndOfBlockAboveSelection.ts
var import_slate46 = require("@udecode/slate");
var import_slate48 = require("@udecode/slate");
var selectEndOfBlockAboveSelection = (editor) => {
var _a;
const path = (_a = getBlockAbove(editor)) == null ? void 0 : _a[1];
path && (0, import_slate46.select)(editor, (0, import_slate46.getEndPoint)(editor, path));
path && (0, import_slate48.select)(editor, (0, import_slate48.getEndPoint)(editor, path));
};
// src/transforms/setMarks.ts
var import_slate47 = require("@udecode/slate");
var import_slate49 = require("@udecode/slate");
var import_castArray4 = __toESM(require("lodash/castArray.js"));

@@ -900,3 +934,3 @@ var setMarks = (editor, marks, clear = []) => {

return;
(0, import_slate47.withoutNormalizing)(editor, () => {
(0, import_slate49.withoutNormalizing)(editor, () => {
const clears = (0, import_castArray4.default)(clear);

@@ -912,8 +946,8 @@ removeMark(editor, { key: clears });

// src/transforms/toggleMark.ts
var import_slate48 = require("@udecode/slate");
var import_slate50 = require("@udecode/slate");
var import_castArray5 = __toESM(require("lodash/castArray.js"));
var toggleMark = (editor, { key, clear }) => {
var toggleMark = (editor, { clear, key }) => {
if (!editor.selection)
return;
(0, import_slate48.withoutNormalizing)(editor, () => {
(0, import_slate50.withoutNormalizing)(editor, () => {
const isActive = isMarkActive(editor, key);

@@ -933,10 +967,10 @@ if (isActive) {

// src/transforms/toggleWrapNodes.ts
var import_slate49 = require("@udecode/slate");
var import_slate51 = require("@udecode/slate");
var toggleWrapNodes = (editor, type) => {
if ((0, import_slate49.someNode)(editor, { match: { type } })) {
(0, import_slate49.unwrapNodes)(editor, { match: { type } });
if ((0, import_slate51.someNode)(editor, { match: { type } })) {
(0, import_slate51.unwrapNodes)(editor, { match: { type } });
} else {
(0, import_slate49.wrapNodes)(editor, {
type,
children: []
(0, import_slate51.wrapNodes)(editor, {
children: [],
type
});

@@ -947,11 +981,11 @@ }

// src/transforms/wrapNodeChildren.ts
var import_slate50 = require("@udecode/slate");
var import_slate52 = require("@udecode/slate");
var wrapNodeChildren = (editor, element, options) => {
const path = options == null ? void 0 : options.at;
const node = (0, import_slate50.getNode)(editor, path);
const node = (0, import_slate52.getNode)(editor, path);
if (!(node == null ? void 0 : node.children))
return;
(0, import_slate50.withoutNormalizing)(editor, () => {
(0, import_slate52.withoutNormalizing)(editor, () => {
const firstChildPath = path.concat([0]);
(0, import_slate50.wrapNodes)(editor, element, __spreadProps(__spreadValues({}, options), {
(0, import_slate52.wrapNodes)(editor, element, __spreadProps(__spreadValues({}, options), {
at: firstChildPath

@@ -963,4 +997,4 @@ }));

at: path,
to: firstChildPath.concat([1]),
fromStartIndex: 1
fromStartIndex: 1,
to: firstChildPath.concat([1])
});

@@ -975,4 +1009,4 @@ });

{
type,
children: [{ text }]
children: [{ text }],
type
},

@@ -986,4 +1020,4 @@ ...remaining

var createNode = (type = "p", text = "") => ({
type,
children: [{ text }]
children: [{ text }],
type
});

@@ -995,2 +1029,3 @@ // Annotate the CommonJS export names for ESM import in node:

findDescendant,
getAncestorNode,
getBlockAbove,

@@ -1005,2 +1040,3 @@ getChildren,

getNextSiblingNodes,
getNodesRange,
getOperations,

@@ -1033,2 +1069,3 @@ getPointBeforeLocation,

isSelectionAtBlockStart,
isSelectionCoverBlock,
isSelectionExpanded,

@@ -1035,0 +1072,0 @@ isTextByPath,

{
"name": "@udecode/slate-utils",
"version": "32.0.1",
"version": "34.0.0",
"description": "Slate utils",

@@ -5,0 +5,0 @@ "license": "MIT",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc