@udecode/slate
Advanced tools
Comparing version 40.3.1 to 41.0.0
import { UnknownObject, Simplify, UnionToIntersection, Modify } from '@udecode/utils'; | ||
import * as slate from 'slate'; | ||
import { Path, Location, Range, Selection, Span, DecoratedRange, Editor, Point, EditorLevelsOptions, NodeAncestorsOptions, NodeChildrenOptions, NodeDescendantsOptions, NodeElementsOptions, NodeLevelsOptions, NodeTextsOptions, NodeNodesOptions, EditorNextOptions, EditorUnhangRangeOptions, EditorNodesOptions, EditorNodeOptions, EditorParentOptions, EditorPathOptions, EditorPointOptions, EditorAfterOptions, EditorBeforeOptions, EditorPositionsOptions, EditorPreviousOptions, EditorVoidOptions, EditorNormalizeOptions, Transforms, Operation, BaseEditor } from 'slate'; | ||
import { Path, Location, Range, Selection, Span, DecoratedRange, Editor, Point, EditorLevelsOptions, NodeAncestorsOptions, NodeChildrenOptions, NodeDescendantsOptions, NodeElementsOptions, NodeLevelsOptions, NodeTextsOptions as NodeTextsOptions$1, NodeNodesOptions, EditorNextOptions, EditorUnhangRangeOptions, EditorNodesOptions, EditorNodeOptions, EditorParentOptions, EditorPathOptions, EditorPointOptions, EditorAfterOptions, EditorBeforeOptions, EditorPositionsOptions, EditorPreviousOptions, EditorVoidOptions, EditorNormalizeOptions, Transforms, Operation, BaseEditor } from 'slate'; | ||
import { HistoryEditor as HistoryEditor$1 } from 'slate-history'; | ||
@@ -406,6 +406,7 @@ import { EditorPathRefOptions, EditorPointRefOptions, EditorRangeRefOptions, EditorDirectedDeletionOptions, EditorFragmentDeletionOptions, EditorAboveOptions, EditorStringOptions, EditorLeafOptions } from 'slate/dist/interfaces/editor'; | ||
type NodeTextsOptions<N extends TextOf<R>, R extends TNode = TNode> = Modify<NonNullable<NodeTextsOptions$1>, { | ||
pass?: (entry: TNodeEntry<NodeOf<N>>) => boolean; | ||
}>; | ||
/** Return a generator of all leaf text nodes in a root node. */ | ||
declare const getNodeTexts: <N extends TextOf<R>, R extends TNode = TNode>(root: R, options?: Modify<NonNullable<NodeTextsOptions>, { | ||
pass?: (entry: TNodeEntry<NodeOf<N>>) => boolean; | ||
}>) => Generator<TNodeEntry<N>, void, undefined>; | ||
declare const getNodeTexts: <N extends TextOf<R>, R extends TNode = TNode>(root: R, options?: NodeTextsOptions<N, R>) => Generator<TNodeEntry<N>, void, undefined>; | ||
@@ -792,2 +793,4 @@ /** | ||
declare const findNodePath: <E extends TEditor = TEditor>(editor: E, node: TNode, options?: FindNodeOptions<E>) => slate.Path | undefined; | ||
/** | ||
@@ -883,2 +886,4 @@ * Iterate through all of the nodes in the editor and break early for the first | ||
declare const setNode: <N extends NodeOf<E>, E extends TEditor = TEditor>(editor: E, node: N, props: Partial<TNodeProps<N>>, options?: Omit<SetNodesOptions<E>, "at">) => void; | ||
/** Unhang the range of length 1 so both edges are in the same text node. */ | ||
@@ -893,2 +898,2 @@ declare const unhangCharacterRange: (editor: TEditor, at: Range) => { | ||
export { type AncestorEntryOf, type AncestorOf, type ChildOf, type DescendantEntryOf, type DescendantOf, type ENodeMatch, type ENodeMatchOptions, type ElementEntryOf, type ElementOf, type ElementOrTextOf, type FindNodeOptions, type GetAboveNodeOptions, type GetLevelsOptions, type GetNextNodeOptions, type GetNodeEntriesOptions, type GetPreviousNodeOptions, HISTORY, History, HistoryEditor, type InsertNodesOptions, type LiftNodesOptions, MERGING, type MarkKeysOf, type MarksOf, type MergeNodesOptions, type MoveNodesOptions, type NodeEntryOf, type NodeMatchOption, type NodeOf, type Predicate, type PredicateFn, type PredicateObj, type QueryEditorOptions, type QueryNodeOptions, type RemoveNodesOptions, SAVING, SPLITTING_ONCE, type SetNodesOptions, type SplitNodesOptions, type TAncestor, type TAncestorEntry, type TDecoratedRange, type TDescendant, type TDescendantEntry, type TEditor, type TElement, type TElementEntry, type TInsertNodeOperation, type TInsertTextOperation, type TLocation, type TMergeNodeOperation, type TMoveNodeOperation, type TNode, type TNodeChildEntry, type TNodeEntry, type TNodeMatch, type TNodeOperation, type TNodeProps, type TOperation, type TPath, type TRange, type TRemoveNodeOperation, type TRemoveTextOperation, type TSelection, type TSelectionOperation, type TSetNodeOperation, type TSetSelectionOperation, type TSpan, type TSplitNodeOperation, type TText, type TTextEntry, type TTextOperation, type TextEntryOf, type TextOf, type UnhangRangeOptions, type UnsetNodesOptions, type UnwrapNodesOptions, type Value, type ValueOf, type WrapNodesOptions, addMark, addRangeMarks, collapseSelection, createPathRef, createPointRef, createRangeRef, createTEditor, deleteBackward, deleteForward, deleteFragment, deleteMerge, deleteText, deselect, elementMatches, findNode, getAboveNode, getCommonNode, getEdgePoints, getEditorString, getEndPoint, getFirstNode, getFragment, getLastNode, getLeafNode, getLevels, getMarks, getNextNode, getNode, getNodeAncestor, getNodeAncestors, getNodeChild, getNodeChildren, getNodeDescendant, getNodeDescendants, getNodeElements, getNodeEntries, getNodeEntry, getNodeFirstNode, getNodeFragment, getNodeLastNode, getNodeLeaf, getNodeLevels, getNodeParent, getNodeProps, getNodeString, getNodeTexts, getNodes, getParentNode, getPath, getPathRefs, getPoint, getPointAfter, getPointBefore, getPointRefs, getPositions, getPreviousNode, getQueryOptions, getRange, getRangeRefs, getStartPoint, getVoidNode, hasBlocks, hasInlines, hasNode, hasSingleChild, hasTexts, insertBreak, insertFragment, insertNode, insertNodes, insertText, isAncestor, isBlock, isCollapsed, isDescendant, isEdgePoint, isEditor, isEditorNormalizing, isElement, isElementEmpty, isElementList, isEndPoint, isExpanded, isHistoryEditor, isHistoryMerging, isHistorySaving, isInline, isMarkableVoid, isNode, isNodeList, isStartPoint, isText, isTextList, isVoid, liftNodes, match, mergeNodes, moveNodes, moveSelection, nodeMatches, normalizeEditor, queryNode, removeEditorMark, removeNodes, select, setElements, setNodes, setPoint, setSelection, someNode, splitNodes, textEquals, textMatches, unhangCharacterRange, unhangRange, unsetNodes, unwrapNodes, withHistory, withMerging, withNewBatch, withoutMergingHistory, withoutNormalizing, withoutSavingHistory, wrapNodes }; | ||
export { type AncestorEntryOf, type AncestorOf, type ChildOf, type DescendantEntryOf, type DescendantOf, type ENodeMatch, type ENodeMatchOptions, type ElementEntryOf, type ElementOf, type ElementOrTextOf, type FindNodeOptions, type GetAboveNodeOptions, type GetLevelsOptions, type GetNextNodeOptions, type GetNodeEntriesOptions, type GetPreviousNodeOptions, HISTORY, History, HistoryEditor, type InsertNodesOptions, type LiftNodesOptions, MERGING, type MarkKeysOf, type MarksOf, type MergeNodesOptions, type MoveNodesOptions, type NodeEntryOf, type NodeMatchOption, type NodeOf, type NodeTextsOptions, type Predicate, type PredicateFn, type PredicateObj, type QueryEditorOptions, type QueryNodeOptions, type RemoveNodesOptions, SAVING, SPLITTING_ONCE, type SetNodesOptions, type SplitNodesOptions, type TAncestor, type TAncestorEntry, type TDecoratedRange, type TDescendant, type TDescendantEntry, type TEditor, type TElement, type TElementEntry, type TInsertNodeOperation, type TInsertTextOperation, type TLocation, type TMergeNodeOperation, type TMoveNodeOperation, type TNode, type TNodeChildEntry, type TNodeEntry, type TNodeMatch, type TNodeOperation, type TNodeProps, type TOperation, type TPath, type TRange, type TRemoveNodeOperation, type TRemoveTextOperation, type TSelection, type TSelectionOperation, type TSetNodeOperation, type TSetSelectionOperation, type TSpan, type TSplitNodeOperation, type TText, type TTextEntry, type TTextOperation, type TextEntryOf, type TextOf, type UnhangRangeOptions, type UnsetNodesOptions, type UnwrapNodesOptions, type Value, type ValueOf, type WrapNodesOptions, addMark, addRangeMarks, collapseSelection, createPathRef, createPointRef, createRangeRef, createTEditor, deleteBackward, deleteForward, deleteFragment, deleteMerge, deleteText, deselect, elementMatches, findNode, findNodePath, getAboveNode, getCommonNode, getEdgePoints, getEditorString, getEndPoint, getFirstNode, getFragment, getLastNode, getLeafNode, getLevels, getMarks, getNextNode, getNode, getNodeAncestor, getNodeAncestors, getNodeChild, getNodeChildren, getNodeDescendant, getNodeDescendants, getNodeElements, getNodeEntries, getNodeEntry, getNodeFirstNode, getNodeFragment, getNodeLastNode, getNodeLeaf, getNodeLevels, getNodeParent, getNodeProps, getNodeString, getNodeTexts, getNodes, getParentNode, getPath, getPathRefs, getPoint, getPointAfter, getPointBefore, getPointRefs, getPositions, getPreviousNode, getQueryOptions, getRange, getRangeRefs, getStartPoint, getVoidNode, hasBlocks, hasInlines, hasNode, hasSingleChild, hasTexts, insertBreak, insertFragment, insertNode, insertNodes, insertText, isAncestor, isBlock, isCollapsed, isDescendant, isEdgePoint, isEditor, isEditorNormalizing, isElement, isElementEmpty, isElementList, isEndPoint, isExpanded, isHistoryEditor, isHistoryMerging, isHistorySaving, isInline, isMarkableVoid, isNode, isNodeList, isStartPoint, isText, isTextList, isVoid, liftNodes, match, mergeNodes, moveNodes, moveSelection, nodeMatches, normalizeEditor, queryNode, removeEditorMark, removeNodes, select, setElements, setNode, setNodes, setPoint, setSelection, someNode, splitNodes, textEquals, textMatches, unhangCharacterRange, unhangRange, unsetNodes, unwrapNodes, withHistory, withMerging, withNewBatch, withoutMergingHistory, withoutNormalizing, withoutSavingHistory, wrapNodes }; |
@@ -73,2 +73,3 @@ "use strict"; | ||
findNode: () => findNode, | ||
findNodePath: () => findNodePath, | ||
getAboveNode: () => getAboveNode, | ||
@@ -165,2 +166,3 @@ getCommonNode: () => getCommonNode, | ||
setElements: () => setElements, | ||
setNode: () => setNode, | ||
setNodes: () => setNodes, | ||
@@ -1276,2 +1278,12 @@ setPoint: () => setPoint, | ||
// src/queries/findNodePath.ts | ||
var findNodePath = (editor, node, options = {}) => { | ||
const { match: match2 } = getQueryOptions(editor, options); | ||
const nodeEntry = findNode(editor, __spreadValues({ | ||
at: [], | ||
match: (n) => n === node && (!match2 || match2(n)) | ||
}, options)); | ||
return nodeEntry == null ? void 0 : nodeEntry[1]; | ||
}; | ||
// src/queries/someNode.ts | ||
@@ -1327,2 +1339,11 @@ var someNode = (editor, options) => { | ||
// src/transforms/setNode.ts | ||
var setNode = (editor, node, props, options) => { | ||
const path = findNodePath(editor, node); | ||
if (!path) return; | ||
editor.setNodes(props, __spreadProps(__spreadValues({}, options), { | ||
at: path | ||
})); | ||
}; | ||
// src/transforms/unhangCharacterRange.ts | ||
@@ -1370,2 +1391,3 @@ var import_slate109 = require("slate"); | ||
findNode, | ||
findNodePath, | ||
getAboveNode, | ||
@@ -1462,2 +1484,3 @@ getCommonNode, | ||
setElements, | ||
setNode, | ||
setNodes, | ||
@@ -1464,0 +1487,0 @@ setPoint, |
{ | ||
"name": "@udecode/slate", | ||
"version": "40.3.1", | ||
"version": "41.0.0", | ||
"description": "Slate extension", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
405979
3356